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