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