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