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