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