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