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