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