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