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