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