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