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