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