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