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