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