1 2007-10-27 Mark Rowe <mrowe@apple.com>
7 2007-10-26 Kevin McCullough <kmccullough@apple.com>
11 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
12 files contain are functions that operate on BSTRs.
14 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
15 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
16 * API/JSStringRefCOM.cpp: Removed.
17 * API/JSStringRefCOM.h: Removed.
18 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
20 2007-10-26 Kevin McCullough <kmccullough@apple.com>
24 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
26 * API/JSStringRefCOM.cpp:
27 (JSStringCreateWithBSTR):
29 2007-10-26 Sam Weinig <sam@webkit.org>
33 * kjs/SymbolTable.h: Add header gaurd.
34 * kjs/nodes.h: #include "SymbolTable.h"
36 2007-10-26 Geoffrey Garen <ggaren@apple.com>
38 Suggested by Anders Carlsson.
43 (KJS::ActivationImp::getOwnPropertySlot):
45 2007-10-26 Geoffrey Garen <ggaren@apple.com>
47 Suggested by Darin Adler.
49 Use computedHash(), which is safer than just directly accessing _hash.
52 (KJS::Lookup::findEntry):
55 2007-10-26 Geoffrey Garen <ggaren@apple.com>
57 Build fix: svn add SymbolTable.h
59 * kjs/SymbolTable.h: Added.
60 (KJS::SymbolTable::set):
61 (KJS::SymbolTable::get):
63 2007-10-26 Geoffrey Garen <ggaren@apple.com>
65 Build fix: export SymbolTable.h to WebCore.
67 * JavaScriptCore.xcodeproj/project.pbxproj:
69 2007-10-26 Geoffrey Garen <ggaren@apple.com>
71 Comment tweak suggested by Maciej.
74 (KJS::ActivationImp::getOwnPropertySlot):
76 2007-10-26 Geoffrey Garen <ggaren@apple.com>
78 Reviewed by Maciej Stachowiak.
80 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
82 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
83 hash value. Also, return immediately instead of branching to the end
84 of the loop if the value is not found.
85 (KJS::PropertyMap::get):
86 (KJS::PropertyMap::getLocation):
87 (KJS::PropertyMap::put):
88 (KJS::PropertyMap::insert):
89 (KJS::PropertyMap::remove):
90 (KJS::PropertyMap::checkConsistency):
93 (KJS::UString::Rep::computedHash): Special no branch accessor to the
94 UString's hash value. Used when the caller knows that the hash value
95 has already been computed. (For example, if the caller got the UString
98 2007-10-26 Geoffrey Garen <ggaren@apple.com>
100 Reviewed by Maciej Stachowiak.
102 Switched ActivationImp to using a symbol table. For now, though, all
103 clients take the slow path.
105 Net .6% speedup on SunSpider.
108 - ActivationImp now mallocs in its constructor
109 - Local variable hits use an extra level of indirection to retrieve
111 - Local variable misses do two lookups
114 - Fast initialization of local variables upon function entry
116 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
119 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
120 data that won't fit in a JSCell.
121 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
123 (KJS::ActivationImp::getOwnPropertySlot): ditto
124 (KJS::ActivationImp::deleteProperty): ditto
125 (KJS::ActivationImp::put): ditto
126 (KJS::ActivationImp::createArgumentsObject): ditto
128 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
129 our properties doesn't try to recursively mark us. (This caused a crash
130 in earlier testing. Not sure why we haven't run into it before.)
132 * kjs/nodes.cpp: Functions now build a symbol table the first time
134 (KJS::VarDeclNode::evaluate):
135 (KJS::FunctionBodyNode::FunctionBodyNode):
136 (KJS::FunctionBodyNode::initializeSymbolTable):
137 (KJS::FunctionBodyNode::processDeclarations):
138 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
139 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
142 (KJS::FunctionBodyNode::symbolTable):
144 * wtf/Forward.h: Added Vector.
146 2007-10-26 Kevin McCullough <kmccullough@apple.com>
148 - Corrected function name mistake in this changelog.
150 2007-10-26 Kevin McCullough <kmccullough@apple.com>
151 Reviewed by Sam and Steve.
153 - Added convenience methods for converting between BSTR and JSStringRefs
155 * API/JSStringRefCOM.cpp: Added.
156 (JSStringCreateWithBSTR):
158 * API/JSStringRefCOM.h: Added.
159 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
161 2007-10-26 Mark Rowe <mrowe@apple.com>
166 (KJS::Collector::collect):
168 2007-10-26 Oliver Hunt <oliver@apple.com>
172 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
174 * kjs/CollectorHeapIntrospector.cpp:
175 (KJS::CollectorHeapIntrospector::init):
176 (KJS::CollectorHeapIntrospector::enumerate):
177 * kjs/CollectorHeapIntrospector.h:
179 (KJS::Collector::recordExtraCost):
180 (KJS::Collector::heapAllocate):
181 (KJS::Collector::allocate):
182 (KJS::Collector::allocateNumber):
183 (KJS::Collector::registerThread):
184 (KJS::Collector::markStackObjectsConservatively):
185 (KJS::Collector::markMainThreadOnlyObjects):
186 (KJS::Collector::sweep):
187 (KJS::Collector::collect):
190 (KJS::NumberImp::operator new):
191 Force numbers to be allocated in the secondary heap.
193 2007-10-26 Maciej Stachowiak <mjs@apple.com>
197 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
200 (KJS::JSValue::getUInt32):
201 (KJS::JSValue::getTruncatedInt32):
202 (KJS::JSValue::toNumber):
204 (WTF::PassRefPtr::~PassRefPtr):
206 (WTF::RefPtr::operator->):
208 2007-10-26 Mark Rowe <mrowe@apple.com>
214 2007-10-26 Maciej Stachowiak <mjs@apple.com>
218 - Merge Context class fully into ExecState, since they are always created and used together.
220 No measurable performance impact but this is a useful cleanup.
222 * JavaScriptCore.pri:
224 (KJS::ExecState::ExecState):
225 (KJS::ExecState::~ExecState):
226 (KJS::ExecState::mark):
227 (KJS::ExecState::lexicalInterpreter):
229 (KJS::ExecState::dynamicInterpreter):
230 (KJS::ExecState::setException):
231 (KJS::ExecState::clearException):
232 (KJS::ExecState::exception):
233 (KJS::ExecState::exceptionSlot):
234 (KJS::ExecState::hadException):
235 (KJS::ExecState::scopeChain):
236 (KJS::ExecState::callingExecState):
237 (KJS::ExecState::propertyNames):
239 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
241 (KJS::FunctionImp::callAsFunction):
242 (KJS::FunctionImp::argumentsGetter):
243 (KJS::FunctionImp::callerGetter):
244 (KJS::GlobalFuncImp::callAsFunction):
245 * kjs/interpreter.cpp:
246 (KJS::Interpreter::Interpreter):
247 (KJS::Interpreter::init):
248 (KJS::Interpreter::evaluate):
249 (KJS::Interpreter::mark):
251 (KJS::Interpreter::setCurrentExec):
252 (KJS::Interpreter::currentExec):
254 (KJS::currentSourceId):
255 (KJS::currentSourceURL):
256 (KJS::ThisNode::evaluate):
257 (KJS::ResolveNode::evaluate):
258 (KJS::FunctionCallResolveNode::evaluate):
259 (KJS::PostfixResolveNode::evaluate):
260 (KJS::DeleteResolveNode::evaluate):
261 (KJS::TypeOfResolveNode::evaluate):
262 (KJS::PrefixResolveNode::evaluate):
263 (KJS::AssignResolveNode::evaluate):
264 (KJS::VarDeclNode::evaluate):
265 (KJS::DoWhileNode::execute):
266 (KJS::WhileNode::execute):
267 (KJS::ForNode::execute):
268 (KJS::ForInNode::execute):
269 (KJS::ContinueNode::execute):
270 (KJS::BreakNode::execute):
271 (KJS::ReturnNode::execute):
272 (KJS::WithNode::execute):
273 (KJS::SwitchNode::execute):
274 (KJS::LabelNode::execute):
275 (KJS::TryNode::execute):
276 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
277 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
278 (KJS::FunctionBodyNode::processDeclarations):
279 (KJS::FuncDeclNode::makeFunction):
280 (KJS::FuncExprNode::evaluate):
282 2007-10-26 Mark Rowe <mrowe@apple.com>
286 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
288 2007-10-26 Mark Rowe <mrowe@apple.com>
292 * JavaScriptCore.pri:
295 2007-10-26 Maciej Stachowiak <mjs@apple.com>
299 - moved Context class into ExecState.{h,cpp} in preparation for merging
300 ExecState and Context classes.
302 * kjs/ExecState.h: Moved CodeType enum and Context class here in
303 preparation for merging ExecState and Context.
304 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
305 (KJS::Context::Context):
306 (KJS::Context::~Context):
307 (KJS::Context::mark):
308 * kjs/context.h: Removed.
309 * kjs/Context.cpp: Removed.
310 * kjs/function.h: Removed CodeType enum.
311 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
312 * kjs/internal.h: Removed LabelStack.
313 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
314 * kjs/collector.cpp: Fixed includes.
315 * kjs/function.cpp: ditto
316 * kjs/internal.cpp: ditto
317 * kjs/interpreter.cpp: ditto
318 * kjs/lookup.h: ditto
319 * kjs/nodes.cpp: ditto
321 2007-10-26 Mark Rowe <mrowe@apple.com>
325 * kjs/string_object.cpp:
326 (KJS::StringObjectFuncImp::callAsFunction):
328 2007-10-25 Darin Adler <darin@apple.com>
332 - http://bugs.webkit.org/show_bug.cgi?id=15703
333 fix numeric functions -- improve correctness and speed
335 Gives about 1% gain on SunSpider.
337 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
338 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
339 with both immediate and number values.
340 (KJS::JSValue::toUInt32): Ditto.
342 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
343 differences. One is that it now correctly returns 0 for NaN, and another is that
344 there's no special case for 0 or infinity, since the general case already handles
346 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
348 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
349 truncation done by the typecast already does the necessary truncation that
350 roundValue was doing.
351 (KJS::JSValue::toUInt32SlowCase): Ditto.
352 (KJS::JSValue::toUInt16): Removed.
354 * kjs/internal.h: Removed roundValue.
355 * kjs/internal.cpp: Ditto.
357 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
358 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
360 * kjs/date_object.cpp:
361 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
362 toNumber as specified.
363 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
364 with a call to toNumber and timeClip as specified.
365 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
366 where the default behavior of toInt32 (returning 0) was already correct. Replaced
367 call to roundValue with a call to toNumber as specified.
368 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
370 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
371 cases for the pow function that the library already handles correctly.
373 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
374 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
375 The real toInteger now returns 0 for NaN. Took out unneeded special case in
376 ToFixed for undefined; was only needed because our toInteger was wrong. Same
377 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
379 * kjs/string_object.cpp:
380 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
381 cases for undefined that were only needed because toInteger was wrong. Same in
382 IndexOf, and was able to remove some special cases. In LastIndexOf, used
383 toIntegerPreserveNaN, but was able to remove some special cases there too.
384 Changed Substr implementation to preserve correct behavior with the change
385 to toInteger and match the specification. Also made sure we weren't converting
386 an out of range double to an int.
387 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
388 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
389 no reason to have toUInt16 as a second, less-optimized function that's only
390 called at this one call site.
392 * wtf/MathExtras.h: Added trunc function for Windows.
394 2007-10-25 Geoffrey Garen <ggaren@apple.com>
396 Reviewed by Maciej Stachowiak.
398 Tweaked the inner hashtable lookup loop to remove a branch in the "not
399 found" case. .5% speedup on SunSpider.
401 * JavaScriptCore.xcodeproj/project.pbxproj:
405 2007-10-25 Maciej Stachowiak <mjs@apple.com>
409 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
412 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
413 adding any value over toNumber() here.
414 (KJS::valueForReadModifyAssignment): Ditto.
415 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
417 (KJS::lessThanEq): Ditto.
418 * JavaScriptCore.exp: Export new functions as needed.
420 (KJS::JSValue::toPrimitive): Fixed formatting.
421 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
422 to number and tells you whether a toPrimitive() conversion with a Number hint
423 would have given a string.
425 (KJS::StringImp::getPrimitiveNumber): Implemented.
426 (KJS::NumberImp::getPrimitiveNumber): ditto
427 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
428 (KJS::StringImp::toPrimitive): Fixed formatting.
429 (KJS::NumberImp::toPrimitive): ditto
430 (KJS::GetterSetterImp::toPrimitive): ditto
433 (KJS::JSObject::getPrimitiveNumber): Implemented.
436 2007-10-25 Sam Weinig <sam@webkit.org>
438 Reviewed by Adam Roben.
440 Remove JSStringRefCFHack from windows as it is no longer needed.
442 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
444 2007-10-25 Geoffrey Garen <ggaren@apple.com>
446 Reviewed by Oliver Hunt.
448 Rolled out my last patch. It turns out that I needed 2 words, not 1,
451 2007-10-25 Geoffrey Garen <ggaren@apple.com>
453 Reviewed by Oliver Hunt.
455 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
456 Shrink the size of an activation object by 1 word
458 This is in preparation for adding a symbol table to the activation
461 The basic strategy here is to rely on the mutual exclusion between
462 the arguments object pointer and the function pointer (you only need
463 the latter in order to create the former), and store them in the same
464 place. The LazyArgumentsObject class encapsulates this strategy.
466 Also inlined the ArgumentsImp constructor, for good measure.
468 SunSpider reports no regression. Regression tests pass.
470 * JavaScriptCore.xcodeproj/project.pbxproj:
472 (KJS::Context::~Context):
474 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
475 (KJS::ActivationImp::LazyArgumentsObject::mark):
477 (KJS::ActivationImp::argumentsGetter):
478 (KJS::ActivationImp::mark):
480 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
481 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
482 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
483 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
484 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
485 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
486 (KJS::ActivationImp::LazyArgumentsObject::function):
487 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
488 (KJS::ActivationImp::LazyArgumentsObject::):
489 (KJS::ActivationImp::ActivationImp::ActivationImp):
490 (KJS::ActivationImp::resetArguments):
492 2007-10-25 Adam Roben <aroben@apple.com>
494 Change JavaScriptCore.vcproj to use DerivedSources.make
496 We were trying to emulate the logic of make in
497 build-generated-files.sh, but we got it wrong. We now use a
498 build-generated-files very much like the one that WebCore uses to
501 We also now only have a Debug configuration of dftables which we build
502 even when doing a Release build of JavaScriptCore. dftables also no
503 longer has the "_debug" name suffix.
505 Changes mostly made by Darin, reviewed by me.
507 * DerivedSources.make: Add a variable to set the extension used for
508 the dftables executable.
509 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
510 dftables in Release configurations.
511 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
512 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
513 - Updated include path to point to the new location of the derived
515 - Modified pre-build event to pass the right arguments to
516 build-generated-files.sh and not call dftables directly.
517 - Added the derived source files to the project.
518 - Removed grammarWrapper.cpp, which isn't needed now that we're
519 compiling grammar.cpp directly.
520 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
521 Slightly modified from the WebCore version.
522 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
523 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
524 - Changed the output location to match Mac.
525 - Removed the Release configuration.
526 - Removed the _debug suffix.
528 2007-10-25 Geoffrey Garen <ggaren@apple.com>
530 Reviewed by Eric Seidel.
532 Slightly elaborated the differences between declaration procesing in
533 Function Code and Program Code.
535 .3% speedup on SunSpider.
538 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
539 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
540 minimum set of attributes instead of recomputing all the time. Also,
541 ignore m_parameters, since programs don't have arguments.
543 2007-10-25 Eric Seidel <eric@webkit.org>
547 More preparation work before adding long-running mode to testkjs.
550 (TestFunctionImp::callAsFunction):
555 (fillBufferWithContentsOfFile):
557 2007-10-25 Eric Seidel <eric@webkit.org>
561 Bring testkjs code out of the dark ages in preparation for more
562 radical improvements (like long-running testing support!)
565 (TestFunctionImp::callAsFunction):
568 (fillBufferWithContentsOfFile):
570 2007-10-25 Geoffrey Garen <ggaren@apple.com>
572 Reviewed by Maciej Stachowiak.
574 Make a fast path for declaration processing inside Function Code.
576 Lifted declaration processing code up from individual declaration nodes
577 and into processDeclarations.
579 Broke out processDeclarations into two cases, depending on the type of
580 code. This eliminates 2 branches, and facilitates more radical
581 divergeance in the future.
583 2.5% SunSpider speedup.
585 * JavaScriptCore.xcodeproj/project.pbxproj:
587 (KJS::FunctionBodyNode::initializeDeclarationStacks):
588 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
589 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
590 (KJS::FunctionBodyNode::execute):
591 (KJS::FuncDeclNode::makeFunction):
595 2007-10-25 Maciej Stachowiak <mjs@apple.com>
599 - add header includes needed on platforms that don't use AllInOneFile.cpp
601 * API/JSCallbackObject.cpp:
604 * kjs/array_instance.cpp:
605 * kjs/function_object.cpp:
606 * kjs/interpreter.cpp:
609 2007-10-25 Eric Seidel <eric@webkit.org>
613 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
615 2007-10-25 Geoffrey Garen <ggaren@apple.com>
617 Reviewed by Maciej Stachowiak.
619 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
620 Re-order declaration initialization to avoid calling hasProperty inside
621 VarDeclNode::processDeclaration
623 .7% speedup on SunSpider.
626 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
627 other processing of declared symbols, so the order of execution could
631 (KJS::VarDeclNode::getDeclarations): Added special case for the
632 "arguments" property name, explained in the comment.
634 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
635 in the case of function code, since we know the declared symbol
636 management will resolve conflicts between symbols. Yay!
638 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
639 implementation of getDeclarations is non-trivial, we can't take a
640 short-cut here any longer -- we need to put the VarDecl node on the
641 stack so it gets processed normally.
643 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
644 processing to enforce mutual exclusion rules.
647 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
648 ExecState now, for fast access to the "arguments" property name.
650 2007-10-24 Eric Seidel <eric@webkit.org>
654 Add a JSGlobalObject class and remove the InterpreterMap
655 http://bugs.webkit.org/show_bug.cgi?id=15681
657 This required making JSCallbackObject a template class to allow for
658 JSGlobalObjects with JSCallbackObject functionality.
660 SunSpider claims this was a 0.5% speedup.
662 * API/JSCallbackObject.cpp:
664 * API/JSCallbackObject.h:
665 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
666 (KJS::::JSCallbackObject):
668 (KJS::::~JSCallbackObject):
669 (KJS::::initializeIfNeeded):
671 (KJS::::getOwnPropertySlot):
673 (KJS::::deleteProperty):
674 (KJS::::implementsConstruct):
676 (KJS::::implementsHasInstance):
677 (KJS::::hasInstance):
678 (KJS::::implementsCall):
679 (KJS::::callAsFunction):
680 (KJS::::getPropertyNames):
686 (KJS::::cachedValueGetter):
687 (KJS::::staticValueGetter):
688 (KJS::::staticFunctionGetter):
689 (KJS::::callbackGetter):
690 * API/JSClassRef.cpp:
691 (OpaqueJSClass::prototype):
692 * API/JSContextRef.cpp:
693 (JSGlobalContextCreate):
694 * API/JSObjectRef.cpp:
696 (JSObjectGetPrivate):
697 (JSObjectSetPrivate):
698 * API/JSValueRef.cpp:
699 (JSValueIsObjectOfClass):
700 * JavaScriptCore.exp:
701 * JavaScriptCore.xcodeproj/project.pbxproj:
702 * bindings/c/c_utility.cpp:
703 (KJS::Bindings::convertValueToNPVariant):
704 * bindings/jni/jni_jsobject.cpp:
705 * bindings/objc/objc_utility.mm:
706 (KJS::Bindings::convertValueToObjcValue):
708 (KJS::Context::Context):
710 (KJS::ExecState::lexicalInterpreter):
711 * kjs/JSGlobalObject.h: Added.
712 (KJS::JSGlobalObject::JSGlobalObject):
713 (KJS::JSGlobalObject::isGlobalObject):
714 (KJS::JSGlobalObject::interpreter):
715 (KJS::JSGlobalObject::setInterpreter):
716 * kjs/array_instance.cpp:
719 (KJS::FunctionImp::callAsFunction):
720 (KJS::GlobalFuncImp::callAsFunction):
721 * kjs/interpreter.cpp:
722 (KJS::Interpreter::Interpreter):
723 (KJS::Interpreter::init):
724 (KJS::Interpreter::~Interpreter):
725 (KJS::Interpreter::globalObject):
726 (KJS::Interpreter::initGlobalObject):
727 (KJS::Interpreter::evaluate):
730 (KJS::cacheGlobalObject):
732 (KJS::JSObject::isGlobalObject):
735 2007-10-24 Eric Seidel <eric@webkit.org>
737 Build fix for Gtk, no review.
739 * kjs/collector.cpp: #include "context.h"
741 2007-10-24 Eric Seidel <eric@webkit.org>
745 Stop checking isOutOfMemory after every allocation, instead let the collector
746 notify all ExecStates if we ever hit this rare condition.
748 SunSpider claims this was a 2.2% speedup.
751 (KJS::Collector::collect):
752 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
755 (KJS::TryNode::execute):
757 2007-10-24 Mark Rowe <mrowe@apple.com>
761 * kjs/identifier.h: Remove extra qualification.
763 2007-10-24 Geoffrey Garen <ggaren@apple.com>
765 Reviewed by Sam Weinig.
767 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
770 * wtf/AlwaysInline.h:
772 2007-10-24 Geoffrey Garen <ggaren@apple.com>
774 Reviewed by Sam Weinig.
776 Inlined the fast path for creating an Identifier from an Identifier.
778 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
779 speedup on certain individual tests. 65% of the Identifiers creating
780 by SunSpider are already Identifiers.
782 (The main reason I'm making this change is that it resolves a large
783 regression in a patch I haven't checked in yet.)
785 * JavaScriptCore.exp:
786 * kjs/identifier.cpp:
787 (KJS::Identifier::addSlowCase):
789 (KJS::Identifier::Identifier::add):
791 2007-10-24 Lars Knoll <lars@trolltech.com>
795 some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's.
797 * bindings/qt/qt_instance.cpp:
798 (KJS::Bindings::QtInstance::invokeMethod):
799 * bindings/qt/qt_runtime.cpp:
800 (KJS::Bindings::convertValueToQVariant):
801 (KJS::Bindings::QtField::setValueToInstance):
803 2007-10-24 Oliver Hunt <oliver@apple.com>
807 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
812 (KJS::LessNode::evaluate):
813 (KJS::GreaterNode::evaluate):
814 (KJS::LessEqNode::evaluate):
815 (KJS::GreaterEqNode::evaluate):
816 * kjs/operations.cpp:
819 2007-10-24 Eric Seidel <eric@webkit.org>
824 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
826 2007-10-24 Darin Adler <darin@apple.com>
830 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
831 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
833 2007-10-24 Darin Adler <darin@apple.com>
837 - separate out the code to create a hash table the first time from the code
840 SunSpider claims this was a 0.7% speedup.
842 * kjs/property_map.cpp:
843 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
844 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
845 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
847 * kjs/property_map.h: Added createTable.
849 2007-10-24 Eric Seidel <eric@webkit.org>
853 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
854 which can be represented by JSImmediate.
856 SunSpider claims this was a 0.6% speedup.
860 (KJS::NumberNode::evaluate):
861 (KJS::ImmediateNumberNode::evaluate):
864 (KJS::ImmediateNumberNode::):
865 * kjs/nodes2string.cpp:
866 (ImmediateNumberNode::streamTo):
868 2007-10-24 Darin Adler <darin@apple.com>
872 - http://bugs.webkit.org/show_bug.cgi?id=15657
873 change static hash tables to use powers of two for speed
875 Seems to give 0.7% SunSpider speedup.
877 * kjs/create_hash_table: Updated to generate new format.
879 (KJS::keysMatch): Took out unneeded typecast.
880 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
881 Replaced the modulus with a bit mask.
882 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
883 their hash -- saves a branch.
884 (KJS::Lookup::find): Ditto.
885 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
887 2007-10-24 Maciej Stachowiak <mjs@apple.com>
891 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
894 (KJS::DoWhileNode::execute):
895 (KJS::WhileNode::execute):
896 (KJS::ForNode::execute):
897 (KJS::ForInNode::execute):
898 (KJS::SourceElementsNode::execute):
900 2007-10-23 Darin Adler <darin@apple.com>
904 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
905 Changed an && to an & for a 1% gain in SunSpider.
907 2007-10-23 Oliver Hunt <oliver@apple.com>
911 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
914 (KJS::MultNode::evaluate):
915 (KJS::DivNode::evaluate):
916 (KJS::ModNode::evaluate):
919 (KJS::AddNode::evaluate):
920 (KJS::SubNode::evaluate):
921 (KJS::valueForReadModifyAssignment):
922 * kjs/operations.cpp:
925 2007-10-23 Oliver Hunt <oliver@apple.com>
929 Separating all of the simple (eg. non-read-modify-write) binary operators
930 into separate classes in preparation for further JS optimisations.
932 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
935 * JavaScriptCore.xcodeproj/project.pbxproj:
938 (KJS::MultNode::evaluate):
939 (KJS::DivNode::evaluate):
940 (KJS::ModNode::evaluate):
941 (KJS::AddNode::evaluate):
942 (KJS::SubNode::evaluate):
943 (KJS::LeftShiftNode::evaluate):
944 (KJS::RightShiftNode::evaluate):
945 (KJS::UnsignedRightShiftNode::evaluate):
946 (KJS::LessNode::evaluate):
947 (KJS::GreaterNode::evaluate):
948 (KJS::LessEqNode::evaluate):
949 (KJS::GreaterEqNode::evaluate):
950 (KJS::InstanceOfNode::evaluate):
951 (KJS::InNode::evaluate):
952 (KJS::EqualNode::evaluate):
953 (KJS::NotEqualNode::evaluate):
954 (KJS::StrictEqualNode::evaluate):
955 (KJS::NotStrictEqualNode::evaluate):
956 (KJS::BitAndNode::evaluate):
957 (KJS::BitXOrNode::evaluate):
958 (KJS::BitOrNode::evaluate):
959 (KJS::LogicalAndNode::evaluate):
960 (KJS::LogicalOrNode::evaluate):
967 (KJS::LeftShiftNode::):
968 (KJS::RightShiftNode::):
969 (KJS::UnsignedRightShiftNode::):
971 (KJS::GreaterNode::):
973 (KJS::GreaterEqNode::):
974 (KJS::InstanceOfNode::):
977 (KJS::NotEqualNode::):
978 (KJS::StrictEqualNode::):
979 (KJS::NotStrictEqualNode::):
983 (KJS::LogicalAndNode::):
984 (KJS::LogicalOrNode::):
985 * kjs/nodes2string.cpp:
986 (MultNode::streamTo):
991 (LeftShiftNode::streamTo):
992 (RightShiftNode::streamTo):
993 (UnsignedRightShiftNode::streamTo):
994 (LessNode::streamTo):
995 (GreaterNode::streamTo):
996 (LessEqNode::streamTo):
997 (GreaterEqNode::streamTo):
998 (InstanceOfNode::streamTo):
1000 (EqualNode::streamTo):
1001 (NotEqualNode::streamTo):
1002 (StrictEqualNode::streamTo):
1003 (NotStrictEqualNode::streamTo):
1004 (BitAndNode::streamTo):
1005 (BitXOrNode::streamTo):
1006 (BitOrNode::streamTo):
1007 (LogicalAndNode::streamTo):
1009 2007-10-23 Darin Adler <darin@apple.com>
1013 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
1014 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
1016 Test: fast/js/math.html
1018 * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
1019 Fix abs to look at the sign bit. Add a special case for values in the range
1020 between -0 and -1 and a special case for ceil and for -0 for floor.
1022 2007-10-23 Darin Adler <darin@apple.com>
1026 - streamline exception handling code for a >1% speed-up of SunSpider
1028 * kjs/nodes.cpp: Changed macros to use functions for everything that's not
1029 part of normal execution. We'll take function call overhead when propagating
1030 an exception or out of memory.
1031 (KJS::createOutOfMemoryCompletion): Added.
1032 (KJS::substitute): Use append instead of the relatively inefficient + operator.
1033 (KJS::Node::rethrowException): Added.
1034 * kjs/nodes.h: Added rethrowException.
1036 2007-10-22 Darin Adler <darin@apple.com>
1040 - fix http://bugs.webkit.org/show_bug.cgi?id=15636
1041 some JavaScriptCore regression tests are failing due to numeric conversion
1043 This should restore correctness and make speed better too, restoring some
1044 of the optimization we lost in my last check-in.
1046 * kjs/JSImmediate.h:
1047 (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
1048 I used in my patch yesterday.
1049 (KJS::JSImmediate::getTruncatedUInt32): Ditto.
1051 * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
1053 (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
1054 a way to write this more efficiently for float.
1055 (KJS::NumberImp::getTruncatedInt32): Added.
1056 (KJS::NumberImp::getTruncatedUInt32): Added.
1058 * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
1059 (KJS::JSValue::getUInt32):
1060 (KJS::JSValue::getTruncatedInt32): Added.
1061 (KJS::JSValue::getTruncatedUInt32): Added.
1062 (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
1063 (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
1065 (KJS::JSCell::getTruncatedInt32): Added.
1066 (KJS::JSCell::getTruncatedUInt32): Added.
1067 (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
1068 (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
1070 (KJS::JSValue::toUInt32SlowCase): Ditto.
1071 (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
1073 * JavaScriptCore.exp: Updated.
1075 2007-10-22 Darin Adler <darin@apple.com>
1079 - fix http://bugs.webkit.org/show_bug.cgi?id=15632
1080 js1_5/Array/array-001.js test failing
1082 One of the JavaScriptCore tests was failing; it failed because of
1083 my change to NumberImp::getUInt32. The incorrect code I copied was
1084 from JSImmediate::getUInt32, and was a pre-existing bug.
1086 This patch fixes correctness, but will surely slow down SunSpider.
1087 We may be able to code this tighter and get the speed back.
1089 * kjs/JSImmediate.h:
1090 (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
1091 reflect the fact that this function only returns true if the value is
1092 accurate (no fractional part, etc.). Changed code so that it returns
1093 false when the value has a fraction.
1094 (KJS::JSImmediate::getUInt32): Ditto.
1097 (KJS::NumberImp::getInt32): Changed code so that it returns false when
1098 the value has a fraction. Restores the old behavior.
1099 (KJS::NumberImp::getUInt32): Ditto.
1102 (KJS::JSValue::getInt32): Updated for name change.
1103 (KJS::JSValue::getUInt32): Ditto.
1104 (KJS::JSValue::toInt32): Ditto.
1105 (KJS::JSValue::toUInt32): Ditto.
1107 2007-10-22 Darin Adler <darin@apple.com>
1111 - fix crash seen when running JavaScriptCore tests
1113 * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
1114 Copy and paste error: I accidentally had code here that was
1115 making a copy of the HashMap -- that's illegal inside a mark
1116 function and was unnecessary. The other callsite was modifying
1117 the map as it iterated it, but this function is not.
1119 2007-10-22 Maciej Stachowiak <mjs@apple.com>
1123 - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
1124 http://bugs.webkit.org/show_bug.cgi?id=15627
1126 * kjs/JSImmediate.h:
1127 (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
1128 registers since this is very slow.
1130 2007-10-22 Darin Adler <darin@apple.com>
1132 Reviewed by Eric Seidel.
1134 - http://bugs.webkit.org/show_bug.cgi?id=15617
1135 improve speed of integer conversions
1137 Makes SunSpider 6% faster.
1139 * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
1142 (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
1144 * kjs/internal.h: Added getInt32.
1146 (KJS::NumberImp::getInt32): Added.
1147 (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
1148 stolen from JSValue.
1151 (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
1153 (KJS::JSValue::getInt32): Added.
1154 (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
1155 to avoid converting from float to double.
1156 (KJS::JSValue::toInt32): Made inline, separated out the slow case.
1157 (KJS::JSValue::toUInt32): Ditto.
1159 (KJS::JSCell::getInt32): Added.
1160 (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
1161 new getInt32. Added a faster case for in-range numbers.
1162 (KJS::JSValue::toUInt32SlowCase): Ditto.
1163 (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
1165 * JavaScriptCore.exp: Updated for changes.
1167 2007-10-22 Adam Roben <aroben@apple.com>
1171 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
1172 warning about implicit conversion to bool.
1174 2007-10-22 Mark Rowe <mrowe@apple.com>
1178 * kjs/array_instance.cpp:
1180 2007-10-22 Darin Adler <darin@apple.com>
1184 - http://bugs.webkit.org/show_bug.cgi?id=15606
1185 make cut-off for sparse vs. dense arrays smarter for speed with large arrays
1187 Makes the morph test in SunSpider 26% faster, and the overall
1188 benchmark 3% faster.
1190 This also fixes some small problems we had with the distinction
1191 between nonexistent and undefined values in arrays.
1193 * kjs/array_instance.h: Tweaked formatting and naming.
1194 * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
1195 (KJS::storageSize): Added. Computes the size of the storage given a vector length.
1196 (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
1197 (KJS::isDenseEnoughForVector): Added.
1198 (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
1199 (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
1200 (KJS::ArrayInstance::getItem): Updated for name changes.
1201 (KJS::ArrayInstance::lengthGetter): Ditto.
1202 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
1203 getOwnPropertySlot to share more code.
1204 (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
1205 (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
1206 array is dense enough. Also keep m_numValuesInVector up to date.
1207 (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
1209 (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
1210 for array indices with undefined values.
1211 (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
1212 simplified to only handle getting larger.
1213 (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
1214 zero out the unused part of the vector and to delete the map if it's no longer
1216 (KJS::ArrayInstance::mark): Tweaked formatting.
1217 (KJS::compareByStringForQSort): Ditto.
1218 (KJS::ArrayInstance::sort): Ditto.
1219 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1221 (KJS::compareWithCompareFunctionForQSort): Ditto.
1222 (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
1223 undefined values into nonexistent values in some cases.
1225 * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
1226 * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
1228 * JavaScriptCore.pri: Added array_instance.cpp.
1229 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
1230 * kjs/AllInOneFile.cpp: Ditto.
1232 2007-10-22 Andrew Wellington <proton@wiretapped.net>
1234 Reviewed by Mark Rowe.
1236 Fix for local database support after r26879
1237 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
1239 * Configurations/JavaScriptCore.xcconfig:
1241 2007-10-22 Simon Hausmann <hausmann@kde.org>
1245 Build fix for the non-qmake builds.
1247 * wtf/Platform.h: Default to enabling the database features unless
1248 otherwise specified. (similar to ENABLE_ICONDATABASE)
1250 2007-10-22 Holger Freyther <zecke@selfish.org>
1252 Reviewed by Simon Hausmann <hausmann@kde.org>.
1254 * Do not build testkjs as an application bundle. This is
1255 needed for run-javascriptcore-tests on OSX.
1256 * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
1257 * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
1258 as we do not have -rpath on OSX.
1262 2007-10-21 Mark Rowe <mrowe@apple.com>
1266 http://bugs.webkit.org/show_bug.cgi?id=15575
1267 Bug 15575: [GTK] Implement threading using GThread
1269 * wtf/Platform.h: Do not enable pthreads for Gtk.
1271 2007-10-21 Mark Rowe <mrowe@apple.com>
1275 Fix http://bugs.webkit.org/show_bug.cgi?id=15603
1276 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
1278 * kjs/array_object.cpp:
1279 (KJS::freeStorage): Reinstate null-check that was removed in r26847.
1281 2007-10-21 Darin Adler <darin@apple.com>
1285 * kjs/array_instance.h: Removed unused ExecState parameter.
1286 * kjs/array_object.cpp:
1287 (KJS::ArrayInstance::put): Ditto.
1288 (KJS::ArrayInstance::setLength): Ditto.
1290 2007-10-21 Darin Adler <darin@apple.com>
1292 * kjs/array_object.cpp: (KJS::ArrayInstance::put):
1293 Add missing assignment that was causing regression test crash.
1295 2007-10-21 Darin Adler <darin@apple.com>
1299 - http://bugs.webkit.org/show_bug.cgi?id=15585
1300 speed up sparse arrays by using a custom map
1302 Speeds up SunSpider by 10%.
1304 * kjs/array_object.cpp:
1305 (allocateStorage): Leave room for an additional pointer.
1306 (reallocateStorage): Ditto.
1307 (freeStorage): Ditto.
1308 (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
1309 (ArrayInstance::getItem): Read values from the overflow map if present.
1310 Removed the check of length, since it slows down the common case.
1311 (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
1312 to the property map.
1313 (ArrayInstance::put): Write values into the overflow map as needed.
1314 Also create overflow map when needed.
1315 (ArrayInstance::deleteProperty): Remove values from the overflow map
1317 (ArrayInstance::getPropertyNames): Add a name for each identifier in
1318 the property map. This is extremely inefficient.
1319 (ArrayInstance::setLength): Remove any values in the overflow map
1320 that are past the new length, as we formerly did with the property map.
1321 (ArrayInstance::mark): Mark any values in the overflow map.
1322 (compareByStringForQSort): Removed unneeded undefined case, since
1323 compactForSorting guarantees we will have no undefined values.
1324 (compareWithCompareFunctionForQSort): Ditto.
1325 (ArrayInstance::compactForSorting): Copy all the values out of the
1326 overflow map and destroy it.
1328 * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
1329 * kjs/property_map.cpp: Ditto.
1331 2007-10-20 Darin Adler <darin@apple.com>
1335 - http://bugs.webkit.org/show_bug.cgi?id=15579
1336 stop churning identifier reference counts copying Completion objects
1338 * kjs/completion.h: Replace the Identifier with an Identifier*.
1340 (ForInNode::execute): Update for change to Completion constructor.
1341 (ContinueNode::execute): Ditto.
1342 (BreakNode::execute): Ditto.
1344 2007-10-20 Mark Rowe <mrowe@apple.com>
1348 Gtk changes needed to enable HTML 5 client-side database storage.
1350 * wtf/Platform.h: Have Gtk use pthreads for now.
1352 2007-10-20 Geoffrey Garen <ggaren@apple.com>
1354 Reviewed by Maciej Stachowiak.
1356 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
1357 Store gathered declaration nodes in the function body node.
1359 This means that you only have to gather the declaration nodes the first
1360 time the function executes. Performance gain of 2.10% on SunSpider,
1361 0.90% on command-line JS iBench.
1363 * kjs/nodes.cpp: Split declaration stack initialization code off into
1364 initializeDeclarationStacks().
1365 (FunctionBodyNode::FunctionBodyNode):
1366 (FunctionBodyNode::initializeDeclarationStacks):
1367 (FunctionBodyNode::processDeclarations):
1369 * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
1370 since the actual Vectors are now stored either on the stack or in the
1373 2007-10-19 Geoffrey Garen <ggaren@apple.com>
1375 Reviewed by Darin Adler.
1377 http://bugs.webkit.org/show_bug.cgi?id=15559
1378 Moved processDeclarations call into FunctionBodyNode::execute
1380 To improve encapsulation, moved processDeclarations call into
1381 FunctionBodyNode::execute. Also marked processDeclarations
1382 ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
1383 on command-line JS iBench.
1386 (KJS::FunctionImp::callAsFunction):
1387 (KJS::GlobalFuncImp::callAsFunction):
1389 * kjs/interpreter.cpp:
1390 (KJS::Interpreter::evaluate):
1392 (FunctionBodyNode::execute):
1395 2007-10-19 Brady Eidson <beidson@apple.com>
1399 Queue -> Deque! and small style tweaks
1401 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1402 * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
1403 * wtf/Deque.h: Added.
1404 (WTF::DequeNode::DequeNode):
1405 (WTF::Deque::Deque):
1406 (WTF::Deque::~Deque):
1408 (WTF::Deque::isEmpty):
1409 (WTF::Deque::append):
1410 (WTF::Deque::prepend):
1411 (WTF::Deque::first):
1413 (WTF::Deque::removeFirst):
1414 (WTF::Deque::clear):
1415 * wtf/Queue.h: Removed.
1418 2007-10-19 Brady Eidson <beidson@apple.com>
1422 Added a simple LinkedList based Queue to wtf
1423 We can make a better, more sophisticated an efficient one later, but have
1424 needed one for some time, now!
1426 * JavaScriptCore.xcodeproj/project.pbxproj:
1427 * wtf/Queue.h: Added.
1428 (WTF::QueueNode::QueueNode):
1429 (WTF::Queue::Queue):
1430 (WTF::Queue::~Queue):
1432 (WTF::Queue::isEmpty):
1433 (WTF::Queue::append):
1434 (WTF::Queue::prepend):
1435 (WTF::Queue::first):
1437 (WTF::Queue::removeFirst):
1438 (WTF::Queue::clear):
1440 2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
1444 Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
1446 * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
1448 2007-10-19 Simon Hausmann <hausmann@kde.org>
1452 Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
1453 Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
1456 (WTF::isASCIIAlpha):
1457 (WTF::isASCIIAlphanumeric):
1458 (WTF::isASCIIDigit):
1459 (WTF::isASCIIHexDigit):
1460 (WTF::isASCIILower):
1461 (WTF::isASCIISpace):
1462 (WTF::toASCIILower):
1463 (WTF::toASCIIUpper):
1465 2007-10-19 Simon Hausmann <hausmann@kde.org>
1469 Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
1473 2007-10-18 Maciej Stachowiak <mjs@apple.com>
1477 - use __declspec(thread) for fast thread-local storage on Windows
1479 - 2.2% speedup on sunspider (on Windows)
1480 - 7% speedup on the string section
1481 - 6% speedup on JS iBench
1483 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
1484 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
1487 * wtf/FastMalloc.cpp:
1488 (WTF::getThreadHeap):
1489 (WTF::setThreadHeap):
1490 (WTF::TCMalloc_ThreadCache::GetCache):
1491 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
1492 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1494 2007-10-17 Darin Adler <darin@apple.com>
1496 Reviewed by Mark Rowe.
1498 - fix http://bugs.webkit.org/show_bug.cgi?id=15543
1499 <rdar://problem/5545639> REGRESSION (r26697):
1500 GoogleDocs: Can't create new documents or open existing ones
1502 Test: fast/js/regexp-non-character.html
1504 * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
1505 in the \u sequences -- not needed and actively harmful.
1507 2007-10-17 Anders Carlsson <andersca@apple.com>
1512 #define USE_PTHREADS on Mac.
1514 2007-10-17 Geoffrey Garen <ggaren@apple.com>
1516 Reviewed by Darin Adler.
1518 Merged DeclaredFunctionImp into FunctionImp (the base class) because
1519 the distinction between the two was unused.
1521 Removed codeType() from FunctionImp because FunctionImp and its
1522 subclasses all returned FunctionCode, so it was unused, practically
1525 Removed a different codeType() from GlobalFuncImp because it was unused.
1526 (Perhaps it was vestigial from a time when GlobalFuncImp used to
1527 inherit from FunctionImp.)
1529 * bindings/runtime_method.cpp:
1530 * bindings/runtime_method.h:
1533 (KJS::FunctionImp::FunctionImp):
1534 (KJS::FunctionImp::callAsFunction):
1535 (KJS::FunctionImp::construct):
1536 (KJS::FunctionImp::execute):
1537 (KJS::FunctionImp::processVarDecls):
1539 (KJS::FunctionImp::implementsConstruct):
1540 (KJS::FunctionImp::scope):
1541 * kjs/function_object.cpp:
1542 (FunctionProtoFunc::callAsFunction):
1543 (FunctionObjectImp::construct):
1545 (FuncDeclNode::processFuncDecl):
1546 (FuncExprNode::evaluate):
1548 2007-10-17 Adam Roben <aroben@apple.com>
1550 Windows build fix part 2.
1552 Fix was by Darin, reviewed by Anders and Adam.
1554 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
1555 FastMallocPCRE.cpp to the project, and let Visual Studio have its way
1556 with the post-build step.
1557 * pcre/pcre.h: Don't DLL export the entry points just because this
1558 is Win32 -- this is an internal copy of PCRE and should be private.
1559 * pcre/pcre_compile.c: Fix an uninitialized variable warning --
1560 there's no real problem but it's better to quiet the compiler by
1561 tweaking the code slightly than turn off the warning entirely.
1563 2007-10-17 Adam Roben <aroben@apple.com>
1569 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1570 some mismatched signed/unsigned comparison warnings.
1572 (match): #if-out some labels that don't seem to exist.
1574 2007-10-17 Mark Rowe <mrowe@apple.com>
1578 * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
1579 * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
1580 is currently unavailable for UTF-16.
1582 2007-10-16 Darin Adler <darin@apple.com>
1586 - merged PCRE changes between 6.4 and 6.5
1588 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1589 * JavaScriptCore.xcodeproj/project.pbxproj:
1590 Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
1591 pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
1592 pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
1598 * pcre/pcre-config.h:
1601 * pcre/pcre_compile.c:
1603 * pcre/pcre_fullinfo.c:
1605 * pcre/pcre_internal.h:
1606 * pcre/pcre_maketables.c:
1607 * pcre/pcre_ord2utf8.c:
1608 * pcre/pcre_tables.c:
1609 * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
1610 * pcre/pcre_xclass.c:
1612 * pcre/ucpinternal.h:
1614 Updated with new versions from the PCRE 6.5 release, merged with changes.
1616 * pcre/pcre_config.c: Removed.
1617 * pcre/pcre_globals.c: Removed.
1618 * pcre/pcre_info.c: Removed.
1619 * pcre/pcre_printint.src: Removed.
1620 * pcre/pcre_refcount.c: Removed.
1621 * pcre/pcre_study.c: Removed.
1622 * pcre/pcre_try_flipped.c: Removed.
1623 * pcre/pcre_ucp_findchar.c: Removed.
1624 * pcre/pcre_version.c: Removed.
1626 2007-10-16 Geoffrey Garen <ggaren@apple.com>
1628 Reviewed by Darin Adler.
1630 Removed KJS_VERBOSE because it was getting in the way of readability,
1631 and the messages didn't seem very helpful.
1634 (KJS::FunctionImp::callAsFunction):
1635 (KJS::FunctionImp::passInParameters):
1639 (KJS::JSObject::put):
1642 2007-10-16 Geoffrey Garen <ggaren@apple.com>
1644 Reviewed by Darin Adler.
1646 Removed the Parameter class because it was a redundant wrapper around
1650 (KJS::FunctionImp::passInParameters):
1651 (KJS::FunctionImp::getParameterName):
1653 (FunctionBodyNode::addParam):
1655 (KJS::FunctionBodyNode::):
1657 2007-10-16 Geoffrey Garen <ggaren@apple.com>
1659 Reviewed by Darin Adler.
1661 Global replace of assert with ASSERT.
1663 2007-10-16 Adam Roben <aroben@apple.com>
1665 Make testkjs not delay-load WebKit
1667 Soon, delay-loading WebKit will be impossible (because we will be
1668 using __declspec(thread) for thread-local storage). This change
1669 prepares testkjs for the future.
1673 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
1675 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
1676 WebKitInitializer, don't delay-load WebKit.
1677 * kjs/testkjs.cpp: Don't use WebKitInitializer.
1679 2007-10-16 Adam Roben <aroben@apple.com>
1681 Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
1683 Reviewed by Kevin McCullough.
1685 * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
1686 * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
1687 * JavaScriptCore.vcproj/release.vsprops: Ditto.
1688 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
1689 WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
1690 in the name of icuuc36[_debug].dll.
1692 2007-10-16 Geoffrey Garen <ggaren@apple.com>
1694 Reviewed by Maciej Stachowiak.
1696 Re-structured variable and function declaration code.
1698 Command-line JS iBench shows no regression.
1700 Here are the changes:
1702 1. Function declarations are now processed at the same time as var
1703 declarations -- namely, immediately upon entry to an execution context.
1704 This does not match Firefox, which waits to process a function
1705 declaration until the declaration's containing block executes, but it
1706 does match IE and the ECMA spec. (10.1.3 states that var and function
1707 declarations should be processed at the same time -- namely, "On
1708 entering an execution context." 12.2 states that "A Block does not
1709 define a new execution scope.")
1711 2. Declaration processing proceeds iteratively now, rather than
1712 recursively, storing the nodes is finds in stacks. This will later
1713 facilitate an optimization to hold on to the gathered declaration nodes,
1714 rather than re-fetching them in every function call.
1715 [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1717 Modified these tests because they expected the incorrect Mozilla
1718 behavior described above:
1720 * tests/mozilla/ecma_3/Function/scope-001.js:
1721 * tests/mozilla/js1_5/Scope/regress-184107.js:
1723 2007-10-16 Darin Adler <darin@apple.com>
1725 - try to fix the GTK build
1727 * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
1729 2007-10-16 Darin Adler <darin@apple.com>
1731 - try to fix the Windows build
1733 * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
1734 in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
1736 2007-10-16 Darin Adler <darin@apple.com>
1738 - try to fix the GTK build
1740 * kjs/ustring.cpp: Include ASCIICType.h.
1742 2007-10-16 Darin Adler <darin@apple.com>
1744 Reviewed by Maciej and Geoff (and looked over by Eric).
1746 - http://bugs.webkit.org/show_bug.cgi?id=15519
1747 eliminate use of <ctype.h> for processing ASCII
1749 * wtf/ASCIICType.h: Added.
1750 * wtf/DisallowCType.h: Added.
1752 * kjs/config.h: Include DisallowCType.h.
1754 * kjs/date_object.cpp:
1755 (KJS::skipSpacesAndComments):
1761 (KJS::UString::toDouble):
1762 Use ASCIICType.h functions instead of ctype.h ones.
1764 2007-10-14 Maciej Stachowiak <mjs@apple.com>
1768 - fixes for "New JavaScript benchmark"
1769 http://bugs.webkit.org/show_bug.cgi?id=15515
1772 (TestFunctionImp::callAsFunction): Implement "load" for compatibility
1774 (TestFunctionImp::): ditto
1776 (kjsmain): Drop useless --> from output.
1778 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1780 Removed unnecessary #include.
1782 * API/JSObjectRef.cpp:
1784 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1786 Double-reverse build fix. My tree was out of date.
1789 (NumberNode::evaluate):
1791 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1796 (NumberNode::evaluate):
1798 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1800 Reviewed by Darin Adler.
1802 Removed surprising self-named "hack" that made nested functions
1803 available as named properties of their containing functions, and placed
1804 containing function objects in the scope chains of nested functions.
1806 There were a few reasons to remove this "hack:"
1808 1. It contradicted FF, IE, and the ECMA spec.
1810 2. It incurred a performance penalty, since merely parsing a function
1811 required parsing its body for nested functions (and so on).
1813 3. SVN history contains no explanation for why it was added. It was just
1814 legacy code in a large merge a long, long time ago.
1816 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1819 (FuncDeclNode::processFuncDecl):
1821 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1823 Reviewed by Darin Adler.
1825 Removed the concept of AnonymousCode. It was unused, and it doesn't
1826 exist in the ECMA spec.
1828 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1831 (KJS::Context::Context):
1835 (ReturnNode::execute):
1837 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1839 Reviewed by Darin Adler.
1841 Made function parameters DontDelete. This matches FF and the vague
1842 description in ECMA 10.1.3. It's also required in order to make
1843 symbol table based lookup of function parameters valid. (If the
1844 parameters aren't DontDelete, you can't guarantee that you'll find
1845 them later in the symbol table.)
1847 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1850 (KJS::FunctionImp::passInParameters):
1852 2007-10-15 Geoffrey Garen <ggaren@apple.com>
1854 Reviewed by Maciej Stachowiak.
1856 Some Vector optimizations. These are especially important when using
1857 Vector as a stack for implementing recursive algorithms iteratively.
1859 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1861 1. Added shrink(), which is a version of resize() that you can call
1862 to save a branch / improve code generation and inlining when you know
1863 that the vector is not getting bigger.
1865 2. Changed subclassing relationship in VectorBuffer to remove a call to
1866 fastFree() in the destructor for the inlineCapacity != 0 template
1867 specialization. This brings inline Vectors one step closer to true
1868 stack-allocated arrays.
1870 Also changed abort() to CRASH(), since the latter works better.
1873 (WTF::VectorBufferBase::allocateBuffer):
1874 (WTF::VectorBufferBase::deallocateBuffer):
1875 (WTF::VectorBufferBase::VectorBufferBase):
1876 (WTF::VectorBufferBase::~VectorBufferBase):
1878 (WTF::VectorBuffer::VectorBuffer):
1879 (WTF::VectorBuffer::~VectorBuffer):
1880 (WTF::VectorBuffer::deallocateBuffer):
1881 (WTF::VectorBuffer::releaseBuffer):
1882 (WTF::Vector::clear):
1883 (WTF::Vector::removeLast):
1888 2007-10-12 Geoffrey Garen <ggaren@apple.com>
1890 Reviewed by Maciej Stachowiak.
1892 Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
1893 Iteration statements sometimes incorrectly evaluate to the empty value
1896 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1898 This patch is a merge of KDE r670547, with substantial modification
1901 It fixes do-while statements to evaluate to a value. (They used
1902 to evaluate to the empty value in all cases.)
1904 It also fixes SourceElementsNode to maintain the value of abnormal
1905 completions like "break" and "continue."
1907 It also re-works the main execution loop in SourceElementsNode so that
1908 it (1) makes a little more sense and (2) avoids unnecessary work. This
1909 is a .28% speedup on command-line JS iBench.
1912 (DoWhileNode::execute):
1913 (SourceElementsNode::execute):
1915 2007-10-15 Simon Hausmann <hausmann@kde.org>
1919 Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
1923 2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
1927 Add support for MSVC7, and fix cases where PLATFORM(WIN) should
1928 be PLATFORM(WIN_OS) for other ports building on Windows.
1931 (KJS::getDSTOffsetSimple):
1932 * kjs/JSImmediate.h:
1933 * wtf/Assertions.cpp:
1936 * wtf/StringExtras.h:
1940 2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1944 Adds NegateNode optimization from KJS. The relevant revision in KDE
1949 (NumberNode::evaluate):
1952 (KJS::NumberNode::):
1953 * kjs/nodes2string.cpp:
1954 (NumberNode::streamTo):
1956 2007-10-14 Jason Foreman <jason@threeve.org>
1960 Fix http://bugs.webkit.org/show_bug.cgi?id=15145
1962 Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
1963 that the property n < intPow10(p) is maintained.
1965 * kjs/number_object.cpp:
1966 (NumberProtoFunc::callAsFunction):
1968 == Rolled over to ChangeLog-2007-10-14 ==