2007-11-15 Eric Seidel <eric@webkit.org>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2007-11-15  Eric Seidel  <eric@webkit.org>
2
3         Reviewed by Sam.
4
5         Clean up match function to match WebKit style
6
7         * JavaScriptCore.xcodeproj/project.pbxproj:
8         * pcre/pcre_exec.cpp:
9         (match):
10
11 2007-11-15  Steve Falkenburg  <sfalken@apple.com>
12
13         Windows build fix.
14
15         * JavaScriptCore.vcproj/JavaScriptCore.make:
16
17 2007-11-14  Alexey Proskuryakov  <ap@webkit.org>
18
19         Reviewed by Darin.
20
21         http://bugs.webkit.org/show_bug.cgi?id=15982
22         Improve JSString UTF-8 decoding
23
24         * API/JSStringRef.cpp:
25         (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
26
27         * wtf/unicode/UTF8.cpp:
28         (WTF::Unicode::convertUTF16ToUTF8):
29         (WTF::Unicode::convertUTF8ToUTF16):
30         * wtf/unicode/UTF8.h:
31         Made these function names start with a lower case letter.
32
33         * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
34
35         * bindings/c/c_utility.cpp:
36         (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
37         from convertUTF8ToUTF16 in wtf/unicode.
38         (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
39         (KJS::Bindings::identifierFromNPIdentifier): Ditto.
40         * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
41
42 2007-11-14  Sam Weinig  <sam@webkit.org>
43
44         Rubber-stamped by Anders.
45
46         Fix the Xcode project file after it was messed up in r27402.
47
48         * JavaScriptCore.xcodeproj/project.pbxproj:
49
50 2007-11-14  Eric Seidel  <eric@webkit.org>
51
52         Reviewed by Oliver.
53         
54         More PCRE style cleanup.
55
56         * pcre/pcre_compile.cpp:
57         (compile_regex):
58
59 2007-11-14  Adam Roben  <aroben@apple.com>
60
61         Clean up the bison conflict checking script
62
63         Reviewed by Geoff.
64
65         * DerivedSources.make:
66
67 2007-11-14  Eric Seidel  <eric@webkit.org>
68
69         Reviewed by Geoff.
70
71         Another round of PCRE cleanups: inlines
72         
73         SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
74
75         * pcre/pcre_compile.cpp:
76         (jsRegExpCompile):
77         * pcre/pcre_exec.cpp:
78         (match):
79         (jsRegExpExecute):
80         * pcre/pcre_internal.h:
81         (PUT):
82         (GET):
83         (PUT2):
84         (GET2):
85         (isNewline):
86
87 2007-11-14  Eric Seidel  <eric@webkit.org>
88
89         Reviewed by Sam.
90         
91         Give PCRE a (small) bath.
92         Fix some formating and break things off into separate functions
93         http://bugs.webkit.org/show_bug.cgi?id=15993
94
95         * pcre/pcre_compile.cpp:
96         (calculateCompiledPatternLengthAndFlags):
97         (printCompiledRegExp):
98         (returnError):
99         (jsRegExpCompile):
100         * pcre/pcre_internal.h:
101         (compile_data::compile_data):
102
103 2007-11-14  Geoffrey Garen  <ggaren@apple.com>
104
105         Reviewed by Eric Seidel.
106         
107         Cleaned up the JavaScript grammar a bit.
108         
109         1. Changed BlockNode to always hold a child vector (which may be empty),
110         eliminating a few NULL-check branches in the common execution case.
111         
112         2. Changed the Block production to correctly report its starting and 
113         ending line numbers to the debugger. (It used to report its ending line
114         as its starting line.) Also, removed duplicate line-reporting code
115         inside the BlockNode constructor.
116         
117         3. Moved curly braces up from FunctionBody production into parent
118         productions. (I had to move the line number reporting code, too, since
119         it depends on the location of the curly braces.) This matches the ECMA
120         spec more closely, and makes some future changes I plan easier.
121         
122         4. Fixed statementList* convenience functions to deal appropriately with
123         empty Vectors.
124
125         SunSpider reports a small and statistically insignificant speedup.
126
127         * kjs/grammar.y:
128         * kjs/nodes.cpp:
129         (KJS::statementListPushFIFO):
130         (KJS::statementListGetDeclarations):
131         (KJS::statementListInitializeDeclarationStack):
132         (KJS::statementListInitializeVariableAccessStack):
133         (KJS::BlockNode::BlockNode):
134         (KJS::BlockNode::optimizeVariableAccess):
135         (KJS::BlockNode::getDeclarations):
136         (KJS::BlockNode::execute):
137         (KJS::FunctionBodyNode::initializeDeclarationStacks):
138         (KJS::FunctionBodyNode::optimizeVariableAccess):
139
140 2007-11-13  Anders Carlsson  <andersca@apple.com>
141
142         Add RefCounted.h (And remove Shared.h)
143         
144         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
145
146 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
147
148         Build fix.
149
150         * kjs/regexp.h:
151
152 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
153
154         Reviewed by Anders Carlsson.
155
156         Renamed Shared to RefCounted.
157
158         * API/JSClassRef.h:
159         * JavaScriptCore.xcodeproj/project.pbxproj:
160         * kjs/interpreter.h:
161         * kjs/regexp.h:
162         * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
163         (WTF::RefCounted::RefCounted):
164         * wtf/Shared.h: Removed.
165
166 2007-11-13  Adam Roben  <aroben@apple.com>
167
168         Build fix
169
170         Reviewed by Geoff.
171
172         * kjs/regexp.h: Added a missing #include.
173
174 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
175
176         Reviewed by Sam Weinig.
177
178         Moved Shared.h into wtf so it could be used in more places. Deployed
179         Shared in places where JSCore previously had hand-rolled ref-counting
180         classes.
181
182         * API/JSClassRef.cpp:
183         (OpaqueJSClass::OpaqueJSClass):
184         * API/JSClassRef.h:
185         * API/JSObjectRef.cpp:
186         (JSClassRetain):
187         (JSClassRelease):
188         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
189         * JavaScriptCore.xcodeproj/project.pbxproj:
190         * kjs/interpreter.cpp:
191         (KJS::Interpreter::init):
192         * kjs/interpreter.h:
193         * kjs/regexp.cpp:
194         (KJS::RegExp::RegExp):
195         * kjs/regexp.h:
196         * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
197
198 2007-11-13  Eric Seidel  <eric@webkit.org>
199
200         Reviewed by Maciej.
201
202         Add an ASSERT to getTruncatedInt32 to enforce proper usage.
203         Best part about this patch?  It doesn't break the web!
204
205         * kjs/JSImmediate.h:
206         (KJS::JSImmediate::getTruncatedInt32):
207         (KJS::JSImmediate::toDouble):
208         (KJS::JSImmediate::getUInt32):
209
210 2007-11-13  Alexey Proskuryakov  <ap@webkit.org>
211
212         Windows build fix.
213
214         * bindings/c/c_utility.cpp:
215         (KJS::Bindings::convertUTF8ToUTF16):
216         * kjs/ustring.cpp:
217         (KJS::UString::UTF8String):
218         * wtf/unicode/UTF8.cpp:
219         (WTF::Unicode::ConvertUTF8ToUTF16):
220
221 2007-11-13  Darin Adler  <darin@apple.com>
222
223         Reviewed by Geoff.
224
225         - fix http://bugs.webkit.org/show_bug.cgi?id=11231
226           RegExp bug when handling newline characters
227           and a number of other differences between PCRE behvior
228           and JavaScript regular expressions:
229
230           + single-digit sequences like \4 should be treated as octal
231             character constants, unless there is a sufficient number
232             of brackets for them to be treated as backreferences
233
234           + \8 turns into the character "8", not a binary zero character
235             followed by "8" (same for 9)
236
237           + only the first 3 digits should be considered part of an
238             octal character constant (the old behavior was to decode
239             an arbitrarily long sequence and then mask with 0xFF)
240
241           + if \x is followed by anything other than two valid hex digits,
242             then it should simply be treated a the letter "x"; that includes
243             not supporting the \x{41} syntax
244
245           + if \u is followed by anything less than four valid hex digits,
246             then it should simply be treated a the letter "u"
247
248           + an extra "+" should be a syntax error, rather than being treated
249             as the "possessive quantifier"
250
251           + if a "]" character appears immediately after a "[" character that
252             starts a character class, then that's an empty character class,
253             rather than being the start of a character class that includes a
254             "]" character
255
256           + a "$" should not match a terminating newline; we could have gotten
257             PCRE to handle this the way we wanted by passing an appropriate option
258
259         Test: fast/js/regexp-no-extensions.html
260
261         * pcre/pcre_compile.cpp:
262         (check_escape): Check backreferences against bracount to catch both
263         overflows and things that should be treated as octal. Rewrite octal
264         loop to not go on indefinitely. Rewrite both hex loops to match and
265         remove \x{} support.
266         (compile_branch): Restructure loops so that we don't special-case a "]"
267         at the beginning of a character class. Remove code that treated "+" as
268         the possessive quantifier.
269         (jsRegExpCompile): Change the "]" handling here too.
270
271         * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
272         Changed DOLL to remove handling of "terminating newline", a Perl concept
273         which we don't need.
274
275         * tests/mozilla/expected.html: Two tests are fixed now:
276         ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
277         One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
278         was due to a bug (we treated all 1-character numeric escapes as backreferences).
279         The date tests also now both expect success -- whatever was making them fail
280         before was probably due to the time being close to a DST shift; maybe we need
281         to get rid of those tests.
282
283 2007-11-13  Darin Adler  <darin@apple.com>
284
285         * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
286         Remove too-strong assert that was firing constantly and preventing even basic
287         web browsing from working in a debug build. This function is used in many
288         cases where the immediate value is not a number; the assertion could perhaps
289         be added back later with a bit of reorganization.
290
291 2007-11-13  Alp Toker  <alp@atoker.com>
292
293         Build fix for breakage to non-Mac builds introduced in r27746.
294
295         * kjs/ustring.cpp:
296
297 2007-11-13  Eric Seidel  <eric@webkit.org>
298
299         Reviewed by Maciej.
300
301         Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
302
303         * kjs/JSImmediate.h:
304         * kjs/nodes.cpp:
305         (KJS::GreaterNode::inlineEvaluateToBoolean):
306         (KJS::GreaterNode::evaluate):
307         (KJS::LessEqNode::inlineEvaluateToBoolean):
308         (KJS::LessEqNode::evaluate):
309         (KJS::GreaterEqNode::inlineEvaluateToBoolean):
310         (KJS::GreaterEqNode::evaluate):
311         (KJS::InNode::evaluateToBoolean):
312         (KJS::EqualNode::inlineEvaluateToBoolean):
313         (KJS::EqualNode::evaluate):
314         (KJS::NotEqualNode::inlineEvaluateToBoolean):
315         (KJS::NotEqualNode::evaluate):
316         (KJS::StrictEqualNode::inlineEvaluateToBoolean):
317         (KJS::StrictEqualNode::evaluate):
318         (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
319         (KJS::NotStrictEqualNode::evaluate):
320         * kjs/nodes.h:
321
322 2007-11-12  Geoffrey Garen  <ggaren@apple.com>
323
324         Reviewed by Sam Weinig.
325         
326         Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
327         base64 spends 1.1% of total time checking for special Infinity case
328         
329         Use a fast character test instead of calling strncmp.
330         
331         1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
332         Sharks reports only .1%. Who are you going to believe? Huh?
333
334         * kjs/ustring.cpp:
335         (KJS::UString::toDouble):
336
337 2007-11-12  Eric Seidel  <eric@webkit.org>
338
339         Reviewed by Oliver.
340
341         Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
342         Fix a few missing evaluateToBoolean methods
343         Deploy all evaluateTo* functions to more nodes to avoid slowdowns
344         http://bugs.webkit.org/show_bug.cgi?id=15950
345         
346         SunSpider claims this is at least a 1.4% speedup.
347
348         * kjs/JSImmediate.h:
349         (KJS::JSImmediate::getTruncatedInt32):
350         (KJS::JSImmediate::toDouble):
351         (KJS::JSImmediate::getUInt32):
352         * kjs/nodes.cpp:
353         (KJS::ExpressionNode::evaluateToNumber):
354         (KJS::ExpressionNode::evaluateToInt32):
355         (KJS::ExpressionNode::evaluateToUInt32):
356         (KJS::NumberNode::evaluateToInt32):
357         (KJS::NumberNode::evaluateToUInt32):
358         (KJS::ImmediateNumberNode::evaluateToInt32):
359         (KJS::ImmediateNumberNode::evaluateToUInt32):
360         (KJS::ResolveNode::evaluate):
361         (KJS::ResolveNode::evaluateToNumber):
362         (KJS::ResolveNode::evaluateToBoolean):
363         (KJS::ResolveNode::evaluateToInt32):
364         (KJS::ResolveNode::evaluateToUInt32):
365         (KJS::LocalVarAccessNode::evaluateToInt32):
366         (KJS::LocalVarAccessNode::evaluateToUInt32):
367         (KJS::BracketAccessorNode::evaluateToNumber):
368         (KJS::BracketAccessorNode::evaluateToBoolean):
369         (KJS::BracketAccessorNode::evaluateToInt32):
370         (KJS::BracketAccessorNode::evaluateToUInt32):
371         (KJS::DotAccessorNode::inlineEvaluate):
372         (KJS::DotAccessorNode::evaluate):
373         (KJS::DotAccessorNode::evaluateToNumber):
374         (KJS::DotAccessorNode::evaluateToBoolean):
375         (KJS::DotAccessorNode::evaluateToInt32):
376         (KJS::DotAccessorNode::evaluateToUInt32):
377         (KJS::NewExprNode::inlineEvaluate):
378         (KJS::NewExprNode::evaluate):
379         (KJS::NewExprNode::evaluateToNumber):
380         (KJS::NewExprNode::evaluateToBoolean):
381         (KJS::NewExprNode::evaluateToInt32):
382         (KJS::NewExprNode::evaluateToUInt32):
383         (KJS::FunctionCallResolveNode::inlineEvaluate):
384         (KJS::FunctionCallResolveNode::evaluate):
385         (KJS::FunctionCallResolveNode::evaluateToNumber):
386         (KJS::FunctionCallResolveNode::evaluateToBoolean):
387         (KJS::FunctionCallResolveNode::evaluateToInt32):
388         (KJS::FunctionCallResolveNode::evaluateToUInt32):
389         (KJS::LocalVarFunctionCallNode::evaluate):
390         (KJS::LocalVarFunctionCallNode::evaluateToNumber):
391         (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
392         (KJS::LocalVarFunctionCallNode::evaluateToInt32):
393         (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
394         (KJS::FunctionCallDotNode::evaluate):
395         (KJS::FunctionCallDotNode::evaluateToNumber):
396         (KJS::FunctionCallDotNode::evaluateToBoolean):
397         (KJS::FunctionCallDotNode::evaluateToInt32):
398         (KJS::FunctionCallDotNode::evaluateToUInt32):
399         (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
400         (KJS::PostDecLocalVarNode::evaluateToNumber):
401         (KJS::PostDecLocalVarNode::evaluateToBoolean):
402         (KJS::PostDecLocalVarNode::evaluateToInt32):
403         (KJS::PostDecLocalVarNode::evaluateToUInt32):
404         (KJS::typeStringForValue):
405         (KJS::UnaryPlusNode::evaluate):
406         (KJS::UnaryPlusNode::evaluateToBoolean):
407         (KJS::UnaryPlusNode::evaluateToNumber):
408         (KJS::UnaryPlusNode::evaluateToInt32):
409         (KJS::BitwiseNotNode::inlineEvaluateToInt32):
410         (KJS::BitwiseNotNode::evaluate):
411         (KJS::BitwiseNotNode::evaluateToNumber):
412         (KJS::BitwiseNotNode::evaluateToBoolean):
413         (KJS::BitwiseNotNode::evaluateToInt32):
414         (KJS::MultNode::evaluateToBoolean):
415         (KJS::MultNode::evaluateToInt32):
416         (KJS::MultNode::evaluateToUInt32):
417         (KJS::DivNode::evaluateToInt32):
418         (KJS::DivNode::evaluateToUInt32):
419         (KJS::ModNode::evaluateToBoolean):
420         (KJS::ModNode::evaluateToInt32):
421         (KJS::ModNode::evaluateToUInt32):
422         (KJS::AddNode::evaluateToNumber):
423         (KJS::AddNode::evaluateToInt32):
424         (KJS::AddNode::evaluateToUInt32):
425         (KJS::AddNumbersNode::evaluateToInt32):
426         (KJS::AddNumbersNode::evaluateToUInt32):
427         (KJS::SubNode::evaluateToInt32):
428         (KJS::SubNode::evaluateToUInt32):
429         (KJS::LeftShiftNode::inlineEvaluateToInt32):
430         (KJS::LeftShiftNode::evaluate):
431         (KJS::LeftShiftNode::evaluateToNumber):
432         (KJS::LeftShiftNode::evaluateToInt32):
433         (KJS::RightShiftNode::inlineEvaluateToInt32):
434         (KJS::RightShiftNode::evaluate):
435         (KJS::RightShiftNode::evaluateToNumber):
436         (KJS::RightShiftNode::evaluateToInt32):
437         (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
438         (KJS::UnsignedRightShiftNode::evaluate):
439         (KJS::UnsignedRightShiftNode::evaluateToNumber):
440         (KJS::UnsignedRightShiftNode::evaluateToInt32):
441         (KJS::LessNode::inlineEvaluateToBoolean):
442         (KJS::LessNode::evaluate):
443         (KJS::LessNode::evaluateToBoolean):
444         (KJS::LessNumbersNode::inlineEvaluateToBoolean):
445         (KJS::LessNumbersNode::evaluate):
446         (KJS::LessNumbersNode::evaluateToBoolean):
447         (KJS::LessStringsNode::inlineEvaluateToBoolean):
448         (KJS::LessStringsNode::evaluate):
449         (KJS::BitAndNode::evaluate):
450         (KJS::BitAndNode::inlineEvaluateToInt32):
451         (KJS::BitAndNode::evaluateToNumber):
452         (KJS::BitAndNode::evaluateToBoolean):
453         (KJS::BitAndNode::evaluateToInt32):
454         (KJS::BitXOrNode::inlineEvaluateToInt32):
455         (KJS::BitXOrNode::evaluate):
456         (KJS::BitXOrNode::evaluateToNumber):
457         (KJS::BitXOrNode::evaluateToBoolean):
458         (KJS::BitXOrNode::evaluateToInt32):
459         (KJS::BitOrNode::inlineEvaluateToInt32):
460         (KJS::BitOrNode::evaluate):
461         (KJS::BitOrNode::evaluateToNumber):
462         (KJS::BitOrNode::evaluateToBoolean):
463         (KJS::BitOrNode::evaluateToInt32):
464         (KJS::ConditionalNode::evaluateToNumber):
465         (KJS::ConditionalNode::evaluateToInt32):
466         (KJS::ConditionalNode::evaluateToUInt32):
467         (KJS::valueForReadModifyAssignment):
468         (KJS::AssignExprNode::evaluate):
469         (KJS::AssignExprNode::evaluateToBoolean):
470         (KJS::AssignExprNode::evaluateToNumber):
471         (KJS::AssignExprNode::evaluateToInt32):
472         (KJS::VarDeclNode::handleSlowCase):
473         * kjs/nodes.h:
474         (KJS::FunctionCallResolveNode::precedence):
475         (KJS::AddNode::precedence):
476         (KJS::AddNode::):
477         (KJS::LessNumbersNode::):
478         (KJS::LessStringsNode::):
479         * kjs/value.cpp:
480         (KJS::JSValue::toInt32SlowCase):
481         (KJS::JSValue::toUInt32SlowCase):
482         * kjs/value.h:
483         (KJS::JSValue::asCell):
484         (KJS::JSValue::toInt32):
485         (KJS::JSValue::toUInt32):
486
487 2007-11-12  Alexey Proskuryakov  <ap@webkit.org>
488
489         Reviewed by Darin.
490
491         http://bugs.webkit.org/show_bug.cgi?id=15953
492         Add UTF-8 encoding/decoding to WTF
493
494         * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
495         * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
496         parameter. Callers are not interested in getting decoding results in strict mode, so 
497         this allows for bailing out as soon as an error is seen.
498
499         * kjs/function.cpp:
500         (KJS::encode): Updated for new UString::UTF8String() signature.
501
502         * API/JSStringRef.cpp:
503         (JSStringCreateWithCharacters): Disambiguate UChar.
504         (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
505         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
506
507         * wtf/unicode/UTF8.cpp: Added.
508         (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
509         (WTF::Unicode::inlineUTF8SequenceLength):
510         (WTF::Unicode::UTF8SequenceLength):
511         (WTF::Unicode::decodeUTF8Sequence):
512         (WTF::Unicode::):
513         (WTF::Unicode::ConvertUTF16ToUTF8):
514         (WTF::Unicode::isLegalUTF8):
515         (WTF::Unicode::ConvertUTF8ToUTF16):
516         * wtf/unicode/UTF8.h: Added.
517         (WTF::Unicode::):
518         Some code moved from ustring.h, some adapted from unicode.org sources.
519
520         * JavaScriptCore.exp:
521         * JavaScriptCore.pri:
522         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
523         * JavaScriptCore.xcodeproj/project.pbxproj:
524         * JavaScriptCoreSources.bkl:
525         Added UTF8.{h,cpp}
526
527 2007-11-12  Josh Aas  <joshmoz@gmail.com>
528
529         Reviewed by Darin.
530
531         - http://bugs.webkit.org/show_bug.cgi?id=15946
532           add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
533
534         * bindings/npapi.h:
535
536 2007-11-12  Darin Adler  <darin@apple.com>
537
538         Reviewed by Sam.
539
540         - http://bugs.webkit.org/show_bug.cgi?id=15951
541           REGRESSION: assertion failure in regexp match() when running JS tests
542
543         Test: fast/js/regexp-many-brackets.html
544
545         * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
546         the BRANUMBER opcode.
547
548 2007-11-12  Darin Adler  <darin@apple.com>
549
550         Reviewed by Geoff.
551
552         - fix use of prefix and config.h, got rid of a few unneeded things in
553           the PCRE code; no behavior changes
554
555         * API/JSBase.cpp: Added include of config.h.
556         * API/JSCallbackConstructor.cpp: Ditto.
557         * API/JSCallbackFunction.cpp: Ditto.
558         * API/JSCallbackObject.cpp: Ditto.
559         * API/JSClassRef.cpp: Ditto.
560         * API/JSContextRef.cpp: Ditto.
561         * API/JSObjectRef.cpp: Ditto.
562         * API/JSStringRef.cpp: Ditto.
563         * API/JSValueRef.cpp: Ditto.
564
565         * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
566         Moved new/delete macros after includes, as they are in WebCore's prefix.
567         Removed "config.h".
568
569         * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
570         function. This is needed for PCRE, but not helpful for our use. Also changed
571         the tables to all be 128 entries long instead of 256, since only the first
572         128 are ever used.
573
574         * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
575         which was only being used to check hex digits. Changed all uses of TRUE and
576         FALSE to use the C++ true and false instead.
577         (check_escape): Just the TRUE/FALSE thing.
578         (is_counted_repeat): Ditto.
579         (could_be_empty_branch): Ditto.
580         (get_othercase_range): Ditto.
581         (compile_branch): Ditto.
582         (compile_regex): Ditto.
583         (is_anchored): Ditto.
584         (is_startline): Ditto.
585         (find_firstassertedchar): Ditto.
586         (jsRegExpCompile): Ditto.
587
588         * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
589         FALSE to use the C++ true and false instead.
590         (match_ref): Just the TRUE/FALSE thing.
591         (match): Ditto. Removed some unneeded braces.
592         (jsRegExpExecute): Just the TRUE/FALSE thing.
593
594         * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
595         of the file instead of the bottom, so they can be used. Also changed the table
596         sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
597         Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
598         be a macro instead of a extern int.
599
600         * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
601
602         * pcre/pcre_tables.cpp: Made table sizes explicit.
603
604         * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
605
606 2007-11-12  Adam Roben  <aroben@apple.com>
607
608         Build fix
609
610         * wtf/FastMalloc.h: Add missing using statement.
611
612 2007-11-11  Oliver Hunt  <oliver@apple.com>
613
614         Reviewed by Darin.
615
616         Add special fastZeroedMalloc function to replace a 
617         number of fastCalloc calls where one argument was 1.
618         
619         This results in a 0.4% progression in SunSpider, more
620         than making up for the earlier regression caused by 
621         additional overflow checks.
622
623         * JavaScriptCore.exp:
624         * kjs/array_instance.cpp:
625         * kjs/property_map.cpp:
626         * wtf/FastMalloc.cpp:
627         * wtf/FastMalloc.h:
628         * wtf/HashTable.h:
629
630 2007-11-11  Adam Roben  <aroben@apple.com>
631
632         Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
633
634         The bug was due to a mismatch between HashMap::remove and
635         HashTable::checkTableConsistency. HashMap::remove can delete the value
636         stored in the HashTable (by derefing it), which is not normally
637         allowed by HashTable. It's OK in this case because the value is about
638         to be removed from the table, but HashTable wasn't aware of this.
639
640         HashMap::remove now performs the consistency check itself before
641         derefing the value.
642
643         Darin noticed that the same bug would occur in HashSet, so I've fixed
644         it there as well.
645
646         Reviewed by Darin.
647
648         * wtf/HashMap.h:
649         (WTF::HashMap::remove): Perform the HashTable consistency check
650         manually before calling deref.
651         * wtf/HashSet.h:
652         (WTF::HashSet::remove): Ditto.
653         * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
654         and HashSet can call it.
655         (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
656         Added.
657         (WTF::HashTable::removeAndInvalidate): Added.
658         (WTF::HashTable::remove):
659         (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
660
661 2007-11-11  Mark Rowe  <mrowe@apple.com>
662
663         Build fix.  Use the correct filename case.
664
665         * kjs/nodes.h:
666
667 2007-11-11  Geoffrey Garen  <ggaren@apple.com>
668
669         Reviewed by Sam Weinig.
670         
671         Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
672         15% of string-validate-input.js is spent compiling the same regular expression
673         
674         Store a compiled representation of the regular expression in the AST.
675         
676         Only a .2% SunSpider speedup overall, but a 10.6% speedup on 
677         string-validate-input.js.
678
679         * kjs/nodes.cpp:
680         (KJS::RegExpNode::evaluate):
681         * kjs/nodes.h:
682         (KJS::RegExpNode::):
683         * kjs/nodes2string.cpp:
684         (KJS::RegExpNode::streamTo):
685         * kjs/regexp.cpp:
686         (KJS::RegExp::flags):
687         * kjs/regexp.h:
688         (KJS::RegExp::pattern):
689         * kjs/regexp_object.cpp:
690         (KJS::RegExpObjectImp::construct):
691         (KJS::RegExpObjectImp::createRegExpImp):
692         * kjs/regexp_object.h:
693
694 2007-11-11  Oliver Hunt  <oliver@apple.com>
695
696         Reviewed by Eric.
697
698         Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
699
700         Unfortunately this is a very slight regression, but is unavoidable.
701
702         * wtf/FastMalloc.cpp:
703
704 2007-11-10  Eric Seidel  <eric@webkit.org>
705
706         Reviewed by darin.
707         
708         Add simple type inferencing to the parser, and create custom
709         AddNode and LessNode subclasses based on inferred types.
710         http://bugs.webkit.org/show_bug.cgi?id=15884
711         
712         SunSpider claims this is at least a 0.5% speedup.
713
714         * JavaScriptCore.exp:
715         * kjs/grammar.y:
716         * kjs/internal.cpp:
717         (KJS::NumberImp::getPrimitiveNumber):
718         (KJS::GetterSetterImp::getPrimitiveNumber):
719         * kjs/internal.h:
720         * kjs/lexer.cpp:
721         (KJS::Lexer::lex):
722         * kjs/nodes.cpp:
723         (KJS::Node::Node):
724         (KJS::StringNode::evaluate):
725         (KJS::StringNode::evaluateToNumber):
726         (KJS::StringNode::evaluateToBoolean):
727         (KJS::RegExpNode::evaluate):
728         (KJS::UnaryPlusNode::optimizeVariableAccess):
729         (KJS::AddNode::evaluate):
730         (KJS::AddNode::evaluateToNumber):
731         (KJS::AddNumbersNode::inlineEvaluateToNumber):
732         (KJS::AddNumbersNode::evaluate):
733         (KJS::AddNumbersNode::evaluateToNumber):
734         (KJS::AddStringsNode::evaluate):
735         (KJS::AddStringLeftNode::evaluate):
736         (KJS::AddStringRightNode::evaluate):
737         (KJS::lessThan):
738         (KJS::lessThanEq):
739         (KJS::LessNumbersNode::evaluate):
740         (KJS::LessStringsNode::evaluate):
741         * kjs/nodes.h:
742         (KJS::ExpressionNode::):
743         (KJS::RegExpNode::):
744         (KJS::RegExpNode::precedence):
745         (KJS::TypeOfResolveNode::):
746         (KJS::LocalVarTypeOfNode::):
747         (KJS::UnaryPlusNode::):
748         (KJS::UnaryPlusNode::precedence):
749         (KJS::AddNode::):
750         (KJS::AddNode::precedence):
751         (KJS::AddNumbersNode::):
752         (KJS::AddStringLeftNode::):
753         (KJS::AddStringRightNode::):
754         (KJS::AddStringsNode::):
755         (KJS::LessNode::):
756         (KJS::LessNode::precedence):
757         (KJS::LessNumbersNode::):
758         (KJS::LessStringsNode::):
759         * kjs/nodes2string.cpp:
760         (KJS::StringNode::streamTo):
761         * kjs/object.cpp:
762         * kjs/object.h:
763         * kjs/value.h:
764         (KJS::JSValue::getPrimitiveNumber):
765
766 2007-11-11  Darin Adler  <darin@apple.com>
767
768         - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
769
770         * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
771         Later we can break it into two files.
772
773         * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
774         * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
775         * pcre/dftables.pro: Take out now-unneeded include paths.
776         * pcre/pcre_maketables.cpp: Use new instead of malloc.
777
778 2007-11-11  Darin Adler  <darin@apple.com>
779
780         * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
781         another include path.
782
783 2007-11-11  Darin Adler  <darin@apple.com>
784
785         * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
786         by adding another include path.
787
788 2007-11-11  Darin Adler  <darin@apple.com>
789
790         Reviewed by Sam.
791
792         - http://bugs.webkit.org/show_bug.cgi?id=15924
793           next round of changes to JSRegExp (formerly PCRE)
794
795         This is a combination of converting to C++, tweaking the API, and adding
796         some additional optimizations.
797
798         Future steps will involve getting rid of the use of UTF-8 completely
799         (we'll use UTF-16 exclusively instead), eliminating more source files,
800         and some more speed-ups.
801
802         SunSpider says the current round is an 0.9% speed-up overall, and a
803         5.3% speed-up for regexp.
804
805         * JavaScriptCore.exp: Updated for new entry points.
806
807         * JavaScriptCore.pri:
808         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
809         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
810         * JavaScriptCore.xcodeproj/project.pbxproj:
811         * JavaScriptCoreSources.bkl:
812         * jscore.bkl:
813         Updated for new source file names and ForwardingHeaders.
814
815         * kjs/regexp.cpp:
816         (KJS::RegExp::RegExp): Changed to use the error message without calling
817         strdup on it and to pass the new types and options.
818         (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
819         (KJS::RegExp::match): Pass the new types and options.
820         * kjs/regexp.h: Update type of m_constructionError.
821
822         * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
823         the Google parts, and this isn't the PCRE library, per se.
824         * pcre/COPYING: Ditto.
825
826         * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
827         (main): Removed unneeded ctype_digit.
828
829         * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
830
831         * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
832         Moved a lot of private stuff used only within this file here from pcre_internal.h.
833         Renumbered the error codes.
834         (error_text): Use a single string with embedded nulls for the error text (I got
835         this idea from newer versions of PCRE).
836         (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
837         uses with isASCIIDigit.
838         (is_counted_repeat): Ditto.
839         (read_repeat_counts): Ditto.
840         (first_significant_code): Ditto.
841         (find_fixedlength): Ditto.
842         (could_be_empty_branch): Ditto.
843         (compile_branch): Ditto. Also removed some code that handles changing options.
844         JavaScript doesn't have any of the features that allow options to change.
845         (compile_regex): Updated for change to options parameter.
846         (is_anchored): Ditto.
847         (find_firstassertedchar): Ditto.
848         (jsRegExpCompile): Changed to take separate flags instead of an options int.
849         Also changed to call new/delete instead of pcre_malloc/free.
850         (jsRegExpFree): Ditto.
851
852         * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
853         Added a case that uses computed goto for the opcode loop, but did not turn it on.
854         Changed the RMATCH macro to handle returns more efficiently by putting the where
855         pointer in the new frame instead of the old one, allowing us to branch to the
856         return with a single statement. Switched to new/delete from pcre_malloc/free.
857         Changed many RRETURN callers to not set the return value since it's already
858         set correctly. Replaced the rrc variable with an is_match variable. Values other
859         than "match" and "no match" are now handled differently. This allows us to remove
860         the code to check for those cases in various rules.
861         (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
862         continue statements, or break statements that break out of the outer case use
863         a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
864         (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
865         start_match field from the match block.
866
867         * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
868         in here. Removed various unused types. Converted from JSRegExpChar to UChar.
869         Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
870         used in multiple places. Unfortunately we lose the comments for each opcode; we
871         should find a place to put those back. Removed ctype_digit.
872
873         * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
874         (pcre_maketables): Got rid of the conditional code that allows this to be compiled
875         in -- it's only used for dftables now (and soon may be obsolete entirely).
876         Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
877         loop. Removed ctype_digit.
878
879         * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
880
881         * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
882         Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
883
884         * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
885         Updated for other file name changes.
886
887         * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
888
889         * pcre/ucpinternal.h: Updated header.
890
891         * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
892
893         * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
894         & for this operation. Also added an overload that takes an int because that's
895         useful for PCRE. Later we could optimize for int and overload other functions in
896         this file; stuck to this simple one for now.
897
898         * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
899         * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
900
901         * pcre/LICENCE: Removed.
902         * pcre/pcre-config.h: Removed.
903         * wtf/FastMallocPCRE.cpp: Removed.
904
905         * pcre/dftables.c: Renamed to cpp.
906         * pcre/pcre_compile.c: Ditto.
907         * pcre/pcre_exec.c: Ditto.
908         * pcre/pcre_maketables.c: Ditto.
909         * pcre/pcre_ord2utf8.c: Ditto.
910         * pcre/pcre_tables.c: Ditto.
911         * pcre/pcre_ucp_searchfuncs.c: Ditto.
912         * pcre/pcre_xclass.c: Ditto.
913         * pcre/ucptable.c: Ditto.
914
915 2007-11-11  Eric Seidel  <eric@webkit.org>
916
917         Reviewed by Oliver.
918
919         Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
920
921         * kjs/nodes.cpp:
922         (KJS::ExpressionNode::evaluateToBoolean):
923         (KJS::LessNode::evaluateToBoolean):
924         (KJS::GreaterNode::evaluateToBoolean):
925         (KJS::LessEqNode::evaluateToBoolean):
926         (KJS::GreaterEqNode::evaluateToBoolean):
927         (KJS::InstanceOfNode::evaluateToBoolean):
928         (KJS::InNode::evaluateToBoolean):
929         (KJS::EqualNode::evaluateToBoolean):
930         (KJS::NotEqualNode::evaluateToBoolean):
931         (KJS::StrictEqualNode::evaluateToBoolean):
932         (KJS::NotStrictEqualNode::evaluateToBoolean):
933         (KJS::LogicalAndNode::evaluateToBoolean):
934         (KJS::LogicalOrNode::evaluateToBoolean):
935         (KJS::ConditionalNode::evaluateToBoolean):
936
937 2007-11-10  Darin Adler  <darin@apple.com>
938
939         Reviewed by Sam.
940
941         - fix http://bugs.webkit.org/show_bug.cgi?id=15927
942           REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
943           and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
944
945         Test: fast/js/delete-then-put.html
946
947         * kjs/property_map.cpp:
948         (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
949         (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
950         problem before.
951
952         - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
953
954         * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
955         optimizeForUnnecessaryResult, since the result is used in some cases.
956
957 2007-11-10  Adam Roben  <aroben@apple.com>
958
959         Windows build fix
960
961         Roll out some changes that were (seemingly accidentally) checked in
962         with r27664.
963
964         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
965
966 2007-11-10  Darin Adler  <darin@apple.com>
967
968         Reviewed by Sam.
969
970         - http://bugs.webkit.org/show_bug.cgi?id=15915
971           add an evaluation path for booleans like the one we have for numbers
972
973         Gives 1.1% on SunSpider.
974
975         * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
976
977         * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
978         down from Node to ExpressionNode. Changed some classes to not inherit from
979         ExpressionNode where not necessary, and removed unnneeded evaluate functions
980         as well as evaluate functions that need not be virtual. Call the
981         optimizeForUnnecessaryResult function on the start of a for loop too.
982         * kjs/nodes.cpp:
983         (KJS::ExpressionNode::evaluateToBoolean): Added.
984         (KJS::FalseNode::evaluate): Added.
985         (KJS::TrueNode::evaluate): Added.
986         (KJS::NumberNode::evaluateToBoolean): Added.
987         (KJS::StringNode::evaluateToBoolean): Added.
988         (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
989         (KJS::BracketAccessorNode::evaluateToBoolean): Added.
990         (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
991         (KJS::LogicalNotNode::evaluateToBoolean): Added.
992         (KJS::lessThan): Changed to return bool.
993         (KJS::lessThanEq): Ditto.
994         (KJS::LessNode::evaluate): Changed since lessThan returns bool.
995         (KJS::LessNode::evaluateToBoolean): Added.
996         (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
997         (KJS::GreaterNode::evaluateToBoolean): Added.
998         (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
999         (KJS::LessEqNode::evaluateToBoolean): Added.
1000         (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
1001         (KJS::GreaterEqNode::evaluateToBoolean): Added.
1002         (KJS::InstanceOfNode::evaluateToBoolean): Added.
1003         (KJS::InNode::evaluateToBoolean): Added.
1004         (KJS::EqualNode::evaluateToBoolean): Added.
1005         (KJS::NotEqualNode::evaluateToBoolean): Added.
1006         (KJS::StrictEqualNode::evaluateToBoolean): Added.
1007         (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
1008         (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
1009         (KJS::IfNode::execute): Ditto.
1010         (KJS::DoWhileNode::execute): Ditto.
1011         (KJS::WhileNode::execute): Ditto.
1012         (KJS::ForNode::execute): Ditto.
1013
1014         * kjs/nodes2string.cpp:
1015         (KJS::FalseNode::streamTo): Added.
1016         (KJS::TrueNode::streamTo): Added.
1017
1018 2007-11-09  Adam Roben  <aroben@apple.com>
1019
1020         Windows build fix
1021
1022         Reviewed by Darin.
1023
1024         * kjs/value.h:
1025         (KJS::jsNumber): Add some explicit casts.
1026
1027 2007-11-08  Darin Adler  <darin@apple.com>
1028
1029         - fix build
1030
1031         * kjs/grammar.y:
1032         * kjs/nodes.h:
1033         * kjs/property_map.cpp:
1034
1035 2007-11-08  Darin Adler  <darin@apple.com>
1036
1037         - roll out accidentally-checked in changes
1038
1039         * kjs/nodes.cpp: Back to previous version.
1040         * kjs/nodes.h: Ditto.
1041         * kjs/grammar.y: Ditto.
1042
1043 2007-11-08  Darin Adler  <darin@apple.com>
1044
1045         Reviewed by Maciej.
1046
1047         - http://bugs.webkit.org/show_bug.cgi?id=15912
1048           fasta spends a lot of time in qsort
1049
1050         * kjs/property_map.cpp:
1051         (KJS::PropertyMap::getEnumerablePropertyNames):
1052         Use insertion sort instead of qsort for small sets of property names.
1053         We can probably do some even-better speedups of for/in, but this nets
1054         0.6% overall and 6.7% on fasta.
1055
1056 2007-11-08  Darin Adler  <darin@apple.com>
1057
1058         Reviewed by Maciej.
1059
1060         - http://bugs.webkit.org/show_bug.cgi?id=15906
1061           getting characters by indexing into a string is very slow
1062
1063         This fixes one source of the slowness -- the conversion to an unused
1064         Identifier as we call the get function from the slot -- but doesn't
1065         fix others, such as the fact that we have to allocate a new UString::Rep
1066         for every single character.
1067
1068         Speeds up string-base64 30%, and at least 0.5% overall.
1069         But does slow down access-fannkuch quite a bit. Might be worth
1070         revisiting in the future to see what we can do about that (although
1071         I did look at a profile for a while).
1072
1073         * kjs/property_slot.h: Add a new marker for "numeric" property slots;
1074         slots where we don't need to pass the identifier to the get function.
1075         (KJS::PropertySlot::getValue): Added code to call the numeric get function.
1076         (KJS::PropertySlot::setCustomNumeric): Added.
1077         * kjs/string_object.cpp:
1078         (KJS::StringInstance::indexGetter): Changed to use substr() instead
1079         of constructing a wholly new UString each time.
1080         (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
1081         takes advantage of setCustomNumeric to avoid creating an Identifier.
1082         (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
1083
1084 2007-11-08  Darin Adler  <darin@apple.com>
1085
1086         Reviewed by Oliver.
1087
1088         - http://bugs.webkit.org/show_bug.cgi?id=15904
1089           more speed-ups possible by tightening up int version of JSImmediate
1090
1091         1% improvement of SunSpider
1092
1093         * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
1094         (KJS::JSImmediate::from): Overload for most numeric types; many types can
1095         do fewer branches and checks.
1096         (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
1097         (KJS::JSImmediate::getTruncatedInt32): Ditto.
1098         (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
1099         between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
1100
1101         * kjs/grammar.y: Update since fromDouble is now just from.
1102         * kjs/nodes.h: Ditto.
1103
1104         * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
1105
1106 2007-11-08  Kevin Ollivier  <kevino@theolliviers.com>
1107
1108         Bakefiles for building JavaScriptCore, needed by wx port.
1109
1110         Reviewed by Mark Rowe.
1111
1112         * JavaScriptCoreSources.bkl: Added.
1113         * jscore.bkl: Added.
1114
1115 2007-11-08  Oliver Hunt  <oliver@apple.com>
1116
1117         Reviewed by Maciej.
1118
1119         Fix regression caused by earlier bitwise and optimisation.  1 & undefined != 1.
1120
1121         The implementation of JSImmediate::areBothImmediateNumbers relies on 
1122         (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having 
1123         a unique result when both immediate values are numbers.
1124
1125         The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
1126         By swapping the value of NumberType and UndefinedType this ceases to be a problem.
1127
1128         * kjs/JSType.h:
1129         (KJS::):
1130
1131 2007-11-08  Darin Adler  <darin@apple.com>
1132
1133         - fix build
1134
1135         * kjs/nodes.h: Add missing parameter name.
1136
1137 2007-11-08  Eric Seidel  <eric@webkit.org>
1138
1139         Reviewed by darin.
1140
1141         Add ExpressionNode subclass of Node, use it.
1142
1143         * kjs/grammar.y:
1144         * kjs/nodes.cpp:
1145         (KJS::ForInNode::ForInNode):
1146         * kjs/nodes.h:
1147         (KJS::ExpressionNode::):
1148         (KJS::NullNode::):
1149         (KJS::NullNode::precedence):
1150         (KJS::BooleanNode::):
1151         (KJS::BooleanNode::precedence):
1152         (KJS::RegExpNode::):
1153         (KJS::RegExpNode::precedence):
1154         (KJS::ThisNode::):
1155         (KJS::ThisNode::precedence):
1156         (KJS::ResolveNode::):
1157         (KJS::ElementNode::):
1158         (KJS::ArrayNode::):
1159         (KJS::PropertyNode::):
1160         (KJS::PropertyNode::precedence):
1161         (KJS::PropertyNode::name):
1162         (KJS::PropertyListNode::):
1163         (KJS::ObjectLiteralNode::):
1164         (KJS::ObjectLiteralNode::precedence):
1165         (KJS::BracketAccessorNode::):
1166         (KJS::DotAccessorNode::):
1167         (KJS::DotAccessorNode::precedence):
1168         (KJS::ArgumentListNode::):
1169         (KJS::ArgumentsNode::):
1170         (KJS::NewExprNode::):
1171         (KJS::NewExprNode::precedence):
1172         (KJS::FunctionCallValueNode::):
1173         (KJS::FunctionCallValueNode::precedence):
1174         (KJS::FunctionCallResolveNode::):
1175         (KJS::FunctionCallBracketNode::):
1176         (KJS::FunctionCallBracketNode::precedence):
1177         (KJS::FunctionCallDotNode::):
1178         (KJS::FunctionCallDotNode::precedence):
1179         (KJS::PrePostResolveNode::):
1180         (KJS::PostfixBracketNode::):
1181         (KJS::PostfixBracketNode::precedence):
1182         (KJS::PostIncBracketNode::):
1183         (KJS::PostIncBracketNode::isIncrement):
1184         (KJS::PostDecBracketNode::):
1185         (KJS::PostDecBracketNode::isIncrement):
1186         (KJS::PostfixDotNode::):
1187         (KJS::PostfixDotNode::precedence):
1188         (KJS::PostIncDotNode::):
1189         (KJS::PostIncDotNode::isIncrement):
1190         (KJS::PostDecDotNode::):
1191         (KJS::PostDecDotNode::isIncrement):
1192         (KJS::PostfixErrorNode::):
1193         (KJS::PostfixErrorNode::precedence):
1194         (KJS::DeleteResolveNode::):
1195         (KJS::DeleteBracketNode::):
1196         (KJS::DeleteBracketNode::precedence):
1197         (KJS::DeleteDotNode::):
1198         (KJS::DeleteDotNode::precedence):
1199         (KJS::DeleteValueNode::):
1200         (KJS::DeleteValueNode::precedence):
1201         (KJS::VoidNode::):
1202         (KJS::VoidNode::precedence):
1203         (KJS::TypeOfResolveNode::):
1204         (KJS::TypeOfValueNode::):
1205         (KJS::PrefixBracketNode::):
1206         (KJS::PrefixBracketNode::precedence):
1207         (KJS::PreIncBracketNode::):
1208         (KJS::PreIncBracketNode::isIncrement):
1209         (KJS::PreDecBracketNode::):
1210         (KJS::PreDecBracketNode::isIncrement):
1211         (KJS::PrefixDotNode::):
1212         (KJS::PrefixDotNode::precedence):
1213         (KJS::PreIncDotNode::):
1214         (KJS::PreIncDotNode::isIncrement):
1215         (KJS::PreDecDotNode::):
1216         (KJS::PreDecDotNode::isIncrement):
1217         (KJS::PrefixErrorNode::):
1218         (KJS::PrefixErrorNode::precedence):
1219         (KJS::UnaryPlusNode::):
1220         (KJS::UnaryPlusNode::precedence):
1221         (KJS::NegateNode::):
1222         (KJS::NegateNode::precedence):
1223         (KJS::BitwiseNotNode::):
1224         (KJS::BitwiseNotNode::precedence):
1225         (KJS::LogicalNotNode::):
1226         (KJS::LogicalNotNode::precedence):
1227         (KJS::AddNode::):
1228         (KJS::AddNode::precedence):
1229         (KJS::LeftShiftNode::):
1230         (KJS::LeftShiftNode::precedence):
1231         (KJS::RightShiftNode::):
1232         (KJS::RightShiftNode::precedence):
1233         (KJS::UnsignedRightShiftNode::):
1234         (KJS::UnsignedRightShiftNode::precedence):
1235         (KJS::LessNode::):
1236         (KJS::LessNode::precedence):
1237         (KJS::GreaterNode::):
1238         (KJS::GreaterNode::precedence):
1239         (KJS::LessEqNode::):
1240         (KJS::LessEqNode::precedence):
1241         (KJS::GreaterEqNode::):
1242         (KJS::GreaterEqNode::precedence):
1243         (KJS::InstanceOfNode::):
1244         (KJS::InstanceOfNode::precedence):
1245         (KJS::InNode::):
1246         (KJS::InNode::precedence):
1247         (KJS::EqualNode::):
1248         (KJS::EqualNode::precedence):
1249         (KJS::NotEqualNode::):
1250         (KJS::NotEqualNode::precedence):
1251         (KJS::StrictEqualNode::):
1252         (KJS::StrictEqualNode::precedence):
1253         (KJS::NotStrictEqualNode::):
1254         (KJS::NotStrictEqualNode::precedence):
1255         (KJS::BitAndNode::):
1256         (KJS::BitAndNode::precedence):
1257         (KJS::BitOrNode::):
1258         (KJS::BitOrNode::precedence):
1259         (KJS::BitXOrNode::):
1260         (KJS::BitXOrNode::precedence):
1261         (KJS::LogicalAndNode::):
1262         (KJS::LogicalAndNode::precedence):
1263         (KJS::LogicalOrNode::):
1264         (KJS::LogicalOrNode::precedence):
1265         (KJS::ConditionalNode::):
1266         (KJS::ConditionalNode::precedence):
1267         (KJS::ReadModifyResolveNode::):
1268         (KJS::ReadModifyResolveNode::precedence):
1269         (KJS::AssignResolveNode::):
1270         (KJS::AssignResolveNode::precedence):
1271         (KJS::ReadModifyBracketNode::):
1272         (KJS::ReadModifyBracketNode::precedence):
1273         (KJS::AssignBracketNode::):
1274         (KJS::AssignBracketNode::precedence):
1275         (KJS::AssignDotNode::):
1276         (KJS::AssignDotNode::precedence):
1277         (KJS::ReadModifyDotNode::):
1278         (KJS::ReadModifyDotNode::precedence):
1279         (KJS::AssignErrorNode::):
1280         (KJS::AssignErrorNode::precedence):
1281         (KJS::CommaNode::):
1282         (KJS::CommaNode::precedence):
1283         (KJS::AssignExprNode::):
1284         (KJS::AssignExprNode::precedence):
1285         (KJS::ExprStatementNode::):
1286         (KJS::IfNode::):
1287         (KJS::DoWhileNode::):
1288         (KJS::WhileNode::):
1289         (KJS::ReturnNode::):
1290         (KJS::WithNode::):
1291         (KJS::ThrowNode::):
1292         (KJS::ParameterNode::):
1293         (KJS::CaseClauseNode::):
1294         (KJS::CaseClauseNode::precedence):
1295         (KJS::ClauseListNode::):
1296         (KJS::SwitchNode::):
1297
1298 2007-11-08  Oliver Hunt  <oliver@apple.com>
1299
1300         Reviewed by Sam.
1301
1302         Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
1303
1304         This only improves bitwise-and performance, as the additional logic required 
1305         for similar code paths on or, xor, and shifting requires additional operations
1306         and branches that negate (and in certain cases, regress) any advantage we might
1307         otherwise receive.
1308
1309         This improves performance on all bitop tests, the cryptography tests, as well as 
1310         the string-base64 and string-unpack-code tests.  No significant degradation on 
1311         any other tests.
1312
1313         * kjs/JSImmediate.h:
1314         (KJS::JSImmediate::areBothImmediateNumbers):
1315         (KJS::JSImmediate::andImmediateNumbers):
1316         * kjs/nodes.cpp:
1317         (KJS::BitAndNode::evaluate):
1318         * kjs/value.h:
1319         (KJS::jsNumberFromAnd):
1320
1321 2007-11-08  Adam Roben  <aroben@apple.com>
1322
1323         Stop using KJS inside of MathExtras.h
1324
1325         Reviewed by Darin.
1326
1327         * wtf/MathExtras.h: Removed an unused header, and a now-unused
1328         forward-declaration.
1329         (wtf_atan2): Use std::numeric_limits intead of KJS.
1330
1331 2007-11-08  Sam Weinig  <sam@webkit.org>
1332
1333         Windows build fix.
1334
1335         * kjs/date_object.cpp:
1336         (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
1337         (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
1338         (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
1339
1340 2007-11-08  Mark Rowe  <mrowe@apple.com>
1341
1342         Gtk build fix.
1343
1344         * kjs/lookup.h: Add missing include.
1345
1346 2007-11-08  Sam Weinig  <sam@webkit.org>
1347
1348         Reviewed by Darin.
1349
1350         Convert JavaScript internal function objects to use one class per
1351         function.  This avoids a switch statement inside what used to be
1352         the shared function classes and will allow Shark to better analyze
1353         the code.
1354
1355         To make this switch, the value property of the HashEntry was changed
1356         to a union of an intptr_t (which is used to continue handle valueGetters)
1357         and function pointer which points to a static constructor for the
1358         individual new function objects.
1359
1360         SunSpider claims this is a 1.0% speedup.
1361
1362         * kjs/array_object.cpp:
1363         (KJS::ArrayPrototype::getOwnPropertySlot):
1364         (KJS::getProperty):
1365         (KJS::ArrayProtoFuncToString::callAsFunction):
1366         (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
1367         (KJS::ArrayProtoFuncJoin::callAsFunction):
1368         (KJS::ArrayProtoFuncConcat::callAsFunction):
1369         (KJS::ArrayProtoFuncPop::callAsFunction):
1370         (KJS::ArrayProtoFuncPush::callAsFunction):
1371         (KJS::ArrayProtoFuncReverse::callAsFunction):
1372         (KJS::ArrayProtoFuncShift::callAsFunction):
1373         (KJS::ArrayProtoFuncSlice::callAsFunction):
1374         (KJS::ArrayProtoFuncSort::callAsFunction):
1375         (KJS::ArrayProtoFuncSplice::callAsFunction):
1376         (KJS::ArrayProtoFuncUnShift::callAsFunction):
1377         (KJS::ArrayProtoFuncFilter::callAsFunction):
1378         (KJS::ArrayProtoFuncMap::callAsFunction):
1379         (KJS::ArrayProtoFuncEvery::callAsFunction):
1380         (KJS::ArrayProtoFuncForEach::callAsFunction):
1381         (KJS::ArrayProtoFuncSome::callAsFunction):
1382         (KJS::ArrayProtoFuncIndexOf::callAsFunction):
1383         (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
1384         * kjs/array_object.h:
1385         (KJS::ArrayPrototype::classInfo):
1386         * kjs/create_hash_table:
1387         * kjs/date_object.cpp:
1388         (KJS::DatePrototype::getOwnPropertySlot):
1389         (KJS::DateProtoFuncToString::callAsFunction):
1390         (KJS::DateProtoFuncToUTCString::callAsFunction):
1391         (KJS::DateProtoFuncToDateString::callAsFunction):
1392         (KJS::DateProtoFuncToTimeString::callAsFunction):
1393         (KJS::DateProtoFuncToLocaleString::callAsFunction):
1394         (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
1395         (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
1396         (KJS::DateProtoFuncValueOf::callAsFunction):
1397         (KJS::DateProtoFuncGetTime::callAsFunction):
1398         (KJS::DateProtoFuncGetFullYear::callAsFunction):
1399         (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
1400         (KJS::DateProtoFuncToGMTString::callAsFunction):
1401         (KJS::DateProtoFuncGetMonth::callAsFunction):
1402         (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
1403         (KJS::DateProtoFuncGetDate::callAsFunction):
1404         (KJS::DateProtoFuncGetUTCDate::callAsFunction):
1405         (KJS::DateProtoFuncGetDay::callAsFunction):
1406         (KJS::DateProtoFuncGetUTCDay::callAsFunction):
1407         (KJS::DateProtoFuncGetHours::callAsFunction):
1408         (KJS::DateProtoFuncGetUTCHours::callAsFunction):
1409         (KJS::DateProtoFuncGetMinutes::callAsFunction):
1410         (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
1411         (KJS::DateProtoFuncGetSeconds::callAsFunction):
1412         (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
1413         (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
1414         (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
1415         (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
1416         (KJS::DateProtoFuncSetTime::callAsFunction):
1417         (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
1418         (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
1419         (KJS::DateProtoFuncSetSeconds::callAsFunction):
1420         (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
1421         (KJS::DateProtoFuncSetMinutes::callAsFunction):
1422         (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
1423         (KJS::DateProtoFuncSetHours::callAsFunction):
1424         (KJS::DateProtoFuncSetUTCHours::callAsFunction):
1425         (KJS::DateProtoFuncSetDate::callAsFunction):
1426         (KJS::DateProtoFuncSetUTCDate::callAsFunction):
1427         (KJS::DateProtoFuncSetMonth::callAsFunction):
1428         (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
1429         (KJS::DateProtoFuncSetFullYear::callAsFunction):
1430         (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
1431         (KJS::DateProtoFuncSetYear::callAsFunction):
1432         (KJS::DateProtoFuncGetYear::callAsFunction):
1433         * kjs/date_object.h:
1434         * kjs/lookup.cpp:
1435         (KJS::Lookup::find):
1436         * kjs/lookup.h:
1437         (KJS::HashEntry::):
1438         (KJS::staticFunctionGetter):
1439         (KJS::staticValueGetter):
1440         (KJS::getStaticPropertySlot):
1441         (KJS::getStaticFunctionSlot):
1442         (KJS::lookupPut):
1443         * kjs/math_object.cpp:
1444         (KJS::MathObjectImp::getOwnPropertySlot):
1445         (KJS::MathProtoFuncAbs::callAsFunction):
1446         (KJS::MathProtoFuncACos::callAsFunction):
1447         (KJS::MathProtoFuncASin::callAsFunction):
1448         (KJS::MathProtoFuncATan::callAsFunction):
1449         (KJS::MathProtoFuncATan2::callAsFunction):
1450         (KJS::MathProtoFuncCeil::callAsFunction):
1451         (KJS::MathProtoFuncCos::callAsFunction):
1452         (KJS::MathProtoFuncExp::callAsFunction):
1453         (KJS::MathProtoFuncFloor::callAsFunction):
1454         (KJS::MathProtoFuncLog::callAsFunction):
1455         (KJS::MathProtoFuncMax::callAsFunction):
1456         (KJS::MathProtoFuncMin::callAsFunction):
1457         (KJS::MathProtoFuncPow::callAsFunction):
1458         (KJS::MathProtoFuncRandom::callAsFunction):
1459         (KJS::MathProtoFuncRound::callAsFunction):
1460         (KJS::MathProtoFuncSin::callAsFunction):
1461         (KJS::MathProtoFuncSqrt::callAsFunction):
1462         (KJS::MathProtoFuncTan::callAsFunction):
1463         * kjs/math_object.h:
1464         (KJS::MathObjectImp::classInfo):
1465         (KJS::MathObjectImp::):
1466         * kjs/string_object.cpp:
1467         (KJS::StringPrototype::getOwnPropertySlot):
1468         (KJS::StringProtoFuncToString::callAsFunction):
1469         (KJS::StringProtoFuncValueOf::callAsFunction):
1470         (KJS::StringProtoFuncCharAt::callAsFunction):
1471         (KJS::StringProtoFuncCharCodeAt::callAsFunction):
1472         (KJS::StringProtoFuncConcat::callAsFunction):
1473         (KJS::StringProtoFuncIndexOf::callAsFunction):
1474         (KJS::StringProtoFuncLastIndexOf::callAsFunction):
1475         (KJS::StringProtoFuncMatch::callAsFunction):
1476         (KJS::StringProtoFuncSearch::callAsFunction):
1477         (KJS::StringProtoFuncReplace::callAsFunction):
1478         (KJS::StringProtoFuncSlice::callAsFunction):
1479         (KJS::StringProtoFuncSplit::callAsFunction):
1480         (KJS::StringProtoFuncSubstr::callAsFunction):
1481         (KJS::StringProtoFuncSubstring::callAsFunction):
1482         (KJS::StringProtoFuncToLowerCase::callAsFunction):
1483         (KJS::StringProtoFuncToUpperCase::callAsFunction):
1484         (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
1485         (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
1486         (KJS::StringProtoFuncLocaleCompare::callAsFunction):
1487         (KJS::StringProtoFuncBig::callAsFunction):
1488         (KJS::StringProtoFuncSmall::callAsFunction):
1489         (KJS::StringProtoFuncBlink::callAsFunction):
1490         (KJS::StringProtoFuncBold::callAsFunction):
1491         (KJS::StringProtoFuncFixed::callAsFunction):
1492         (KJS::StringProtoFuncItalics::callAsFunction):
1493         (KJS::StringProtoFuncStrike::callAsFunction):
1494         (KJS::StringProtoFuncSub::callAsFunction):
1495         (KJS::StringProtoFuncSup::callAsFunction):
1496         (KJS::StringProtoFuncFontcolor::callAsFunction):
1497         (KJS::StringProtoFuncFontsize::callAsFunction):
1498         (KJS::StringProtoFuncAnchor::callAsFunction):
1499         (KJS::StringProtoFuncLink::callAsFunction):
1500         * kjs/string_object.h:
1501
1502 2007-11-08  Adam Roben  <aroben@apple.com>
1503
1504         Windows build fix
1505
1506         Reviewed by Sam and Ada.
1507
1508         * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
1509         the build.
1510
1511 2007-11-08  Adam Roben  <aroben@apple.com>
1512
1513         Fix a precedence warning on Windows
1514
1515         * kjs/JSImmediate.h:
1516         (KJS::JSImmediate::toBoolean):
1517
1518 2007-11-08  Mark Rowe  <mrowe@apple.com>
1519
1520         Build fix for JavaScriptGlue.
1521
1522         * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
1523
1524 2007-11-08  Darin Adler  <darin@apple.com>
1525
1526         - Windows build fix
1527
1528         * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
1529
1530 2007-11-08  Oliver Hunt  <oliver@apple.com>
1531
1532         Reviewed by Darin.
1533
1534         Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
1535
1536         Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
1537         we should now have faster array access, faster immediate to double conversion, and the 
1538         potential to further improve bitwise operators in future.
1539
1540         This also removes the need for unions to avoid strict aliasing problems when extracting 
1541         a value from immediates.
1542
1543         * kjs/JSImmediate.h:
1544         (KJS::):
1545         (KJS::JSImmediate::trueImmediate):
1546         (KJS::JSImmediate::falseImmediate):
1547         (KJS::JSImmediate::undefinedImmediate):
1548         (KJS::JSImmediate::nullImmediate):
1549         (KJS::JSImmediate::toBoolean):
1550         * kjs/value.h:
1551         (KJS::jsNaN):
1552
1553 2007-11-07  Eric Seidel  <eric@webkit.org>
1554
1555         Reviewed by Darin and Oliver.
1556         
1557         Add evaluateToNumber parallel evaluation tree to speed up number operations.
1558         Make ImmediateNumberNode a subclass of NumberNode.
1559         Share evaluate logic between evaluate and evaluateToNumber using inline functions
1560         There is still a lot of improvement to be made here.
1561         
1562         SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
1563         Given the huge win that this prepares us for with simple type inferencing I see the small
1564         regression in base64 being worth the substantial overall improvement.
1565
1566         * kjs/grammar.y:
1567         * kjs/nodes.cpp:
1568         (KJS::Node::evaluateToNumber):
1569         (KJS::NumberNode::evaluate):
1570         (KJS::NumberNode::evaluateToNumber):
1571         (KJS::StringNode::evaluateToNumber):
1572         (KJS::LocalVarAccessNode::inlineEvaluate):
1573         (KJS::LocalVarAccessNode::evaluate):
1574         (KJS::LocalVarAccessNode::evaluateToNumber):
1575         (KJS::BracketAccessorNode::inlineEvaluate):
1576         (KJS::BracketAccessorNode::evaluate):
1577         (KJS::BracketAccessorNode::evaluateToNumber):
1578         (KJS::NegateNode::evaluate):
1579         (KJS::NegateNode::evaluateToNumber):
1580         (KJS::MultNode::inlineEvaluateToNumber):
1581         (KJS::MultNode::evaluate):
1582         (KJS::MultNode::evaluateToNumber):
1583         (KJS::DivNode::inlineEvaluateToNumber):
1584         (KJS::DivNode::evaluate):
1585         (KJS::DivNode::evaluateToNumber):
1586         (KJS::ModNode::inlineEvaluateToNumber):
1587         (KJS::ModNode::evaluate):
1588         (KJS::ModNode::evaluateToNumber):
1589         (KJS::throwOutOfMemoryErrorToNumber):
1590         (KJS::addSlowCaseToNumber):
1591         (KJS::add):
1592         (KJS::addToNumber):
1593         (KJS::AddNode::evaluateToNumber):
1594         (KJS::SubNode::inlineEvaluateToNumber):
1595         (KJS::SubNode::evaluate):
1596         (KJS::SubNode::evaluateToNumber):
1597         (KJS::valueForReadModifyAssignment):
1598         (KJS::ReadModifyLocalVarNode::evaluate):
1599         (KJS::ReadModifyResolveNode::evaluate):
1600         (KJS::ReadModifyDotNode::evaluate):
1601         (KJS::ReadModifyBracketNode::evaluate):
1602         * kjs/nodes.h:
1603         (KJS::Node::):
1604         (KJS::NumberNode::):
1605         (KJS::ImmediateNumberNode::):
1606         (KJS::AddNode::precedence):
1607         * kjs/nodes2string.cpp:
1608         (KJS::NumberNode::streamTo):
1609
1610 2007-11-07  Mark Rowe  <mrowe@apple.com>
1611
1612         Reviewed by Eric.
1613
1614         Fix up initialization after being mangled in r27572, and remove the
1615         ternary expression as extraCost will always be zero for the numeric
1616         heap.
1617
1618         * kjs/collector.cpp:
1619         (KJS::Collector::heapAllocate):
1620
1621 2007-11-07  Mark Rowe  <mrowe@apple.com>
1622
1623         Gtk build fix.
1624
1625         * kjs/regexp_object.cpp:
1626
1627 2007-11-07  Geoffrey Garen  <ggaren@apple.com>
1628
1629         Reviewed by Beth Dakin.
1630         
1631         Eliminated a bogus (though compiled-out) branch in the collector.
1632
1633         * kjs/collector.cpp:
1634         (KJS::Collector::heapAllocate):
1635
1636 2007-11-06  Geoffrey Garen  <ggaren@apple.com>
1637
1638         Reviewed by Darin Adler.
1639         
1640         Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861 
1641         5.8% of string-validate-input.js is spent creating RegExpImps
1642
1643         Put RegExpImp properties into a static hashtable to avoid a slew of
1644         PropertyMap churn when creating a RegExpImp.
1645         
1646         Factored important bits of regular expression implementation out of
1647         RegExpImp (the JS object) and into RegExp (the PCRE wrapper class), 
1648         making RegExp a ref-counted class. (This will help later.)
1649
1650         Removed PCRE_POSIX support because I didn't quite know how to test it 
1651         and keep it working with these changes.
1652         
1653         1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
1654
1655         * kjs/regexp.h: A few interface changes:
1656         1. Renamed "subpatterns()" => "numSubpatterns()"
1657         2. Made flag enumeration private and replaced it with public getters for
1658         specific flags.
1659         3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
1660         4. Made RegExp take a string of flags instead of an int, eliminating 
1661         duplicated flag parsing code elsewhere.
1662
1663         * kjs/regexp_object.cpp:
1664         (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile: 
1665         - Fixed a bug where compile(undefined) would throw an exception. 
1666         - Removed some now-redundant code.
1667         - Used RegExp sharing to eliminate an allocation and a bunch of 
1668         PropertyMap thrash. (Not a big win since compile is a deprecated 
1669         function. I mainly did this to test the plubming.)
1670
1671 2007-11-07  Simon Hausmann  <hausmann@kde.org>
1672
1673         Reviewed by nobody, Qt/Windows build fix.
1674
1675         JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
1676         testkjs.pro, too, where it's included from.
1677
1678         * kjs/testkjs.pro:
1679
1680 2007-11-07  Simon Hausmann  <shausman@trolltech.com>
1681
1682         Reviewed by Lars.
1683
1684         Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
1685
1686         * JavaScriptCore.pri:
1687         * pcre/pcre.pri:
1688
1689 2007-11-07  Lars Knoll  <lars@trolltech.com>
1690
1691         Reviewed by Simon.
1692
1693         fix umemcasecmp
1694         
1695         Pretty embarrassing bug. Has the potential to fix quite a few test failures.
1696
1697         * wtf/unicode/qt4/UnicodeQt4.h:
1698         (WTF::Unicode::umemcasecmp):
1699
1700 2007-11-06  Maciej Stachowiak  <mjs@apple.com>
1701
1702         Reviewed by Eric.        
1703         
1704         - only collect when the heap is full, unless we have lots of extra cost garbage
1705         
1706         1.1% SunSpider speedup.
1707         
1708         This shouldn't hit memory use much since the extra space in those
1709         blocks hangs around either way.
1710
1711         * kjs/collector.cpp:
1712         (KJS::Collector::heapAllocate):
1713         (KJS::Collector::collect): Fix logic error that reversed the sense of collect's 
1714         return value.
1715
1716 2007-11-06  Oliver Hunt  <oliver@apple.com>
1717
1718         Reviewed by Maciej.
1719
1720         Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
1721         
1722         We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
1723         'for (...; ...; ++<var>) ...'.
1724
1725         * kjs/nodes.cpp:
1726         (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
1727         (KJS::PostIncLocalVarNode::evaluate):
1728         (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
1729         (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
1730         (KJS::PostDecLocalVarNode::evaluate):
1731         (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
1732         * kjs/nodes.h:
1733         (KJS::PrePostResolveNode::):
1734         (KJS::PostIncResolveNode::):
1735         (KJS::PostIncLocalVarNode::):
1736         (KJS::PostDecResolveNode::):
1737         (KJS::PostDecLocalVarNode::):
1738         (KJS::PreIncResolveNode::):
1739         (KJS::PreDecResolveNode::):
1740         (KJS::ForNode::ForNode):
1741
1742 2007-11-06  Eric Seidel  <eric@webkit.org>
1743
1744         Reviewed by darin.
1745
1746         This fixes a regressed layout test for string + object
1747         
1748         SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
1749
1750         * kjs/nodes.cpp:
1751         (KJS::add): remove erroneous "fast path" for string + *
1752
1753 2007-11-06  Geoffrey Garen  <ggaren@apple.com>
1754
1755         Reviewed by Eric Seidel.
1756         
1757         Added toJSNumber, a fast path for converting a JSValue to a JS number,
1758         and deployed it in postfix expressions. In the fast case this 
1759         eliminates a call to jsNumber.
1760         
1761         0.4% speedup on SunSpider.
1762
1763         * ChangeLog:
1764         * kjs/nodes.cpp:
1765         (KJS::PostIncResolveNode::evaluate):
1766         (KJS::PostIncLocalVarNode::evaluate):
1767         (KJS::PostDecResolveNode::evaluate):
1768         (KJS::PostDecLocalVarNode::evaluate):
1769         (KJS::PostIncBracketNode::evaluate):
1770         (KJS::PostDecBracketNode::evaluate):
1771         (KJS::PostIncDotNode::evaluate):
1772         (KJS::PostDecDotNode::evaluate):
1773         (KJS::UnaryPlusNode::evaluate):
1774         * kjs/value.h:
1775         (KJS::JSValue::toJSNumber):
1776
1777 2007-11-06  Darin Adler  <darin@apple.com>
1778
1779         Reviewed by Maciej.
1780
1781         - http://bugs.webkit.org/show_bug.cgi?id=15846
1782           REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
1783
1784         There was a mistake in the algorithm used to find an empty slot in the property
1785         map entries vector; when we were putting in a new property value and not overwriting
1786         an existing deleted sentinel, we would enlarge the entries vector, but would not
1787         overwrite the stale data that's in the new part. It was easy to pin this down by
1788         turning on property map consistency checks -- I never would have landed with this
1789         bug if I had run the regression tests once with consistency checks on!
1790
1791         * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
1792         foundDeletedElement is false to always use the item at the end of the entries vector.
1793         Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
1794
1795 2007-11-06  Oliver Hunt  <oliver@apple.com>
1796
1797         RS=Darin.
1798
1799         Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
1800
1801         * kjs/nodes.cpp:
1802         (KJS::add):
1803
1804 2007-11-06  Oliver Hunt  <oliver@apple.com>
1805
1806         Reviewed by Darin.
1807
1808         Replace boolean comparisons in AddNode with mask
1809         comparisons for a 0.2% improvement in sunspider.
1810
1811         * JavaScriptCore.xcodeproj/project.pbxproj:
1812         * kjs/nodes.cpp:
1813         (KJS::add):
1814
1815 2007-11-06  Eric Seidel  <eric@webkit.org>
1816
1817         Reviewed by darin.
1818         
1819         SunSpider claims this is a 1.1% speedup.
1820
1821         * kjs/nodes.cpp:
1822         (KJS::throwOutOfMemoryError): Added, non inline.
1823         (KJS::addSlowCase): renamed from add(), non inline.
1824         (KJS::add): add fast path for String + String, Number + Number and String + *
1825
1826 2007-11-06  Eric Seidel  <eric@webkit.org>
1827
1828         Reviewed by mjs.
1829         
1830         Avoid more UString creation.
1831         
1832         SunSpider claims this is a 0.4% speedup.
1833
1834         * kjs/regexp_object.cpp:
1835         (KJS::RegExpObjectImp::construct): use UString::find(UChar)
1836
1837 2007-11-05  Mark Rowe  <mrowe@apple.com>
1838
1839         Mac build fix.
1840
1841         * kjs/array_object.cpp:
1842         (KJS::ArrayProtoFunc::callAsFunction):
1843
1844 2007-11-05  Adam Roben  <aroben@apple.com>
1845
1846         Windows build fix
1847
1848         * kjs/list.h:
1849
1850 2007-11-05  Mark Rowe  <mrowe@apple.com>
1851
1852         Build fix.  Add missing #include.
1853
1854         * kjs/operations.cpp:
1855
1856 2007-11-05  Eric Seidel  <eric@webkit.org>
1857
1858         Reviewed by mjs.
1859         
1860         Remove another call to toString(exec)
1861         
1862         SunSpider claims this is a 0.5% speedup.
1863
1864         * kjs/operations.cpp:
1865         (KJS::equal): remove another toString
1866
1867 2007-11-05  Eric Seidel  <eric@webkit.org>
1868
1869         * kjs/operations.cpp:
1870         (KJS::equal): correct broken change.
1871
1872 2007-11-05  Eric Seidel  <eric@webkit.org>
1873
1874         Reviewed by mjs.
1875
1876         Remove one more call to toString(exec).
1877         
1878         SunSpider claims this is a 0.7% speedup.
1879
1880         * kjs/operations.cpp:
1881         (KJS::equal): remove a call to toString()
1882
1883 2007-11-05  Mark Rowe  <mrowe@apple.com>
1884
1885         Gtk build fix.
1886
1887         * pcre/pcre.pri:
1888
1889 2007-11-05  Mark Rowe  <mrowe@apple.com>
1890
1891         Gtk build fix.
1892
1893         * kjs/list.cpp:
1894
1895 2007-11-05  Geoffrey Garen  <ggaren@apple.com>
1896
1897         Touched a file to test my new HTTP access.
1898
1899         * kjs/scope_chain.cpp:
1900
1901 2007-11-05  Alp Toker  <alp@atoker.com>
1902
1903         Unreviewed build fix for qmake-based ports.
1904
1905         Someone with a better understanding of qmake still needs to sort out
1906         the INCLUDEPATH/DEPENDPATH mess.
1907
1908         * JavaScriptCore.pri:
1909
1910 2007-11-05  Geoffrey Garen  <ggaren@apple.com>
1911
1912         Reviewed by Darin Adler.
1913         
1914         http://bugs.webkit.org/show_bug.cgi?id=15835
1915
1916         Switched List implementation from a custom heap allocator to an inline
1917         Vector, for a disappointing .5% SunSpider speedup.
1918         
1919         Also renamed List::slice to List::getSlice because "get" is the 
1920         conventional prefix for functions returning a value through an out 
1921         parameter.
1922
1923         * kjs/array_object.cpp:
1924         (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
1925         calls and memory accesses.
1926
1927         * kjs/bool_object.cpp:
1928         (BooleanObjectImp::construct): Removed questionable use of iterator.
1929
1930         * kjs/list.cpp:
1931         * kjs/list.h: New List class, implemented in terms of Vector. Two 
1932         interesting differences:
1933             1. The inline capacity is 8, not 5. Many of the Lists constructed 
1934             during a SunSpider run are larger than 5; almost none are larger
1935             than 8.
1936
1937             2. The growth factor is 4, not 2. Since we can guarantee that Lists
1938             aren't long-lived, we can grow them more aggressively, to avoid
1939             excessive copying.
1940
1941         * kjs/regexp_object.cpp:
1942         (RegExpObjectImp::construct): Removed redundant function calls.
1943
1944         * kjs/string_object.cpp:
1945         (KJS::StringObjectImp::construct): Removed questionable use of iterator.
1946
1947         * wtf/Vector.h:
1948         (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
1949
1950 2007-11-05  Mark Rowe  <mrowe@apple.com>
1951
1952         Reviewed by Alp Toker.
1953
1954         Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
1955
1956         * JavaScriptCore.pri:
1957         * pcre/pcre.pri:
1958
1959 2007-11-04  Darin Adler  <darin@apple.com>
1960
1961         Reviewed by Maciej.
1962
1963         - http://bugs.webkit.org/show_bug.cgi?id=15826
1964           optimize opcode loop and case insensitive ASCII compares for a 30% speedup
1965
1966         SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
1967
1968         * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
1969
1970         * pcre/pcre_compile.c:
1971         (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
1972         added OP_NOT since there was no reason it should not be in here.
1973         (could_be_empty_branch): Ditto.
1974         (compile_branch): Streamlined all the single-character cases; there was a bit of
1975         duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
1976         But in particular, compile to those opcodes when the single character match is
1977         ASCII.
1978         (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
1979
1980         * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
1981         the matchframe, after I discovered that none of them needed to be saved and restored
1982         across recursive match calls. Also eliminated the ignored result field from the
1983         matchframe, since I discovered that rrc ("recursive result code") was already the
1984         exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
1985         statement of the switch instead of doing them before the switch. This removes a
1986         branch from each iteration of the opcode interpreter, just as removal of "op"
1987         removed at least one store from each iteration. Last, but not least, add the
1988         OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
1989         surrogate pair and the letter case can be handled efficiently.
1990
1991 2007-11-04  Darin Adler  <darin@apple.com>
1992
1993         * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
1994
1995 2007-11-03  Darin Adler  <darin@apple.com>
1996
1997         - fix non-Mac builds; remove some more unused PCRE stuff
1998
1999         * pcre/pcre_compile.c:
2000         (compile_branch): Removed branch chain and some unused ESC values.
2001         (compile_regex): Ditto.
2002         (jsRegExpCompile): Ditto.
2003         * pcre/pcre_exec.c:
2004         (match): Removed unused branch targets. Don't use macros any more.
2005         (jsRegExpExecute): More of the same.
2006
2007         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
2008         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2009         * pcre/pcre.pri: Ditto.
2010
2011         * pcre/MERGING: Removed.
2012         * pcre/pcre_fullinfo.c: Removed.
2013         * pcre/pcre_get.c: Removed.
2014         * pcre/pcre_internal.h:
2015         * pcre/ucp.h: Removed.
2016
2017 2007-11-03  Darin Adler  <darin@apple.com>
2018
2019         Reviewed by Maciej.
2020
2021         - http://bugs.webkit.org/show_bug.cgi?id=15821
2022           remove unused PCRE features for speed
2023
2024         A first step toward removing the PCRE features we don't use.
2025         This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
2026         the SunSpider regular expression test.
2027
2028         Replaced the public interface with one that doesn't use the
2029         name PCRE. Removed code we don't need for JavaScript and various
2030         configurations we don't use. This is in preparation for still
2031         more changes in the future. We'll probably switch to C++ and
2032         make some even more significant changes to the regexp engine
2033         to get some additional speed.
2034
2035         There's probably additional unused stuff that I haven't
2036         deleted yet.
2037
2038         This does mean that our PCRE is now a fork, but I think that's
2039         not really a big deal.
2040
2041         * JavaScriptCore.exp: Remove the 5 old entry points and add
2042         the 3 new entry points for WebCore's direct use of the regular
2043         expression engine.
2044
2045         * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
2046         its sense and now there's a USE(POSIX_REGEX) instead, which should
2047         probably not be set by anyone. Maybe later we'll just get rid of it
2048         altogether.
2049
2050         * kjs/regexp.h:
2051         * kjs/regexp.cpp:
2052         (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
2053         defines. Cut down on the number of functions used.
2054         (KJS::RegExp::~RegExp): Ditto.
2055         (KJS::RegExp::match): Ditto.
2056
2057         * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
2058         which are unused.
2059
2060         * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
2061         size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
2062         POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
2063         and JAVASCRIPT. These are all no longer configurable in our copy
2064         of the library.
2065
2066         * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
2067         version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
2068         the include of <stdlib.h>, and most of the constants and
2069         functions defined in this header. Changed the naming scheme to
2070         use a JSRegExp prefix rather than a pcre prefix. In the future,
2071         we'll probably change this to be a C++ header.
2072
2073         * pcre/pcre_compile.c: Removed all unused code branches,
2074         including many whole functions and various byte codes.
2075         Kept changes outside of removal to a minimum.
2076         (check_escape):
2077         (first_significant_code):
2078         (find_fixedlength):
2079         (find_recurse):
2080         (could_be_empty_branch):
2081         (compile_branch):
2082         (compile_regex):
2083         (is_anchored):
2084         (is_startline):
2085         (find_firstassertedchar):
2086         (jsRegExpCompile): Renamed from pcre_compile2 and changed the
2087         parameters around a bit.
2088         (jsRegExpFree): Added.
2089
2090         * pcre/pcre_exec.c: Removed many unused opcodes and variables.
2091         Also started tearing down the NO_RECURSE mechanism since it's
2092         now the default. In some cases there were things in the explicit
2093         frame that could be turned into plain old local variables and
2094         other small like optimizations.
2095         (pchars):
2096         (match_ref):
2097         (match): Changed parameters quite a bit since it's now not used
2098         recursively.
2099         (jsRegExpExecute): Renamed from pcre_exec.
2100
2101         * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
2102         PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
2103         PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
2104         PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
2105         _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
2106         and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
2107
2108         * pcre/pcre_maketables.c: Changed to only compile in dftables.
2109         Also got rid of many of the tables that we don't use.
2110
2111         * pcre/pcre_tables.c: Removed the unused Unicode property tables.
2112
2113         * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
2114         _pcre_ucp_othercase.
2115
2116         * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
2117         for classes based on Unicode properties.
2118
2119         * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
2120         to eliminate this completely, but we need the regular expression
2121         code to be C++ first.
2122
2123         * pcre/pcre_fullinfo.c:
2124         * pcre/pcre_get.c:
2125         * pcre/ucp.h:
2126         Files that are no longer needed. I didn't remove them with this
2127         check-in, because I didn't want to modify all the project files.
2128
2129 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
2130
2131         Reviewed by Sam.
2132         
2133         - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
2134
2135         It turns out that doing this check costs more than it saves.
2136         
2137         * kjs/JSImmediate.h:
2138         (KJS::JSImmediate::fromDouble):
2139
2140 2007-11-03  Sam Weinig  <sam@webkit.org>
2141
2142         Reviewed by Oliver.
2143
2144         Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
2145         The variable had been kept around for binary compatibility, but since nothing
2146         else is there is no point in continuing to keep it around.
2147
2148         * API/JSCallbackConstructor.cpp:
2149         (KJS::):
2150         * API/JSCallbackFunction.cpp:
2151         (KJS::):
2152         * API/JSCallbackObject.cpp:
2153         (KJS::):
2154         * bindings/objc/objc_runtime.mm:
2155         * bindings/runtime_array.cpp:
2156         * bindings/runtime_object.cpp:
2157         * kjs/array_instance.cpp:
2158         (KJS::):
2159         * kjs/array_object.cpp:
2160         (KJS::):
2161         * kjs/bool_object.cpp:
2162         * kjs/date_object.cpp:
2163         (KJS::):
2164         * kjs/error_object.cpp:
2165         * kjs/function.cpp:
2166         (KJS::):
2167         * kjs/internal.cpp:
2168         (KJS::):
2169         * kjs/lookup.h:
2170         * kjs/math_object.cpp:
2171         * kjs/number_object.cpp:
2172         * kjs/object.h:
2173         * kjs/regexp_object.cpp:
2174         * kjs/string_object.cpp:
2175         (KJS::):
2176
2177 2007-11-03  Kevin McCullough  <kmccullough@apple.com>
2178
2179         - Updated testkjs results to make the build bots green until we
2180         can fix the tests that are failing.  The new failures are in DST.
2181
2182         * tests/mozilla/expected.html:
2183
2184 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
2185
2186         Reviewed by Adam.
2187         
2188         - don't print the var twice for ForInNodes with a var declaration
2189
2190         * kjs/nodes2string.cpp:
2191         (KJS::ForInNode::streamTo):
2192
2193 2007-11-03  Darin Adler  <darin@apple.com>
2194
2195         * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
2196         C-incompatible declaration.
2197
2198 2007-11-03  Mark Rowe  <mrowe@apple.com>
2199
2200         Gtk build fix.
2201
2202         * kjs/nodes.cpp:  Add missing include.
2203
2204 2007-11-03  Darin Adler  <darin@apple.com>
2205
2206         Reviewed by Maciej.
2207
2208         - fix http://bugs.webkit.org/show_bug.cgi?id=15814
2209           <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
2210
2211         These changes cause us to match the JavaScript specification and pass the
2212         fast/js/kde/encode_decode_uri.html test.
2213
2214         * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
2215         new strict mode, throwing an exception if there are malformed UTF-16 surrogate
2216         pairs in the text.
2217
2218         * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
2219         * kjs/ustring.cpp:
2220         (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
2221         those might be illegal in some sense, they aren't supposed to get any special
2222         handling in the place where this function is currently used.
2223         (KJS::UString::UTF8String): Added the strictness.
2224
2225 2007-11-03  Darin Adler  <darin@apple.com>
2226
2227         Reviewed by Maciej.
2228
2229         - http://bugs.webkit.org/show_bug.cgi?id=15812
2230           some JavaScript tests (from the Mozilla test suite) are failing
2231
2232         Two or three fixes get 7 more of the Mozilla tests passing.
2233         This gets us down from 61 failing tests to 54.
2234
2235         * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
2236         Made this inline and gave it a more specific type. Some day we should
2237         probably do that for all of these -- might even get a bit of a speed
2238         boost from it.
2239         * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
2240         inline in the header.
2241
2242         * kjs/regexp_object.h:
2243         * kjs/regexp_object.cpp:
2244         (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
2245         switch statement into the RegExpImp object, so they can be shared with
2246         RegExpImp::callAsFunction.
2247         (KJS::RegExpImp::match): Added. Common code used by both test and exec.
2248         (KJS::RegExpImp::test): Added.
2249         (KJS::RegExpImp::exec): Added.
2250         (KJS::RegExpImp::implementsCall): Added.
2251         (KJS::RegExpImp::callAsFunction): Added.
2252         (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
2253         lastInput to null rather than empty string -- we take advantage of the
2254         difference in RegExpImp::match.
2255         (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
2256         just to get at a field like this.
2257
2258         * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
2259         the JavaScript specification. If there are not 4 hex digits after the \u,
2260         then it's processed as if it wasn't an escape sequence at all.
2261
2262         * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
2263         for JavaScript (4 specific Unicode values).
2264         * pcre/pcre_exec.c:
2265         (match): Changed all call sites to use IS_NEWLINE.
2266         (pcre_exec): Ditto.
2267
2268         * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2269
2270 2007-11-03  David D. Kilzer  <ddkilzer@webkit.org>
2271
2272         Sort files(...); sections of Xcode project files.
2273
2274         Rubber-stamped by Darin.
2275
2276         * JavaScriptCore.xcodeproj/project.pbxproj:
2277
2278 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
2279
2280         Reviewed by Oliver.
2281         
2282         - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
2283
2284         * kjs/grammar.y:
2285         * kjs/nodes.cpp:
2286         (KJS::VarDeclNode::optimizeVariableAccess):
2287         (KJS::VarDeclNode::getDeclarations):
2288         (KJS::VarDeclNode::handleSlowCase):
2289         (KJS::VarDeclNode::evaluateSingle):
2290         (KJS::VarDeclNode::evaluate):
2291         (KJS::VarStatementNode::execute):
2292         * kjs/nodes.h:
2293         (KJS::VarDeclNode::):
2294         (KJS::VarStatementNode::):
2295         * kjs/nodes2string.cpp:
2296         (KJS::VarDeclNode::streamTo):
2297
2298 2007-11-03  Alexey Proskuryakov  <ap@webkit.org>
2299
2300         Reviewed by Darin.
2301
2302         http://bugs.webkit.org/show_bug.cgi?id=15800
2303         REGRESSION (r27303): RegExp leaks
2304
2305         * kjs/regexp_object.h:
2306         (KJS::RegExpImp::setRegExp):
2307         (KJS::RegExpImp::regExp):
2308         (KJS::RegExpImp::classInfo):
2309         * kjs/regexp_object.cpp:
2310         (RegExpImp::RegExpImp):
2311         (RegExpImp::~RegExpImp):
2312         Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2313
2314 2007-11-02  Maciej Stachowiak  <mjs@apple.com>
2315
2316         Reviewed by Oliver.
2317         
2318         - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
2319
2320         * kjs/grammar.y:
2321         * kjs/nodes.cpp:
2322         (KJS::statementListPushFIFO):
2323         (KJS::statementListGetDeclarations):
2324         (KJS::statementListInitializeDeclarationStacks):
2325         (KJS::statementListInitializeVariableAccessStack):
2326         (KJS::statementListExecute):
2327         (KJS::BlockNode::BlockNode):
2328         (KJS::FunctionBodyNode::FunctionBodyNode):
2329         (KJS::ProgramNode::ProgramNode):
2330         * kjs/nodes.h:
2331         (KJS::CaseClauseNode::):
2332
2333 2007-11-02  Darin Adler  <darin@apple.com>
2334
2335         Reviewed by Maciej.
2336
2337         - http://bugs.webkit.org/show_bug.cgi?id=15791
2338           change property map data structure for less memory use, better speed
2339
2340         The property map now has an array of indices and a separate array of
2341         property map entries. This slightly slows down lookup because of a second
2342         memory acess, but makes property maps smaller and faster to iterate in
2343         functions like mark().
2344
2345         SunSpider says this is 1.2% faster, although it makes the bitwise-end test
2346         more than 10% slower. To fix that we'll need to optimize global variable lookup.
2347
2348         * kjs/property_map.cpp:
2349         (KJS::PropertyMapEntry::PropertyMapEntry):
2350         (KJS::PropertyMapHashTable::entries):
2351         (KJS::PropertyMapHashTable::allocationSize):
2352         (KJS::SavedProperties::SavedProperties):
2353         (KJS::SavedProperties::~SavedProperties):
2354         (KJS::PropertyMap::checkConsistency):
2355         (KJS::PropertyMap::~PropertyMap):
2356         (KJS::PropertyMap::clear):
2357         (KJS::PropertyMap::get):
2358         (KJS::PropertyMap::getLocation):
2359         (KJS::PropertyMap::put):
2360         (KJS::PropertyMap::insert):
2361         (KJS::PropertyMap::createTable):
2362         (KJS::PropertyMap::rehash):
2363         (KJS::PropertyMap::remove):
2364         (KJS::PropertyMap::mark):
2365         (KJS::comparePropertyMapEntryIndices):
2366         (KJS::PropertyMap::containsGettersOrSetters):
2367         (KJS::PropertyMap::getEnumerablePropertyNames):
2368         (KJS::PropertyMap::save):
2369         (KJS::PropertyMap::restore):
2370         * kjs/property_map.h:
2371
2372 2007-11-02  Darin Adler  <darin@apple.com>
2373
2374         Reviewed by Maciej.
2375
2376         - http://bugs.webkit.org/show_bug.cgi?id=15807
2377           HashMap needs a take() function that combines get and remove
2378
2379         * wtf/HashMap.h: Added take function. Simplistic implementation for now,
2380         but still does only one hash table lookup.
2381
2382         * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
2383         a find followed by a remove.
2384
2385 2007-11-02  David Carson  <dacarson@gmail.com>
2386
2387         Reviewed by Darin.
2388
2389         Fix compiler warning "warning: suggest parentheses around && within ||"
2390         http://bugs.webkit.org/show_bug.cgi?id=15764
2391
2392         * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2393
2394 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2395
2396         Reviewed by Maciej Stachowiak.
2397         
2398         In preparation for making List a simple stack-allocated Vector:
2399
2400         Removed all instances of List copying and/or assignment, and made List 
2401         inherit from Noncopyable.
2402         
2403         Functions that used to return a List by copy now take List& out 
2404         parameters.
2405         
2406         Layout tests and JS tests pass.
2407
2408         * kjs/list.cpp:
2409         (KJS::List::slice): Replaced copyTail with a more generic slice 
2410         alternative. (JavaScriptCore only calls slice(1), but WebCore calls 
2411         slice(2)).
2412
2413 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2414
2415         Reviewed by Maciej Stachowiak.
2416
2417         Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
2418         REGRESSION(r27344): Crash on load at finance.yahoo.com
2419         
2420         Reverted a small portion of my last check-in. (The speedup and the List 
2421         removal are still there, though.)
2422         
2423         ActivationImp needs to hold a pointer to its function, and mark that 
2424         pointer (rather than accessing its function through its ExecState, and 
2425         counting on the active scope to mark its function) because a closure 
2426         can cause an ActivationImp to outlive its ExecState along with any 
2427         active scope.
2428
2429         * kjs/ExecState.cpp:
2430         (KJS::ExecState::ExecState):
2431         * kjs/function.cpp:
2432         (KJS::FunctionImp::~FunctionImp):
2433         (KJS::ActivationImp::ActivationImp):
2434         * kjs/function.h:
2435         (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2436
2437         Also made HashTable a little more crash-happy in debug builds, so 
2438         problems like this will show up earlier:
2439         
2440         * wtf/HashTable.h:
2441         (WTF::HashTable::~HashTable):
2442
2443 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2444
2445         Reviewed by Adam Roben.
2446         
2447         Addressed some of Darin's review comments.
2448         
2449         Used perl -p, which is the shorthand while(<>) {}.
2450         
2451         Made sure not to suppress bison's output.
2452         
2453         Added line to removed bison_out.txt, since this script removes other 
2454         intermediate files, too.
2455
2456         * DerivedSources.make:
2457
2458 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2459
2460         Reviewed by Oliver Hunt.
2461         
2462         Removed List from ActivationImp, in preparation for making all lists
2463         stack-allocated.
2464         
2465         Tests pass.
2466         
2467         1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
2468
2469         * kjs/ExecState.cpp:
2470         (KJS::ExecState::ExecState):
2471         (KJS::ExecState::~ExecState):
2472         * kjs/function.cpp:
2473         (KJS::ActivationImp::ActivationImp):
2474         (KJS::ActivationImp::createArgumentsObject):
2475         * kjs/function.h:
2476         (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2477
2478 2007-11-01  Adam Roben  <aroben@apple.com>
2479
2480         Use jsNumberCell instead of jsNumber when converting double constants to JSValues
2481
2482         This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
2483         ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
2484
2485         It also gets rid of an MSVC warning that we previously had to silence.
2486
2487         Reviewed by Geoff.
2488
2489         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
2490         back on the "overflow in constant arithmetic" warning.
2491         * kjs/number_object.cpp:
2492         (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
2493         jsNumber.
2494
2495 2007-10-31  Adam Roben  <aroben@apple.com>
2496
2497         Windows build fix
2498
2499         * kjs/ExecState.h:
2500
2501 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
2502
2503         Reviewed by Oliver.
2504         
2505         - shave some cycles off of local storage access for a 1% SunSpider speedup
2506         
2507         Keep the LocalStorage pointer in the ExecState, instead of getting
2508         it from the ActivationImp all the time.
2509
2510         * kjs/ExecState.cpp:
2511         (KJS::ExecState::updateLocalStorage):
2512         * kjs/ExecState.h:
2513         (KJS::ExecState::localStorage):
2514         * kjs/nodes.cpp:
2515         (KJS::LocalVarAccessNode::evaluate):
2516         (KJS::LocalVarFunctionCallNode::evaluate):
2517         (KJS::PostIncLocalVarNode::evaluate):
2518         (KJS::PostDecLocalVarNode::evaluate):
2519         (KJS::LocalVarTypeOfNode::evaluate):
2520         (KJS::PreIncLocalVarNode::evaluate):
2521         (KJS::PreDecLocalVarNode::evaluate):
2522         (KJS::ReadModifyLocalVarNode::evaluate):
2523         (KJS::AssignLocalVarNode::evaluate):
2524         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2525
2526 2007-10-31  Adam Roben  <aroben@apple.com>
2527
2528         Fix a crash on launch due to a static initializer race
2529
2530         We now use fast inline assembler spinlocks which can be statically
2531         initialized at compile time.
2532
2533         As a side benefit, this speeds up SunSpider by 0.4%.
2534
2535         Reviewed by Oliver.
2536
2537         * wtf/FastMalloc.cpp:
2538         * wtf/TCSpinLock.h:
2539         (TCMalloc_SpinLock::Lock):
2540         (TCMalloc_SpinLock::Unlock):
2541         (TCMalloc_SlowLock):
2542         * wtf/TCSystemAlloc.cpp:
2543
2544 2007-10-31  Kevin McCullough  <kmccullough@apple.com>
2545
2546         Reviewed by Sam.
2547
2548         - Corrected spelling.
2549
2550         * wtf/HashTraits.h:
2551
2552 2007-10-31  Mark Rowe  <mrowe@apple.com>
2553
2554         Further Gtk build fixage.
2555
2556         * kjs/regexp_object.cpp:
2557
2558 2007-10-31  Mark Rowe  <mrowe@apple.com>
2559
2560         Gtk build fix.
2561
2562         * kjs/regexp.h:
2563
2564 2007-10-31  Darin Adler  <darin@apple.com>
2565
2566         Reviewed by Maciej.
2567
2568         - fix http://bugs.webkit.org/show_bug.cgi?id=15749
2569           RegExp/RegExpObjectImp cause needless UString creation
2570
2571         Speeds things up 0.4% according to SunSpider.
2572
2573         * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
2574         because this library doesn't use the real PCRE -- it uses its
2575         own PCRE that works on UTF-16.
2576
2577         * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
2578         Use Noncopyable. Change the return value of match.
2579         * kjs/regexp.cpp:
2580         (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
2581         (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
2582         (KJS::RegExp::match): Change to return the position as an int and the
2583         ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
2584
2585         * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
2586         require a result string.
2587         * kjs/regexp_object.cpp:
2588         (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
2589         (RegExpObjectImp::performMatch): Change so it doesn't return a string.
2590         (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
2591         the main result with the backreferences; now it doesn't need to take
2592         a result parameter.
2593         (RegExpObjectImp::getBackref): Minor tweaks.
2594         (RegExpObjectImp::getLastParen): Ditto.
2595         (RegExpObjectImp::getLeftContext): Ditto.
2596         (RegExpObjectImp::getRightContext): Ditto.
2597         (RegExpObjectImp::getValueProperty): Change LastMatch case to call
2598         getBackref(0) so we don't need a separate getLastMatch function.
2599
2600         * kjs/string_object.cpp:
2601         (KJS::replace): Update to use new performMatch, including merging the
2602         matched string section with the other substrings.
2603         (KJS::StringProtoFunc::callAsFunction): Update functions to use the
2604         new performMatch and match. Also change to use OwnArrayPtr.
2605
2606 2007-10-31  Oliver Hunt  <oliver@apple.com>
2607
2608         * kjs/nodes.h: include OwnPtr.h
2609
2610 2007-10-31  Oliver Hunt  <oliver@apple.com>
2611
2612         Reviewed by Maciej.
2613
2614         Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
2615
2616         * kjs/grammar.y:
2617         * kjs/nodes.cpp:
2618         (KJS::statementListPushFIFO):
2619         (KJS::statementListGetDeclarations):
2620         (KJS::statementListInitializeDeclarationStacks):
2621         (KJS::statementListInitializeVariableAccessStack):
2622         (KJS::statementListExecute):
2623         (KJS::BlockNode::optimizeVariableAccess):
2624         (KJS::BlockNode::BlockNode):
2625         (KJS::BlockNode::getDeclarations):
2626         (KJS::BlockNode::execute):
2627         (KJS::CaseClauseNode::optimizeVariableAccess):
2628         (KJS::CaseClauseNode::getDeclarations):
2629         (KJS::CaseClauseNode::evalStatements):
2630         (KJS::FunctionBodyNode::initializeDeclarationStacks):
2631         (KJS::FunctionBodyNode::optimizeVariableAccess):
2632         * kjs/nodes.h:
2633         * kjs/nodes2string.cpp:
2634         (KJS::statementListStreamTo):
2635         (KJS::BlockNode::streamTo):
2636         (KJS::CaseClauseNode::streamTo):
2637
2638 2007-10-30  Mark Rowe  <mrowe@apple.com>
2639
2640         * kjs/property_map.cpp: Added a missing using directive to fix the build
2641         for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
2642
2643 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
2644
2645         * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
2646         for non-Mac ports.
2647
2648 2007-10-31  Alexey Proskuryakov  <ap@webkit.org>
2649
2650         Reviewed by Darin.
2651
2652         http://bugs.webkit.org/show_bug.cgi?id=11001
2653         WebKit doesn't support RegExp.compile method
2654
2655         Test: fast/js/regexp-compile.html
2656
2657         * kjs/regexp_object.cpp:
2658         (RegExpPrototype::RegExpPrototype):
2659         (RegExpProtoFunc::callAsFunction):
2660         * kjs/regexp_object.h:
2661         (KJS::RegExpProtoFunc::):
2662         Added RegExp.compile.
2663
2664         * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
2665
2666 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
2667
2668         Reviewed by Oliver.
2669         
2670         - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
2671         
2672         Integer divide sucks. Fortunately, a bunch of shifts and XORs
2673         biased towards the high bits is sufficient to provide a good
2674         double hash. Besides the SunSpider win, I used the dump statistics
2675         mode for both to verify that collisions did not increase and that
2676         the longest collision chain is not any longer.
2677
2678         * kjs/property_map.cpp:
2679         (KJS::doubleHash):
2680         (KJS::PropertyMap::get):
2681         (KJS::PropertyMap::getLocation):
2682         (KJS::PropertyMap::put):
2683         (KJS::PropertyMap::insert):
2684         (KJS::PropertyMap::remove):
2685         (KJS::PropertyMap::checkConsistency):
2686         * wtf/HashTable.h:
2687         (WTF::doubleHash):
2688         (WTF::::lookup):
2689         (WTF::::lookupForWriting):
2690         (WTF::::fullLookupForWriting):
2691         (WTF::::add):
2692
2693 2007-10-30  Adam Roben  <aroben@apple.com>
2694
2695         * kjs/collector.h: Make HeapType public so it can be used for non-member
2696         things like the HeapConstants struct template. Fixes the build on Windows.
2697
2698 2007-10-30  Adam Roben  <aroben@apple.com>
2699
2700         Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
2701
2702         Speeds up SunSpider by 0.4%.
2703
2704         Reviewed by Steve and Maciej.
2705
2706         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
2707         a warning during LTCG in release builds about double -> float
2708         conversion.
2709         * wtf/AlwaysInline.h:
2710         * wtf/FastMalloc.h:
2711
2712 2007-10-30  Adam Roben  <aroben@apple.com>
2713
2714         Use GetCurrentThreadId instead of pthread_self in FastMalloc
2715
2716         Speeds up SunSpider by 0.3%.
2717
2718         Reviewed by Steve.
2719
2720         * wtf/FastMalloc.cpp:
2721         (WTF::TCMalloc_ThreadCache::InitTSD):
2722         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2723
2724 2007-10-30  Adam Roben  <aroben@apple.com>
2725
2726         Switch to a Win32 critical section implementation of spinlocks
2727         
2728         Speeds up SunSpider by 0.4%.
2729         
2730         Reviewed by Steve.
2731         
2732         * wtf/FastMalloc.cpp:
2733         * wtf/TCSpinLock.h:
2734         (TCMalloc_SpinLock::TCMalloc_SpinLock):
2735         (TCMalloc_SpinLock::Init):
2736         (TCMalloc_SpinLock::Finalize):
2737         (TCMalloc_SpinLock::Lock):
2738         (TCMalloc_SpinLock::Unlock):
2739         * wtf/TCSystemAlloc.cpp:
2740
2741 2007-10-30  Adam Roben  <aroben@apple.com>
2742
2743         Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
2744
2745         http://bugs.webkit.org/show_bug.cgi?id=15586
2746
2747         Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
2748
2749         Use Win32 TLS functions instead of __declspec(thread), which breaks
2750         delay-loading.
2751
2752         Reviewed by Steve.
2753
2754         * wtf/FastMalloc.cpp:
2755         (WTF::getThreadHeap):
2756         (WTF::TCMalloc_ThreadCache::InitModule):
2757
2758 2007-10-30  Maciej Stachowiak  <mjs@apple.com>
2759
2760         Reviewed by Oliver.
2761         
2762         - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
2763         http://bugs.webkit.org/show_bug.cgi?id=15772
2764         
2765         We do this by using a single mark bit per two number cells, and
2766         tweaking marking.
2767         
2768         Besides being an 0.5% win overall, this is a 7.1% win on morph.
2769
2770         * kjs/collector.cpp:
2771         (KJS::):
2772         (KJS::Collector::heapAllocate):
2773         (KJS::Collector::markStackObjectsConservatively):
2774         (KJS::Collector::sweep):
2775         * kjs/collector.h:
2776         (KJS::SmallCollectorCell::):
2777
2778 2007-10-30  Geoffrey Garen  <ggaren@apple.com>
2779
2780         Reviewed by Adam Roben, Sam Weinig.
2781         
2782         Made conflicts in grammar.y a persistent build failure.
2783
2784         * DerivedSources.make:
2785
2786 2007-10-30  Kevin McCullough  <kmccullough@apple.com>
2787
2788         Reviewed by Adam and Geoff.
2789
2790         - Added a new cast so all the casts are in the same place.
2791
2792         * API/APICast.h:
2793         (toGlobalRef):
2794
2795 2007-10-30  Geoffrey Garen  <ggaren@apple.com>
2796
2797         Reviewed by Darin Adler.
2798
2799         Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
2800         
2801         JS tests, including 
2802
2803             ecma_2/Statements/dowhile-001.js
2804             ecma_2/Statements/dowhile-002.js
2805             ecma_2/Statements/dowhile-003.js
2806             ecma_2/Statements/dowhile-004.js
2807             ecma_2/Statements/dowhile-005.js
2808             ecma_2/Statements/dowhile-006.js
2809             ecma_2/Statements/dowhile-007.js
2810             js1_2/statements/do_while.js
2811
2812         and layout tests, including
2813
2814             do-while-expression-value.html
2815             do-while-semicolon.html
2816             do-while-without-semicolon.html
2817         
2818         pass.
2819         
2820         * kjs/grammar.y: Use the explicit "error" production, as we do with other
2821         automatic semicolon insertions, to disambiguate "do { } while();" from
2822         "do { } while()" followed by ";" (the empty statement).
2823
2824 2007-10-29  Oliver Hunt  <oliver@apple.com>
2825
2826         Reviewed by Maciej.
2827
2828         Debranching remaining assignment nodes, and miscellaneous cleanup
2829         
2830         Split read-modify code paths out of AssignBracketNode and AssignDotNode
2831         Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode 
2832         and ReadModifyResolveNode evaluate methods
2833
2834         Leads to a 1% gain in SunSpider.
2835
2836         * kjs/grammar.y:
2837         * kjs/nodes.cpp:
2838         (KJS::ReadModifyLocalVarNode::evaluate):
2839         (KJS::ReadModifyResolveNode::evaluate):
2840         (KJS::AssignDotNode::evaluate):
2841         (KJS::ReadModifyDotNode::optimizeVariableAccess):
2842         (KJS::ReadModifyDotNode::evaluate):
2843         (KJS::AssignBracketNode::evaluate):
2844         (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2845         (KJS::ReadModifyBracketNode::evaluate):
2846         * kjs/nodes.h:
2847         (KJS::AssignBracketNode::):
2848         (KJS::AssignBracketNode::precedence):
2849         (KJS::AssignDotNode::):
2850         (KJS::AssignDotNode::precedence):
2851         * kjs/nodes2string.cpp:
2852         (KJS::ReadModifyBracketNode::streamTo):
2853         (KJS::AssignBracketNode::streamTo):
2854         (KJS::ReadModifyDotNode::streamTo):
2855         (KJS::AssignDotNode::streamTo):
2856
2857 2007-10-29  Oliver Hunt  <oliver@apple.com>
2858
2859         Debranching various Node::evaluate implementations
2860         
2861         Reviewed by Maciej.
2862         
2863         Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
2864         Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
2865         
2866         Gains 1.6% on SunSpider
2867
2868         * JavaScriptCore.xcodeproj/project.pbxproj:
2869         * kjs/grammar.y:
2870         * kjs/nodes.cpp:
2871         (KJS::PostIncResolveNode::optimizeVariableAccess):
2872         (KJS::PostIncResolveNode::evaluate):
2873         (KJS::PostIncLocalVarNode::evaluate):
2874         (KJS::PostDecResolveNode::optimizeVariableAccess):
2875         (KJS::PostDecResolveNode::evaluate):
2876         (KJS::PostDecLocalVarNode::evaluate):
2877         (KJS::PostIncBracketNode::evaluate):
2878         (KJS::PostDecBracketNode::evaluate):
2879         (KJS::PostIncDotNode::evaluate):
2880         (KJS::PostDecDotNode::evaluate):
2881         (KJS::PreIncResolveNode::optimizeVariableAccess):
2882         (KJS::PreIncLocalVarNode::evaluate):
2883         (KJS::PreIncResolveNode::evaluate):
2884         (KJS::PreDecResolveNode::optimizeVariableAccess):
2885         (KJS::PreDecLocalVarNode::evaluate):
2886         (KJS::PreDecResolveNode::evaluate):
2887         (KJS::PreIncBracketNode::evaluate):
2888         (KJS::PreDecBracketNode::evaluate):
2889         (KJS::PreIncDotNode::evaluate):
2890         (KJS::PreDecDotNode::evaluate):
2891         (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2892         (KJS::AssignResolveNode::optimizeVariableAccess):
2893         (KJS::AssignLocalVarNode::evaluate):
2894         (KJS::AssignResolveNode::evaluate):
2895         * kjs/nodes.h:
2896         (KJS::PostDecResolveNode::):
2897         (KJS::PostDecResolveNode::precedence):
2898         (KJS::PostDecLocalVarNode::):
2899         (KJS::PostfixBracketNode::):
2900         (KJS::PostfixBracketNode::precedence):
2901         (KJS::PostIncBracketNode::):
2902         (KJS::PostIncBracketNode::isIncrement):
2903         (KJS::PostDecBracketNode::):
2904         (KJS::PostDecBracketNode::isIncrement):
2905         (KJS::PostfixDotNode::):
2906         (KJS::PostfixDotNode::precedence):
2907         (KJS::PostIncDotNode::):
2908         (KJS::PostIncDotNode::isIncrement):
2909         (KJS::PostDecDotNode::):
2910         (KJS::PreIncResolveNode::):
2911         (KJS::PreDecResolveNode::):
2912         (KJS::PreDecResolveNode::precedence):
2913         (KJS::PreDecLocalVarNode::):
2914         (KJS::PrefixBracketNode::):
2915         (KJS::PrefixBracketNode::precedence):
2916         (KJS::PreIncBracketNode::):
2917         (KJS::PreIncBracketNode::isIncrement):
2918         (KJS::PreDecBracketNode::):
2919         (KJS::PreDecBracketNode::isIncrement):
2920         (KJS::PrefixDotNode::):
2921         (KJS::PrefixDotNode::precedence):
2922         (KJS::PreIncDotNode::):
2923         (KJS::PreIncDotNode::isIncrement):
2924         (KJS::PreDecDotNode::):
2925         (KJS::ReadModifyResolveNode::):
2926         (KJS::ReadModifyLocalVarNode::):
2927         (KJS::AssignResolveNode::):
2928         (KJS::AssignResolveNode::precedence):
2929         * kjs/nodes2string.cpp:
2930         (KJS::PostIncResolveNode::streamTo):
2931         (KJS::PostDecResolveNode::streamTo):
2932         (KJS::PostfixBracketNode::streamTo):
2933         (KJS::PostfixDotNode::streamTo):
2934         (KJS::PreIncResolveNode::streamTo):
2935         (KJS::PreDecResolveNode::streamTo):
2936         (KJS::ReadModifyResolveNode::streamTo):
2937         (KJS::AssignResolveNode::streamTo):
2938
2939 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
2940
2941         Not reviewed, build fix.
2942         
2943         - Include Vector.h in a way that actually works.
2944
2945         * kjs/LocalStorage.h:
2946
2947 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
2948
2949         Not reviewed, build fix.
2950         
2951         - Install LocalStorage.h as a private header.
2952
2953         * JavaScriptCore.xcodeproj/project.pbxproj:
2954
2955 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
2956
2957         Reviewed by Darin.
2958         
2959         - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
2960
2961         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2962         * JavaScriptCore.xcodeproj/project.pbxproj:
2963         * kjs/LocalStorage.h: Added.
2964         (KJS::LocalStorageEntry::LocalStorageEntry):
2965         (WTF::):
2966         * kjs/function.h:
2967         * kjs/nodes.cpp:
2968         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2969
2970 2007-10-29  Geoffrey Garen  <ggaren@apple.com>
2971
2972         Reviewed by Oliver Hunt.
2973         
2974         Some small tweaks that I notice while reviewing Oliver's last patch.
2975         
2976         Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
2977         
2978         No change in SunSpider because SunSpider doesn't take the code path that
2979         would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
2980
2981         * kjs/nodes.cpp:
2982         (KJS::LocalVarPostfixNode::evaluate):
2983         (KJS::TypeOfResolveNode::optimizeVariableAccess):
2984         (KJS::LocalVarTypeOfNode::evaluate):
2985         (KJS::PrefixResolveNode::optimizeVariableAccess):
2986         (KJS::LocalVarPrefixNode::evaluate):
2987         (KJS::AssignResolveNode::optimizeVariableAccess):
2988         (KJS::LocalVarAssignNode::evaluate):
2989         * kjs/nodes.h:
2990         (KJS::LocalVarTypeOfNode::):
2991         (KJS::PrefixResolveNode::):
2992         (KJS::LocalVarPrefixNode::):
2993         (KJS::AssignResolveNode::):
2994         (KJS::LocalVarAssignNode::):
2995
2996 2007-10-29  Eric Seidel  <eric@webkit.org>
2997
2998         Reviewed by Maciej.
2999         
3000         SunSpider claims this was a 0.7% speedup.
3001
3002         * kjs/string_object.cpp:
3003         (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
3004
3005 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
3006
3007         Reviewed by Mark.
3008         
3009         - re-enable asserts for access to empty or deleted keys
3010
3011         * wtf/HashTable.h:
3012         (WTF::::lookup):
3013         (WTF::::lookupForWriting):
3014         (WTF::::fullLookupForWriting):
3015         (WTF::::add):
3016
3017 2007-10-29  Eric Seidel  <eric@webkit.org>
3018
3019         Build fix only, no review.
3020
3021         * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
3022
3023 2007-10-29  Mark Rowe  <mrowe@apple.com>
3024
3025         Gtk build fix.  Move struct declarations into nodes.h.
3026
3027         * kjs/grammar.y:
3028         * kjs/nodes.h:
3029
3030 2007-10-29  Eric Seidel  <eric@webkit.org>
3031
3032         Reviewed by darin.
3033         
3034         Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
3035         Make it a compile time error to use toString(ExecState) on a StringInstance
3036         
3037         SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
3038
3039         * kjs/internal.h:
3040         (KJS::StringImp::getLength):
3041         * kjs/string_object.cpp:
3042         (KJS::StringInstance::lengthGetter):
3043         (KJS::StringInstance::inlineGetOwnPropertySlot):
3044         (KJS::StringInstance::getOwnPropertySlot):
3045         * kjs/string_object.h:
3046
3047 2007-10-28  Oliver Hunt  <oliver@apple.com>
3048
3049         Reviewed by Darin.
3050
3051         Add nodes to allow Assignment, TypeOf, and prefix operators to 
3052         make use of the new optimised local variable look up.
3053
3054         5% gain on sunspider
3055
3056         * kjs/nodes.cpp:
3057         (KJS::TypeOfResolveNode::optimizeVariableAccess):
3058         (KJS::LocalTypeOfAccessNode::evaluate):
3059         (KJS::PrefixResolveNode::optimizeVariableAccess):
3060         (KJS::PrefixLocalAccessNode::evaluate):
3061         (KJS::AssignResolveNode::optimizeVariableAccess):
3062         (KJS::AssignLocalAccessNode::evaluate):
3063         * kjs/nodes.h:
3064         (KJS::TypeOfResolveNode::):
3065         (KJS::TypeOfResolveNode::precedence):
3066         (KJS::LocalTypeOfAccessNode::):
3067         (KJS::PrefixResolveNode::):
3068         (KJS::PrefixResolveNode::precedence):
3069         (KJS::PrefixLocalAccessNode::):
3070         (KJS::AssignResolveNode::):
3071         (KJS::AssignLocalAccessNode::):
3072
3073 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
3074
3075         Reviewed by Darin.
3076         
3077         - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
3078         http://bugs.webkit.org/show_bug.cgi?id=15748
3079         
3080         Not a significant speedup or slowdown on SunSpider.
3081
3082         * kjs/Parser.cpp:
3083         (KJS::clearNewNodes):
3084         * kjs/Parser.h:
3085         * kjs/grammar.y:
3086         * kjs/nodes.cpp:
3087         (KJS::BlockNode::BlockNode):
3088         (KJS::CaseBlockNode::CaseBlockNode):
3089         (KJS::FunctionBodyNode::FunctionBodyNode):
3090         (KJS::SourceElementsNode::SourceElementsNode):
3091         (KJS::ProgramNode::ProgramNode):
3092         * kjs/nodes.h:
3093         (KJS::ElementNode::):
3094         (KJS::ArrayNode::):
3095         (KJS::PropertyListNode::):
3096         (KJS::ObjectLiteralNode::):
3097         (KJS::ArgumentListNode::):
3098         (KJS::ArgumentsNode::):
3099         (KJS::VarDeclListNode::):
3100         (KJS::VarStatementNode::):
3101         (KJS::ForNode::):
3102         (KJS::ParameterNode::):
3103         (KJS::FuncExprNode::):
3104         (KJS::FuncDeclNode::):
3105         (KJS::SourceElementsNode::):
3106         (KJS::CaseClauseNode::):
3107         (KJS::ClauseListNode::):
3108
3109 2007-10-28  Mark Rowe  <mrowe@apple.com>
3110
3111         Disable assertions in a manner that doesn't break the Qt Windows build.
3112
3113         * wtf/HashTable.h:
3114         (WTF::::lookup):
3115         (WTF::::lookupForWriting):
3116         (WTF::::fullLookupForWriting):
3117
3118 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
3119
3120         Temporarily disabling some ASSERTs I introduced in my last check-in 
3121         because of http://bugs.webkit.org/show_bug.cgi?id=15747
3122         Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
3123
3124         * wtf/HashTable.h:
3125         (WTF::::lookup):
3126         (WTF::::lookupForWriting):
3127         (WTF::::fullLookupForWriting):
3128         (WTF::::add):
3129
3130 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
3131
3132         Reviewed by Darin Adler.
3133         
3134         Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
3135         #ifndef ASSERT_DISABLED is no good!
3136         
3137         Replaced with #if !ASSERT_DISABLED.
3138
3139         * wtf/HashTable.h:
3140         (WTF::::lookup):
3141         (WTF::::lookupForWriting):
3142         (WTF::::fullLookupForWriting):
3143         (WTF::::add):
3144
3145 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
3146
3147         Reviewed by Darin Adler.
3148         
3149         Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
3150         to the AST transfom that replaces slow resolve nodes with fast local 
3151         variable alternatives.
3152         
3153         2.5% speedup on SunSpider.
3154         
3155         Also added some missing copyright notices.
3156         
3157         * kjs/nodes.cpp:
3158         (KJS::FunctionCallResolveNode::optimizeVariableAccess):
3159         (KJS::FunctionCallResolveNode::evaluate):
3160         (KJS::LocalVarFunctionCallNode::evaluate):
3161         (KJS::PostfixResolveNode::optimizeVariableAccess):
3162         (KJS::PostfixResolveNode::evaluate):
3163         (KJS::LocalVarPostfixNode::evaluate):
3164         (KJS::DeleteResolveNode::optimizeVariableAccess):
3165         (KJS::DeleteResolveNode::evaluate):
3166         (KJS::LocalVarDeleteNode::evaluate):
3167         * kjs/nodes.h:
3168         (KJS::FunctionCallResolveNode::):
3169         (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
3170         (KJS::PostfixResolveNode::):
3171         (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
3172         (KJS::DeleteResolveNode::):
3173         (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
3174
3175 2007-10-28  Eric Seidel  <eric@webkit.org>
3176
3177         Reviewed by darin.
3178         
3179         Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
3180         Add virtual keyword to a few virtual functions previously unmarked.
3181
3182         * kjs/internal.h:
3183         (KJS::StringImp::type):
3184         (KJS::NumberImp::type):
3185         * kjs/ustring.h:
3186         (KJS::UString::Rep::deref):
3187
3188 2007-10-28  Darin Adler  <darin@apple.com>
3189
3190         - fix "broken everything" from the storage leak fix
3191
3192         * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
3193         * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
3194
3195 2007-10-28  Darin Adler  <darin@apple.com>
3196
3197         Reviewed by Adam.
3198
3199         - turn on unused parameter waring on Mac OS X because it's already on elsewhere
3200
3201         * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
3202
3203         * API/JSNode.c:
3204         * API/JSNodeList.c:
3205         * API/minidom.c:
3206         * API/testapi.c:
3207         Fixed unused variables by using them or marked them with UNUSED_PARAM.
3208
3209         * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
3210         Removed parameter names to indicate they are unused.
3211
3212 2007-10-28  Darin Adler  <darin@apple.com>
3213
3214         Reviewed by Maciej.
3215
3216         - fix a storage leak where we ref the UString every time we replace
3217           a ResolveNode with a LocalVarAccessNode
3218
3219         * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
3220         that takes PlacementNewAdopt.
3221
3222         * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
3223         with PlacementNewAdopt instead of the old value of ident.
3224
3225         * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
3226         takes PlacementNewAdopt.
3227
3228 2007-10-28  Darin Adler  <darin@apple.com>
3229
3230         - Windows build fix; get rid of unused parameter
3231
3232         * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
3233         * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
3234         The assertions weren't all that helpful.
3235
3236 2007-10-28  Mark Rowe  <mrowe@apple.com>
3237
3238         Gtk build fix.  Add include of MathExtras.h.
3239
3240         * kjs/string_object.cpp:
3241
3242 2007-10-28  Mark Rowe  <mrowe@apple.com>
3243
3244         Reviewed by Maciej and Tim.
3245
3246         Replace uses of isNaN and isInf with isnan and isinf, and
3247         remove isNaN and isInf.
3248
3249         * kjs/config.h: Remove unused HAVE_'s.
3250         * kjs/date_object.cpp:
3251         (KJS::DateInstance::getTime):
3252         (KJS::DateInstance::getUTCTime):
3253         (KJS::DateProtoFunc::callAsFunction):
3254         (KJS::DateObjectImp::construct):
3255         (KJS::DateObjectFuncImp::callAsFunction):
3256         * kjs/function.cpp:
3257         (KJS::GlobalFuncImp::callAsFunction):
3258         * kjs/math_object.cpp:
3259         (MathFuncImp::callAsFunction):
3260         * kjs/nodes2string.cpp:
3261         (KJS::isParserRoundTripNumber):
3262         * kjs/number_object.cpp:
3263         (NumberProtoFunc::callAsFunction):
3264         * kjs/operations.cpp:
3265         * kjs/operations.h:
3266         * kjs/string_object.cpp:
3267         (KJS::StringProtoFunc::callAsFunction):
3268         * kjs/ustring.cpp:
3269         (KJS::UString::from):
3270         * kjs/value.cpp:
3271         (KJS::JSValue::toInteger):
3272         (KJS::JSValue::toInt32SlowCase):
3273         (KJS::JSValue::toUInt32SlowCase):
3274
3275 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
3276
3277         Build fix: use the new-fangled missingSymbolMarker().
3278
3279         * kjs/nodes.cpp:
3280         (KJS::ResolveNode::optimizeVariableAccess):
3281         * kjs/nodes.h:
3282         (KJS::LocalVarAccessNode::LocalVarAccessNode):
3283
3284 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
3285
3286         Reviewed by Maciej Stachowiak, Darin Adler.
3287         
3288         Much supporting work done by Maciej Stachowiak, Maks Orlovich, and 
3289         Cameron Zwarich.
3290         
3291         AST transfom to replace slow resolve nodes with fast local variable
3292         alternatives that do direct memory access. Currently, only ResolveNode
3293         provides a fast local variable alternative. 6 others are soon to come.
3294         
3295         16.7% speedup on SunSpider.
3296         
3297         Most of this patch is just scaffolding to support iterating all the 
3298         resolve nodes in the AST through optimizeResolveNodes(). In 
3299         optimizeResolveNodes(), most classes just push their child nodes onto 
3300         the processing stack, while ResolveNodes actually replace themselves in 
3301         the tree with more optimized alternatives, if possible.
3302
3303         Here are the interesting bits:
3304
3305         * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations 
3306         in Node and ResolveNode. This tag allows you to use placement new to 
3307         swap out a base class Node in favor of a subclass copy that holds the
3308         same data. (Without this tag, default initialization would NULL out
3309         RefPtrs, change line numbers, etc.)
3310
3311         * kjs/nodes.cpp:
3312         (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
3313         that the fast path is impossible, to make sure we didn't leave anything
3314         on the table.
3315
3316         (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST 
3317         transformation happens.
3318         
3319         (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
3320         optimization happens.
3321
3322         * kjs/function.h: Added symbolTable() accessor for, for the sake of 
3323         an ASSERT.
3324
3325 2007-10-28  Mark Rowe  <mrowe@apple.com>
3326
3327         Reviewed by Maciej.
3328
3329         Fix "AllInOneFile.o has a global initializer in it".
3330
3331         Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
3332         We can avoid this by moving it inside an inline function.
3333
3334         * kjs/SymbolTable.h:
3335         (KJS::missingSymbolMarker):
3336         * kjs/function.cpp:
3337         (KJS::ActivationImp::getOwnPropertySlot):
3338         (KJS::ActivationImp::put):
3339
3340 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
3341
3342         Reviewed by Mark.
3343         
3344         - Added assertions to protect against adding empty or deleted keys to a HashTable
3345
3346         * wtf/HashTable.h:
3347         (WTF::HashTable::lookup):
3348         (WTF::HashTable::lookupForWriting):
3349         (WTF::HashTable::fullLookupForWriting):
3350         (WTF::HashTable::add):
3351
3352 2007-10-28  Darin Adler  <darin@apple.com>
3353
3354         - fix GTK build
3355
3356         * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
3357         Use isNaN and isInf instead of isnan and isinf.
3358
3359 2007-10-28  Darin Adler  <darin@apple.com>
3360
3361         Reviewed by Maciej.
3362
3363         - http://bugs.webkit.org/show_bug.cgi?id=15735
3364           remove GroupNode to simplify AST and possibly get a modest speedup
3365
3366         This patch removes 4 node types: GroupNode, PropertyNameNode,
3367         FunctionCallParenBracketNode, and FunctionCallParenDotNode.
3368
3369         To remove GroupNode, we add knowledge of precedence to the tree nodes,
3370         and use that when serializing to determine where parentheses are needed.
3371         This means we no longer have to represent parentheses in the tree.
3372
3373         The precedence values are named after productions in the grammar from the
3374         JavaScript standard.
3375
3376         SunSpider says this is an 0.4% speedup.
3377
3378         * kjs/function.h:
3379         * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
3380         serialization, so I moved it to the file that takes care of that.
3381
3382         * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
3383         indicate failure instead of a separate boolean. Got rid of PropertyNameNode
3384         by merging the PropertyName rule into the Property rule (which was easier
3385         than figuring out how to pass the Identifier from one node to another).
3386         Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
3387         and FunctionCallParenDotNode.
3388
3389         * kjs/nodes.h: Removed unused forward declarations and Operator values.
3390         Added Precedence enum, and precedence function to all nodes. Removed
3391         nodeInsideAllParens. Added streamBinaryOperator function for serialization.
3392         Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
3393         Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
3394
3395         * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
3396         (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
3397         of converting it from an Identifier to a jsString then back to a UString
3398         then into an Identifier again!
3399
3400         * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
3401         function for each of Endl, Indent, Unindent, and DotExpr instead of using a
3402         single function with a switch. Added a precedence that you can stream in, to
3403         cause the next node serialized to add parentheses based on that precedence value.
3404         (KJS::operatorString): Moved to the top of the file.
3405         (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
3406         workaround for snprintf, since StringExtras.h takes care of that.
3407         (KJS::operator<<): Made the char and char* versions faster by using UString's
3408         character append functions instead of constructing a UString. Added the logic
3409         to the Node* version to add parentheses if needed.
3410         (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
3411         (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
3412         (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
3413         the bracket.
3414         (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
3415         (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
3416         (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
3417         (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
3418         (KJS::FunctionCallBracketNode::streamTo): Ditto.
3419         (KJS::FunctionCallDotNode::streamTo): Ditto.
3420         (KJS::PostfixBracketNode::streamTo): Ditto.
3421         (KJS::PostfixDotNode::streamTo): Ditto.
3422         (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
3423         (KJS::DeleteBracketNode::streamTo): Use PrecCall.
3424         (KJS::DeleteDotNode::streamTo): Ditto.
3425         (KJS::DeleteValueNode::streamTo): Use PrecUnary.
3426         (KJS::VoidNode::streamTo): Ditto.
3427         (KJS::TypeOfValueNode::streamTo): Ditto.
3428         (KJS::PrefixBracketNode::streamTo): Use PrecCall.
3429         (KJS::PrefixDotNode::streamTo): Ditto.
3430         (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
3431         (KJS::UnaryPlusNode::streamTo): Ditto.
3432         (KJS::NegateNode::streamTo): Ditto.
3433         (KJS::BitwiseNotNode::streamTo): Ditto.
3434         (KJS::LogicalNotNode::streamTo): Ditto.
3435         (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
3436         (KJS::DivNode::streamTo): Ditto.
3437         (KJS::ModNode::streamTo): Ditto.
3438         (KJS::AddNode::streamTo): Ditto.
3439         (KJS::SubNode::streamTo): Ditto.
3440         (KJS::LeftShiftNode::streamTo): Ditto.
3441         (KJS::RightShiftNode::streamTo): Ditto.
3442         (KJS::UnsignedRightShiftNode::streamTo): Ditto.
3443         (KJS::LessNode::streamTo): Ditto.
3444         (KJS::GreaterNode::streamTo): Ditto.
3445         (KJS::LessEqNode::streamTo): Ditto.
3446         (KJS::GreaterEqNode::streamTo): Ditto.
3447         (KJS::InstanceOfNode::streamTo): Ditto.
3448         (KJS::InNode::streamTo): Ditto.
3449         (KJS::EqualNode::streamTo): Ditto.
3450         (KJS::NotEqualNode::streamTo): Ditto.
3451         (KJS::StrictEqualNode::streamTo): Ditto.
3452         (KJS::NotStrictEqualNode::streamTo): Ditto.
3453         (KJS::BitAndNode::streamTo): Ditto.
3454         (KJS::BitXOrNode::streamTo): Ditto.
3455         (KJS::BitOrNode::streamTo): Ditto.
3456         (KJS::LogicalAndNode::streamTo): Ditto.
3457         (KJS::LogicalOrNode::streamTo): Ditto.
3458         (KJS::ConditionalNode::streamTo): Ditto.
3459         (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
3460         (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
3461         the bracket and PrecAssignment for the right side.
3462         (KJS::AssignDotNode::streamTo): Ditto.
3463         (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
3464         and PrecAssignment for the right side.
3465         (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
3466         (KJS::AssignExprNode::streamTo): Use PrecAssignment.
3467
3468 2007-10-28  Kevin Ollivier  <kevino@theolliviers.com>
3469
3470         Define wx port and set wx port USE options.
3471
3472         Reviewed by Adam Roben.
3473
3474         * wtf/Platform.h:
3475
3476 2007-10-28  Mark Rowe  <mrowe@apple.com>
3477
3478         We don't include "config.h" in headers.
3479
3480         * bindings/jni/jni_instance.h:
3481         * kjs/regexp.h:
3482         * wtf/TCPageMap.h:
3483         * wtf/TCSpinLock.h:
3484
3485 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
3486
3487         Rubber stamped by Mark.
3488         
3489         - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
3490
3491         * kjs/SymbolTable.h:
3492         (KJS::SymbolTableIndexHashTraits::emptyValue):
3493         * kjs/function.cpp:
3494         (KJS::ActivationImp::getOwnPropertySlot):
3495         (KJS::ActivationImp::put):
3496
3497 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
3498
3499         Reviewed by Eric.
3500         
3501         - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
3502
3503         * kjs/SymbolTable.h:
3504         (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
3505         (KJS::IdentifierRepHash::equal): ditto
3506         (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
3507         (KJS::SymbolTable): change to a typedef for a HashMap.
3508         * kjs/function.cpp:
3509         (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
3510         (KJS::ActivationImp::deleteProperty): ditto
3511         (KJS::ActivationImp::put): ditto
3512
3513         * kjs/nodes.cpp:
3514         (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
3515         you now have to store a UString::rep, not an identifier.
3516
3517 2007-10-27  Maciej Stachowiak  <mjs@apple.com>
3518
3519         Reviewed by Oliver.
3520         
3521         - numerous HashTable performance improvements
3522         
3523         This does not quite add up to a measurable win on SunSpider, but it allows a
3524         follow-on > 3% improvement and probably helps WebCore too.
3525         
3526         I made the following improvements, among others:
3527         
3528         - Made HashFunctions note whether it is ok to compare a real value with the equal() function
3529         to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
3530