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