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