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