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