2007-10-27 Mark Rowe <mrowe@apple.com>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2007-10-27  Mark Rowe  <mrowe@apple.com>
2
3         Gtk build fix.
4
5         * kjs/function.h:
6
7 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
8
9        Rubber stamp by Adam. 
10
11         - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
12         files contain are functions that operate on BSTRs.
13
14         * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
15         * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
16         * API/JSStringRefCOM.cpp: Removed.
17         * API/JSStringRefCOM.h: Removed.
18         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19
20 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
21
22         Reviewed by Adam.
23
24         - Made JSStringCreateWithBSTR capable of handling null BSTRs.
25
26         * API/JSStringRefCOM.cpp:
27         (JSStringCreateWithBSTR):
28
29 2007-10-26  Sam Weinig  <sam@webkit.org>
30
31         Windows build fix.
32
33         * kjs/SymbolTable.h: Add header gaurd.
34         * kjs/nodes.h: #include "SymbolTable.h"
35
36 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
37
38         Suggested by Anders Carlsson.
39         
40         Fixed tyop.
41
42         * kjs/function.cpp:
43         (KJS::ActivationImp::getOwnPropertySlot):
44
45 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
46
47         Suggested by Darin Adler.
48         
49         Use computedHash(), which is safer than just directly accessing _hash.
50
51         * kjs/lookup.cpp:
52         (KJS::Lookup::findEntry):
53         (KJS::Lookup::find):
54
55 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
56
57         Build fix: svn add SymbolTable.h
58
59         * kjs/SymbolTable.h: Added.
60         (KJS::SymbolTable::set):
61         (KJS::SymbolTable::get):
62
63 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
64
65         Build fix: export SymbolTable.h to WebCore.
66
67         * JavaScriptCore.xcodeproj/project.pbxproj:
68
69 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
70
71         Comment tweak suggested by Maciej.
72
73         * kjs/function.cpp:
74         (KJS::ActivationImp::getOwnPropertySlot):
75
76 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
77
78         Reviewed by Maciej Stachowiak.
79         
80         Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
81
82         * kjs/property_map.cpp: Use a special no branch accessor to the UString's
83         hash value. Also, return immediately instead of branching to the end
84         of the loop if the value is not found.
85         (KJS::PropertyMap::get):
86         (KJS::PropertyMap::getLocation):
87         (KJS::PropertyMap::put):
88         (KJS::PropertyMap::insert):
89         (KJS::PropertyMap::remove):
90         (KJS::PropertyMap::checkConsistency):
91
92         * kjs/ustring.h:
93         (KJS::UString::Rep::computedHash): Special no branch accessor to the
94         UString's hash value. Used when the caller knows that the hash value
95         has already been computed. (For example, if the caller got the UString
96         from an Identifier.)
97
98 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
99
100         Reviewed by Maciej Stachowiak.
101         
102         Switched ActivationImp to using a symbol table. For now, though, all
103         clients take the slow path.
104         
105         Net .6% speedup on SunSpider.
106         
107         Slowdowns:
108             - ActivationImp now mallocs in its constructor
109             - Local variable hits use an extra level of indirection to retrieve 
110             data
111             - Local variable misses do two lookups
112
113         Speedups:
114             - Fast initialization of local variables upon function entry
115
116         * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
117         
118         * kjs/function.cpp:
119         (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
120         data that won't fit in a JSCell.
121         (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for 
122         lookup.
123         (KJS::ActivationImp::getOwnPropertySlot): ditto
124         (KJS::ActivationImp::deleteProperty): ditto
125         (KJS::ActivationImp::put): ditto
126         (KJS::ActivationImp::createArgumentsObject): ditto
127
128         (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
129         our properties doesn't try to recursively mark us. (This caused a crash
130         in earlier testing. Not sure why we haven't run into it before.)
131
132         * kjs/nodes.cpp: Functions now build a symbol table the first time 
133         they're called.
134         (KJS::VarDeclNode::evaluate):
135         (KJS::FunctionBodyNode::FunctionBodyNode):
136         (KJS::FunctionBodyNode::initializeSymbolTable):
137         (KJS::FunctionBodyNode::processDeclarations):
138         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
139         (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
140
141         * kjs/nodes.h:
142         (KJS::FunctionBodyNode::symbolTable):
143
144         * wtf/Forward.h: Added Vector.
145
146 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
147
148         - Corrected function name mistake in this changelog.
149
150 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
151         Reviewed by Sam and Steve.
152
153         - Added convenience methods for converting between BSTR and JSStringRefs
154
155         * API/JSStringRefCOM.cpp: Added.
156         (JSStringCreateWithBSTR):
157         (JSStringCopyBSTR):
158         * API/JSStringRefCOM.h: Added.
159         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
160
161 2007-10-26  Mark Rowe  <mrowe@apple.com>
162
163         Windows build fix.
164
165         * kjs/collector.cpp:
166         (KJS::Collector::collect):
167
168 2007-10-26  Oliver Hunt  <oliver@apple.com>
169
170         Reviewed by Maciej.
171
172         Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
173
174         * kjs/CollectorHeapIntrospector.cpp:
175         (KJS::CollectorHeapIntrospector::init):
176         (KJS::CollectorHeapIntrospector::enumerate):
177         * kjs/CollectorHeapIntrospector.h:
178         * kjs/collector.cpp:
179         (KJS::Collector::recordExtraCost):
180         (KJS::Collector::heapAllocate):
181         (KJS::Collector::allocate):
182         (KJS::Collector::allocateNumber):
183         (KJS::Collector::registerThread):
184         (KJS::Collector::markStackObjectsConservatively):
185         (KJS::Collector::markMainThreadOnlyObjects):
186         (KJS::Collector::sweep):
187         (KJS::Collector::collect):
188         * kjs/collector.h:
189         * kjs/internal.h:
190         (KJS::NumberImp::operator new):
191           Force numbers to be allocated in the secondary heap.
192
193 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
194
195         Reviewed by Oliver.
196         
197         - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
198
199         * kjs/value.h:
200         (KJS::JSValue::getUInt32):
201         (KJS::JSValue::getTruncatedInt32):
202         (KJS::JSValue::toNumber):
203         * wtf/PassRefPtr.h:
204         (WTF::PassRefPtr::~PassRefPtr):
205         * wtf/RefPtr.h:
206         (WTF::RefPtr::operator->):
207
208 2007-10-26  Mark Rowe  <mrowe@apple.com>
209
210         Gtk build fix.
211
212         * kjs/ExecState.h:
213
214 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
215
216         Reviewed by Mark.
217
218         - Merge Context class fully into ExecState, since they are always created and used together.
219
220         No measurable performance impact but this is a useful cleanup.
221
222         * JavaScriptCore.pri:
223         * kjs/ExecState.cpp:
224         (KJS::ExecState::ExecState):
225         (KJS::ExecState::~ExecState):
226         (KJS::ExecState::mark):
227         (KJS::ExecState::lexicalInterpreter):
228         * kjs/ExecState.h:
229         (KJS::ExecState::dynamicInterpreter):
230         (KJS::ExecState::setException):
231         (KJS::ExecState::clearException):
232         (KJS::ExecState::exception):
233         (KJS::ExecState::exceptionSlot):
234         (KJS::ExecState::hadException):
235         (KJS::ExecState::scopeChain):
236         (KJS::ExecState::callingExecState):
237         (KJS::ExecState::propertyNames):
238         * kjs/collector.cpp:
239         (KJS::Collector::reportOutOfMemoryToAllInterpreters):
240         * kjs/function.cpp:
241         (KJS::FunctionImp::callAsFunction):
242         (KJS::FunctionImp::argumentsGetter):
243         (KJS::FunctionImp::callerGetter):
244         (KJS::GlobalFuncImp::callAsFunction):
245         * kjs/interpreter.cpp:
246         (KJS::Interpreter::Interpreter):
247         (KJS::Interpreter::init):
248         (KJS::Interpreter::evaluate):
249         (KJS::Interpreter::mark):
250         * kjs/interpreter.h:
251         (KJS::Interpreter::setCurrentExec):
252         (KJS::Interpreter::currentExec):
253         * kjs/nodes.cpp:
254         (KJS::currentSourceId):
255         (KJS::currentSourceURL):
256         (KJS::ThisNode::evaluate):
257         (KJS::ResolveNode::evaluate):
258         (KJS::FunctionCallResolveNode::evaluate):
259         (KJS::PostfixResolveNode::evaluate):
260         (KJS::DeleteResolveNode::evaluate):
261         (KJS::TypeOfResolveNode::evaluate):
262         (KJS::PrefixResolveNode::evaluate):
263         (KJS::AssignResolveNode::evaluate):
264         (KJS::VarDeclNode::evaluate):
265         (KJS::DoWhileNode::execute):
266         (KJS::WhileNode::execute):
267         (KJS::ForNode::execute):
268         (KJS::ForInNode::execute):
269         (KJS::ContinueNode::execute):
270         (KJS::BreakNode::execute):
271         (KJS::ReturnNode::execute):
272         (KJS::WithNode::execute):
273         (KJS::SwitchNode::execute):
274         (KJS::LabelNode::execute):
275         (KJS::TryNode::execute):
276         (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
277         (KJS::FunctionBodyNode::processDeclarationsProgramCode):
278         (KJS::FunctionBodyNode::processDeclarations):
279         (KJS::FuncDeclNode::makeFunction):
280         (KJS::FuncExprNode::evaluate):
281
282 2007-10-26  Mark Rowe  <mrowe@apple.com>
283
284         Windows build fix.
285
286         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
287
288 2007-10-26  Mark Rowe  <mrowe@apple.com>
289
290         Gtk build fix.
291
292         * JavaScriptCore.pri:
293         * kjs/ExecState.cpp:
294
295 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
296
297         Reviewed by Oliver.
298         
299         - moved Context class into ExecState.{h,cpp} in preparation for merging 
300         ExecState and Context classes.
301
302         * kjs/ExecState.h: Moved CodeType enum and Context class here in
303         preparation for merging ExecState and Context.
304         * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
305         (KJS::Context::Context):
306         (KJS::Context::~Context):
307         (KJS::Context::mark):
308         * kjs/context.h: Removed.
309         * kjs/Context.cpp: Removed.
310         * kjs/function.h: Removed CodeType enum.
311         * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
312         * kjs/internal.h: Removed LabelStack.
313         * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
314         * kjs/collector.cpp: Fixed includes.
315         * kjs/function.cpp: ditto
316         * kjs/internal.cpp: ditto
317         * kjs/interpreter.cpp: ditto
318         * kjs/lookup.h: ditto
319         * kjs/nodes.cpp: ditto
320
321 2007-10-26  Mark Rowe  <mrowe@apple.com>
322
323         Windows build fix.
324
325         * kjs/string_object.cpp:
326         (KJS::StringObjectFuncImp::callAsFunction):
327
328 2007-10-25  Darin Adler  <darin@apple.com>
329
330         Reviewed by Maciej.
331
332         - http://bugs.webkit.org/show_bug.cgi?id=15703
333           fix numeric functions -- improve correctness and speed
334
335         Gives about 1% gain on SunSpider.
336
337         * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
338         (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
339         with both immediate and number values.
340         (KJS::JSValue::toUInt32): Ditto.
341         * kjs/value.cpp:
342         (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
343         differences. One is that it now correctly returns 0 for NaN, and another is that
344         there's no special case for 0 or infinity, since the general case already handles
345         those correctly.
346         (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
347         check for NaN.
348         (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
349         truncation done by the typecast already does the necessary truncation that
350         roundValue was doing.
351         (KJS::JSValue::toUInt32SlowCase): Ditto.
352         (KJS::JSValue::toUInt16): Removed.
353
354         * kjs/internal.h: Removed roundValue.
355         * kjs/internal.cpp: Ditto.
356
357         * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
358         code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
359
360         * kjs/date_object.cpp:
361         (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
362         toNumber as specified.
363         (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
364         with a call to toNumber and timeClip as specified.
365         (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
366         where the default behavior of toInt32 (returning 0) was already correct. Replaced
367         call to roundValue with a call to toNumber as specified.
368         (KJS::DateObjectFuncImp::callAsFunction): Ditto.
369
370         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
371         cases for the pow function that the library already handles correctly.
372
373         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
374         call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
375         The real toInteger now returns 0 for NaN. Took out unneeded special case in
376         ToFixed for undefined; was only needed because our toInteger was wrong. Same
377         thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
378
379         * kjs/string_object.cpp:
380         (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
381         cases for undefined that were only needed because toInteger was wrong. Same in
382         IndexOf, and was able to remove some special cases. In LastIndexOf, used
383         toIntegerPreserveNaN, but was able to remove some special cases there too.
384         Changed Substr implementation to preserve correct behavior with the change
385         to toInteger and match the specification. Also made sure we weren't converting
386         an out of range double to an int.
387         (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
388         toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
389         no reason to have toUInt16 as a second, less-optimized function that's only
390         called at this one call site.
391
392         * wtf/MathExtras.h: Added trunc function for Windows.
393
394 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
395
396         Reviewed by Maciej Stachowiak.
397         
398         Tweaked the inner hashtable lookup loop to remove a branch in the "not 
399         found" case. .5% speedup on SunSpider.
400
401         * JavaScriptCore.xcodeproj/project.pbxproj:
402         * wtf/HashTable.h:
403         (WTF::::lookup):
404
405 2007-10-25  Maciej Stachowiak  <mjs@apple.com>
406
407         Reviewed by Oliver.
408
409         - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
410
411         * kjs/nodes.cpp:
412         (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
413         adding any value over toNumber() here.
414         (KJS::valueForReadModifyAssignment): Ditto.
415         (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
416         and branches.
417         (KJS::lessThanEq): Ditto.
418         * JavaScriptCore.exp: Export new functions as needed.
419         * kjs/value.h:
420         (KJS::JSValue::toPrimitive): Fixed formatting.
421         (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
422         to number and tells you whether a toPrimitive() conversion with a Number hint
423         would have given a string.
424         * kjs/internal.cpp:
425         (KJS::StringImp::getPrimitiveNumber): Implemented. 
426         (KJS::NumberImp::getPrimitiveNumber): ditto
427         (KJS::GetterSetterImp::getPrimitiveNumber): ditto
428         (KJS::StringImp::toPrimitive): Fixed formatting.
429         (KJS::NumberImp::toPrimitive): ditto
430         (KJS::GetterSetterImp::toPrimitive): ditto
431         * kjs/internal.h:
432         * kjs/object.cpp:
433         (KJS::JSObject::getPrimitiveNumber): Implemented.
434         * kjs/object.h:
435
436 2007-10-25  Sam Weinig  <sam@webkit.org>
437
438         Reviewed by Adam Roben.
439
440         Remove JSStringRefCFHack from windows as it is no longer needed.
441
442         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
443
444 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
445
446         Reviewed by Oliver Hunt.
447         
448         Rolled out my last patch. It turns out that I needed 2 words, not 1,
449         so it didn't help.
450
451 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
452
453         Reviewed by Oliver Hunt.
454         
455         Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
456         Shrink the size of an activation object by 1 word
457         
458         This is in preparation for adding a symbol table to the activation 
459         object.
460         
461         The basic strategy here is to rely on the mutual exclusion between
462         the arguments object pointer and the function pointer (you only need
463         the latter in order to create the former), and store them in the same 
464         place. The LazyArgumentsObject class encapsulates this strategy.
465         
466         Also inlined the ArgumentsImp constructor, for good measure.
467         
468         SunSpider reports no regression. Regression tests pass.
469
470         * JavaScriptCore.xcodeproj/project.pbxproj:
471         * kjs/Context.cpp:
472         (KJS::Context::~Context):
473         * kjs/function.cpp:
474         (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
475         (KJS::ActivationImp::LazyArgumentsObject::mark):
476         (KJS::):
477         (KJS::ActivationImp::argumentsGetter):
478         (KJS::ActivationImp::mark):
479         * kjs/function.h:
480         (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
481         (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
482         (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
483         (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
484         (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
485         (KJS::ActivationImp::LazyArgumentsObject::setFunction):
486         (KJS::ActivationImp::LazyArgumentsObject::function):
487         (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
488         (KJS::ActivationImp::LazyArgumentsObject::):
489         (KJS::ActivationImp::ActivationImp::ActivationImp):
490         (KJS::ActivationImp::resetArguments):
491
492 2007-10-25  Adam Roben  <aroben@apple.com>
493
494         Change JavaScriptCore.vcproj to use DerivedSources.make
495
496         We were trying to emulate the logic of make in
497         build-generated-files.sh, but we got it wrong. We now use a
498         build-generated-files very much like the one that WebCore uses to
499         invoke make.
500
501         We also now only have a Debug configuration of dftables which we build
502         even when doing a Release build of JavaScriptCore. dftables also no
503         longer has the "_debug" name suffix.
504
505         Changes mostly made by Darin, reviewed by me.
506
507         * DerivedSources.make: Add a variable to set the extension used for
508         the dftables executable.
509         * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
510         dftables in Release configurations.
511         * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
512         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
513            - Updated include path to point to the new location of the derived
514              sources.
515            - Modified pre-build event to pass the right arguments to
516              build-generated-files.sh and not call dftables directly.
517            - Added the derived source files to the project.
518            - Removed grammarWrapper.cpp, which isn't needed now that we're
519              compiling grammar.cpp directly.
520         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
521         Slightly modified from the WebCore version.
522         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
523         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
524             - Changed the output location to match Mac.
525             - Removed the Release configuration.
526             - Removed the _debug suffix.
527
528 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
529
530         Reviewed by Eric Seidel.
531         
532         Slightly elaborated the differences between declaration procesing in 
533         Function Code and Program Code.
534         
535         .3% speedup on SunSpider.
536
537         * kjs/nodes.cpp:
538         (KJS::FunctionBodyNode::processDeclarationsFunctionCode): 
539         (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a 
540         minimum set of attributes instead of recomputing all the time. Also,
541         ignore m_parameters, since programs don't have arguments.
542
543 2007-10-25  Eric Seidel  <eric@webkit.org>
544
545         Reviewed by Maciej.
546         
547         More preparation work before adding long-running mode to testkjs.
548
549         * kjs/testkjs.cpp:
550         (TestFunctionImp::callAsFunction):
551         (prettyPrintScript):
552         (runWithScripts):
553         (parseArguments):
554         (kjsmain):
555         (fillBufferWithContentsOfFile):
556
557 2007-10-25  Eric Seidel  <eric@webkit.org>
558
559         Reviewed by Maciej.
560         
561         Bring testkjs code out of the dark ages in preparation for more
562         radical improvements (like long-running testing support!)
563
564         * kjs/testkjs.cpp:
565         (TestFunctionImp::callAsFunction):
566         (setupInterpreter):
567         (doIt):
568         (fillBufferWithContentsOfFile):
569
570 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
571
572         Reviewed by Maciej Stachowiak.
573         
574         Make a fast path for declaration processing inside Function Code.
575         
576         Lifted declaration processing code up from individual declaration nodes
577         and into processDeclarations.
578         
579         Broke out processDeclarations into two cases, depending on the type of 
580         code. This eliminates 2 branches, and facilitates more radical 
581         divergeance in the future.
582         
583         2.5% SunSpider speedup.
584
585         * JavaScriptCore.xcodeproj/project.pbxproj:
586         * kjs/nodes.cpp:
587         (KJS::FunctionBodyNode::initializeDeclarationStacks):
588         (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
589         (KJS::FunctionBodyNode::processDeclarationsProgramCode):
590         (KJS::FunctionBodyNode::execute):
591         (KJS::FuncDeclNode::makeFunction):
592         * kjs/nodes.h:
593         (KJS::):
594
595 2007-10-25  Maciej Stachowiak  <mjs@apple.com>
596
597         Reviewed by Adam.
598         
599         - add header includes needed on platforms that don't use AllInOneFile.cpp
600
601         * API/JSCallbackObject.cpp:
602         * kjs/Context.cpp:
603         * kjs/ExecState.cpp:
604         * kjs/array_instance.cpp:
605         * kjs/function_object.cpp:
606         * kjs/interpreter.cpp:
607         * kjs/nodes.cpp:
608
609 2007-10-25  Eric Seidel  <eric@webkit.org>
610
611         Reviewed by Geoff.
612
613         * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
614
615 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
616
617         Reviewed by Maciej Stachowiak.
618         
619         Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
620         Re-order declaration initialization to avoid calling hasProperty inside
621         VarDeclNode::processDeclaration
622         
623         .7% speedup on SunSpider.
624
625         * kjs/function.h:
626         * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
627         other processing of declared symbols, so the order of execution could 
628         change.
629
630         * kjs/nodes.cpp:
631         (KJS::VarDeclNode::getDeclarations): Added special case for the 
632         "arguments" property name, explained in the comment.
633
634         (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
635         in the case of function code, since we know the declared symbol
636         management will resolve conflicts between symbols. Yay!
637
638         (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's 
639         implementation of getDeclarations is non-trivial, we can't take a 
640         short-cut here any longer -- we need to put the VarDecl node on the 
641         stack so it gets processed normally.
642
643         (KJS::FunctionBodyNode::processDeclarations): Changed the order of 
644         processing to enforce mutual exclusion rules.
645
646         * kjs/nodes.h:
647         (KJS::DeclarationStacks::DeclarationStacks): Structure includes an 
648         ExecState now, for fast access to the "arguments" property name.
649
650 2007-10-24  Eric Seidel  <eric@webkit.org>
651
652         Reviewed by Maciej.
653         
654         Add a JSGlobalObject class and remove the InterpreterMap
655         http://bugs.webkit.org/show_bug.cgi?id=15681
656         
657         This required making JSCallbackObject a template class to allow for
658         JSGlobalObjects with JSCallbackObject functionality.
659         
660         SunSpider claims this was a 0.5% speedup.
661
662         * API/JSCallbackObject.cpp:
663         (KJS::):
664         * API/JSCallbackObject.h:
665         * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
666         (KJS::::JSCallbackObject):
667         (KJS::::init):
668         (KJS::::~JSCallbackObject):
669         (KJS::::initializeIfNeeded):
670         (KJS::::className):
671         (KJS::::getOwnPropertySlot):
672         (KJS::::put):
673         (KJS::::deleteProperty):
674         (KJS::::implementsConstruct):
675         (KJS::::construct):
676         (KJS::::implementsHasInstance):
677         (KJS::::hasInstance):
678         (KJS::::implementsCall):
679         (KJS::::callAsFunction):
680         (KJS::::getPropertyNames):
681         (KJS::::toNumber):
682         (KJS::::toString):
683         (KJS::::setPrivate):
684         (KJS::::getPrivate):
685         (KJS::::inherits):
686         (KJS::::cachedValueGetter):
687         (KJS::::staticValueGetter):
688         (KJS::::staticFunctionGetter):
689         (KJS::::callbackGetter):
690         * API/JSClassRef.cpp:
691         (OpaqueJSClass::prototype):
692         * API/JSContextRef.cpp:
693         (JSGlobalContextCreate):
694         * API/JSObjectRef.cpp:
695         (JSObjectMake):
696         (JSObjectGetPrivate):
697         (JSObjectSetPrivate):
698         * API/JSValueRef.cpp:
699         (JSValueIsObjectOfClass):
700         * JavaScriptCore.exp:
701         * JavaScriptCore.xcodeproj/project.pbxproj:
702         * bindings/c/c_utility.cpp:
703         (KJS::Bindings::convertValueToNPVariant):
704         * bindings/jni/jni_jsobject.cpp:
705         * bindings/objc/objc_utility.mm:
706         (KJS::Bindings::convertValueToObjcValue):
707         * kjs/Context.cpp:
708         (KJS::Context::Context):
709         * kjs/ExecState.cpp:
710         (KJS::ExecState::lexicalInterpreter):
711         * kjs/JSGlobalObject.h: Added.
712         (KJS::JSGlobalObject::JSGlobalObject):
713         (KJS::JSGlobalObject::isGlobalObject):
714         (KJS::JSGlobalObject::interpreter):
715         (KJS::JSGlobalObject::setInterpreter):
716         * kjs/array_instance.cpp:
717         * kjs/context.h:
718         * kjs/function.cpp:
719         (KJS::FunctionImp::callAsFunction):
720         (KJS::GlobalFuncImp::callAsFunction):
721         * kjs/interpreter.cpp:
722         (KJS::Interpreter::Interpreter):
723         (KJS::Interpreter::init):
724         (KJS::Interpreter::~Interpreter):
725         (KJS::Interpreter::globalObject):
726         (KJS::Interpreter::initGlobalObject):
727         (KJS::Interpreter::evaluate):
728         * kjs/interpreter.h:
729         * kjs/lookup.h:
730         (KJS::cacheGlobalObject):
731         * kjs/object.h:
732         (KJS::JSObject::isGlobalObject):
733         * kjs/testkjs.cpp:
734
735 2007-10-24  Eric Seidel  <eric@webkit.org>
736
737         Build fix for Gtk, no review.
738
739         * kjs/collector.cpp: #include "context.h"
740
741 2007-10-24  Eric Seidel  <eric@webkit.org>
742
743         Reviewed by Maciej.
744         
745         Stop checking isOutOfMemory after every allocation, instead let the collector
746         notify all ExecStates if we ever hit this rare condition.
747         
748         SunSpider claims this was a 2.2% speedup.
749
750         * kjs/collector.cpp:
751         (KJS::Collector::collect):
752         (KJS::Collector::reportOutOfMemoryToAllInterpreters):
753         * kjs/collector.h:
754         * kjs/nodes.cpp:
755         (KJS::TryNode::execute):
756
757 2007-10-24  Mark Rowe  <mrowe@apple.com>
758
759         Gtk build fix.
760
761         * kjs/identifier.h:  Remove extra qualification.
762
763 2007-10-24  Geoffrey Garen  <ggaren@apple.com>
764
765         Reviewed by Sam Weinig.
766         
767         Disable ALWAYS_INLINE in debug builds, since it drives the debugger
768         crazy.
769
770         * wtf/AlwaysInline.h:
771
772 2007-10-24  Geoffrey Garen  <ggaren@apple.com>
773
774         Reviewed by Sam Weinig.
775         
776         Inlined the fast path for creating an Identifier from an Identifier. 
777         
778         This is a .4% speedup on SunSpider overall, but as big as a 2.5% 
779         speedup on certain individual tests. 65% of the Identifiers creating 
780         by SunSpider are already Identifiers.
781         
782         (The main reason I'm making this change is that it resolves a large
783         regression in a patch I haven't checked in yet.)
784
785         * JavaScriptCore.exp:
786         * kjs/identifier.cpp:
787         (KJS::Identifier::addSlowCase):
788         * kjs/identifier.h:
789         (KJS::Identifier::Identifier::add):
790
791 2007-10-24  Lars Knoll  <lars@trolltech.com>
792
793         Reviewed by Simon.
794
795         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.
796
797         * bindings/qt/qt_instance.cpp:
798         (KJS::Bindings::QtInstance::invokeMethod):
799         * bindings/qt/qt_runtime.cpp:
800         (KJS::Bindings::convertValueToQVariant):
801         (KJS::Bindings::QtField::setValueToInstance):
802
803 2007-10-24  Oliver Hunt  <oliver@apple.com>
804
805         Reviewed by Darin.
806
807         Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
808
809         * kjs/nodes.cpp:
810         (KJS::lessThan):
811         (KJS::lessThanEq):
812         (KJS::LessNode::evaluate):
813         (KJS::GreaterNode::evaluate):
814         (KJS::LessEqNode::evaluate):
815         (KJS::GreaterEqNode::evaluate):
816         * kjs/operations.cpp:
817         * kjs/operations.h:
818
819 2007-10-24  Eric Seidel  <eric@webkit.org>
820
821         Reviewed by darin.
822
823         * kjs/nodes.h:
824         (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
825
826 2007-10-24  Darin Adler  <darin@apple.com>
827
828         Reviewed by Eric.
829
830         * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
831         Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
832
833 2007-10-24  Darin Adler  <darin@apple.com>
834
835         Reviewed by Maciej.
836
837         - separate out the code to create a hash table the first time from the code
838           to rehash
839
840         SunSpider claims this was a 0.7% speedup.
841
842         * kjs/property_map.cpp:
843         (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
844         (KJS::PropertyMap::createTable): Added. For the case where we had no table.
845         (KJS::PropertyMap::rehash): Removed code needed only in the case where we
846         had no table.
847         * kjs/property_map.h: Added createTable.
848
849 2007-10-24  Eric Seidel  <eric@webkit.org>
850
851         Reviewed by darin.
852         
853         Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
854         which can be represented by JSImmediate.
855         
856         SunSpider claims this was a 0.6% speedup.
857
858         * kjs/grammar.y:
859         * kjs/nodes.cpp:
860         (KJS::NumberNode::evaluate):
861         (KJS::ImmediateNumberNode::evaluate):
862         * kjs/nodes.h:
863         (KJS::Node::):
864         (KJS::ImmediateNumberNode::):
865         * kjs/nodes2string.cpp:
866         (ImmediateNumberNode::streamTo):
867
868 2007-10-24  Darin Adler  <darin@apple.com>
869
870         Reviewed by Maciej.
871
872         - http://bugs.webkit.org/show_bug.cgi?id=15657
873           change static hash tables to use powers of two for speed
874
875         Seems to give 0.7% SunSpider speedup.
876
877         * kjs/create_hash_table: Updated to generate new format.
878         * kjs/lookup.cpp:
879         (KJS::keysMatch): Took out unneeded typecast.
880         (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
881         Replaced the modulus with a bit mask.
882         (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
883         their hash -- saves a branch.
884         (KJS::Lookup::find): Ditto.
885         * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
886
887 2007-10-24  Maciej Stachowiak  <mjs@apple.com>
888
889         Reviewed by Darin.
890         
891         - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
892
893         * kjs/nodes.cpp:
894         (KJS::DoWhileNode::execute):
895         (KJS::WhileNode::execute):
896         (KJS::ForNode::execute):
897         (KJS::ForInNode::execute):
898         (KJS::SourceElementsNode::execute):
899
900 2007-10-23  Darin Adler  <darin@apple.com>
901
902         Reviewed by Maciej.
903
904         * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
905         Changed an && to an & for a 1% gain in SunSpider.
906
907 2007-10-23  Oliver Hunt  <oliver@apple.com>
908
909         Reviewed by Maciej.
910
911         Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
912
913         * kjs/nodes.cpp:
914         (KJS::MultNode::evaluate):
915         (KJS::DivNode::evaluate):
916         (KJS::ModNode::evaluate):
917         (KJS::add):
918         (KJS::sub):
919         (KJS::AddNode::evaluate):
920         (KJS::SubNode::evaluate):
921         (KJS::valueForReadModifyAssignment):
922         * kjs/operations.cpp:
923         * kjs/operations.h:
924
925 2007-10-23  Oliver Hunt  <oliver@apple.com>
926
927         Reviewed by Maciej.
928
929         Separating all of the simple (eg. non-read-modify-write) binary operators
930         into separate classes in preparation for further JS optimisations.
931         
932         Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
933         no further work.
934
935         * JavaScriptCore.xcodeproj/project.pbxproj:
936         * kjs/grammar.y:
937         * kjs/nodes.cpp:
938         (KJS::MultNode::evaluate):
939         (KJS::DivNode::evaluate):
940         (KJS::ModNode::evaluate):
941         (KJS::AddNode::evaluate):
942         (KJS::SubNode::evaluate):
943         (KJS::LeftShiftNode::evaluate):
944         (KJS::RightShiftNode::evaluate):
945         (KJS::UnsignedRightShiftNode::evaluate):
946         (KJS::LessNode::evaluate):
947         (KJS::GreaterNode::evaluate):
948         (KJS::LessEqNode::evaluate):
949         (KJS::GreaterEqNode::evaluate):
950         (KJS::InstanceOfNode::evaluate):
951         (KJS::InNode::evaluate):
952         (KJS::EqualNode::evaluate):
953         (KJS::NotEqualNode::evaluate):
954         (KJS::StrictEqualNode::evaluate):
955         (KJS::NotStrictEqualNode::evaluate):
956         (KJS::BitAndNode::evaluate):
957         (KJS::BitXOrNode::evaluate):
958         (KJS::BitOrNode::evaluate):
959         (KJS::LogicalAndNode::evaluate):
960         (KJS::LogicalOrNode::evaluate):
961         * kjs/nodes.h:
962         (KJS::MultNode::):
963         (KJS::DivNode::):
964         (KJS::ModNode::):
965         (KJS::AddNode::):
966         (KJS::SubNode::):
967         (KJS::LeftShiftNode::):
968         (KJS::RightShiftNode::):
969         (KJS::UnsignedRightShiftNode::):
970         (KJS::LessNode::):
971         (KJS::GreaterNode::):
972         (KJS::LessEqNode::):
973         (KJS::GreaterEqNode::):
974         (KJS::InstanceOfNode::):
975         (KJS::InNode::):
976         (KJS::EqualNode::):
977         (KJS::NotEqualNode::):
978         (KJS::StrictEqualNode::):
979         (KJS::NotStrictEqualNode::):
980         (KJS::BitAndNode::):
981         (KJS::BitOrNode::):
982         (KJS::BitXOrNode::):
983         (KJS::LogicalAndNode::):
984         (KJS::LogicalOrNode::):
985         * kjs/nodes2string.cpp:
986         (MultNode::streamTo):
987         (DivNode::streamTo):
988         (ModNode::streamTo):
989         (AddNode::streamTo):
990         (SubNode::streamTo):
991         (LeftShiftNode::streamTo):
992         (RightShiftNode::streamTo):
993         (UnsignedRightShiftNode::streamTo):
994         (LessNode::streamTo):
995         (GreaterNode::streamTo):
996         (LessEqNode::streamTo):
997         (GreaterEqNode::streamTo):
998         (InstanceOfNode::streamTo):
999         (InNode::streamTo):
1000         (EqualNode::streamTo):
1001         (NotEqualNode::streamTo):
1002         (StrictEqualNode::streamTo):
1003         (NotStrictEqualNode::streamTo):
1004         (BitAndNode::streamTo):
1005         (BitXOrNode::streamTo):
1006         (BitOrNode::streamTo):
1007         (LogicalAndNode::streamTo):
1008
1009 2007-10-23  Darin Adler  <darin@apple.com>
1010
1011         Reviewed by Maciej.
1012
1013         - fix http://bugs.webkit.org/show_bug.cgi?id=15639
1014           fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
1015
1016         Test: fast/js/math.html
1017
1018         * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
1019         Fix abs to look at the sign bit. Add a special case for values in the range
1020         between -0 and -1 and a special case for ceil and for -0 for floor.
1021
1022 2007-10-23  Darin Adler  <darin@apple.com>
1023
1024         Reviewed by Eric.
1025
1026         - streamline exception handling code for a >1% speed-up of SunSpider
1027
1028         * kjs/nodes.cpp: Changed macros to use functions for everything that's not
1029         part of normal execution. We'll take function call overhead when propagating
1030         an exception or out of memory.
1031         (KJS::createOutOfMemoryCompletion): Added.
1032         (KJS::substitute): Use append instead of the relatively inefficient + operator.
1033         (KJS::Node::rethrowException): Added.
1034         * kjs/nodes.h: Added rethrowException.
1035
1036 2007-10-22  Darin Adler  <darin@apple.com>
1037
1038         Reviewed by Maciej.
1039
1040         - fix http://bugs.webkit.org/show_bug.cgi?id=15636
1041           some JavaScriptCore regression tests are failing due to numeric conversion
1042
1043         This should restore correctness and make speed better too, restoring some
1044         of the optimization we lost in my last check-in.
1045
1046         * kjs/JSImmediate.h:
1047         (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
1048         I used in my patch yesterday.
1049         (KJS::JSImmediate::getTruncatedUInt32): Ditto.
1050
1051         * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
1052         * kjs/internal.cpp:
1053         (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
1054         a way to write this more efficiently for float.
1055         (KJS::NumberImp::getTruncatedInt32): Added.
1056         (KJS::NumberImp::getTruncatedUInt32): Added.
1057
1058         * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
1059         (KJS::JSValue::getUInt32):
1060         (KJS::JSValue::getTruncatedInt32): Added.
1061         (KJS::JSValue::getTruncatedUInt32): Added.
1062         (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
1063         (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
1064         * kjs/value.cpp:
1065         (KJS::JSCell::getTruncatedInt32): Added.
1066         (KJS::JSCell::getTruncatedUInt32): Added.
1067         (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
1068         (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
1069         had left in here.
1070         (KJS::JSValue::toUInt32SlowCase): Ditto.
1071         (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
1072
1073         * JavaScriptCore.exp: Updated.
1074
1075 2007-10-22  Darin Adler  <darin@apple.com>
1076
1077         Reviewed by Geoff.
1078
1079         - fix http://bugs.webkit.org/show_bug.cgi?id=15632
1080           js1_5/Array/array-001.js test failing
1081
1082         One of the JavaScriptCore tests was failing; it failed because of
1083         my change to NumberImp::getUInt32. The incorrect code I copied was
1084         from JSImmediate::getUInt32, and was a pre-existing bug.
1085
1086         This patch fixes correctness, but will surely slow down SunSpider.
1087         We may be able to code this tighter and get the speed back.
1088
1089         * kjs/JSImmediate.h:
1090         (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
1091         reflect the fact that this function only returns true if the value is
1092         accurate (no fractional part, etc.). Changed code so that it returns
1093         false when the value has a fraction.
1094         (KJS::JSImmediate::getUInt32): Ditto.
1095
1096         * kjs/internal.cpp:
1097         (KJS::NumberImp::getInt32): Changed code so that it returns false when
1098         the value has a fraction. Restores the old behavior.
1099         (KJS::NumberImp::getUInt32): Ditto.
1100
1101         * kjs/value.h:
1102         (KJS::JSValue::getInt32): Updated for name change.
1103         (KJS::JSValue::getUInt32): Ditto.
1104         (KJS::JSValue::toInt32): Ditto.
1105         (KJS::JSValue::toUInt32): Ditto.
1106
1107 2007-10-22  Darin Adler  <darin@apple.com>
1108
1109         Reviewed by Brady.
1110
1111         - fix crash seen when running JavaScriptCore tests
1112
1113         * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
1114         Copy and paste error: I accidentally had code here that was
1115         making a copy of the HashMap -- that's illegal inside a mark
1116         function and was unnecessary. The other callsite was modifying
1117         the map as it iterated it, but this function is not.
1118
1119 2007-10-22  Maciej Stachowiak  <mjs@apple.com>
1120
1121         Reviewed by Oliver.
1122         
1123         - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
1124         http://bugs.webkit.org/show_bug.cgi?id=15627
1125
1126         * kjs/JSImmediate.h:
1127         (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
1128         registers since this is very slow.
1129
1130 2007-10-22  Darin Adler  <darin@apple.com>
1131
1132         Reviewed by Eric Seidel.
1133
1134         - http://bugs.webkit.org/show_bug.cgi?id=15617
1135           improve speed of integer conversions
1136
1137         Makes SunSpider 6% faster.
1138
1139         * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
1140         32-bit and 64-bit.
1141         * kjs/value.h:
1142         (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
1143
1144         * kjs/internal.h: Added getInt32.
1145         * kjs/internal.cpp:
1146         (KJS::NumberImp::getInt32): Added.
1147         (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
1148         stolen from JSValue.
1149
1150         * kjs/value.h:
1151         (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
1152         inlined.
1153         (KJS::JSValue::getInt32): Added.
1154         (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
1155         to avoid converting from float to double.
1156         (KJS::JSValue::toInt32): Made inline, separated out the slow case.
1157         (KJS::JSValue::toUInt32): Ditto.
1158         * kjs/value.cpp:
1159         (KJS::JSCell::getInt32): Added.
1160         (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
1161         new getInt32. Added a faster case for in-range numbers.
1162         (KJS::JSValue::toUInt32SlowCase): Ditto.
1163         (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
1164
1165         * JavaScriptCore.exp: Updated for changes.
1166
1167 2007-10-22  Adam Roben  <aroben@apple.com>
1168
1169         Windows build fix
1170
1171         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
1172         warning about implicit conversion to bool.
1173
1174 2007-10-22  Mark Rowe  <mrowe@apple.com>
1175
1176         Gtk build fix.
1177
1178         * kjs/array_instance.cpp:
1179
1180 2007-10-22  Darin Adler  <darin@apple.com>
1181
1182         Reviewed by Maciej.
1183
1184         - http://bugs.webkit.org/show_bug.cgi?id=15606
1185           make cut-off for sparse vs. dense arrays smarter for speed with large arrays
1186
1187         Makes the morph test in SunSpider 26% faster, and the overall
1188         benchmark 3% faster.
1189
1190         This also fixes some small problems we had with the distinction
1191         between nonexistent and undefined values in arrays.
1192
1193         * kjs/array_instance.h: Tweaked formatting and naming.
1194         * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
1195         (KJS::storageSize): Added. Computes the size of the storage given a vector length.
1196         (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
1197         (KJS::isDenseEnoughForVector): Added.
1198         (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
1199         (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
1200         (KJS::ArrayInstance::getItem): Updated for name changes.
1201         (KJS::ArrayInstance::lengthGetter): Ditto.
1202         (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
1203         getOwnPropertySlot to share more code.
1204         (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
1205         (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
1206         array is dense enough. Also keep m_numValuesInVector up to date.
1207         (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
1208         up to date.
1209         (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
1210         for array indices with undefined values.
1211         (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
1212         simplified to only handle getting larger.
1213         (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
1214         zero out the unused part of the vector and to delete the map if it's no longer
1215         needed.
1216         (KJS::ArrayInstance::mark): Tweaked formatting.
1217         (KJS::compareByStringForQSort): Ditto.
1218         (KJS::ArrayInstance::sort): Ditto.
1219         (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1220         Ditto.
1221         (KJS::compareWithCompareFunctionForQSort): Ditto.
1222         (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
1223         undefined values into nonexistent values in some cases.
1224
1225         * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
1226         * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
1227
1228         * JavaScriptCore.pri: Added array_instance.cpp.
1229         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
1230         * kjs/AllInOneFile.cpp: Ditto.
1231
1232 2007-10-22  Andrew Wellington  <proton@wiretapped.net>
1233
1234         Reviewed by Mark Rowe.
1235         
1236         Fix for local database support after r26879
1237         Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
1238
1239         * Configurations/JavaScriptCore.xcconfig:
1240
1241 2007-10-22  Simon Hausmann  <hausmann@kde.org>
1242
1243         Reviewed by Alp.
1244
1245         Build fix for the non-qmake builds.
1246
1247         * wtf/Platform.h: Default to enabling the database features unless
1248         otherwise specified. (similar to ENABLE_ICONDATABASE)
1249
1250 2007-10-22  Holger Freyther  <zecke@selfish.org>
1251
1252         Reviewed by Simon Hausmann <hausmann@kde.org>.
1253
1254         * Do not build testkjs as an application bundle. This is
1255         needed for run-javascriptcore-tests on OSX.
1256         * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
1257         * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
1258         as we do not have -rpath on OSX.
1259
1260         * kjs/testkjs.pro:
1261
1262 2007-10-21  Mark Rowe  <mrowe@apple.com>
1263
1264         Reviewed by Alp.
1265
1266         http://bugs.webkit.org/show_bug.cgi?id=15575
1267         Bug 15575: [GTK] Implement threading using GThread
1268
1269         * wtf/Platform.h: Do not enable pthreads for Gtk.
1270
1271 2007-10-21  Mark Rowe  <mrowe@apple.com>
1272
1273         Reviewed by Mitz.
1274
1275         Fix http://bugs.webkit.org/show_bug.cgi?id=15603
1276         Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
1277
1278         * kjs/array_object.cpp:
1279         (KJS::freeStorage): Reinstate null-check that was removed in r26847.
1280
1281 2007-10-21  Darin Adler  <darin@apple.com>
1282
1283         - fix Windows build
1284
1285         * kjs/array_instance.h: Removed unused ExecState parameter.
1286         * kjs/array_object.cpp:
1287         (KJS::ArrayInstance::put): Ditto.
1288         (KJS::ArrayInstance::setLength): Ditto.
1289
1290 2007-10-21  Darin Adler  <darin@apple.com>
1291
1292         * kjs/array_object.cpp: (KJS::ArrayInstance::put):
1293         Add missing assignment that was causing regression test crash.
1294
1295 2007-10-21  Darin Adler  <darin@apple.com>
1296
1297         Reviewed by Maciej.
1298
1299         - http://bugs.webkit.org/show_bug.cgi?id=15585
1300           speed up sparse arrays by using a custom map
1301     
1302         Speeds up SunSpider by 10%.
1303
1304         * kjs/array_object.cpp:
1305         (allocateStorage): Leave room for an additional pointer.
1306         (reallocateStorage): Ditto.
1307         (freeStorage): Ditto.
1308         (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
1309         (ArrayInstance::getItem): Read values from the overflow map if present.
1310         Removed the check of length, since it slows down the common case.
1311         (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
1312         to the property map.
1313         (ArrayInstance::put): Write values into the overflow map as needed.
1314         Also create overflow map when needed.
1315         (ArrayInstance::deleteProperty): Remove values from the overflow map
1316         as appropriate.
1317         (ArrayInstance::getPropertyNames): Add a name for each identifier in
1318         the property map. This is extremely inefficient.
1319         (ArrayInstance::setLength): Remove any values in the overflow map
1320         that are past the new length, as we formerly did with the property map.
1321         (ArrayInstance::mark): Mark any values in the overflow map.
1322         (compareByStringForQSort): Removed unneeded undefined case, since
1323         compactForSorting guarantees we will have no undefined values.
1324         (compareWithCompareFunctionForQSort): Ditto.
1325         (ArrayInstance::compactForSorting): Copy all the values out of the
1326         overflow map and destroy it.
1327
1328         * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
1329         * kjs/property_map.cpp: Ditto.
1330
1331 2007-10-20  Darin Adler  <darin@apple.com>
1332
1333         Reviewed by Maciej.
1334
1335         - http://bugs.webkit.org/show_bug.cgi?id=15579
1336           stop churning identifier reference counts copying Completion objects
1337
1338         * kjs/completion.h: Replace the Identifier with an Identifier*.
1339         * kjs/nodes.cpp:
1340         (ForInNode::execute): Update for change to Completion constructor.
1341         (ContinueNode::execute): Ditto.
1342         (BreakNode::execute): Ditto.
1343
1344 2007-10-20  Mark Rowe  <mrowe@apple.com>
1345
1346         Reviewed by Alp.
1347
1348         Gtk changes needed to enable HTML 5 client-side database storage.
1349
1350         * wtf/Platform.h: Have Gtk use pthreads for now.
1351
1352 2007-10-20  Geoffrey Garen  <ggaren@apple.com>
1353
1354         Reviewed by Maciej Stachowiak.
1355
1356         Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
1357         Store gathered declaration nodes in the function body node.
1358         
1359         This means that you only have to gather the declaration nodes the first 
1360         time the function executes. Performance gain of 2.10% on SunSpider, 
1361         0.90% on command-line JS iBench.
1362
1363         * kjs/nodes.cpp: Split declaration stack initialization code off into 
1364         initializeDeclarationStacks().
1365         (FunctionBodyNode::FunctionBodyNode):
1366         (FunctionBodyNode::initializeDeclarationStacks):
1367         (FunctionBodyNode::processDeclarations):
1368
1369         * kjs/nodes.h: Changed DeclarationStacks structure to hold references, 
1370         since the actual Vectors are now stored either on the stack or in the 
1371         function body node.
1372
1373 2007-10-19  Geoffrey Garen  <ggaren@apple.com>
1374
1375         Reviewed by Darin Adler.
1376         
1377         http://bugs.webkit.org/show_bug.cgi?id=15559
1378         Moved processDeclarations call into FunctionBodyNode::execute
1379
1380         To improve encapsulation, moved processDeclarations call into
1381         FunctionBodyNode::execute. Also marked processDeclarations 
1382         ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup 
1383         on command-line JS iBench.
1384
1385         * kjs/function.cpp:
1386         (KJS::FunctionImp::callAsFunction):
1387         (KJS::GlobalFuncImp::callAsFunction):
1388         * kjs/function.h:
1389         * kjs/interpreter.cpp:
1390         (KJS::Interpreter::evaluate):
1391         * kjs/nodes.cpp:
1392         (FunctionBodyNode::execute):
1393         * kjs/nodes.h:
1394
1395 2007-10-19  Brady Eidson  <beidson@apple.com>
1396
1397         Reviewed by Sam
1398
1399         Queue -> Deque! and small style tweaks
1400
1401         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1402         * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
1403         * wtf/Deque.h: Added.
1404         (WTF::DequeNode::DequeNode):
1405         (WTF::Deque::Deque):
1406         (WTF::Deque::~Deque):
1407         (WTF::Deque::size):
1408         (WTF::Deque::isEmpty):
1409         (WTF::Deque::append):
1410         (WTF::Deque::prepend):
1411         (WTF::Deque::first):
1412         (WTF::Deque::last):
1413         (WTF::Deque::removeFirst):
1414         (WTF::Deque::clear):
1415         * wtf/Queue.h: Removed.
1416
1417
1418 2007-10-19  Brady Eidson <beidson@apple.com>
1419
1420         Reviewed by Oliver
1421
1422         Added a simple LinkedList based Queue to wtf
1423         We can make a better, more sophisticated an efficient one later, but have
1424         needed one for some time, now!
1425
1426         * JavaScriptCore.xcodeproj/project.pbxproj:
1427         * wtf/Queue.h: Added.
1428         (WTF::QueueNode::QueueNode):
1429         (WTF::Queue::Queue):
1430         (WTF::Queue::~Queue):
1431         (WTF::Queue::size):
1432         (WTF::Queue::isEmpty):
1433         (WTF::Queue::append):
1434         (WTF::Queue::prepend):
1435         (WTF::Queue::first):
1436         (WTF::Queue::last):
1437         (WTF::Queue::removeFirst):
1438         (WTF::Queue::clear):
1439
1440 2007-10-19  Nikolas Zimmermann  <zimmermann@kde.org>
1441
1442         Reviewed by Anders.
1443
1444         Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
1445
1446         * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
1447
1448 2007-10-19  Simon Hausmann  <hausmann@kde.org>
1449
1450         Reviewed by Lars.
1451
1452         Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
1453         Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
1454
1455         * wtf/ASCIICType.h:
1456         (WTF::isASCIIAlpha):
1457         (WTF::isASCIIAlphanumeric):
1458         (WTF::isASCIIDigit):
1459         (WTF::isASCIIHexDigit):
1460         (WTF::isASCIILower):
1461         (WTF::isASCIISpace):
1462         (WTF::toASCIILower):
1463         (WTF::toASCIIUpper):
1464
1465 2007-10-19  Simon Hausmann  <hausmann@kde.org>
1466
1467         Reviewed by Lars.
1468
1469         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.
1470
1471         * kjs/config.h:
1472
1473 2007-10-18  Maciej Stachowiak  <mjs@apple.com>
1474
1475         Reviewed by Adam.
1476         
1477         - use __declspec(thread) for fast thread-local storage on Windows
1478         
1479         - 2.2% speedup on sunspider (on Windows)
1480         - 7% speedup on the string section
1481         - 6% speedup on JS iBench
1482         
1483         - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
1484         - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
1485         
1486         
1487         * wtf/FastMalloc.cpp:
1488         (WTF::getThreadHeap):
1489         (WTF::setThreadHeap):
1490         (WTF::TCMalloc_ThreadCache::GetCache):
1491         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
1492         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1493
1494 2007-10-17  Darin Adler  <darin@apple.com>
1495
1496         Reviewed by Mark Rowe.
1497
1498         - fix http://bugs.webkit.org/show_bug.cgi?id=15543
1499           <rdar://problem/5545639> REGRESSION (r26697):
1500           GoogleDocs: Can't create new documents or open existing ones
1501
1502         Test: fast/js/regexp-non-character.html
1503
1504         * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
1505         in the \u sequences -- not needed and actively harmful.
1506
1507 2007-10-17  Anders Carlsson  <andersca@apple.com>
1508
1509         Reviewed by Oliver.
1510
1511         * wtf/Platform.h:
1512         #define USE_PTHREADS on Mac.
1513
1514 2007-10-17  Geoffrey Garen  <ggaren@apple.com>
1515
1516         Reviewed by Darin Adler.
1517         
1518         Merged DeclaredFunctionImp into FunctionImp (the base class) because 
1519         the distinction between the two was unused.
1520         
1521         Removed codeType() from FunctionImp because FunctionImp and its 
1522         subclasses all returned FunctionCode, so it was unused, practically 
1523         speaking.
1524         
1525         Removed a different codeType() from GlobalFuncImp because it was unused.
1526         (Perhaps it was vestigial from a time when GlobalFuncImp used to 
1527         inherit from FunctionImp.)
1528
1529         * bindings/runtime_method.cpp:
1530         * bindings/runtime_method.h:
1531         * kjs/function.cpp:
1532         (KJS::):
1533         (KJS::FunctionImp::FunctionImp):
1534         (KJS::FunctionImp::callAsFunction):
1535         (KJS::FunctionImp::construct):
1536         (KJS::FunctionImp::execute):
1537         (KJS::FunctionImp::processVarDecls):
1538         * kjs/function.h:
1539         (KJS::FunctionImp::implementsConstruct):
1540         (KJS::FunctionImp::scope):
1541         * kjs/function_object.cpp:
1542         (FunctionProtoFunc::callAsFunction):
1543         (FunctionObjectImp::construct):
1544         * kjs/nodes.cpp:
1545         (FuncDeclNode::processFuncDecl):
1546         (FuncExprNode::evaluate):
1547
1548 2007-10-17  Adam Roben  <aroben@apple.com>
1549
1550         Windows build fix part 2.
1551
1552         Fix was by Darin, reviewed by Anders and Adam.
1553
1554         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
1555         FastMallocPCRE.cpp to the project, and let Visual Studio have its way
1556         with the post-build step.
1557         * pcre/pcre.h: Don't DLL export the entry points just because this
1558         is Win32 -- this is an internal copy of PCRE and should be private.
1559         * pcre/pcre_compile.c: Fix an uninitialized variable warning --
1560         there's no real problem but it's better to quiet the compiler by
1561         tweaking the code slightly than turn off the warning entirely.
1562
1563 2007-10-17  Adam Roben  <aroben@apple.com>
1564
1565         Windows build fix.
1566
1567         Reviewed by Anders.
1568
1569         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1570         some mismatched signed/unsigned comparison warnings.
1571         * pcre/pcre_exec.c:
1572         (match): #if-out some labels that don't seem to exist.
1573
1574 2007-10-17  Mark Rowe  <mrowe@apple.com>
1575
1576         Gtk build fix.
1577
1578         * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
1579         * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
1580         is currently unavailable for UTF-16.
1581
1582 2007-10-16  Darin Adler  <darin@apple.com>
1583
1584         Reviewed by Geoff.
1585
1586         - merged PCRE changes between 6.4 and 6.5
1587
1588         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1589         * JavaScriptCore.xcodeproj/project.pbxproj:
1590         Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
1591         pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
1592         pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
1593
1594         * pcre/AUTHORS:
1595         * pcre/LICENCE:
1596         * pcre/MERGING:
1597         * pcre/dftables.c:
1598         * pcre/pcre-config.h:
1599         * pcre/pcre.h:
1600         * pcre/pcre.pri:
1601         * pcre/pcre_compile.c:
1602         * pcre/pcre_exec.c:
1603         * pcre/pcre_fullinfo.c:
1604         * pcre/pcre_get.c:
1605         * pcre/pcre_internal.h:
1606         * pcre/pcre_maketables.c:
1607         * pcre/pcre_ord2utf8.c:
1608         * pcre/pcre_tables.c:
1609         * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
1610         * pcre/pcre_xclass.c:
1611         * pcre/ucp.h:
1612         * pcre/ucpinternal.h:
1613         * pcre/ucptable.c:
1614         Updated with new versions from the PCRE 6.5 release, merged with changes.
1615
1616         * pcre/pcre_config.c: Removed.
1617         * pcre/pcre_globals.c: Removed.
1618         * pcre/pcre_info.c: Removed.
1619         * pcre/pcre_printint.src: Removed.
1620         * pcre/pcre_refcount.c: Removed.
1621         * pcre/pcre_study.c: Removed.
1622         * pcre/pcre_try_flipped.c: Removed.
1623         * pcre/pcre_ucp_findchar.c: Removed.
1624         * pcre/pcre_version.c: Removed.
1625
1626 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1627
1628         Reviewed by Darin Adler.
1629
1630         Removed KJS_VERBOSE because it was getting in the way of readability, 
1631         and the messages didn't seem very helpful.
1632
1633         * kjs/function.cpp:
1634         (KJS::FunctionImp::callAsFunction):
1635         (KJS::FunctionImp::passInParameters):
1636         * kjs/lookup.h:
1637         (KJS::lookupPut):
1638         * kjs/object.cpp:
1639         (KJS::JSObject::put):
1640         * kjs/value.h:
1641
1642 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1643
1644         Reviewed by Darin Adler.
1645         
1646         Removed the Parameter class because it was a redundant wrapper around 
1647         Identifier.
1648
1649         * kjs/function.cpp:
1650         (KJS::FunctionImp::passInParameters):
1651         (KJS::FunctionImp::getParameterName):
1652         * kjs/nodes.cpp:
1653         (FunctionBodyNode::addParam):
1654         * kjs/nodes.h:
1655         (KJS::FunctionBodyNode::):
1656
1657 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1658
1659         Reviewed by Darin Adler.
1660         
1661         Global replace of assert with ASSERT.
1662
1663 2007-10-16  Adam Roben  <aroben@apple.com>
1664
1665         Make testkjs not delay-load WebKit
1666
1667         Soon, delay-loading WebKit will be impossible (because we will be
1668         using __declspec(thread) for thread-local storage). This change
1669         prepares testkjs for the future.
1670
1671         Reviewed by Sam.
1672
1673         * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
1674         added FindSafari.
1675         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
1676         WebKitInitializer, don't delay-load WebKit.
1677         * kjs/testkjs.cpp: Don't use WebKitInitializer.
1678
1679 2007-10-16  Adam Roben  <aroben@apple.com>
1680
1681         Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
1682
1683         Reviewed by Kevin McCullough.
1684
1685         * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
1686         * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
1687         * JavaScriptCore.vcproj/release.vsprops: Ditto.
1688         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
1689         WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
1690         in the name of icuuc36[_debug].dll.
1691
1692 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1693
1694         Reviewed by Maciej Stachowiak.
1695         
1696         Re-structured variable and function declaration code.
1697         
1698         Command-line JS iBench shows no regression.
1699         
1700         Here are the changes:
1701
1702         1. Function declarations are now processed at the same time as var 
1703         declarations -- namely, immediately upon entry to an execution context. 
1704         This does not match Firefox, which waits to process a function
1705         declaration until the declaration's containing block executes, but it 
1706         does match IE and the ECMA spec. (10.1.3 states that var and function 
1707         declarations should be processed at the same time -- namely, "On 
1708         entering an execution context." 12.2 states that "A Block does not 
1709         define a new execution scope.")
1710
1711         2. Declaration processing proceeds iteratively now, rather than 
1712         recursively, storing the nodes is finds in stacks. This will later 
1713         facilitate an optimization to hold on to the gathered declaration nodes, 
1714         rather than re-fetching them in every function call. 
1715         [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1716
1717         Modified these tests because they expected the incorrect Mozilla 
1718         behavior described above:
1719
1720         * tests/mozilla/ecma_3/Function/scope-001.js:
1721         * tests/mozilla/js1_5/Scope/regress-184107.js:
1722
1723 2007-10-16  Darin Adler  <darin@apple.com>
1724
1725         - try to fix the GTK build
1726
1727         * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
1728
1729 2007-10-16  Darin Adler  <darin@apple.com>
1730
1731         - try to fix the Windows build
1732
1733         * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
1734         in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
1735
1736 2007-10-16  Darin Adler  <darin@apple.com>
1737
1738         - try to fix the GTK build
1739
1740         * kjs/ustring.cpp: Include ASCIICType.h.
1741
1742 2007-10-16  Darin Adler  <darin@apple.com>
1743
1744         Reviewed by Maciej and Geoff (and looked over by Eric).
1745
1746         - http://bugs.webkit.org/show_bug.cgi?id=15519
1747           eliminate use of <ctype.h> for processing ASCII
1748
1749         * wtf/ASCIICType.h: Added.
1750         * wtf/DisallowCType.h: Added.
1751
1752         * kjs/config.h: Include DisallowCType.h.
1753
1754         * kjs/date_object.cpp:
1755         (KJS::skipSpacesAndComments):
1756         (KJS::findMonth):
1757         (KJS::parseDate):
1758         * kjs/function.cpp:
1759         (KJS::decode):
1760         * kjs/ustring.cpp:
1761         (KJS::UString::toDouble):
1762         Use ASCIICType.h functions instead of ctype.h ones.
1763
1764 2007-10-14  Maciej Stachowiak  <mjs@apple.com>
1765
1766         Reviewed by Darin.
1767
1768         - fixes for "New JavaScript benchmark"
1769         http://bugs.webkit.org/show_bug.cgi?id=15515
1770         
1771         * kjs/testkjs.cpp:
1772         (TestFunctionImp::callAsFunction): Implement "load" for compatibility
1773         with SpiderMonkey.
1774         (TestFunctionImp::): ditto
1775         (doIt): ditto
1776         (kjsmain): Drop useless --> from output.
1777
1778 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1779
1780         Removed unnecessary #include.
1781
1782         * API/JSObjectRef.cpp:
1783
1784 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1785
1786         Double-reverse build fix. My tree was out of date.
1787
1788         * kjs/nodes.cpp:
1789         (NumberNode::evaluate):
1790
1791 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1792
1793         Build fix.
1794
1795         * kjs/nodes.cpp:
1796         (NumberNode::evaluate):
1797
1798 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1799
1800         Reviewed by Darin Adler.
1801         
1802         Removed surprising self-named "hack" that made nested functions 
1803         available as named properties of their containing functions, and placed
1804         containing function objects in the scope chains of nested functions.
1805         
1806         There were a few reasons to remove this "hack:"
1807
1808         1. It contradicted FF, IE, and the ECMA spec.
1809
1810         2. It incurred a performance penalty, since merely parsing a function 
1811         required parsing its body for nested functions (and so on).
1812
1813         3. SVN history contains no explanation for why it was added. It was just
1814         legacy code in a large merge a long, long time ago.
1815
1816         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1817
1818         * kjs/nodes.cpp:
1819         (FuncDeclNode::processFuncDecl):
1820
1821 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1822
1823         Reviewed by Darin Adler.
1824         
1825         Removed the concept of AnonymousCode. It was unused, and it doesn't
1826         exist in the ECMA spec.
1827         
1828         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1829
1830         * kjs/Context.cpp:
1831         (KJS::Context::Context):
1832         * kjs/function.h:
1833         (KJS::):
1834         * kjs/nodes.cpp:
1835         (ReturnNode::execute):
1836
1837 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1838
1839         Reviewed by Darin Adler.
1840         
1841         Made function parameters DontDelete. This matches FF and the vague
1842         description in ECMA 10.1.3. It's also required in order to make
1843         symbol table based lookup of function parameters valid. (If the 
1844         parameters aren't DontDelete, you can't guarantee that you'll find
1845         them later in the symbol table.)
1846
1847         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1848
1849         * kjs/function.cpp:
1850         (KJS::FunctionImp::passInParameters):
1851
1852 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
1853
1854         Reviewed by Maciej Stachowiak.
1855         
1856         Some Vector optimizations. These are especially important when using
1857         Vector as a stack for implementing recursive algorithms iteratively.
1858         
1859         [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1860
1861         1. Added shrink(), which is a version of resize() that you can call
1862         to save a branch / improve code generation and inlining when you know 
1863         that the vector is not getting bigger.
1864         
1865         2. Changed subclassing relationship in VectorBuffer to remove a call to
1866         fastFree() in the destructor for the inlineCapacity != 0 template
1867         specialization. This brings inline Vectors one step closer to true
1868         stack-allocated arrays.
1869         
1870         Also changed abort() to CRASH(), since the latter works better.
1871
1872         * wtf/Vector.h:
1873         (WTF::VectorBufferBase::allocateBuffer):
1874         (WTF::VectorBufferBase::deallocateBuffer):
1875         (WTF::VectorBufferBase::VectorBufferBase):
1876         (WTF::VectorBufferBase::~VectorBufferBase):
1877         (WTF::):
1878         (WTF::VectorBuffer::VectorBuffer):
1879         (WTF::VectorBuffer::~VectorBuffer):
1880         (WTF::VectorBuffer::deallocateBuffer):
1881         (WTF::VectorBuffer::releaseBuffer):
1882         (WTF::Vector::clear):
1883         (WTF::Vector::removeLast):
1884         (WTF::::operator):
1885         (WTF::::fill):
1886         (WTF::::shrink):
1887
1888 2007-10-12  Geoffrey Garen  <ggaren@apple.com>
1889
1890         Reviewed by Maciej Stachowiak.
1891         
1892         Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
1893         Iteration statements sometimes incorrectly evaluate to the empty value 
1894         (KDE r670547). 
1895         
1896         [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1897         
1898         This patch is a merge of KDE r670547, with substantial modification 
1899         for performance.
1900         
1901         It fixes do-while statements to evaluate to a value. (They used
1902         to evaluate to the empty value in all cases.) 
1903
1904         It also fixes SourceElementsNode to maintain the value of abnormal 
1905         completions like "break" and "continue."
1906         
1907         It also re-works the main execution loop in SourceElementsNode so that
1908         it (1) makes a little more sense and (2) avoids unnecessary work. This 
1909         is a .28% speedup on command-line JS iBench.
1910
1911         * kjs/nodes.cpp:
1912         (DoWhileNode::execute):
1913         (SourceElementsNode::execute):
1914
1915 2007-10-15  Simon Hausmann  <hausmann@kde.org>
1916
1917         Reviewed by Lars.
1918
1919         Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
1920
1921         * wtf/HashTraits.h:
1922
1923 2007-10-5  Kevin Ollivier  <kevino@theolliviers.com>
1924  
1925         Reviewed by Adam.
1926         
1927         Add support for MSVC7, and fix cases where PLATFORM(WIN) should
1928         be PLATFORM(WIN_OS) for other ports building on Windows.
1929  
1930         * kjs/DateMath.cpp:
1931         (KJS::getDSTOffsetSimple):
1932         * kjs/JSImmediate.h:
1933         * wtf/Assertions.cpp:
1934         * wtf/Assertions.h:
1935         * wtf/Platform.h:
1936         * wtf/StringExtras.h:
1937         (snprintf):
1938         (vsnprintf):
1939
1940 2007-10-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1941
1942         Reviewed by Darin.
1943
1944         Adds NegateNode optimization from KJS. The relevant revision in KDE
1945         is 666736.
1946
1947         * kjs/grammar.y:
1948         * kjs/nodes.cpp:
1949         (NumberNode::evaluate):
1950         * kjs/nodes.h:
1951         (KJS::Node::):
1952         (KJS::NumberNode::):
1953         * kjs/nodes2string.cpp:
1954         (NumberNode::streamTo):
1955
1956 2007-10-14  Jason Foreman  <jason@threeve.org>
1957
1958         Reviewed by Maciej.
1959
1960         Fix http://bugs.webkit.org/show_bug.cgi?id=15145
1961         
1962         Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
1963         that the property n < intPow10(p) is maintained.
1964
1965         * kjs/number_object.cpp:
1966         (NumberProtoFunc::callAsFunction):
1967
1968 == Rolled over to ChangeLog-2007-10-14 ==