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