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