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