1 2008-08-10 Jan Michael Alonzo <jmalonzo@webkit.org>
3 Reviewed (and updated) by Alp Toker.
5 https://bugs.webkit.org/show_bug.cgi?id=16620
6 [GTK] Autotools make dist and make check support
10 Note that not all possible configurations have been tested yet.
14 2008-08-09 Alexey Proskuryakov <ap@webkit.org>
16 Reviewed by Sam Weinig.
18 Added same heap debug checks to more code paths.
20 * kjs/JSActivation.cpp:
21 (KJS::JSActivation::put):
22 (KJS::JSActivation::putWithAttributes):
23 * kjs/JSGlobalObject.cpp:
24 (KJS::JSGlobalObject::putWithAttributes):
26 (KJS::JSObject::putDirect):
27 * kjs/JSVariableObject.h:
28 (KJS::JSVariableObject::symbolTablePut):
29 (KJS::JSVariableObject::symbolTablePutWithAttributes):
31 2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
35 Fix some style issues in the sampling tool.
37 * VM/SamplingTool.cpp:
38 (KJS::sleepForMicroseconds):
39 (KJS::SamplingTool::dump):
41 2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
45 Revision 35651, despite being a rather trivial change, introduced a
46 large regression on the regexp-dna SunSpider test. This regression
47 stemmed from an increase in the size of CodeBlock::dump(). There is
48 no reason for this method (and several related methods) to be compiled
49 in non-debug builds with the sampling tool disabled. This patch
50 conditionally compiles them, reversing the regression on SunSpider.
57 2008-08-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
61 Bug 20330: JSCore crash loading any filehurricane media page
62 <https://bugs.webkit.org/show_bug.cgi?id=20330>
64 Fix a typo in the constant loading patch. Also, add a case for
65 op_unexpected_load to CodeBlock::dump().
68 (KJS::CodeBlock::dump):
69 * VM/CodeGenerator.cpp:
70 (KJS::CodeGenerator::addUnexpectedConstant):
72 2008-08-08 Matt Lilek <webkit@mattlilek.com>
74 Not reviewed, build fix.
78 2008-08-08 Oliver Hunt <oliver@apple.com>
80 Reviewed by Cameron Zwarich.
82 Improve performance of arithmetic operators
84 Added a fast (non-virtual) mechanism to determine if a non-immediate JSValue*
85 is a JSNumberCell. We then use this to allow improved specialisation in many
86 arithmetic operators. SunSpider reports a 2.5% progression overall, with greater
87 than 10% progressions on a number of arithmetic heavy tests.
96 (KJS::Machine::privateExecute):
98 (KJS::JSNumberCell::fastToInt32):
99 (KJS::JSNumberCell::fastToUInt32):
101 (KJS::allocateBlock):
102 (KJS::Heap::heapAllocate):
104 (KJS::Heap::fastIsNumber):
106 2008-08-06 Adam Roben <aroben@apple.com>
108 Try to fix the Windows build bots
110 * API/JSBase.cpp: Touch this to force JSC to rebuild and re-copy the
113 2008-08-06 Tor Arne Vestbø <tavestbo@trolltech.com>
119 2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
123 * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
125 2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
129 * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
131 2008-08-06 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
133 Reviewed by Darin. Landed by Cameron.
135 Bug 20272: typo in JavaScriptCore
136 <https://bugs.webkit.org/show_bug.cgi?id=20272>
138 Correct the documentation for op_not. (typo)
142 (KJS::Machine::privateExecute):
144 2008-08-06 Cameron Zwarich <cwzwarich@webkit.org>
148 Bug 20286: Load constants all at once instead of using op_load
149 <https://bugs.webkit.org/show_bug.cgi?id=20286>
151 Load constants all at once into temporary registers instead of using
152 individual instances of op_load.
154 This is a 2.6% speedup on SunSpider.
156 * JavaScriptCore.exp:
158 (KJS::CodeBlock::dump):
159 (KJS::CodeBlock::mark):
161 * VM/CodeGenerator.cpp:
162 (KJS::CodeGenerator::CodeGenerator):
163 (KJS::CodeGenerator::newTemporary):
164 (KJS::CodeGenerator::addConstant):
165 (KJS::CodeGenerator::addUnexpectedConstant):
166 (KJS::CodeGenerator::emitLoad):
167 (KJS::CodeGenerator::emitUnexpectedLoad):
168 (KJS::CodeGenerator::emitNewError):
169 * VM/CodeGenerator.h:
171 (KJS::slideRegisterWindowForCall):
172 (KJS::Machine::unwindCallFrame):
173 (KJS::Machine::throwException):
174 (KJS::Machine::execute):
175 (KJS::Machine::privateExecute):
179 (KJS::RegisterID::RegisterID):
180 (KJS::RegisterID::makeConstant):
181 (KJS::RegisterID::isTemporary):
184 (KJS::Parser::didFinishParsing):
186 (KJS::Parser::parse):
189 (KJS::NullNode::emitCode):
190 (KJS::BooleanNode::emitCode):
191 (KJS::NumberNode::emitCode):
192 (KJS::StringNode::emitCode):
193 (KJS::ArrayNode::emitCode):
194 (KJS::DeleteResolveNode::emitCode):
195 (KJS::DeleteValueNode::emitCode):
196 (KJS::VoidNode::emitCode):
197 (KJS::ConstDeclNode::emitCodeSingle):
198 (KJS::ReturnNode::emitCode):
199 (KJS::ScopeNode::ScopeNode):
200 (KJS::ProgramNode::ProgramNode):
201 (KJS::ProgramNode::create):
202 (KJS::EvalNode::EvalNode):
203 (KJS::EvalNode::create):
204 (KJS::FunctionBodyNode::FunctionBodyNode):
205 (KJS::FunctionBodyNode::create):
206 (KJS::FunctionBodyNode::emitCode):
208 (KJS::ScopeNode::neededConstants):
210 2008-08-05 Maciej Stachowiak <mjs@apple.com>
214 - add fast path for immediates to % operator, as we have for many other math ops
216 This fixes handling for a 0 divisor relative to the last patch. Only an 0.2% speedup on SunSpider but
217 still a 1.4x win on Oliver's prime test.
220 (KJS::Machine::privateExecute):
222 2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
226 Bug 20293: Crash in JavaScript codegen for eval("const a;")
227 <https://bugs.webkit.org/show_bug.cgi?id=20293>
229 Correctly handle constant declarations in eval code with no initializer.
232 (KJS::ConstDeclNode::emitCodeSingle):
234 2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
238 Roll out r35555 because of correctness issues.
241 (KJS::Machine::privateExecute):
243 2008-08-05 Maciej Stachowiak <mjs@apple.com>
247 - add fast path for immediates to % operator, as we have for many other math ops
249 0.6% speedup on SunSpider. 1.4x speedup on a prime testing torture test that Oliver whipped up.
252 (KJS::Machine::privateExecute):
254 2008-07-31 Oliver Hunt <oliver@apple.com>
256 Reviewed by Cameron Zwarich.
258 Bug 19359: JavaScriptCore behaves differently from FF2/3 and IE when handling context in catch statement
259 <https://bugs.webkit.org/show_bug.cgi?id=19359>
261 Make our catch behave like Firefox and IE, we do this by using a StaticScopeObject
262 instead of a generic JSObject for the scope node. We still don't make use of the
263 fact that we have a static scope inside the catch block, so the internal performance
264 of the catch block is not improved, even though technically it would be possible to
268 (KJS::CodeBlock::dump):
269 * VM/CodeGenerator.cpp:
270 (KJS::CodeGenerator::emitPushNewScope):
271 * VM/CodeGenerator.h:
273 (KJS::createExceptionScope):
274 (KJS::Machine::privateExecute):
277 * kjs/JSStaticScopeObject.cpp:
278 (KJS::JSStaticScopeObject::toThisObject):
279 (KJS::JSStaticScopeObject::put):
280 * kjs/JSStaticScopeObject.h:
282 (KJS::TryNode::emitCode):
284 2008-08-02 Rob Gowin <robg@gowin.net>
286 Reviewed by Eric Seidel.
288 Added JavaScriptCore/API/WebKitAvailability to list of files in
289 javascriptcore_h_api.
293 2008-08-01 Alexey Proskuryakov <ap@webkit.org>
295 Rubber-stamped by Maciej.
297 Remove JSGlobalData::DataInstance. It was only needed when we had per-thread JSGlobalData
300 * kjs/JSGlobalData.h:
302 2008-07-31 Kevin Ollivier <kevino@theolliviers.com>
304 Second attempt at Windows/wx build fix. Instead of avoiding inclusion of windows.h,
305 use defines, etc. to avoid conflicts in each affected file. Also, change PLATFORM(WIN)
306 to PLATFORM(WIN_OS) so that other ports using Windows headers get the right impls.
308 * VM/SamplingTool.cpp:
311 2008-07-31 Anders Carlsson <andersca@apple.com>
318 * wtf/FastMalloc.cpp:
320 2008-07-31 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
324 Bug 20170: [Qt] missing namespace defines in JavaScriptCore.pro
325 <https://bugs.webkit.org/show_bug.cgi?id=20170>
327 * JavaScriptCore.pro: Added missing define.
329 2008-07-31 Alexey Proskuryakov <ap@webkit.org>
331 Rubber-stamped by Maciej.
333 Eliminate JSLock (it was already disabled, removing the stub implementaion and all
338 (JSCheckScriptSyntax):
340 * API/JSCallbackConstructor.cpp:
341 (KJS::constructJSCallback):
342 * API/JSCallbackFunction.cpp:
343 (KJS::JSCallbackFunction::call):
344 * API/JSCallbackObjectFunctions.h:
346 (KJS::::getOwnPropertySlot):
348 (KJS::::deleteProperty):
350 (KJS::::hasInstance):
352 (KJS::::getPropertyNames):
355 (KJS::::staticValueGetter):
356 (KJS::::callbackGetter):
357 * API/JSContextRef.cpp:
358 (JSGlobalContextCreateInGroup):
359 (JSGlobalContextRetain):
360 (JSGlobalContextRelease):
361 * API/JSObjectRef.cpp:
363 (JSObjectMakeFunctionWithCallback):
364 (JSObjectMakeConstructor):
365 (JSObjectMakeFunction):
366 (JSObjectHasProperty):
367 (JSObjectGetProperty):
368 (JSObjectSetProperty):
369 (JSObjectGetPropertyAtIndex):
370 (JSObjectSetPropertyAtIndex):
371 (JSObjectDeleteProperty):
372 (JSObjectCallAsFunction):
373 (JSObjectCallAsConstructor):
374 (JSObjectCopyPropertyNames):
375 (JSPropertyNameArrayRelease):
376 (JSPropertyNameAccumulatorAddName):
377 * API/JSStringRef.cpp:
379 * API/JSValueRef.cpp:
381 (JSValueIsInstanceOfConstructor):
385 (JSValueToStringCopy):
389 * ForwardingHeaders/JavaScriptCore/JSLock.h: Removed.
391 * JavaScriptCore.exp:
392 * JavaScriptCore.order:
393 * JavaScriptCore.pri:
394 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
395 * JavaScriptCore.xcodeproj/project.pbxproj:
396 * JavaScriptCoreSources.bkl:
397 * kjs/AllInOneFile.cpp:
398 * kjs/JSGlobalData.cpp:
399 (KJS::JSGlobalData::JSGlobalData):
400 * kjs/JSGlobalData.h:
401 * kjs/JSGlobalObject.cpp:
402 (KJS::JSGlobalObject::~JSGlobalObject):
403 (KJS::JSGlobalObject::init):
404 * kjs/JSLock.cpp: Removed.
405 * kjs/JSLock.h: Removed.
411 (KJS::Heap::heapAllocate):
412 (KJS::Heap::setGCProtectNeedsLocking):
413 (KJS::Heap::protect):
414 (KJS::Heap::unprotect):
415 (KJS::Heap::collect):
416 * kjs/identifier.cpp:
417 * kjs/interpreter.cpp:
418 (KJS::Interpreter::checkSyntax):
419 (KJS::Interpreter::evaluate):
421 2008-07-31 Alexey Proskuryakov <ap@webkit.org>
423 Rubber-stamped by Oliver Hunt.
425 Fix the Mac project to not display "test/" as part of file name for tests.
427 * JavaScriptCore.xcodeproj/project.pbxproj:
429 2008-07-31 Eric Seidel <eric@webkit.org>
431 Reviewed by Alexey Proskuryakov.
433 Rename USE(MULTIPLE_THREADS) to ENABLE(JSC_MULTIPLE_THREADS)
434 to better match the use/enable pattern (and better describe
435 the usage of the feature in question.)
437 I also fixed a couple other ENABLE_ macros to be pre-processor
438 definition override-able to match the rest of the ENABLE_ macros
439 since it seems to be our convention that build systems can set
440 ENABLE_ macros in Makefiles.
442 * kjs/InitializeThreading.cpp:
443 (KJS::initializeThreadingOnce):
444 * kjs/JSGlobalData.cpp:
445 (KJS::JSGlobalData::JSGlobalData):
446 (KJS::JSGlobalData::~JSGlobalData):
447 * kjs/MathObject.cpp:
451 (KJS::allocateBlock):
452 (KJS::Heap::markStackObjectsConservatively):
459 * wtf/FastMalloc.cpp:
461 * wtf/RefCountedLeakCounter.cpp:
463 2008-07-30 Eric Seidel <eric@webkit.org>
465 Reviewed by Mark Rowe.
467 Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS) a little.
468 It looks like JSC assumes that if MULTIPLE_THREADS is defined, then pthreads will always be available
469 I'm not sure that's always the case for gtk, certainly not for Windows. We should eventually go back
470 and fix wtf/Threading.h to cover all these cases some day.
476 2008-07-30 Eric Seidel <eric@webkit.org>
480 MSVC warns when structs are called classes or vice versa.
481 Make all the source refer to JSGlobalData as a class.
483 * kjs/CommonIdentifiers.h:
484 * kjs/JSGlobalData.h:
488 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
490 Reviewed by Geoff Garen.
492 Add consistency checks to UString to document and enforce its design.
495 (KJS::UString::Rep::create):
496 (KJS::UString::Rep::destroy):
497 (KJS::UString::Rep::checkConsistency):
498 (KJS::UString::expandCapacity):
499 (KJS::UString::expandPreCapacity):
500 (KJS::UString::UString):
501 (KJS::UString::spliceSubstringsWithSeparators):
502 (KJS::UString::append):
504 (KJS::UString::Rep::checkConsistency):
506 2008-07-30 Gavin Barraclough <barraclough@apple.com>
508 Reviewed by Geoff Garen.
510 Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes.
512 * GNUmakefile.am: Adding SamplingTool.cpp to build.
513 * JavaScriptCore.exp: Export hooks to init & control SamplingTool.
514 * JavaScriptCore.pri: Adding SamplingTool.cpp to build.
515 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build.
516 * JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build.
517 * JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build.
518 * VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction
520 * VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID.
522 * VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool.
524 * kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL.
525 * wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option.
526 * kjs/nodes.cpp: Header include to fix non-AllInOne builds.
528 2008-07-30 Ariya Hidayat <ariya.hidayat@trolltech.com>
530 Reviewed by Alexey Proskuryakov.
532 Fix compilation without multi-threading support.
537 2008-07-30 Anders Carlsson <andersca@apple.com>
539 Add WebKitAvailability.h forwarding header.
541 * ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added.
543 2008-07-30 Anders Carlsson <andersca@apple.com>
547 * API/WebKitAvailability.h:
549 2008-07-30 Anders Carlsson <andersca@apple.com>
551 * API/WebKitAvailability.h:
552 Fix Windows (and other non-Mac builds).
554 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
555 Add WebKitAvailability.h to the project.
557 2008-07-30 Anders Carlsson <andersca@apple.com>
559 One step closer towards fixing the Windows build.
561 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
562 Make sure to copy WebKitAvailability.h
564 2008-07-29 Gavin Barraclough <barraclough@apple.com>
566 Reviewed by Geoff Garen.
568 Bug 20209: Atomize constant strings
569 <https://bugs.webkit.org/show_bug.cgi?id=20209>
571 Prevents significant performance degradation seen when a script contains multiple
572 identical strings that are used as keys to identify properties on objects.
574 No performance change on SunSpider.
576 * kjs/nodes.cpp: Atomize constant strings.
578 2008-07-30 Oliver Hunt <oliver@apple.com>
580 Reviewed by Alexey Proskuryakov.
582 <rdar://problem/6111648> JavaScript exceptions fail if the scope chain includes the global object
584 In an attempt to remove the branch I just added to KJS::depth I
585 used the existence of a Variable Object at a point in the scope
586 chain as an indicator of function or global scope activation.
587 However this assumption results in incorrect behaviour if the
588 global object is injected into the scope chain with 'with'.
593 2008-07-30 Alexey Proskuryakov <ap@webkit.org>
595 Reviewed by Geoff Garen.
597 Don't call JSGarbageCollect() on a released context.
599 * API/testapi.c: (main):
601 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
603 Reviewed by Geoff Garen.
605 Implement JSContextGroup APIs to make concurrent execution possible for
606 JavaScriptCore clients.
608 This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
609 group for each context, making JSlock implicit locking unnecessary.
611 * API/JSContextRef.h:
612 * API/JSContextRef.cpp:
613 (JSContextGroupCreate):
614 (JSContextGroupRetain):
615 (JSContextGroupRelease):
616 (JSGlobalContextCreate):
617 (JSGlobalContextCreateInGroup):
618 (JSGlobalContextRelease):
620 Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
622 * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
623 * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
624 context is actually used.
626 * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
629 * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
631 * kjs/JSGlobalData.cpp:
632 * kjs/JSGlobalData.h:
633 Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
634 variable still remains, to be deleted in a followup patch.
636 * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
639 (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
640 JSGlobalData::sharedInstance.
642 * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
644 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
646 Reviewed by Geoff Garen.
648 Fix a leak of ThreadRegistrar objects.
650 As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
651 have a chance to clean up per-thread object. Switched to native pthread calls, storing a
652 plain pointer that doesn't require cleanup.
655 (KJS::PlatformThread::PlatformThread):
656 (KJS::Heap::Thread::Thread):
659 (KJS::Heap::registerThread):
660 (KJS::Heap::unregisterThread):
663 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
665 Reviewed by Sam Weinig.
667 https://bugs.webkit.org/show_bug.cgi?id=20169
668 Memory allocated with fastMalloc is freed with delete
670 * VM/JSPropertyNameIterator.cpp:
671 (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
672 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
675 2008-07-29 Mark Rowe <mrowe@apple.com>
677 Attempt to fix the Qt build.
679 * wtf/ThreadingQt.cpp: Add the extra argument to createThread.
681 2008-07-29 Adam Roben <aroben@apple.com>
683 Change Vector::find to return an index instead of an iterator
685 Indices are more natural than iterators when working with Vector.
687 Reviewed by John Sullivan.
690 (WTF::Vector::find): Changed to iterate the Vector manually and return
691 the index of the found item, rather than an iterator. When the item
692 could not be found, we return WTF::notFound.
694 2008-07-29 Adam Roben <aroben@apple.com>
698 * wtf/ThreadingWin.cpp:
699 (WTF::setThreadName): Move a misplaced assertion to here...
700 (WTF::createThread): ...from here.
702 2008-07-29 Adam Roben <aroben@apple.com>
704 Add support for setting thread names on Windows
706 These thread names make it much easier to identify particular threads
707 in Visual Studio's Threads panel.
709 WTF::createThread now takes a const char* representing the thread's
710 name. On Windows, we throw a special exception to set this string as
711 the thread's name. Other platforms do nothing with this name for now.
713 Reviewed by Anders Carlsson.
715 * JavaScriptCore.exp: Export the new version of createThread that
716 takes 3 arguments (the old one continues to be exported for backward
718 * wtf/Threading.h: Add a threadName argument to createThread.
720 * wtf/ThreadingGtk.cpp:
722 * wtf/ThreadingNone.cpp:
724 Updated for function signature change.
726 * wtf/ThreadingPthreads.cpp:
727 (WTF::createThread): Updated for function signature change. We keep
728 around the old 2-argument version of createThread for backward
731 * wtf/ThreadingWin.cpp:
732 (WTF::setThreadName): Added. This function's implementation came from
734 (WTF::initializeThreading): Set the name of the main thread.
735 (WTF::createThread): Call setThreadName. We keep around the old
736 2-argument version of createThread for backward compatibility.
738 2008-07-29 Alexey Proskuryakov <ap@webkit.org>
740 Reviewed by Oliver Hunt.
742 Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
743 slightly nicer code and a 0.5% SunSpider improvement.
745 * API/JSClassRef.cpp:
746 (OpaqueJSClass::~OpaqueJSClass):
747 (OpaqueJSClassContextData::OpaqueJSClassContextData):
748 * API/JSStringRef.cpp:
750 * kjs/PropertyNameArray.cpp:
751 (KJS::PropertyNameArray::add):
752 * kjs/identifier.cpp:
753 (KJS::IdentifierTable::~IdentifierTable):
754 (KJS::IdentifierTable::add):
755 (KJS::Identifier::addSlowCase):
756 (KJS::Identifier::remove):
758 (KJS::Identifier::add):
761 (KJS::UString::Rep::create):
762 (KJS::UString::Rep::destroy):
764 (KJS::UString::Rep::identifierTable):
765 (KJS::UString::Rep::setIdentifierTable):
766 (KJS::UString::Rep::isStatic):
767 (KJS::UString::Rep::setStatic):
768 (KJS::UString::cost):
770 2008-07-28 Geoffrey Garen <ggaren@apple.com>
772 Reviewed by Sam Weinig.
774 Renamed "ConstructTypeNative" => "ConstructTypeHost".
776 2008-07-26 Mark Rowe <mrowe@apple.com>
778 Speculative fix for the wx build.
780 * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
782 2008-07-25 Oliver Hunt <oliver@apple.com>
786 Whoops, forgot to save style correction.
788 * kjs/JSStaticScopeObject.h:
790 2008-07-25 Oliver Hunt <oliver@apple.com>
792 Reviewed by Cameron Zwarich.
794 Bug 19718: Named anonymous functions are slow accessing global variables
795 <https://bugs.webkit.org/show_bug.cgi?id=19718>
797 To fix this we switch over to an activation-like scope object for
798 on which we attach the function name property, and add logic to
799 prevent cross scope assignment to read only properties.
802 * JavaScriptCore.pri:
803 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
804 * JavaScriptCore.xcodeproj/project.pbxproj:
805 * VM/CodeGenerator.cpp:
806 (KJS::CodeGenerator::findScopedProperty):
807 (KJS::CodeGenerator::emitResolve):
808 * VM/CodeGenerator.h:
809 * kjs/AllInOneFile.cpp:
810 * kjs/JSStaticScopeObject.cpp: Added.
811 (KJS::JSStaticScopeObject::putWithAttributes):
812 (KJS::JSStaticScopeObject::isDynamicScope):
813 (KJS::JSStaticScopeObject::~JSStaticScopeObject):
814 (KJS::JSStaticScopeObject::getOwnPropertySlot):
815 * kjs/JSStaticScopeObject.h: Added.
816 (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
817 (KJS::JSStaticScopeObject::JSStaticScopeObject):
819 (KJS::FunctionCallResolveNode::emitCode):
820 (KJS::PostfixResolveNode::emitCode):
821 (KJS::PrefixResolveNode::emitCode):
822 (KJS::ReadModifyResolveNode::emitCode):
823 (KJS::AssignResolveNode::emitCode):
824 (KJS::FuncExprNode::makeFunction):
826 2008-07-25 kevino <kevino@theolliviers.com>
828 wx build fix for Win.
830 On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
831 for libjpeg and wx, and also wx needs to include windows.h itself first for wx
832 includes to work right. So until we can find a better solution to this problem,
833 on wx, we work around the need to include windows.h here.
837 2008-07-25 Adam Roben <aroben@apple.com>
841 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
844 2008-07-25 Simon Hausmann <hausmann@webkit.org>
846 Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
847 include search path (added by WebKit.pri).
851 2008-07-25 Alexey Proskuryakov <ap@webkit.org>
853 Reviewed by Simon Hausmann.
855 Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
856 conflicts and developer confusion.
858 * API/JSNode.c: Removed.
859 * API/JSNode.h: Removed.
860 * API/JSNodeList.c: Removed.
861 * API/JSNodeList.h: Removed.
862 * API/Node.c: Removed.
863 * API/Node.h: Removed.
864 * API/NodeList.c: Removed.
865 * API/NodeList.h: Removed.
866 * API/minidom.c: Removed.
867 * API/minidom.html: Removed.
868 * API/minidom.js: Removed.
869 * API/testapi.c: Removed.
870 * API/testapi.js: Removed.
872 * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
873 * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
874 * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
875 * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
876 * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
877 * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
878 * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
879 * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
880 * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
881 * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
882 * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
883 * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
884 * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
886 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
887 * JavaScriptCore.xcodeproj/project.pbxproj:
889 2008-07-25 Simon Hausmann <hausmann@webkit.org>
891 Prospective WX build fix, add JavaScriptCore/API to the include search
896 2008-07-25 Simon Hausmann <hausmann@webkit.org>
898 Rubber-stamped by Lars.
900 Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
901 but operator delete was not implemented. Unfortunately MSVC decides to call/reference
902 the function, so a simple implementation using fastFree() fixes the build.
905 (KJS::ArgList::operator delete):
907 2008-07-25 Simon Hausmann <hausmann@webkit.org>
909 Discussed with and rubber-stamped by Lars.
911 Fix the build system for the Qt port.
913 Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
914 include search path. With a build process that combines JavaScriptCore and
915 WebCore in one build process/Makefile the existance of
916 JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
918 This commit solves this by introducing a separate build of JavaScriptCore into
921 As a result of the split-up a race-condition due to broken dependencies of
922 regular source files to header files of generated sources showed up very
923 frequently when doing parallel builds (which the buildbot does). This commit at
924 the same time tries to address the dependency problem by making the
925 addExtraCompiler() function also generate a pseudo extra compiler that
926 represents the header file output, so that qmake is aware of the creation of
927 the header file for dependency calculation.
929 At the same time I removed a lot of cruft from the pro files to ease maintenance.
931 * JavaScriptCore.pri:
932 * JavaScriptCore.pro: Added.
935 2008-07-24 Geoffrey Garen <ggaren@apple.com>
937 Reviewed by Maciej Stachowiak.
939 Fixed a strict aliasing violation, which caused hash tables with floating
940 point keys not to find items that were indeed in the tables
941 (intermittently, and only in release builds, of course).
943 SunSpider reports no change.
945 This bug doesn't seem to affect any existing code, but it causes obvious
946 crashes in some new code I'm working on.
948 * wtf/HashFunctions.h:
949 (WTF::FloatHash::hash): Use a union when punning between a float / double
950 and an unsigned (bucket of bits). With strict aliasing enabled, unions
951 are the only safe way to do this kind of type punning.
953 * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
954 the table is indeed in the table. In the buggy case described above, this
957 2008-07-24 Oliver Hunt <oliver@apple.com>
959 Reviewed by Alexey Proskuryakov.
961 Bug 20142: REGRESSION(r35245): /=/ weirdness
962 <https://bugs.webkit.org/show_bug.cgi?id=20142>
964 When adding all the meta data needed for exception error messages
965 I accidentally clobbered the handling of regex beginning with /=.
969 2008-07-23 Alp Toker <alp@nuanti.com>
971 Build fix after r35293: Add API/ to the include path.
975 2008-07-23 Adam Roben <aroben@apple.com>
979 Build fix after r35293:
981 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
984 Build fix after r35305:
990 Completely compile out all sampler-related code when
991 SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
992 non-AllInOne configurations due to circular header dependencies, and
993 2) on platforms that don't have a usleep() function, such as Windows.
995 2008-07-23 Oliver Hunt <oliver@apple.com>
997 Reviewed by Geoff Garen and Sam Weinig.
999 Improve switch performance.
1001 Improve switch performance by converting to a hashmap based jump
1002 table to avoid the sequence of dispatches that would otherwise be
1003 needed. This results in a 9-19x performance win for string switches
1004 based on ad hoc testing, and a 6x improvement for integer switch
1005 statements. SunSpider reports a 1.2% progression.
1008 (KJS::CodeBlock::dump):
1009 (KJS::SimpleJumpTable::offsetForValue):
1011 * VM/CodeGenerator.cpp:
1012 (KJS::CodeGenerator::beginSwitch):
1013 (KJS::prepareJumpTableForImmediateSwitch):
1014 (KJS::prepareJumpTableForCharacterSwitch):
1015 (KJS::prepareJumpTableForStringSwitch):
1016 (KJS::CodeGenerator::endSwitch):
1017 * VM/CodeGenerator.h:
1019 (KJS::offsetForStringSwitch):
1020 (KJS::Machine::privateExecute):
1024 * kjs/JSImmediate.h:
1027 (KJS::processClauseList):
1028 (KJS::CaseBlockNode::tryOptimisedSwitch):
1029 (KJS::CaseBlockNode::emitCodeForBlock):
1031 (KJS::SwitchInfo::):
1033 2008-07-23 Gavin Barraclough <barraclough@apple.com>
1035 Reviewed by Geoff Garen.
1037 Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
1038 Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
1040 * JavaScriptCore.exp: Export symbols for Shell.cpp.
1041 * VM/Machine.cpp: Added sampling hooks.
1042 * VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
1043 * VM/Opcode.cpp: Tool implementation.
1044 * VM/Opcode.h: Tool declaration.
1045 * kjs/Shell.cpp: Initialize the sampler, if enabled.
1046 * kjs/nodes.cpp: Added sampling hooks.
1048 2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
1050 Bug 20097: [Qt] 20% Sunspider slow-down
1052 <https://bugs.webkit.org/show_bug.cgi?id=20097>
1054 Reviewed by Simon Hausmann.
1056 * kjs/jsc.pro: Added missing NDEBUG define for release builds.
1058 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
1060 Reviewed by Geoff Garen.
1062 JSClassRef is created context-free, but gets infatuated with the first context it sees.
1064 The implicit API contract is that JSClassRef can be used with any context on any thread.
1065 This no longer worked, because UStrings in the class were turned into per-context
1066 identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
1068 * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
1069 * API/JSClassRef.cpp:
1070 (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
1071 (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
1072 (clearReferenceToPrototype): Update for the new reference location.
1073 (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
1074 (OpaqueJSClass::contextData): Added a function that finds the per-context part of
1075 OpaqueJSClass in JSGlobalData, or creates it if not found.
1076 (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
1077 a way to access JSGlobalData, so a per-context copy could not be made.
1078 (OpaqueJSClass::staticValues): Updated for new data location.
1079 (OpaqueJSClass::staticFunctions): Ditto.
1080 (OpaqueJSClass::prototype): Changed to take an internal type for consistency.
1082 * kjs/JSGlobalData.cpp:
1083 (KJS::JSGlobalData::JSGlobalData):
1084 (KJS::JSGlobalData::~JSGlobalData):
1085 * kjs/JSGlobalData.h:
1086 Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
1088 * API/JSCallbackObjectFunctions.h:
1090 (KJS::::getOwnPropertySlot):
1092 (KJS::::deleteProperty):
1093 (KJS::::getPropertyNames):
1094 (KJS::::staticValueGetter):
1095 (KJS::::staticFunctionGetter):j
1096 Use function accessors instead of accessing OpaqueJSClass members directly.
1098 * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
1099 OpaqueJSClass::prototype() argument type.
1101 * API/JSObjectRef.cpp:
1102 (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
1103 (JSObjectMakeConstructor): Ditto.
1105 2008-07-23 Alexey Proskuryakov <ap@webkit.org>
1109 * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
1112 2008-07-22 Geoffrey Garen <ggaren@apple.com>
1114 Reviewed by Oliver Hunt and Sam Weinig.
1116 Next step toward putting doubles in registers: Prepare the Register class
1117 and its clients for registers that don't contain JSValue*s.
1119 This means a few things:
1121 1. Register::jsValue() clients, including ArgList clients, must now supply
1122 an ExecState* when accessing an entry in an ArgList, in case the entry
1123 will need to create a JSValue* on the fly.
1125 2. Register clients that definitely don't want to create a JSValue* on
1126 the fly now use different APIs: getJSValue() for clients that know
1127 the register contains a JSValue*, and v() for clients who just want a
1130 3. I had to change some headers around in order to resolve dependency
1131 problems created by using a Register in the ArgList header.
1133 SunSpider reports no change.
1135 2008-07-22 Gavin Barraclough <barraclough@apple.com>
1137 Reviewed by Alexey Proskuryakov.
1139 Prevent integer overflow when reallocating storage vector for arrays.
1141 Sunspider reports 1.005x as fast (no change expected).
1145 2008-07-21 Mark Rowe <mrowe@apple.com>
1147 Reviewed by Sam Weinig.
1149 <rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
1151 * Configurations/Version.xcconfig:
1154 2008-07-21 Adam Roben <aroben@apple.com>
1158 This is a convenience wrapper around std::find.
1160 Reviewed by Anders Carlsson.
1164 2008-07-19 Oliver Hunt <oliver@apple.com>
1166 Reviewed by Cameron Zwarich.
1168 Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
1169 <https://bugs.webkit.org/show_bug.cgi?id=20104>
1171 To make this correct we make the dot and bracket assign nodes emit the information to indicate
1172 the failure range is the dot/bracket accessor.
1176 2008-07-18 Steve Falkenburg <sfalken@apple.com>
1180 * kjs/JSGlobalObjectFunctions.cpp:
1181 (KJS::isStrWhiteSpace):
1183 2008-07-18 Steve Falkenburg <sfalken@apple.com>
1188 (KJS::ThrowableExpressionData::ThrowableExpressionData):
1190 2008-07-18 Oliver Hunt <oliver@apple.com>
1192 Reviewed by Cameron Zwarich.
1194 Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
1195 <rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
1197 Add support for decent error messages in JavaScript. This patch achieves this by providing
1198 ensuring the common errors and exceptions have messages that provide the text of expression
1199 that trigger the exception. In addition it attaches a number of properties to the exception
1200 object detailing where in the source the expression came from.
1202 * JavaScriptCore.exp:
1204 (KJS::CodeBlock::lineNumberForVPC):
1205 (KJS::CodeBlock::expressionRangeForVPC):
1206 Function to recover the expression range for an instruction
1207 that triggered an exception.
1209 (KJS::ExpressionRangeInfo::):
1210 (KJS::CodeBlock::CodeBlock):
1211 * VM/CodeGenerator.cpp:
1212 (KJS::CodeGenerator::emitCall):
1213 (KJS::CodeGenerator::emitCallEval):
1214 Emit call needed to be modified so to place the expression range info internally,
1215 as the CodeGenerator emits the arguments nodes itself, rather than the various call
1217 * VM/CodeGenerator.h:
1218 (KJS::CodeGenerator::emitExpressionInfo):
1219 Record the expression range info.
1220 * VM/ExceptionHelpers.cpp:
1221 (KJS::createErrorMessage):
1222 (KJS::createInvalidParamError):
1223 (KJS::createUndefinedVariableError):
1224 (KJS::createNotAConstructorError):
1225 (KJS::createNotAFunctionError):
1226 (KJS::createNotAnObjectErrorStub):
1227 (KJS::createNotAnObjectError):
1228 Rewrite all the code for the error messages so that they make use of the newly available
1230 * VM/ExceptionHelpers.h:
1232 (KJS::isNotObject): Now needs vPC and codeBlock
1233 (KJS::Machine::throwException):
1234 New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
1235 (KJS::Machine::privateExecute):
1237 * kjs/DebuggerCallFrame.cpp:
1238 (KJS::DebuggerCallFrame::evaluate):
1240 (KJS::Error::create):
1242 * kjs/JSGlobalObjectFunctions.cpp:
1243 * kjs/JSImmediate.cpp:
1244 (KJS::JSImmediate::toObject):
1245 (KJS::JSImmediate::prototype):
1246 My changes to the JSNotAnObject constructor needed to be handled here.
1247 * kjs/JSNotAnObject.h:
1248 (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
1249 (KJS::JSNotAnObjectErrorStub::isNull):
1250 (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
1251 Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
1252 and potentially allow even more detailed error messages in future.
1255 (KJS::Parser::parse):
1256 * kjs/SourceRange.h:
1258 Large amounts of position propagation.
1260 (KJS::Lexer::Lexer):
1261 (KJS::Lexer::shift):
1263 The lexer needed a few changes to be able to correctly track token character positions.
1266 (KJS::ThrowableExpressionData::emitThrowError):
1267 (KJS::StatementNode::StatementNode):
1268 (KJS::ResolveNode::emitCode):
1269 (KJS::BracketAccessorNode::emitCode):
1270 (KJS::DotAccessorNode::emitCode):
1271 (KJS::NewExprNode::emitCode):
1272 (KJS::EvalFunctionCallNode::emitCode):
1273 (KJS::FunctionCallValueNode::emitCode):
1274 (KJS::FunctionCallResolveNode::emitCode):
1275 (KJS::FunctionCallBracketNode::emitCode):
1276 (KJS::FunctionCallDotNode::emitCode):
1277 (KJS::PostfixResolveNode::emitCode):
1278 (KJS::PostfixBracketNode::emitCode):
1279 (KJS::PostfixDotNode::emitCode):
1280 (KJS::DeleteResolveNode::emitCode):
1281 (KJS::DeleteBracketNode::emitCode):
1282 (KJS::DeleteDotNode::emitCode):
1283 (KJS::PrefixResolveNode::emitCode):
1284 (KJS::PrefixBracketNode::emitCode):
1285 (KJS::PrefixDotNode::emitCode):
1286 (KJS::ThrowableBinaryOpNode::emitCode):
1287 (KJS::ReadModifyResolveNode::emitCode):
1288 (KJS::AssignResolveNode::emitCode):
1289 (KJS::AssignDotNode::emitCode):
1290 (KJS::ReadModifyDotNode::emitCode):
1291 (KJS::AssignBracketNode::emitCode):
1292 (KJS::ReadModifyBracketNode::emitCode):
1293 (KJS::ForInNode::ForInNode):
1294 (KJS::ForInNode::emitCode):
1295 (KJS::WithNode::emitCode):
1296 (KJS::LabelNode::emitCode):
1297 (KJS::ThrowNode::emitCode):
1298 (KJS::ProgramNode::ProgramNode):
1299 (KJS::ProgramNode::create):
1300 (KJS::EvalNode::generateCode):
1301 (KJS::FunctionBodyNode::create):
1302 (KJS::FunctionBodyNode::generateCode):
1303 (KJS::ProgramNode::generateCode):
1304 All of these methods were handling the position information.
1305 Constructors and create methods were modified to store the information.
1306 All the emitCall implementations listed needed to be updated to actually
1307 record the position information we have so carefully collected.
1309 (KJS::ThrowableExpressionData::ThrowableExpressionData):
1310 (KJS::ThrowableExpressionData::setExceptionSourceRange):
1311 (KJS::ThrowableExpressionData::divot):
1312 (KJS::ThrowableExpressionData::startOffset):
1313 (KJS::ThrowableExpressionData::endOffset):
1314 (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
1315 (KJS::ThrowableSubExpressionData::setSubexpressionInfo):
1316 (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
1317 (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
1318 ThrowableExpressionData is just a uniform mechanism for storing the position
1320 (KJS::ResolveNode::):
1321 (KJS::PrePostResolveNode::):
1322 (KJS::ThrowableBinaryOpNode::):
1325 2008-07-18 Geoffrey Garen <ggaren@apple.com>
1327 Reviewed by Cameron Zwarich.
1331 "CallTypeNative" => "CallTypeHost"
1332 "code" => "byteCode"
1333 "generatedCode" => "generatedByteCode"
1335 2008-07-18 Geoffrey Garen <ggaren@apple.com>
1337 Reviewed by Oliver Hunt.
1339 Optimized <= for immediate number cases.
1341 SunSpider reports no overall change, but a 10% speedup on access-nsieve.
1343 2008-07-18 Mark Rowe <mrowe@apple.com>
1345 Rubber-stamped by Sam Weinig.
1347 Fix some casts added in a previous build fix to match the style used
1351 (KJS::Machine::initializeCallFrame):
1353 (KJS::Register::Register):
1355 2008-07-18 Landry Breuil <landry@openbsd.org>
1357 Bug 19975: [OpenBSD] Patches to enable build of WebKit
1359 <https://bugs.webkit.org/show_bug.cgi?id=19975>
1361 Reviewed by David Kilzer.
1363 Support for OpenBSD, mostly threading and libm tweaks.
1365 * kjs/collector.cpp: #include <pthread.h>
1366 (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
1367 * kjs/config.h: OpenBSD also provides <pthread_np.h>
1368 * wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
1369 (isfinite), (signbit): as long as we don't have those functions provide fallback implementations
1370 * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
1372 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1374 Reviewed by Oliver Hunt.
1376 Next step toward putting doubles in registers: Store constant pool
1377 entries as registers, not JSValue*s.
1379 SunSpider reports no change.
1381 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1383 Reviewed by John Sullivan and Oliver Hunt.
1385 A tiny bit of tidying in function call register allocation.
1387 This patch saves one register when invoking a function expression and/or
1388 a new expression that is stored in a temporary.
1390 Since it's just one register, I can't make a testcase for it.
1392 * VM/CodeGenerator.cpp:
1393 (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
1394 or its base. We'd like the call frame to overlap with them, if possible.
1395 op_call will read the function and its base before writing the call frame,
1399 (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
1400 for the same reasons stated above.
1402 (KJS::FunctionCallValueNode::emitCode): ditto
1404 2008-07-17 Steve Falkenburg <sfalken@apple.com>
1408 * kjs/InternalFunction.cpp:
1410 2008-07-17 Sam Weinig <sam@webkit.org>
1412 Roll out r35199 as it is causing failures on the PPC build.
1414 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1416 Reviewed by David Kilzer.
1418 Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
1419 Support function.name (Firefox extension)
1421 Pretty straight-forward.
1423 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1425 Reviewed by Oliver Hunt.
1427 Fixed <rdar://problem/6081636> Functions calls use more temporary
1428 registers than necessary
1430 Holding a reference to the last statement result register caused each
1431 successive statement to output its result to an even higher register.
1433 Happily, statements don't actually need to return a result register
1434 at all. I hope to make this clearer in a future cleanup patch,
1435 but this change will fix the major bug for now.
1438 (KJS::statementListEmitCode):
1440 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1442 Reviewed by Sam Weinig.
1444 Merge pre&post dot nodes to simplify the parse tree.
1445 Sunspider results show 0.6% progression (no performance change expected).
1450 * kjs/nodes2string.cpp:
1452 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1454 Reviewed by Cameron Zwarich.
1456 Merge pre&post resolve nodes to simplify the parse tree.
1457 Sunspider results show no performance change.
1462 * kjs/nodes2string.cpp:
1464 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1466 Reviewed by Cameron Zwarich.
1468 Merge logical nodes to simplify the parse tree.
1469 Sunspider results show 0.6% progression (no performance change expected).
1474 * kjs/nodes2string.cpp:
1476 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1480 Fix MinGW build (broken in r35198) and simplify getLocalTime().
1483 (KJS::getLocalTime):
1485 2008-07-17 Gavin Barraclough <barraclough@apple.com>
1487 Reviewed by Sam Weinig.
1489 Merge pre&post bracket nodes to simplify the parse tree.
1490 Sunspider results show no performance change.
1495 * kjs/nodes2string.cpp:
1497 2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
1501 Fix the 32-bit gcc builds, conversion from "long int" to Register is
1502 ambiguous. Explicitly choose the intptr_t constructor.
1505 (KJS::Machine::initializeCallFrame):
1507 (KJS::Register::Register):
1509 2008-07-16 Mark Rowe <mrowe@apple.com>
1511 Rubber-stamped by Geoff Garen.
1513 Fix JavaScript in 64-bit by using a pointer-sized integer
1514 type in the Register union. Also includes a rename of
1515 the intType constant to IntType.
1518 (KJS::Machine::initializeCallFrame):
1521 (KJS::Register::Register):
1523 2008-07-17 Geoffrey Garen <ggaren@apple.com>
1525 Reviewed by Oliver Hunt.
1527 First step toward putting doubles in registers: Turned Register into a
1528 proper abstraction layer. It is no longer possible to cast a Register
1529 to a JSValue*, or a Register& to a JSValue*&, or to access the union
1530 inside a Register directly.
1532 SunSpider reports no change.
1534 In support of this change, I had to make the following mechanical changes
1537 1. Clients now use explicit accessors to read data out of Registers, and
1538 implicit copy constructors to write data into registers.
1540 So, assignment that used to look like
1548 And access that used to look like
1556 2. I made generic flow control specific in opcodes that made their flow
1557 control generic by treating a Register& as a JSValue*&. This had the
1558 added benefit of removing some exception checking branches from immediate
1561 3. I beefed up PropertySlot to support storing a Register* in a property
1562 slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
1563 use this functionality, but I expect more clients to use it in the future.
1565 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
1566 changed ArgList iterator clients to iterate Registers, not JSValue*'s.
1568 2008-07-16 Ada Chan <adachan@apple.com>
1572 * kjs/JSGlobalObject.cpp:
1574 2008-07-16 Kevin McCullough <kmccullough@apple.com>
1576 Reviewed by Sam and Geoff.
1578 <rdar://problem/5958840> Navigating to another page while profiler is
1579 attached results in slow JavaScript for all time.
1581 - The UNLIKELY keeps this from being a sunspider performance regression.
1583 * kjs/JSGlobalObject.cpp:
1584 (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
1585 with this exec state.
1587 2008-07-16 Sam Weinig <sam@webkit.org>
1589 Reviewed by Steve Falkenburg.
1591 Replace adopting UString constructor in favor of explicit
1592 static adopt method.
1594 * API/JSStringRefCF.cpp:
1595 (JSStringCreateWithCFString):
1596 * kjs/StringConstructor.cpp:
1597 (KJS::stringFromCharCode):
1598 * kjs/StringPrototype.cpp:
1599 (KJS::stringProtoFuncToLowerCase):
1600 (KJS::stringProtoFuncToUpperCase):
1601 (KJS::stringProtoFuncToLocaleLowerCase):
1602 (KJS::stringProtoFuncToLocaleUpperCase):
1604 (KJS::UString::adopt):
1606 (KJS::UString::UString):
1607 (KJS::UString::~UString):
1609 2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
1613 http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
1614 Fix potential crash (on Qt for Windows port) when performing JavaScript date
1618 (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
1619 localtime_s() instead of localtime() since the latter might crash (on Windows)
1620 given a non-sensible, e.g. NaN, argument.
1622 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1624 Reviewed by Anders and Geoff.
1626 https://bugs.webkit.org/show_bug.cgi?id=20023
1627 Failed assertion in PropertyNameArray.cpp
1629 This is already tested by testapi.
1631 * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
1632 table to appease PropertyNameArray.
1634 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1638 Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
1641 * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
1642 * kjs/lookup.cpp: (KJS::HashTable::deleteTable):
1644 * kjs/lexer.cpp: (KJS::Lexer::~Lexer)
1645 HashTable cannot have a destructor, because check-for-global-initializers complains about
1646 having a global constructor then.
1648 2008-07-16 Alexey Proskuryakov <ap@webkit.org>
1652 Check pthread_key_create return value.
1654 This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
1655 because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
1656 It also looks useful for production builds.
1658 * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
1660 2008-07-15 Kevin McCullough <kmccullough@apple.com>
1664 Rename pageGroupIdentifier to profileGroup to keep mention of a
1665 pageGroup out of JavaScriptCore.
1667 * kjs/JSGlobalObject.cpp:
1668 (KJS::JSGlobalObject::init):
1669 * kjs/JSGlobalObject.h:
1670 (KJS::JSGlobalObject::setProfileGroup):
1671 (KJS::JSGlobalObject::profileGroup):
1672 * profiler/ProfileGenerator.cpp:
1673 (KJS::ProfileGenerator::create):
1674 (KJS::ProfileGenerator::ProfileGenerator):
1675 * profiler/ProfileGenerator.h:
1676 (KJS::ProfileGenerator::profileGroup):
1677 * profiler/Profiler.cpp:
1678 (KJS::Profiler::startProfiling):
1679 (KJS::dispatchFunctionToProfiles):
1680 (KJS::Profiler::willExecute):
1681 (KJS::Profiler::didExecute):
1683 2008-07-14 Mark Rowe <mrowe@apple.com>
1685 Reviewed by Sam Weinig.
1687 Fix https://bugs.webkit.org/show_bug.cgi?id=20037
1688 Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
1691 (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
1693 * profiler/CallIdentifier.h:
1694 (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
1696 2008-07-14 David Hyatt <hyatt@apple.com>
1698 Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
1703 * wtf/ListHashSet.h:
1704 (WTF::ListHashSetConstIterator::operator--):
1706 2008-07-14 David Hyatt <hyatt@apple.com>
1708 Buidl fix. Make sure the second insertBefore method returns a value.
1710 * wtf/ListHashSet.h:
1711 (WTF::::insertBefore):
1713 2008-07-14 Adam Roben <aroben@apple.com>
1717 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
1720 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1722 Reviewed by Kevin McCullough.
1724 Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
1727 * JavaScriptCore.exp:
1728 * kjs/JSGlobalData.cpp:
1729 (KJS::JSGlobalData::create):
1730 * kjs/JSGlobalData.h:
1731 Made contructor private, and added a static create() method. Made the class inherit from
1734 * kjs/JSGlobalObject.h:
1735 (KJS::JSGlobalObject::globalData):
1736 JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
1737 WebCore one, which are never deleted).
1739 * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
1741 2008-07-14 Simon Hausmann <hausmann@webkit.org>
1743 Fix the single-threaded build.
1745 * kjs/JSLock.cpp: Removed undeclared registerThread() function.
1746 * kjs/collector.cpp:
1747 (KJS::Heap::registerThread): Added dummy implementation.
1749 2008-07-14 Alexey Proskuryakov <ap@webkit.org>
1751 Reviewed by Geoff Garen.
1753 Eliminate per-thread JavaScript global data instance support and make arbitrary
1754 global data/global object combinations possible.
1756 * kjs/collector.cpp:
1757 (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
1758 This allows for going from any JS object to its associated global data, currently used in
1759 JSGlobalObject constructor to initialize its JSGlobalData pointer.
1760 (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
1761 only the shared heap could be used from multiple threads, so it was the only one that needed
1762 thread registration, but now this can happen to any heap.
1763 (KJS::Heap::unregisterThread): Ditto.
1764 (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
1765 (KJS::Heap::setGCProtectNeedsLocking): Ditto.
1766 (KJS::Heap::protect): Ditto.
1767 (KJS::Heap::unprotect): Ditto.
1768 (KJS::Heap::collect): Ditto.
1769 (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
1770 not the late per-thread one.
1771 (KJS::Heap::protectedGlobalObjectCount): Ditto.
1774 (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
1778 (KJS::JSLock::JSLock):
1780 (KJS::JSLock::JSLock):
1781 Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
1782 places that use JSLock - we cannot guarantee absolute safety unless we always mark all
1783 threads in the process, but these implicit registration calls should cover reasonable usage
1787 (JSEvaluateScript): Explicitly register the current thread.
1788 (JSCheckScriptSyntax): Explicitly register the current thread.
1789 (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
1790 condition for clients that pass an already released context to JSGarbageCollect - but it is
1791 unlikely to create real life problems.
1792 To maintain compatibility, the shared heap is collected if NULL is passed.
1794 * API/JSContextRef.cpp:
1795 (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
1796 (JSGlobalContextRetain): Register the thread.
1797 (JSContextGetGlobalObject): Register the thread.
1799 * API/JSObjectRef.cpp:
1801 (JSObjectMakeFunctionWithCallback):
1802 (JSObjectMakeConstructor):
1803 (JSObjectMakeFunction):
1804 (JSObjectHasProperty):
1805 (JSObjectGetProperty):
1806 (JSObjectSetProperty):
1807 (JSObjectGetPropertyAtIndex):
1808 (JSObjectSetPropertyAtIndex):
1809 (JSObjectDeleteProperty):
1810 (JSObjectCallAsFunction):
1811 (JSObjectCallAsConstructor):
1812 (JSObjectCopyPropertyNames):
1813 (JSPropertyNameAccumulatorAddName):
1814 * API/JSValueRef.cpp:
1816 (JSValueIsInstanceOfConstructor):
1817 (JSValueMakeNumber):
1818 (JSValueMakeString):
1820 (JSValueToStringCopy):
1824 Register the thread.
1826 * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
1828 * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
1830 * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
1831 their own instances. Adapt to other changes, too.
1833 * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
1834 included by collector.h and is thus needed in other projects.
1836 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
1837 global data, as it no longer exists.
1839 * kjs/JSGlobalData.cpp:
1840 (KJS::JSGlobalData::JSGlobalData):
1841 (KJS::JSGlobalData::~JSGlobalData):
1842 * kjs/JSGlobalData.h:
1843 Removed support for per-thread instance. Made constructor and destructor public.
1845 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
1847 (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
1848 * kjs/JSGlobalObject.h:
1853 Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
1855 2008-07-13 Ada Chan <adachan@apple.com>
1857 Windows build fix: Add wtf/RefCountedLeakCounter to the project.
1859 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1861 2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
1863 Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
1867 * JavaScriptCore.pri:
1868 * JavaScriptCoreSources.bkl:
1870 2008-07-11 Stephanie Lewis <slewis@apple.com>
1872 Reviewed by Darin Adler and Oliver Hunt.
1874 Refactor RefCounting Leak counting code into a common class.
1876 In order to export the symbols I needed to put the debug defines inside the function names
1878 Before we had a separate channel for each Logging each Leak type. Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel.
1880 * JavaScriptCore.exp:
1881 * JavaScriptCore.xcodeproj/project.pbxproj: add new class
1882 * kjs/nodes.cpp: remove old leak counting code
1883 * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
1884 * wtf/RefCountedLeakCounter.h: Added.
1886 2008-07-11 David Hyatt <hyatt@apple.com>
1888 Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
1893 * wtf/ListHashSet.h:
1894 (WTF::::insertBefore):
1895 (WTF::::insertNodeBefore):
1897 2008-07-11 Sam Weinig <sam@webkit.org>
1899 Rubber-stamped by Darin Adler.
1901 Move call function to CallData.cpp and construct to ConstructData.cpp.
1904 * JavaScriptCore.pri:
1905 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1906 * JavaScriptCore.xcodeproj/project.pbxproj:
1907 * JavaScriptCoreSources.bkl:
1908 * kjs/AllInOneFile.cpp:
1909 * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
1910 * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
1913 2008-07-10 Mark Rowe <mrowe@apple.com>
1915 Reviewed by Sam Weinig.
1917 Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
1919 * Configurations/Base.xcconfig:
1921 2008-07-10 Mark Rowe <mrowe@apple.com>
1923 Reviewed by Sam Weinig.
1925 Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
1927 * API/WebKitAvailability.h:
1929 2008-07-10 Kevin McCullough <kmccullough@apple.com>
1933 -Minor cleanup. Renamed callTree() to head() and no longer use m_head
1934 directly but instead keep it private and access via a method().
1936 * profiler/HeavyProfile.cpp:
1937 (KJS::HeavyProfile::HeavyProfile):
1938 (KJS::HeavyProfile::generateHeavyStructure):
1939 (KJS::HeavyProfile::addNode):
1940 * profiler/Profile.h:
1941 (KJS::Profile::head):
1942 * profiler/ProfileGenerator.cpp:
1943 (KJS::ProfileGenerator::ProfileGenerator):
1945 2008-07-10 Alexey Proskuryakov <ap@webkit.org>
1947 Reviewed by Mark Rowe.
1949 Eliminate CollectorHeapIntrospector.
1951 CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
1952 a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
1953 vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
1954 way to label mapped regions is to use a VM tag.
1956 So, it makes more sense to remove it completely than to make it work with multiple heaps.
1958 * JavaScriptCore.exp:
1959 * JavaScriptCore.xcodeproj/project.pbxproj:
1960 * kjs/AllInOneFile.cpp:
1961 * kjs/InitializeThreading.cpp:
1962 (KJS::initializeThreading):
1963 * kjs/collector.cpp:
1965 * kjs/CollectorHeapIntrospector.cpp: Removed.
1966 * kjs/CollectorHeapIntrospector.h: Removed.
1968 2008-07-09 Kevin McCullough <kmccullough@apple.com>
1972 <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
1974 - Implemented the time and call count portionof heavy. Now all that we
1977 * profiler/CallIdentifier.h: Removed an unused constructor.
1978 * profiler/HeavyProfile.cpp:
1979 (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
1980 node so that percentages work correctly.
1981 (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
1983 * profiler/ProfileNode.cpp: Set the intital values of time and call
1984 count when copying ProfileNodes.
1985 (KJS::ProfileNode::ProfileNode):
1987 2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
1991 * GNUmakefile.am: Add HeavyProfile.cpp
1993 2008-07-09 Mark Rowe <mrowe@apple.com>
1995 Reviewed by Geoff Garen.
1997 Don't warn about deprecated functions in production builds.
1999 * Configurations/Base.xcconfig:
2000 * Configurations/DebugRelease.xcconfig:
2002 2008-07-09 Darin Adler <darin@apple.com>
2004 * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
2006 2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
2008 wx biuld fix. Add HeavyProfile.cpp to build files.
2010 * JavaScriptCoreSources.bkl:
2012 2008-07-09 Kevin McCullough <kmccullough@apple.com>
2014 - Windows build fix.
2016 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2018 2008-07-09 Kevin McCullough <kmccullough@apple.com>
2022 * profiler/HeavyProfile.cpp:
2023 (KJS::HeavyProfile::mergeProfiles):
2025 2008-07-09 Kevin McCullough <kmccullough@apple.com>
2027 Reviewed by Geoff and Adam.
2029 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
2030 - This is the plumbing for bottom-up, but does not include calculating
2031 time, mostly because I'm still undclear about what the end result should
2033 - This, obviously, does not include the UI to expose this in the
2036 * JavaScriptCore.xcodeproj/project.pbxproj:
2037 * profiler/CallIdentifier.h:
2038 (KJS::CallIdentifier::CallIdentifier):
2039 (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
2040 * profiler/HeavyProfile.cpp: Added.
2041 (KJS::HeavyProfile::HeavyProfile):
2042 (KJS::HeavyProfile::generateHeavyStructure):
2043 (KJS::HeavyProfile::addNode):
2044 (KJS::HeavyProfile::mergeProfiles):
2045 (KJS::HeavyProfile::addAncestorsAsChildren):
2046 * profiler/HeavyProfile.h: Added.
2047 (KJS::HeavyProfile::create):
2048 (KJS::HeavyProfile::heavyProfile):
2049 (KJS::HeavyProfile::treeProfile):
2050 * profiler/Profile.cpp: Removed old commented out includes.
2051 * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
2052 is now protected as opposed to private.
2053 * profiler/ProfileNode.cpp:
2054 (KJS::ProfileNode::ProfileNode): Created a constructor to copy
2056 (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
2057 children finding easier and avoid a potential crasher.
2058 * profiler/ProfileNode.h: Mostly moved things around but also added some
2059 functionality needed by HeavyProfile.
2060 (KJS::ProfileNode::create):
2061 (KJS::ProfileNode::functionName):
2062 (KJS::ProfileNode::url):
2063 (KJS::ProfileNode::lineNumber):
2064 (KJS::ProfileNode::head):
2065 (KJS::ProfileNode::setHead):
2066 (KJS::ProfileNode::setNextSibling):
2067 (KJS::ProfileNode::actualTotalTime):
2068 (KJS::ProfileNode::actualSelfTime):
2069 * profiler/TreeProfile.cpp: Implemented the ability to get a
2071 (KJS::TreeProfile::heavyProfile):
2072 * profiler/TreeProfile.h:
2074 2008-07-08 Geoffrey Garen <ggaren@apple.com>
2076 Reviewed by Oliver Hunt.
2078 Added support for checking if an object has custom properties in its
2079 property map. WebCore uses this to optimize marking DOM wrappers.
2081 2008-07-08 Simon Hausmann <hausmann@webkit.org>
2083 Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
2086 * JavaScriptCoreSources.bkl:
2088 2008-07-08 Simon Hausmann <hausmann@webkit.org>
2090 Fix the Qt build, add ProfileGenerator.cpp to the build.
2092 * JavaScriptCore.pri:
2094 2008-07-07 David Kilzer <ddkilzer@apple.com>
2096 releaseFastMallocFreeMemory() should always be defined
2100 * JavaScriptCore.exp: Changed to export C++ binding for
2101 WTF::releaseFastMallocFreeMemory() instead of C binding for
2102 releaseFastMallocFreeMemory().
2103 * wtf/FastMalloc.cpp: Moved definitions of
2104 releaseFastMallocFreeMemory() to be in the WTF namespace
2105 regardless whether FORCE_SYSTEM_MALLOC is defined.
2106 * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
2107 extern "C" binding to WTF::releaseFastMallocFreeMemory().
2109 2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2113 Bug 19926: URL causes crash within a minute
2114 <https://bugs.webkit.org/show_bug.cgi?id=19926>
2116 Add a check that lastGlobalObject is non-null in Machine::execute()
2117 before copying its globals to the current register file.
2119 In theory, it is possible to make a test case for this, but it will
2120 take a while to get it right.
2123 (KJS::Machine::execute):
2125 2008-07-07 Darin Adler <darin@apple.com>
2127 Rubber stamped by Adele.
2130 (KJS::Machine::privateExecute): Fix a typo in a comment.
2132 2008-07-07 Steve Falkenburg <sfalken@apple.com>
2136 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2137 * JavaScriptCore.vcproj/testapi/testapi.vcproj:
2139 2008-07-07 Kevin McCullough <kmccullough@apple.com>
2143 When the profiler is running it gathers information and creates a
2144 Profile. After it finishes the Profile can be sorted and have other
2145 data refinements run over it. Both of these were done in the same class
2146 before. Now I split the gathering operations into a new class called
2149 * JavaScriptCore.xcodeproj/project.pbxproj:
2150 * profiler/Profile.cpp: Removed code related to the gather stage of a
2152 (KJS::Profile::create):
2153 (KJS::Profile::Profile):
2154 * profiler/Profile.h: Ditto.
2155 (KJS::Profile::title):
2156 (KJS::Profile::callTree):
2157 (KJS::Profile::setHead):
2158 * profiler/ProfileGenerator.cpp: Added. This is the class that will
2159 handle the stage of creating a Profile. Once the Profile is finished
2160 being created, this class goes away.
2161 (KJS::ProfileGenerator::create):
2162 (KJS::ProfileGenerator::ProfileGenerator):
2163 (KJS::ProfileGenerator::title):
2164 (KJS::ProfileGenerator::willExecute):
2165 (KJS::ProfileGenerator::didExecute):
2166 (KJS::ProfileGenerator::stopProfiling):
2167 (KJS::ProfileGenerator::didFinishAllExecution):
2168 (KJS::ProfileGenerator::removeProfileStart):
2169 (KJS::ProfileGenerator::removeProfileEnd):
2170 * profiler/ProfileGenerator.h: Added.
2171 (KJS::ProfileGenerator::profile):
2172 (KJS::ProfileGenerator::originatingGlobalExec):
2173 (KJS::ProfileGenerator::pageGroupIdentifier):
2174 (KJS::ProfileGenerator::client):
2175 (KJS::ProfileGenerator::stoppedProfiling):
2176 * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
2178 (KJS::Profiler::startProfiling):
2179 (KJS::Profiler::stopProfiling):
2180 (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
2181 handed off to its client and the Profile Generator is no longer needed.
2182 (KJS::dispatchFunctionToProfiles):
2183 (KJS::Profiler::willExecute):
2184 (KJS::Profiler::didExecute):
2185 * profiler/Profiler.h: Cleaned up the includes and subsequently the
2186 forward declarations. Also use the new ProfileGenerator.
2187 (KJS::ProfilerClient::~ProfilerClient):
2188 (KJS::Profiler::currentProfiles):
2189 * profiler/TreeProfile.cpp: Use Profile's new interface.
2190 (KJS::TreeProfile::create):
2191 (KJS::TreeProfile::TreeProfile):
2192 * profiler/TreeProfile.h:
2194 2008-07-07 Sam Weinig <sam@webkit.org>
2196 Reviewed by Cameron Zwarich.
2198 Third step in broad cleanup effort.
2200 [ File list elided ]
2202 2008-07-06 Sam Weinig <sam@webkit.org>
2204 Reviewed by Cameron Zwarich.
2206 Second step in broad cleanup effort.
2208 [ File list elided ]
2210 2008-07-05 Sam Weinig <sam@webkit.org>
2212 Reviewed by Cameron Zwarich.
2214 First step in broad cleanup effort.
2216 [ File list elided ]
2218 2008-07-05 Sam Weinig <sam@webkit.org>
2220 Rubber-stamped by Cameron Zwarich.
2222 Rename list.h/cpp to ArgList.h/cpp.
2225 * JavaScriptCore.pri:
2226 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2227 * JavaScriptCore.xcodeproj/project.pbxproj:
2228 * JavaScriptCoreSources.bkl:
2230 * kjs/AllInOneFile.cpp:
2231 * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
2232 * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
2233 * kjs/IndexToNameMap.cpp:
2234 * kjs/JSGlobalData.cpp:
2235 * kjs/JSGlobalData.h:
2237 * kjs/collector.cpp:
2238 * kjs/list.cpp: Removed.
2239 * kjs/list.h: Removed.
2241 2008-07-05 Sam Weinig <sam@webkit.org>
2243 Fix non-AllInOne builds again.
2245 * kjs/BooleanPrototype.cpp:
2246 * kjs/ErrorPrototype.cpp:
2247 * kjs/FunctionPrototype.cpp:
2248 * kjs/NumberPrototype.cpp:
2249 * kjs/ObjectPrototype.cpp:
2251 2008-07-05 Sam Weinig <sam@webkit.org>
2253 Fix build on case-sensitive build systems.
2255 * kjs/IndexToNameMap.cpp:
2257 2008-07-05 Sam Weinig <sam@webkit.org>
2261 * kjs/Arguments.cpp:
2262 * kjs/BooleanPrototype.cpp:
2263 * kjs/DateConstructor.cpp:
2264 * kjs/ErrorPrototype.cpp:
2265 * kjs/FunctionPrototype.cpp:
2266 * kjs/NumberPrototype.cpp:
2267 * kjs/ObjectPrototype.cpp:
2268 * kjs/RegExpPrototype.cpp:
2269 * kjs/StringConstructor.cpp:
2272 2008-07-05 Sam Weinig <sam@webkit.org>
2274 Fix non-AllInOne build.
2276 * kjs/JSGlobalObject.cpp:
2278 2008-07-05 Sam Weinig <sam@webkit.org>
2280 Rubber-stamped by Cameron Zwarich.
2282 Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
2283 the functions on the global object out of JSFunction.h/cpp.
2286 * JavaScriptCore.pri:
2287 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2288 * JavaScriptCore.xcodeproj/project.pbxproj:
2289 * JavaScriptCoreSources.bkl:
2291 * kjs/AllInOneFile.cpp:
2292 * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2293 * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2294 * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2295 * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2296 * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2297 * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2298 * kjs/JSActivation.cpp:
2299 * kjs/JSFunction.cpp:
2301 * kjs/JSGlobalObject.cpp:
2302 * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2303 * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2304 The functions on the global object should be in JSGlobalObject.cpp, but putting them there
2305 was a 0.5% regression.
2307 * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
2308 * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
2313 2008-07-04 Sam Weinig <sam@webkit.org>
2315 Really fix the mac build.
2317 * JavaScriptCore.xcodeproj/project.pbxproj:
2319 2008-07-04 Sam Weinig <sam@webkit.org>
2323 * JavaScriptCore.xcodeproj/project.pbxproj:
2325 2008-07-04 Sam Weinig <sam@webkit.org>
2327 Fix non-AllInOne builds.
2330 * kjs/GetterSetter.cpp:
2331 * kjs/JSImmediate.cpp:
2332 * kjs/operations.cpp:
2334 2008-07-04 Sam Weinig <sam@webkit.org>
2336 Rubber-stamped by Dan Bernstein.
2338 Split Error and GetterSetter out of JSObject.h.
2340 * API/JSCallbackObjectFunctions.h:
2342 * JavaScriptCore.pri:
2343 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2344 * JavaScriptCore.xcodeproj/project.pbxproj:
2345 * JavaScriptCoreSources.bkl:
2346 * kjs/AllInOneFile.cpp:
2347 * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
2348 * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
2349 * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
2350 * kjs/GetterSetter.cpp:
2351 * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
2356 2008-07-04 Simon Hausmann <hausmann@webkit.org>
2358 Fix the Wx build, added TreeProfile.cpp to the build.
2360 * JavaScriptCoreSources.bkl:
2362 2008-07-03 Mark Rowe <mrowe@apple.com>
2364 Reviewed by Oliver Hunt.
2366 Fix output path of recently-added script phase to reference the correct file.
2367 This prevents Xcode from running the script phase unnecessarily, which caused
2368 the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
2370 * JavaScriptCore.xcodeproj/project.pbxproj:
2372 2008-07-03 Mark Rowe <mrowe@apple.com>
2374 Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
2375 the latter is non-standard and does not exist on Windows.
2378 (KJS::JSLock::lockCount):
2379 (KJS::JSLock::lock):
2380 (KJS::JSLock::unlock):
2381 (KJS::JSLock::DropAllLocks::DropAllLocks):
2384 2008-07-02 Mark Rowe <mrowe@apple.com>
2386 Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
2387 so use ssize_t rather than int to track the lock count to avoid warnings about
2388 truncating the result of pthread_getspecific.
2391 (KJS::JSLock::lockCount):
2392 (KJS::JSLock::lock):
2393 (KJS::JSLock::unlock):
2394 (KJS::JSLock::DropAllLocks::DropAllLocks):
2397 2008-07-03 Geoffrey Garen <ggaren@apple.com>
2399 Reviewed by Sam Weinig.
2401 Removed checking for the array get/put fast case from the array code.
2402 Callers who want the fast case should call getIndex and/or setIndex
2403 instead. (get_by_val and put_by_val already do this.)
2405 SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
2406 a 3.6% speedup on nsieve.
2408 2008-07-03 Dan Bernstein <mitz@apple.com>
2412 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
2414 2008-07-03 Dan Bernstein <mitz@apple.com>
2416 Reviewed by Anders Carlsson.
2421 (KJS::Machine::Machine):
2423 2008-07-03 Simon Hausmann <hausmann@webkit.org>
2425 Reviewed by Alexey Proskuryakov.
2427 Fix the non-threaded build.
2429 * kjs/JSGlobalData.cpp:
2430 (KJS::JSGlobalData::threadInstanceInternal):
2432 2008-07-03 Simon Hausmann <hausmann@webkit.org>
2434 Fix the Qt build, added TreeProfile to the build.
2436 * JavaScriptCore.pri:
2438 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2442 Don't create unnecessary JSGlobalData instances.
2444 * kjs/JSGlobalData.h:
2445 * kjs/JSGlobalData.cpp:
2446 (KJS::JSGlobalData::threadInstanceExists):
2447 (KJS::JSGlobalData::sharedInstanceExists):
2448 (KJS::JSGlobalData::threadInstance):
2449 (KJS::JSGlobalData::sharedInstance):
2450 (KJS::JSGlobalData::threadInstanceInternal):
2451 (KJS::JSGlobalData::sharedInstanceInternal):
2452 Added methods to query instance existence.
2454 * kjs/InitializeThreading.cpp:
2455 (KJS::initializeThreadingOnce):
2456 Initialize thread instance static in a new way.
2460 * kjs/collector.cpp:
2461 (KJS::Heap::collect):
2462 Check for instance existence before accessing it.
2464 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2466 Reviewed by Cameron Zwarich.
2468 Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
2469 REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
2471 I was never able to reproduce this issue, but Cameron could, and he says
2472 that this patch fixes it.
2474 The crash seems tied to a timer or event handler callback. In such a case,
2475 the sole reference to the global object may be in the current call frame,
2476 so we can't depend on the global object to mark the call frame area in
2479 The new GC marking rule is: the global object is not responsible for
2480 marking the whole register file -- it's just responsible for the globals
2481 section it's tied to. The heap is responsible for marking the call frame area.
2483 2008-07-02 Mark Rowe <mrowe@apple.com>
2485 Reviewed by Sam Weinig.
2487 Add the ability to trace JavaScriptCore garabge collections using dtrace.
2489 * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
2490 file when building on a new enough version of Mac OS X.
2491 * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
2492 * kjs/Tracing.d: Declare three dtrace probes.
2493 * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
2494 otherwise provide versions that do nothing.
2495 * kjs/collector.cpp:
2496 (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
2497 mark phase has completed, and when the collection is complete.
2498 * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
2500 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2502 Rubber stamped by Oliver Hunt.
2504 Reduced the max register file size from 8MB to 2MB.
2506 We still allow about 20,000 levels of recursion.
2508 2008-07-02 Alp Toker <alp@nuanti.com>
2510 Build fix for r34960. Add TreeProfile.cpp to build.
2514 2008-07-02 Geoffrey Garen <ggaren@apple.com>
2516 Reviewed by Oliver Hunt.
2518 Optimized a[n] get for cases when a is an array or a string. When a is
2519 an array, we optimize both get and put. When a is a string, we only
2520 optimize get, since you can't put to a string.
2522 SunSpider says 3.4% faster.
2524 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2528 -Small cleanup in preparation for implementing Bottom-up.
2530 * profiler/CallIdentifier.h: Rename debug function to make it clear of
2531 its output and intention to be debug only.
2532 (KJS::CallIdentifier::operator const char* ): Implement in terms of
2534 (KJS::CallIdentifier::c_str):
2535 * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
2536 by the bottom-up implementation.
2537 (KJS::ProfileNode::findChild):
2538 * profiler/ProfileNode.h: Added comments to make the collections of
2539 functions more clear.
2540 (KJS::ProfileNode::operator==):
2541 (KJS::ProfileNode::c_str):
2543 2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2547 Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
2548 <https://bugs.webkit.org/show_bug.cgi?id=19776>
2550 Perform the sign check for the exponent on the actual exponent value,
2551 which is 1 less than the value of decimalPoint, instead of on the value
2552 of decimalPoint itself.
2554 * kjs/NumberPrototype.cpp:
2555 (KJS::exponentialPartToString):
2557 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2561 <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
2562 - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
2565 * JavaScriptCore.xcodeproj/project.pbxproj:
2566 * profiler/Profile.cpp: By default we create a TreeProfile.
2567 (KJS::Profile::create):
2568 * profiler/Profile.h: Changes to the Profile class to make it amenable
2569 to be inherited from.
2570 (KJS::Profile::~Profile):
2571 * profiler/TreeProfile.cpp: Added.
2572 (KJS::TreeProfile::create):
2573 (KJS::TreeProfile::TreeProfile):
2574 (KJS::TreeProfile::heavyProfile):
2575 * profiler/TreeProfile.h: Added.
2576 (KJS::TreeProfile::treeProfile):
2578 2008-07-02 Kevin McCullough <kmccullough@apple.com>
2582 Broke CallIdentifier out into its own file. I did this because it's
2583 going to grow a lot soon and I wanted this to be a separate patch.
2585 * JavaScriptCore.xcodeproj/project.pbxproj:
2586 * profiler/CallIdentifier.h: Added.
2587 (KJS::CallIdentifier::CallIdentifier):
2588 (KJS::CallIdentifier::operator==):
2589 (KJS::CallIdentifier::operator!=):
2590 (KJS::CallIdentifier::operator const char* ):
2591 (KJS::CallIdentifier::toString):
2592 * profiler/ProfileNode.h:
2594 2008-07-02 Simon Hausmann <hausmann@webkit.org>
2596 Build fix. Implemented missing functions for single-threaded build.
2599 (KJS::JSLock::JSLock):
2600 (KJS::JSLock::lock):
2601 (KJS::JSLock::unlock):
2602 (KJS::JSLock::DropAllLocks::DropAllLocks):
2604 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2606 Another non-AllInOne build fix.
2608 * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
2610 2008-07-02 Alexey Proskuryakov <ap@webkit.org>
2612 Non-AllInOne build fix.
2614 * kjs/interpreter.cpp: Include JSLock.h.
2616 2008-06-30 Alexey Proskuryakov <ap@webkit.org>
2620 Disable JSLock for per-thread contexts.
2622 No change on SunSpider.
2624 * kjs/JSGlobalData.h:
2625 * kjs/JSGlobalData.cpp:
2626 (KJS::JSGlobalData::JSGlobalData):
2627 (KJS::JSGlobalData::sharedInstance):
2628 Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
2631 (KJS::createJSLockCount):
2632 (KJS::JSLock::lockCount):
2633 (KJS::setLockCount):
2634 (KJS::JSLock::JSLock):
2635 (KJS::JSLock::lock):
2636 (KJS::JSLock::unlock):
2637 (KJS::JSLock::currentThreadIsHoldingLock):
2638 (KJS::JSLock::DropAllLocks::DropAllLocks):
2639 (KJS::JSLock::DropAllLocks::~DropAllLocks):
2641 (KJS::JSLock::JSLock):
2642 (KJS::JSLock::~JSLock):
2643 Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
2644 actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
2645 if we want to keep existing assertions working.
2646 Made recursion count per-thread, now that locks may not lock.
2649 (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
2650 locking in any case), so that a decision whether to actually lock can be made.
2651 (JSCheckScriptSyntax): Ditto.
2652 (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
2654 * API/JSObjectRef.cpp:
2655 (JSClassCreate): Don't lock, as there is no reason to.
2656 (JSClassRetain): Ditto.
2657 (JSClassRelease): Ditto.
2658 (JSPropertyNameArrayRetain): Ditto.
2659 (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
2661 (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
2662 lookup, and possibly modification.
2664 * API/JSStringRef.cpp:
2665 (JSStringCreateWithCharacters):
2666 (JSStringCreateWithUTF8CString):
2669 (JSStringGetUTF8CString):
2671 * API/JSStringRefCF.cpp:
2672 (JSStringCreateWithCFString):
2673 JSStringRef operations other than releasing do not need locking.
2675 * VM/Machine.cpp: Don't include unused JSLock.h.
2677 * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
2678 Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
2679 the existing code could cause deadlocks.
2685 The test tool uses a per-thread context, so no real locking is required.
2688 (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
2689 per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
2690 migration between threads" by using ProtectedPtr on a background thread.
2691 (KJS::Heap::isShared): Keep a shared flag here, as well.
2694 (KJS::::ProtectedPtr):
2695 (KJS::::~ProtectedPtr):
2699 ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
2700 Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
2702 * kjs/collector.cpp:
2703 (KJS::Heap::Heap): Initialize m_isShared.
2704 (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
2706 (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
2707 so locking is always needed here.
2708 (KJS::Heap::registerThread): Ditto.
2709 (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
2710 instance for a small speedup.
2711 (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
2712 way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
2713 (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
2715 (KJS::Heap::unprotect): Ditto.
2716 (KJS::Heap::markProtectedObjects): Ditto.
2717 (KJS::Heap::protectedGlobalObjectCount): Ditto.
2718 (KJS::Heap::protectedObjectCount): Ditto.
2719 (KJS::Heap::protectedObjectTypeCounts): Ditto.
2723 Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
2724 to be added to many files in JavaScriptGlue, WebCore and WebKit.
2726 * kjs/JSGlobalObject.cpp:
2727 (KJS::JSGlobalObject::init):
2728 * API/JSCallbackConstructor.cpp:
2729 (KJS::constructJSCallback):
2730 * API/JSCallbackFunction.cpp:
2731 (KJS::JSCallbackFunction::call):
2732 * API/JSCallbackObjectFunctions.h:
2734 (KJS::::getOwnPropertySlot):
2736 (KJS::::deleteProperty):
2738 (KJS::::hasInstance):
2740 (KJS::::getPropertyNames):
2743 (KJS::::staticValueGetter):
2744 (KJS::::callbackGetter):
2745 * API/JSContextRef.cpp:
2746 (JSGlobalContextCreate):
2747 (JSGlobalContextRetain):
2748 (JSGlobalContextRelease):
2749 * API/JSValueRef.cpp:
2751 (JSValueIsStrictEqual):
2752 (JSValueIsInstanceOfConstructor):
2753 (JSValueMakeNumber):
2754 (JSValueMakeString):
2756 (JSValueToStringCopy):
2760 * JavaScriptCore.exp:
2761 * kjs/PropertyNameArray.h:
2762 (KJS::PropertyNameArray::globalData):
2763 * kjs/interpreter.cpp:
2764 (KJS::Interpreter::checkSyntax):
2765 (KJS::Interpreter::evaluate):
2766 Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
2768 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
2772 https://bugs.webkit.org/show_bug.cgi?id=19834
2773 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
2775 Creating a global object with a custom prototype resets it twice (wasteful!).
2776 So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
2779 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
2781 * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
2782 constructor and operator= to ensure that no one attempts to copy this object (for whatever
2783 reason, I couldn't make Noncopyable work).
2785 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
2788 * kjs/JSVariableObject.cpp:
2789 (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
2790 (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
2791 "changing" the value from 0 to 0.
2793 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2795 Reviewed by Oliver Hunt.
2797 Removed and/or reordered exception checks in array-style a[n] access.
2799 SunSpider says 1.4% faster.
2802 (KJS::Machine::privateExecute): No need to check for exceptions before
2803 calling toString, toNumber and/or get. If the call ends up being observable
2804 through toString, valueOf, or a getter, we short-circuit it there, instead.
2805 In the op_del_by_val case, I removed the incorrect comment without actually
2806 removing the code, since I didn't want to tempt the GCC fates!
2809 (KJS::callDefaultValueFunction): Added exception check to prevent
2810 toString and valueOf functions from observing execution after an exception
2811 has been thrown. This removes some of the burden of exception checking
2814 (KJS::JSObject::defaultValue): Removed redundant exception check here.
2816 * kjs/PropertySlot.cpp:
2817 (KJS::PropertySlot::functionGetter): Added exception check to prevent
2818 getter functions from observing execution after an exception has been
2819 thrown. This removes some of the burden of exception checking from the
2822 2008-07-01 Geoffrey Garen <ggaren@apple.com>
2824 Reviewed by Oliver Hunt.
2826 Optimized a[n] get and put for cases where n is an immediate unsigned
2829 SunSpider says 3.5% faster.
2831 2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2835 Bug 19844: JavaScript Switch statement modifies "this"
2836 <https://bugs.webkit.org/show_bug.cgi?id=19844>
2838 Use a temporary when generating code for switch clauses to avoid
2839 overwriting 'this' or a local variable.
2842 (KJS::CaseBlockNode::emitCodeForBlock):
2844 2008-07-01 Christian Dywan <christian@twotoasts.de>
2848 * kjs/list.cpp: Include "JSCell.h"
2850 2008-07-01 Kevin McCullough <kmccullough@apple.com>
2854 * JavaScriptCore.xcodeproj/project.pbxproj:
2856 2008-07-01 Dan Bernstein <mitz@apple.com>
2858 Reviewed by Anders Carlsson.
2860 - Mac release build fix
2862 * JavaScriptCore.exp:
2864 2008-07-01 Sam Weinig <sam@webkit.org>
2866 Try and fix mac builds.
2868 * JavaScriptCore.exp:
2870 2008-07-01 Sam Weinig <sam@webkit.org>
2872 Fix non-AllInOne builds.
2876 2008-07-01 Sam Weinig <sam@webkit.org>
2878 Reviewed by Darin Adler.
2880 Split JSCell and JSNumberCell class declarations out of JSValue.h
2883 * JavaScriptCore.pri:
2884 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2885 * JavaScriptCore.xcodeproj/project.pbxproj:
2886 * JavaScriptCoreSources.bkl:
2887 * VM/JSPropertyNameIterator.h:
2888 * kjs/AllInOneFile.cpp:
2889 * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
2890 * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2891 (KJS::JSValue::getJSNumber):
2892 * kjs/JSNumberCell.cpp:
2893 * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
2897 (KJS::jsOwnedString):
2899 (KJS::JSValue::toThisJSString):
2903 2008-07-01 Anders Carlsson <andersca@apple.com>
2907 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2908 * kjs/JSGlobalObject.h:
2909 (KJS::JSGlobalObject::addStaticGlobals):
2911 2008-07-01 Simon Hausmann <hausmann@webkit.org>
2913 Build fix, include OwnPtr.h.
2915 * kjs/RegExpConstructor.h:
2917 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2919 Reviewed by Oliver Hunt.
2921 Fixed a global object leak caused by the switch to one register file.
2923 Don't unconditionally mark the register file, since that logically
2924 makes all global variables GC roots, even when their global object is
2925 no longer reachable.
2927 Instead, make the global object associated with the register file
2928 responsible for marking the register file.
2930 2008-06-30 Geoffrey Garen <ggaren@apple.com>
2932 Reviewed by Oliver Hunt.
2934 Removed the "registerBase" abstraction. Since the register file never
2935 reallocates, we can keep direct pointers into it, instead of
2936 <registerBase, offset> tuples.
2938 SunSpider says 0.8% faster.
2940 2008-06-30 Oliver Hunt <oliver@apple.com>
2942 Reviewed by NOBODY (build fix).
2944 Fix build by adding all (hopefully) the missing includes.
2946 * kjs/BooleanPrototype.cpp:
2947 * kjs/DateConstructor.cpp:
2948 * kjs/ErrorPrototype.cpp:
2949 * kjs/FunctionPrototype.cpp:
2950 * kjs/NativeErrorConstructor.cpp:
2951 * kjs/NumberPrototype.cpp:
2952 * kjs/ObjectPrototype.cpp:
2953 * kjs/RegExpConstructor.cpp:
2954 * kjs/StringConstructor.cpp:
2955 * kjs/StringPrototype.cpp:
2957 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2961 Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
2962 <https://bugs.webkit.org/show_bug.cgi?id=19830>
2964 Ensure that we do not eliminate a write to a local register when doing
2965 peephole optimizations.
2967 * VM/CodeGenerator.cpp:
2968 (KJS::CodeGenerator::emitJumpIfTrue):
2969 (KJS::CodeGenerator::emitJumpIfFalse):
2971 2008-06-30 Sam Weinig <sam@webkit.org>
2973 Rubber-stamped by Darin Alder.
2975 Split InternalFunction into its own header file.
2977 * API/JSCallbackFunction.h:
2978 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2979 * JavaScriptCore.xcodeproj/project.pbxproj:
2980 * kjs/ArrayConstructor.h:
2981 * kjs/BooleanConstructor.h:
2982 * kjs/DateConstructor.h:
2983 * kjs/ErrorConstructor.h:
2984 * kjs/FunctionConstructor.h:
2985 * kjs/FunctionPrototype.h:
2986 * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
2988 * kjs/NativeErrorConstructor.h:
2989 * kjs/NumberConstructor.h:
2990 * kjs/ObjectConstructor.h:
2991 * kjs/RegExpConstructor.h:
2992 * kjs/StringConstructor.h:
2993 * profiler/Profiler.cpp:
2995 2008-06-30 Sam Weinig <sam@webkit.org>
2997 Reviewed by Kevin McCullough.
2999 Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
3002 * JavaScriptCore.pri:
3003 * JavaScriptCore.xcodeproj/project.pbxproj:
3004 * JavaScriptCoreSources.bkl:
3005 * VM/Instruction.cpp: Removed.
3006 * VM/LabelID.cpp: Removed.
3007 * VM/Register.cpp: Removed.
3008 * VM/RegisterID.cpp: Removed.
3010 2008-06-30 Sam Weinig <sam@webkit.org>
3012 Rubber-stamped (reluctantly) by Kevin McCullough.
3014 Rename date_object.h/cpp to DateInstance.h/cpp
3017 * JavaScriptCore.pri:
3018 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3019 * JavaScriptCore.xcodeproj/project.pbxproj:
3020 * JavaScriptCoreSources.bkl:
3021 * kjs/AllInOneFile.cpp:
3022 * kjs/DateConstructor.cpp:
3023 * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
3024 * kjs/DateInstance.h: Copied from kjs/date_object.h.
3025 * kjs/DatePrototype.cpp:
3026 * kjs/DatePrototype.h:
3027 * kjs/date_object.cpp: Removed.
3028 * kjs/date_object.h: Removed.
3030 2008-06-30 Sam Weinig <sam@webkit.org>
3032 Rubber-stamped by Darin Adler.
3034 Remove internal.cpp and move its contents to there own .cpp files.
3037 * JavaScriptCore.pri:
3038 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3039 * JavaScriptCore.xcodeproj/project.pbxproj:
3040 * JavaScriptCoreSources.bkl:
3041 * kjs/AllInOneFile.cpp:
3042 * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
3043 * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
3044 * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
3045 * kjs/JSString.cpp: Copied from kjs/internal.cpp.
3047 * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
3048 * kjs/NumberConstructor.cpp:
3049 * kjs/NumberObject.cpp:
3050 (KJS::constructNumber):
3051 (KJS::constructNumberFromImmediateNumber):
3052 * kjs/internal.cpp: Removed.
3054 2008-06-30 Adam Roben <aroben@apple.com>
3056 Fix <rdar://5954749> Assertion failure due to HashTable's use of
3059 HashTable was passing &value to constructDeletedValue, which in
3060 classes like WebCore::COMPtr would cause an assertion. We now pass
3061 value by reference instead of by address so that the HashTraits
3062 implementations have more flexibility in constructing the deleted
3065 Reviewed by Ada Chan.
3067 * VM/CodeGenerator.h: Updated for changes to HashTraits.
3069 (WTF::::deleteBucket): Changed to pass bucket by reference instead of
3071 (WTF::::checkKey): Ditto.
3073 (WTF::): Updated HashTraits for HashTable change.
3075 2008-07-01 Alexey Proskuryakov <ap@webkit.org>
3077 Reviewed by Cameron Zwarich.
3079 Make RegisterFile really unmap memory on destruction.
3081 This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
3083 * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
3086 * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
3087 half of WebCore rebuild.
3089 * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
3091 * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
3093 2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3095 Rubber-stamped by Oliver.
3097 Correct the documentation for op_put_by_index.
3100 (KJS::Machine::privateExecute):
3102 2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3106 Bug 19821: Merge the instruction pair (less, jfalse)
3107 <https://bugs.webkit.org/show_bug.cgi?id=19821>
3109 This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
3110 intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
3111 regression in regexp-dna.
3114 (KJS::CodeBlock::dump):
3115 * VM/CodeGenerator.cpp:
3116 (KJS::CodeGenerator::rewindBinaryOp):
3117 (KJS::CodeGenerator::emitJumpIfFalse):
3119 (KJS::Machine::privateExecute):
3124 2008-06-29 Sam Weinig <sam@webkit.org>
3126 Fix non-AllInOne builds.
3131 2008-06-29 Sam Weinig <sam@webkit.org>
3136 * kjs/DatePrototype.cpp:
3138 2008-06-29 Sam Weinig <sam@webkit.org>
3140 Rubber-stamped by Cameron Zwarich.
3142 Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
3143 NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
3146 * JavaScriptCore.pri:
3147 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3148 * JavaScriptCore.xcodeproj/project.pbxproj:
3149 * JavaScriptCoreSources.bkl:
3150 * kjs/AllInOneFile.cpp:
3151 * kjs/ArrayConstructor.cpp:
3152 * kjs/ArrayPrototype.cpp:
3153 * kjs/BooleanPrototype.cpp:
3154 * kjs/DatePrototype.cpp:
3155 * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
3156 * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
3157 * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
3158 * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
3159 * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
3160 * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
3161 * kjs/JSGlobalObject.cpp:
3164 * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
3165 * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
3166 * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
3167 * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
3168 * kjs/NumberPrototype.cpp:
3169 * kjs/RegExpConstructor.cpp:
3170 * kjs/RegExpObject.cpp:
3171 * kjs/RegExpPrototype.cpp:
3172 * kjs/StringPrototype.cpp:
3173 * kjs/error_object.cpp: Removed.
3174 * kjs/error_object.h: Removed.
3177 2008-06-29 Sam Weinig <sam@webkit.org>
3179 Fix non-AllInOne build.
3181 * kjs/DateConstructor.cpp:
3185 2008-06-29 Sam Weinig <sam@webkit.org>
3187 Rubber-stamped by Oliver Hunt.
3189 Splits DateConstructor and DatePrototype out of date_object.h/cpp
3190 Moves shared Date code into DateMath.
3192 * DerivedSources.make:
3194 * JavaScriptCore.pri:
3195 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3196 * JavaScriptCore.xcodeproj/project.pbxproj:
3197 * JavaScriptCoreSources.bkl:
3198 * kjs/AllInOneFile.cpp:
3199 * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
3200 * kjs/DateConstructor.h: Copied from kjs/date_object.h.
3202 (KJS::ymdhmsToSeconds):
3204 (KJS::skipSpacesAndComments):
3209 (KJS::formatDateUTCVariant):
3213 * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
3214 * kjs/DatePrototype.h: Copied from kjs/date_object.h.
3215 * kjs/JSGlobalObject.cpp:
3217 * kjs/date_object.cpp:
3218 * kjs/date_object.h:
3221 2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
3223 Rubber-stamped by Cameron Zwarich
3225 Fix Gtk non-AllInOne build
3227 * GNUmakefile.am: include JSVariableObject.cpp
3228 * kjs/RegExpConstructor.cpp: include RegExpObject.h
3229 * kjs/RegExpObject.h: forward declare RegExpPrototype
3231 2008-06-28 Darin Adler <darin@apple.com>
3233 Reviewed by Sam and Cameron.
3235 - fix https://bugs.webkit.org/show_bug.cgi?id=19805
3236 Array.concat turns missing array elements into "undefined"
3238 Test: fast/js/array-holes.html
3240 * JavaScriptCore.exp: No longer export JSArray::getItem.
3242 * kjs/ArrayPrototype.cpp:
3243 (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
3244 JSArray::getItem -- need to handle properties from the prototype chain
3245 instead of ignoring them.
3247 * kjs/JSArray.cpp: Removed getItem.
3248 * kjs/JSArray.h: Ditto.
3250 2008-06-28 Darin Adler <darin@apple.com>
3252 Reviewed by Cameron.
3254 - https://bugs.webkit.org/show_bug.cgi?id=19804
3255 optimize access to arrays without "holes"
3257 SunSpider says 1.8% faster.
3260 (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
3261 arrays. Also updated for new location of m_vectorLength.
3262 (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
3263 (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
3264 getOwnPropertySlot to make the hot part faster.
3265 (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
3266 indices lower than m_fastAccessCutoff. We can do theese with no
3267 additional checks or branches.
3268 (KJS::JSArray::put): Added a new faster case for indices lower than
3269 m_fastAccessCutoff. We can do theese with no additional checks or
3270 branches. Moved the maxArrayIndex handling out of this function.
3271 Added code to set m_fastAccessCutoff when the very last hole in
3272 an array is filled; this is how the cutoff gets set for most arrays.
3273 (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
3274 in here, to make the hot part of the put function faster.
3275 (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
3276 when a delete makes a new hole in the array.
3277 (KJS::JSArray::getPropertyNames): Updated for new location of
3279 (KJS::JSArray::increaseVectorLength): Ditto.
3280 (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
3281 when setLength makes the array smaller.
3282 (KJS::JSArray::mark): Updated for new location of m_vectorLength.
3283 (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
3284 all the holes to the end of the array.
3285 (KJS::JSArray::compactForSorting): Ditto.
3286 (KJS::JSArray::checkConsistency): Added consistency checks fro
3287 m_fastAccessCutoff and updated for the new location of m_vectorLength.
3289 * kjs/JSArray.h: Added declarations for slow case functions.
3290 Replaced m_vectorLength with m_fastAccessCutoff.
3292 2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3296 When executing a native call, check for an exception before writing the
3300 (KJS::Machine::privateExecute):
3302 2008-06-28 Mark Rowe <mrowe@apple.com>
3304 Build fix. Flag headers as private or public as is appropriate.
3305 These settings were accidentally removed during some project file cleanup.
3307 * JavaScriptCore.xcodeproj/project.pbxproj:
3309 2008-06-28 Sam Weinig <sam@webkit.org>
3311 Rubber-stamped by Darin Adler.
3313 Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
3315 * DerivedSources.make:
3317 * JavaScriptCore.pri:
3318 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3319 * JavaScriptCore.xcodeproj/project.pbxproj:
3320 * JavaScriptCoreSources.bkl:
3322 * kjs/AllInOneFile.cpp:
3323 * kjs/JSGlobalObject.cpp:
3324 * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
3325 * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
3326 * kjs/RegExpObject.cpp:
3327 * kjs/RegExpObject.h:
3328 * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
3329 * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
3330 * kjs/StringPrototype.cpp:
3333 2008-06-28 Sam Weinig <sam@webkit.org>
3335 Fix non-AllInOne builds.
3337 * kjs/StringConstructor.cpp:
3339 2008-06-28 Sam Weinig <sam@webkit.org>
3341 Rubber-stamped by Darin Adler.
3343 Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
3344 StringConstructor and StringPrototype.
3346 * DerivedSources.make:
3348 * JavaScriptCore.pri:
3349 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3350 * JavaScriptCore.xcodeproj/project.pbxproj:
3351 * JavaScriptCoreSources.bkl:
3352 * kjs/AllInOneFile.cpp:
3353 * kjs/JSGlobalObject.cpp:
3354 * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
3355 * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
3356 * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
3357 * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
3358 * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
3359 * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
3360 * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
3362 * kjs/string_object.cpp: Removed.
3363 * kjs/string_object.h: Removed.
3365 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
3367 Gtk build fix: JSVariableObject is now part of AllInOne
3371 2008-06-28 Darin Adler <darin@apple.com>
3375 - https://bugs.webkit.org/show_bug.cgi?id=19801
3376 add a feature so we can tell what regular expressions are taking time
3378 * pcre/pcre_compile.cpp:
3379 (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
3381 * pcre/pcre_exec.cpp:
3382 (jsRegExpExecute): Add hook to time execution.
3383 (Histogram::~Histogram): Print a sorted list of what took time.
3384 (Histogram::add): Accumulate records of what took time.
3385 (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
3386 Histogram::add at the right moment and creates the global histogram
3389 * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
3391 * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
3392 any more, but an omissions an earlier version of this patch detected.
3393 * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
3394 * pcre/pcre_xclass.cpp: Ditto.
3396 2008-06-28 Sam Weinig <sam@webkit.org>
3398 Try and fix the Windows build again.
3400 * kjs/RegExpObject.cpp:
3401 * kjs/date_object.cpp:
3402 * kjs/error_object.cpp:
3404 2008-06-28 Sam Weinig <sam@webkit.org>
3406 Rubber-stamped by Darin Adler.
3408 Remove unused StringConstructorFunction class.
3410 * kjs/string_object.h:
3412 2008-06-28 Sam Weinig <sam@webkit.org>
3416 * kjs/ArrayPrototype.cpp:
3417 * kjs/BooleanPrototype.cpp:
3418 * kjs/BooleanPrototype.h:
3419 * kjs/FunctionPrototype.cpp:
3420 * kjs/JSImmediate.cpp:
3422 * kjs/MathObject.cpp:
3423 * kjs/NumberPrototype.cpp:
3424 * kjs/NumberPrototype.h:
3425 * kjs/ObjectConstructor.cpp:
3426 * kjs/RegExpObject.h:
3427 * kjs/error_object.h:
3428 * kjs/string_object.cpp:
3430 2008-06-28 Sam Weinig <sam@webkit.org>
3432 Rubber-stamped by Oliver Hunt.
3434 Splits FunctionConstructor out of FunctionPrototype.h/cpp
3435 Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
3436 Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
3438 * API/JSCallbackConstructor.cpp:
3439 * API/JSClassRef.cpp:
3440 * API/JSObjectRef.cpp:
3441 * DerivedSources.make:
3443 * JavaScriptCore.pri:
3444 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3445 * JavaScriptCore.xcodeproj/project.pbxproj:
3446 * JavaScriptCoreSources.bkl:
3448 * kjs/AllInOneFile.cpp:
3449 * kjs/ArrayConstructor.cpp:
3450 * kjs/ArrayConstructor.h:
3451 * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
3452 * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
3453 * kjs/FunctionPrototype.cpp:
3454 * kjs/FunctionPrototype.h:
3455 * kjs/JSFunction.cpp:
3456 * kjs/JSGlobalObject.cpp:
3457 * kjs/JSImmediate.cpp:
3459 * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
3460 * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
3461 * kjs/NumberObject.cpp:
3462 * kjs/NumberObject.h:
3463 * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
3464 * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
3465 * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
3466 * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
3467 * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
3468 * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
3469 * kjs/RegExpObject.h:
3471 * kjs/error_object.h:
3474 * kjs/object_object.cpp: Removed.
3475 * kjs/object_object.h: Removed.
3476 * kjs/string_object.h:
3478 2008-06-28 Darin Adler <darin@apple.com>
3482 - fix https://bugs.webkit.org/show_bug.cgi?id=19796
3483 optimize expressions with ignored results (especially post-increment)
3485 SunSpider says 0.9% faster.
3487 * VM/CodeGenerator.h:
3488 (KJS::CodeGenerator::tempDestination): Create a new temporary for
3489 ignoredResult() too, just as we would for 0.
3490 (KJS::CodeGenerator::finalDestination): Use the temporary if the
3491 register passed in is ignoredResult() too, just as we would for 0.
3492 (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
3493 passed in register is ignoredResult(), just as we would for 0.
3494 (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
3495 register passed in is ignoredResult(). What matters is that we
3496 don't want to emit a move. The return value won't be looked at.
3497 (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
3498 through to the node's emitCode function.
3501 (KJS::ignoredResult): Added. Special value to indicate the result of
3502 a node will be ignored and need not be put in any register.
3505 (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
3506 (KJS::BooleanNode::emitCode): Ditto.
3507 (KJS::NumberNode::emitCode): Ditto.
3508 (KJS::StringNode::emitCode): Ditto.
3509 (KJS::RegExpNode::emitCode): Ditto.
3510 (KJS::ThisNode::emitCode): Ditto.
3511 (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3512 the identifier resolves to a local variable.
3513 (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
3514 and the object is empty.
3515 (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
3516 nothing for the local constant case, and do a pre-increment in all the
3518 (KJS::PostDecResolveNode::emitCode): Ditto.
3519 (KJS::PostIncBracketNode::emitCode): Ditto.
3520 (KJS::PostDecBracketNode::emitCode): Ditto.
3521 (KJS::PostIncDotNode::emitCode): Ditto.
3522 (KJS::PostDecDotNode::emitCode): Ditto.
3523 (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
3525 (KJS::VoidNode::emitCode): Ditto.
3526 (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
3527 if the identifier resolves to a local variable, and don't bother generating
3528 a typeof opcode in the other case.
3529 (KJS::TypeOfValueNode::emitCode): Ditto.
3530 (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
3531 the identifier resolves to a local constant.
3532 (KJS::PreDecResolveNode::emitCode): Ditto.
3533 (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
3534 places, because we need to put the result into a register so we can assign
3535 it. At other sites this is taken care of by functions like finalDestination.
3536 (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
3538 (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
3540 (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
3543 2008-06-28 Darin Adler <darin@apple.com>
3547 - https://bugs.webkit.org/show_bug.cgi?id=19787
3548 create most arrays from values in registers rather than with multiple put operations
3550 SunSpider says 0.8% faster.
3553 (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
3555 (KJS::Machine::privateExecute): Ditto.
3557 * VM/CodeGenerator.cpp:
3558 (KJS::CodeGenerator::emitNewArray): Added.
3559 * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
3562 (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
3563 initialized with as many elements as possible. If the array doesn't have any
3564 holes in it, that's all that's needed. If there are holes, then emit some separate
3565 put operations for the other values in the array and for the length as needed.
3567 * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
3568 iterate through elements and generate code to evaluate them. Now ArrayNode does
3569 not need to be a friend. Also took out some unused PlacementNewAdoptType
3572 2008-06-28 Darin Adler <darin@apple.com>
3576 * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
3577 We no longer mutate the AST in place.
3579 2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
3581 Reviewed by Oliver Hunt.
3585 * VM/Machine.cpp: include stdio.h for printf
3587 2008-06-27 Sam Weinig <sam@webkit.org>
3589 Reviewed by Oliver Hunt.
3591 Fix platforms that don't use AllInOne.cpp
3593 * kjs/BooleanConstructor.h:
3594 * kjs/BooleanPrototype.h:
3595 * kjs/FunctionPrototype.cpp:
3597 2008-06-27 Sam Weinig <sam@webkit.org>
3599 Rubber-stamped by Oliver Hunt.
3601 Splits ArrayConstructor out of ArrayPrototype.h/cpp
3602 Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
3605 * JavaScriptCore.pri:
3606 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3607 * JavaScriptCore.xcodeproj/project.pbxproj:
3608 * JavaScriptCoreSources.bkl:
3610 * kjs/AllInOneFile.cpp:
3611 * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
3612 * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
3613 * kjs/ArrayPrototype.cpp:
3614 * kjs/ArrayPrototype.h:
3615 * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
3616 * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
3617 * kjs/BooleanObject.cpp:
3618 * kjs/BooleanObject.h:
3619 * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
3620 * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
3621 * kjs/CommonIdentifiers.h:
3622 * kjs/FunctionPrototype.cpp:
3624 * kjs/JSGlobalObject.cpp:
3625 * kjs/JSImmediate.cpp:
3629 * kjs/string_object.cpp:
3631 2008-06-27 Oliver Hunt <oliver@apple.com>
3635 Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
3636 <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
3638 Adds support for the slow script dialog in squirrelfish. This requires the addition
3639 of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
3640 same behaviour as their simple jump equivalents but have an additional time out check.
3642 Additional assertions were added to other jump instructions to prevent accidentally
3643 creating loops with jump types that do not support time out checks.
3645 Sunspider does not report a regression, however this appears very sensitive to code
3646 layout and hardware, so i would expect up to a 1% regression on other systems.
3648 Part of this required moving the old timeout logic from JSGlobalObject and into Machine
3649 which is the cause of a number of the larger diff blocks.
3651 * JavaScriptCore.exp:
3653 (KJS::CodeBlock::dump):
3654 * VM/CodeGenerator.cpp:
3655 (KJS::CodeGenerator::emitJumpIfTrue):
3656 (KJS::CodeGenerator::emitJumpScopes):
3657 * VM/ExceptionHelpers.cpp:
3658 (KJS::InterruptedExecutionError::isWatchdogException):
3659 (KJS::createInterruptedExecutionException):
3660 * VM/ExceptionHelpers.h:
3663 (KJS::Machine::Machine):
3664 (KJS::Machine::throwException):
3665 (KJS::Machine::resetTimeoutCheck):
3666 (KJS::getCurrentTime):
3667 (KJS::Machine::checkTimeout):
3668 (KJS::Machine::privateExecute):
3670 (KJS::Machine::setTimeoutTime):
3671 (KJS::Machine::startTimeoutCheck):
3672 (KJS::Machine::stopTimeoutCheck):
3673 (KJS::Machine::initTimeout):
3677 * kjs/JSGlobalObject.cpp:
3678 (KJS::JSGlobalObject::init):
3679 (KJS::JSGlobalObject::setTimeoutTime):
3680 (KJS::JSGlobalObject::startTimeoutCheck):
3681 * kjs/JSGlobalObject.h:
3683 * kjs/interpreter.cpp:
3684 (KJS::Interpreter::evaluate):
3686 2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
3688 Gtk and Qt build fix: Remove RegisterFileStack from the build
3692 * JavaScriptCore.pri:
3694 2008-06-27 Adele Peterson <adele@apple.com>
3700 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3701 * VM/RegisterFile.h:
3702 (KJS::RegisterFile::RegisterFile):
3703 * kjs/JSGlobalObject.cpp:
3704 * kjs/collector.cpp:
3706 2008-06-27 Geoffrey Garen <ggaren@apple.com>
3708 Reviewed by Oliver Hunt.
3710 One RegisterFile to rule them all!
3712 SunSpider reports a 0.2% speedup.
3714 This patch removes the RegisterFileStack abstraction and replaces it with
3715 a single register file that
3717 (a) allocates a fixed storage area, including a fixed area for global
3718 vars, so that no operation may cause the register file to reallocate
3722 (b) swaps between global storage areas when executing code in different
3725 This patch also changes the layout of the register file so that all call
3726 frames, including call frames for global code, get a header. This is
3727 required to support re-entrant global code. It also just makes things simpler.
3729 * VM/CodeGenerator.cpp:
3730 (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
3733 (a) global vars don't contribute to a CodeBlock's numLocals count, since
3734 global storage is fixed and allocated at startup
3738 (b) references to global vars get shifted to elide intermediate stack
3739 between "r" and the global storage area.
3742 (KJS::Machine::dumpRegisters): Updated this function to match the new
3743 register file layout, and added the ability to dump exact identifiers
3744 for the different parts of a call frame.
3746 (KJS::Machine::unwindCallFrame): Updated this function to match the new
3747 register file layout.
3749 (KJS::Machine::execute): Updated this function to initialize a call frame
3750 header for global code, and to swap global storage areas when switching
3751 to execution in a new global object.
3753 (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
3754 of registerBase because the register file is always safe for reentry now,
3755 and registerBase never changes.
3757 * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
3758 to resolve a header dependency problem (a good sign that the enum belonged
3759 in RegisterFile all along!)
3761 * VM/RegisterFile.cpp:
3762 * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
3763 area. This allows us to avoid re-allocting the register file later on.
3764 Instead, we rely on the OS to allocate physical pages to the register
3767 * VM/RegisterFileStack.cpp: Removed. Tada!
3768 * VM/RegisterFileStack.h: Removed. Tada!
3770 * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
3771 register file layout, greatly simplifying it in the process.
3773 * kjs/JSActivation.h:
3774 * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
3775 since the global object now needs to be able to tear off its registers
3776 just like the activation object.
3778 * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
3780 * kjs/JSGlobalObject.h:
3781 * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
3782 global storage area into and out of the register file.
3784 * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
3786 * kjs/collector.cpp: Renamed markStackObjectConservatively to
3787 markConservatively, since we don't just mark stack objects this way.
3789 Also, added code to mark the machine's register file.
3791 * kjs/config.h: Moved some platforms #defines from here...
3792 * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
3795 2008-06-26 Mark Rowe <mrowe@apple.com>
3797 Speculative fix for the Windows build.
3799 * kjs/JSImmediate.cpp:
3801 2008-06-26 Mark Rowe <mrowe@apple.com>
3803 Reviewed by Darin Adler and Geoff Garen.
3805 Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
3806 bogus output in an application that uses JavaScriptCore.
3808 * kjs/CollectorHeapIntrospector.cpp:
3809 (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
3810 * kjs/CollectorHeapIntrospector.h:
3811 * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
3812 Returning zero for all values is preferable to returning bogus data.
3814 2008-06-26 Darin Adler <darin@apple.com>
3818 - https://bugs.webkit.org/show_bug.cgi?id=19721
3819 speed up JavaScriptCore by not wrapping strings in objects just
3820 to call functions on them
3822 - optimize UString append and the replace function a bit
3824 SunSpider says 1.8% faster.
3826 * JavaScriptCore.exp: Updated.
3828 * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
3829 because jsString returns a JSString*.
3832 (KJS::Machine::privateExecute): Removed the toObject call from native
3833 function calls. Also removed code to put the this value into a register.
3835 * kjs/BooleanObject.cpp:
3836 (KJS::booleanProtoFuncToString): Rewrite to handle false and true
3839 * kjs/FunctionPrototype.cpp:
3840 (KJS::constructFunction): Use single-character append rather than building
3841 a string for each character.
3842 * kjs/JSFunction.cpp:
3843 (KJS::globalFuncUnescape): Ditto.
3845 * kjs/JSImmediate.cpp:
3846 (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
3847 use with an immediate value. To be used instead of toObject when doing a
3848 get on an immediate value.
3849 * kjs/JSImmediate.h: Added prototype.
3852 (KJS::JSObject::toString): Tweaked formatting.
3855 (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
3856 an object wrapper just to search for properties. This also saves an
3857 unnecessary hash table lookup since the object wrappers themselves don't
3858 have any properties.
3860 * kjs/JSString.h: Added toThisString and toThisJSString.
3863 (KJS::JSCell::toThisString): Added.
3864 (KJS::JSCell::toThisJSString): Added.
3865 (KJS::JSCell::getJSNumber): Added.
3866 (KJS::jsString): Changed return type to JSString*.
3867 (KJS::jsOwnedString): Ditto.
3870 (KJS::JSValue::toThisString): Added.
3871 (KJS::JSValue::toThisJSString): Added.
3872 (KJS::JSValue::getJSNumber): Added.
3874 * kjs/NumberObject.cpp:
3875 (KJS::NumberObject::getJSNumber): Added.
3876 (KJS::integer_part_noexp): Append C string directly rather than first
3877 turning it into a UString.
3878 (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
3879 is a number rather than isObject(&NumberObject::info). This works for
3880 immediate numbers, number cells, and NumberObject instances.
3881 (KJS::numberProtoFuncToLocaleString): Ditto.
3882 (KJS::numberProtoFuncValueOf): Ditto.
3883 (KJS::numberProtoFuncToFixed): Ditto.
3884 (KJS::numberProtoFuncToExponential): Ditto.
3885 (KJS::numberProtoFuncToPrecision): Ditto.
3886 * kjs/NumberObject.h: Added getJSNumber.
3888 * kjs/PropertySlot.cpp: Tweaked comment.
3891 (KJS::JSString::toThisString): Added.
3892 (KJS::JSString::toThisJSString): Added.
3893 (KJS::JSString::getOwnPropertySlot): Changed code that searches the
3894 prototype chain to start with the string prototype and not create a
3896 (KJS::JSNumberCell::toThisString): Added.
3897 (KJS::JSNumberCell::getJSNumber): Added.
3900 (KJS::staticFunctionGetter): Moved here, because there's no point in
3901 having a function that's only used for a function pointer be inline.
3902 (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
3905 (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
3906 to have a function that's only used for a function pointer be inline.
3907 (KJS::getStaticFunctionSlot): Changed to get properties from the parent
3908 first before doing any handling of functions. This is the fastest way
3909 to return the function once the initial setup is done.
3911 * kjs/string_object.cpp:
3912 (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
3913 avoiding an unnecessary virtual function call (the call to the type()
3914 function in the implementation of the isString() function).
3915 (KJS::StringObject::toString): Added.
3916 (KJS::StringObject::toThisString): Added.
3917 (KJS::StringObject::toThisJSString): Added.
3918 (KJS::substituteBackreferences): Rewrote to use a appending algorithm
3919 instead of a the old one that tried to replace in place.
3920 (KJS::stringProtoFuncReplace): Merged this function and the replace function.
3921 Replaced the hand-rolled dynamic arrays for source ranges and replacements
3923 (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
3924 Removed the separate valueOf implementation, since it can just share this.
3925 (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
3926 well as StringObject, and is slightly more efficient than the old code too.
3927 (KJS::stringProtoFuncCharCodeAt): Ditto.
3928 (KJS::stringProtoFuncConcat): Ditto.
3929 (KJS::stringProtoFuncIndexOf): Ditto.
3930 (KJS::stringProtoFuncLastIndexOf): Ditto.
3931 (KJS::stringProtoFuncMatch): Ditto.
3932 (KJS::stringProtoFuncSearch): Ditto.
3933 (KJS::stringProtoFuncSlice): Ditto.
3934 (KJS::stringProtoFuncSplit): Ditto.
3935 (KJS::stringProtoFuncSubstr): Ditto.
3936 (KJS::stringProtoFuncSubstring): Ditto.
3937 (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
3938 (KJS::stringProtoFuncToUpperCase): Ditto.
3939 (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
3940 (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
3941 (KJS::stringProtoFuncLocaleCompare): Ditto.
3942 (KJS::stringProtoFuncBig): Use toThisString.
3943 (KJS::stringProtoFuncSmall): Ditto.
3944 (KJS::stringProtoFuncBlink): Ditto.
3945 (KJS::stringProtoFuncBold): Ditto.
3946 (KJS::stringProtoFuncFixed): Ditto.
3947 (KJS::stringProtoFuncItalics): Ditto.
3948 (KJS::stringProtoFuncStrike): Ditto.
3949 (KJS::stringProtoFuncSub): Ditto.
3950 (KJS::stringProtoFuncSup): Ditto.
3951 (KJS::stringProtoFuncFontcolor): Ditto.
3952 (KJS::stringProtoFuncFontsize): Ditto.
3953 (KJS::stringProtoFuncAnchor): Ditto.
3954 (KJS::stringProtoFuncLink): Ditto.
3956 * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
3959 (KJS::UString::append): Added a version that takes a character pointer and
3960 size, so we don't have to create a UString just to append to another UString.
3963 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
3967 Make JSGlobalData per-thread.
3969 No change on SunSpider total.
3971 * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
3973 * kjs/JSGlobalObject.cpp:
3974 (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
3975 want to preserve these somehow to keep legacy behavior in working condition.
3976 (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
3977 when updating JSGlobalObject linked list.
3979 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
3980 to use JSGlobalData associated with the current object.
3982 * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
3983 Heap::registerAsMainThread() call.
3985 * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
3986 transient, and while newParserObjects may conceptually be such, there is still some node
3987 manipulation going on outside Parser::parse which touches it.
3989 * kjs/JSGlobalData.cpp:
3990 (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
3991 (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
3993 * kjs/collector.cpp:
3995 (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
3996 (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
3997 (KJS::Heap::collect): Ditto.
3998 (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
3999 list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
4000 work with the main thread currently anyway.
4001 (KJS::Heap::protectedGlobalObjectCount): Ditto.
4003 * kjs/collector.h: Removed code related to "collect on main thread only" logic.
4005 * JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
4007 2008-06-26 Alexey Proskuryakov <ap@webkit.org>
4011 https://bugs.webkit.org/show_bug.cgi?id=19767
4012 REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
4014 * kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
4015 Made changing balance factor from -1 to +1 work correctly.
4017 * wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
4018 this slightly earlier.
4020 2008-06-25 Timothy Hatcher <timothy@apple.com>
4022 Fixes an ASSERT in the profiler when starting multiple profiles
4023 with the same name inside the same function/program.
4025 Reviewed by Kevin McCullough.
4027 * profiler/Profile.cpp:
4028 (KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
4029 (KJS::Profile::stopProfiling): Set the current node to the parent,
4030 because we are in a call that will not get a didExecute call.
4031 (KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
4032 account for didExecute not being called for profile.
4033 (KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
4034 (KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
4035 greater than zero, and return early.
4036 * profiler/Profile.h: Added stoppedProfiling().
4037 * profiler/Profiler.cpp:
4038 (KJS::Profiler::findProfile): Removed.
4039 (KJS::Profiler::startProfiling): Don't return early for stopped profiles.
4040 (KJS::Profiler::stopProfiling): Skipp stopped profiles.
4041 (KJS::Profiler::didFinishAllExecution): Code clean-up.
4042 * profiler/Profiler.h: Removed findProfile.
4044 2008-06-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4046 Reviewed by Alexey Proskuryakov.
4048 Attempt to fix Windows debug build. The compiler gives a warning when
4049 Structured Exception Handling and destructors are used in the same
4050 function. Using manual locking and unlocking instead of constructors
4051 and destructors should fix the warning.
4056 2008-06-25 Alexey Proskuryakov <ap@webkit.org>
4058 Forgot to address a review comment about better names for tracked objects, doing it now.
4060 * kjs/JSGlobalData.cpp:
4061 (KJS::JSGlobalData::JSGlobalData):
4062 * kjs/JSGlobalData.h:
4064 (KJS::ParserRefCounted::ParserRefCounted):
4065 (KJS::ParserRefCounted::ref):
4066 (KJS::ParserRefCounted::deref):
4067 (KJS::ParserRefCounted::hasOneRef):
4068 (KJS::ParserRefCounted::deleteNewObjects):
4070 2008-06-25 Alexey Proskuryakov <ap@webkit.org>
4074 Remove more threadInstance() calls.
4076 * kjs/JSFunction.cpp:
4077 (KJS::JSFunction::getParameterName):
4078 (KJS::IndexToNameMap::unMap):
4079 (KJS::Arguments::deleteProperty):
4081 Access nullIdentifier without going to thread specific storage.
4083 * JavaScriptCore.exp:
4084 * kjs/JSGlobalData.cpp:
4085 (KJS::JSGlobalData::JSGlobalData):
4086 * kjs/JSGlobalData.h:
4088 (KJS::Parser::parse):
4090 (KJS::ParserRefCountedData::ParserRefCountedData):
4091 (KJS::Parser::parse):
4094 (KJS::ParserRefCounted::ParserRefCounted):
4095 (KJS::ParserRefCounted::ref):
4096 (KJS::ParserRefCounted::deref):
4097 (KJS::ParserRefCounted::hasOneRef):
4098 (KJS::ParserRefCounted::deleteNewObjects):
4100 (KJS::StatementNode::StatementNode):
4101 (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
4102 (KJS::ConstDeclNode::ConstDeclNode):
4103 (KJS::BlockNode::BlockNode):
4104 (KJS::ForInNode::ForInNode):
4105 (KJS::ScopeNode::ScopeNode):
4106 (KJS::ProgramNode::ProgramNode):
4107 (KJS::ProgramNode::create):
4108 (KJS::EvalNode::EvalNode):
4109 (KJS::EvalNode::create):
4110 (KJS::FunctionBodyNode::FunctionBodyNode):
4111 (KJS::FunctionBodyNode::create):
4113 (KJS::ExpressionNode::):
4115 (KJS::BooleanNode::):
4116 (KJS::NumberNode::):
4117 (KJS::ImmediateNumberNode::):
4118 (KJS::StringNode::):
4119 (KJS::RegExpNode::):
4121 (KJS::ResolveNode::):
4122 (KJS::ElementNode::):
4124 (KJS::PropertyNode::):
4125 (KJS::PropertyListNode::):
4126 (KJS::ObjectLiteralNode::):
4127 (KJS::BracketAccessorNode::):
4128 (KJS::DotAccessorNode::):
4129 (KJS::ArgumentListNode::):
4130 (KJS::ArgumentsNode::):
4131 (KJS::NewExprNode::):
4132 (KJS::EvalFunctionCallNode::):
4133 (KJS::FunctionCallValueNode::):
4134 (KJS::FunctionCallResolveNode::):
4135 (KJS::FunctionCallBracketNode::):
4136 (KJS::FunctionCallDotNode::):
4137 (KJS::PrePostResolveNode::):
4138 (KJS::PostIncResolveNode::):
4139 (KJS::PostDecResolveNode::):
4140 (KJS::PostfixBracketNode::):
4141 (KJS::PostIncBracketNode::):
4142 (KJS::PostDecBracketNode::):
4143 (KJS::PostfixDotNode::):
4144 (KJS::PostIncDotNode::):
4145 (KJS::PostDecDotNode::):
4146 (KJS::PostfixErrorNode::):
4147 (KJS::DeleteResolveNode::):
4148 (KJS::DeleteBracketNode::):
4149 (KJS::DeleteDotNode::):
4150 (KJS::DeleteValueNode::):
4152 (KJS::TypeOfResolveNode::):
4153 (KJS::TypeOfValueNode::):
4154 (KJS::PreIncResolveNode::):
4155 (KJS::PreDecResolveNode::):
4156 (KJS::PrefixBracketNode::):
4157 (KJS::PreIncBracketNode::):
4158 (KJS::PreDecBracketNode::):
4159 (KJS::PrefixDotNode::):
4160 (KJS::PreIncDotNode::):
4161 (KJS::PreDecDotNode::):
4162 (KJS::PrefixErrorNode::):
4163 (KJS::UnaryOpNode::UnaryOpNode):
4164 (KJS::UnaryPlusNode::):
4165 (KJS::NegateNode::):
4166 (KJS::BitwiseNotNode::):
4167 (KJS::LogicalNotNode::):
4168 (KJS::BinaryOpNode::BinaryOpNode):
4169 (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
4175 (KJS::LeftShiftNode::):
4176 (KJS::RightShiftNode::):
4177 (KJS::UnsignedRightShiftNode::):
4179 (KJS::GreaterNode::):
4180 (KJS::LessEqNode::):
4181 (KJS::GreaterEqNode::):
4182 (KJS::InstanceOfNode::):
4185 (KJS::NotEqualNode::):
4186 (KJS::StrictEqualNode::):
4187 (KJS::NotStrictEqualNode::):
4188 (KJS::BitAndNode::):
4190 (KJS::BitXOrNode::):
4191 (KJS::LogicalAndNode::):
4192 (KJS::LogicalOrNode::):
4193 (KJS::ConditionalNode::):
4194 (KJS::ReadModifyResolveNode::):
4195 (KJS::AssignResolveNode::):
4196 (KJS::ReadModifyBracketNode::):
4197 (KJS::AssignBracketNode::):
4198 (KJS::AssignDotNode::):
4199 (KJS::ReadModifyDotNode::):
4200 (KJS::AssignErrorNode::):
4202 (KJS::VarDeclCommaNode::):
4203 (KJS::ConstStatementNode::):
4204 (KJS::SourceElements::SourceElements):
4205 (KJS::EmptyStatementNode::):
4206 (KJS::DebuggerStatementNode::):
4207 (KJS::ExprStatementNode::):
4208 (KJS::VarStatementNode::):
4210 (KJS::IfElseNode::):
4211 (KJS::DoWhileNode::):
4214 (KJS::ContinueNode::):
4216 (KJS::ReturnNode::):
4221 (KJS::ParameterNode::):
4222 (KJS::FuncExprNode::):
4223 (KJS::FuncDeclNode::):
4224 (KJS::CaseClauseNode::):
4225 (KJS::ClauseListNode::):
4226 (KJS::CaseBlockNode::):
4227 (KJS::SwitchNode::):
4228 Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
4229 threadInstance calls.
4231 2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4233 Reviewed by Alexey Proskuryakov.
4235 Make the JavaScript shell collect the heap from main() instead of
4236 jscmain() to suppress leak messages in debug builds.
4242 2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4246 Make the conversion of the pair (less, jtrue) to jless use register
4247 reference counting information for safety instead of requiring callers
4248 to decide whether it is safe.
4250 No changes on SunSpider codegen.
4252 * VM/CodeGenerator.cpp:
4253 (KJS::CodeGenerator::emitJumpIfTrue):
4254 * VM/CodeGenerator.h:
4256 (KJS::DoWhileNode::emitCode):
4257 (KJS::WhileNode::emitCode):
4258 (KJS::ForNode::emitCode):
4259 (KJS::CaseBlockNode::emitCodeForBlock):
4261 2008-06-24 Kevin McCullough <kmccullough@apple.com>
4265 <rdar://problem/6031594> JSProfiler: Profiler goes into an infinite
4267 <rdar://problem/6031603> JSProfiler: Profiler asserts in debug and
4268 give the wrong times in release
4270 Fixed two issues found by Tim in the same test.
4272 * profiler/Profile.cpp:
4273 (KJS::Profile::removeProfileStart): No longer take profile's time from
4274 all ancestors, but instead attribute it to its parent. Also add an
4275 Assert to ensure we only delete the child we mean to.
4276 (KJS::Profile::removeProfileEnd): Ditto for profileEnd.
4277 (KJS::Profile::didExecute): Cleaned up the execution order and correctly
4278 attribute all of the parent's time to the new node.
4279 * profiler/ProfileNode.cpp: If this node does not have a startTime it
4280 should not get a giant total time, but instead be 0.
4281 (KJS::ProfileNode::endAndRecordCall):
4282 * profiler/ProfileNode.h:
4283 (KJS::ProfileNode::removeChild): Should reset the sibling pointers since
4284 one of them has been removed.
4286 2008-06-24 Darin Adler <darin@apple.com>
4288 Reviewed by Cameron.
4290 - fix https://bugs.webkit.org/show_bug.cgi?id=19739
4291 REGRESSION: fast/js/property-getters-and-setters.html fails
4294 (KJS::JSObject::put): Remove an untested optimization I checked in by accident.
4295 The two loops up the prototype chain both need to start from this; instead the
4296 second loop was starting where the first loop left off.
4298 2008-06-24 Steve Falkenburg <sfalken@apple.com>
4304 2008-06-24 Joerg Bornemann <joerg.bornemann@trolltech.com>
4308 For the Qt build on Windows don't depend on the presence of GNU CPP
4309 but use MSVC's preprocessor instead.
4310 dftables accepts a --preprocessor option which is set in pcre.pri for MSVC platforms.
4312 * pcre/dftables: Added support for specifying the preprocessor command
4313 to use via --preprocessor, similar to
4314 WebCore/bindings/scripts/generate-bindings.pl.
4315 * pcre/pcre.pri: Pass --preprocessor='cl /e' to dftables, or more
4316 generally speaking QMAKE_CC /E for the win32-msvc buildspecs.
4318 2008-06-24 Simon Hausmann <hausmann@webkit.org>
4320 Fix the Qt build, added missing include.
4322 * kjs/PropertySlot.cpp:
4324 2008-06-24 Alexey Proskuryakov <ap@webkit.org>
4326 Reviewed by Cameron Zwarich.
4328 Make ParserRefCountedCounter actually perform a leak check.
4331 (KJS::ParserRefCountedCounter::~ParserRefCountedCounter): Check for leaks in destructor,
4333 (KJS::ParserRefCountedCounter::increment):
4334 (KJS::ParserRefCountedCounter::decrement):
4335 (KJS::ParserRefCounted::ParserRefCounted):
4336 (KJS::ParserRefCounted::~ParserRefCounted):
4337 While at it, also made counting thread-safe.
4339 2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4343 Bug 19730: REGRESSION (r34497): Text in alerts in "Leisure suit Larry" is not wrapped
4344 <https://bugs.webkit.org/show_bug.cgi?id=19730>
4346 Do not convert the pair (less, jtrue) to jless when jtrue is a jump
4347 target. An example of this is when the condition of a while loop is a
4350 * VM/CodeGenerator.cpp:
4351 (KJS::CodeGenerator::emitLabel):
4353 2008-06-20 Ariya Hidayat <ariya.hidayat@trolltech.com>
4355 Reviewed by Adam Roben.
4357 Fix compile with MinGW.
4361 (WTF::atomicIncrement):
4362 (WTF::atomicDecrement):
4364 2008-06-23 Mark Rowe <mrowe@apple.com>
4366 Reviewed by Oliver Hunt.
4368 Prepration for returning memory to the OS on Windows. Track whether a portion of a span of memory was returned to the OS.
4369 If it was, ask that it be recommitted before returning it to the application as an allocated region.
4371 * wtf/FastMalloc.cpp:
4372 (WTF::TCMalloc_PageHeap::New): If the span was decommitted, ask that it be recommitted before returning it.
4373 (WTF::TCMalloc_PageHeap::AllocLarge): Ditto.
4374 (WTF::TCMalloc_PageHeap::Carve): When splitting a span, ensure that the decommitted state propogates to the two new spans.
4375 (WTF::TCMalloc_PageHeap::Delete): When merging a span, ensure that the resulting span is marked as decommitted if any of the
4376 spans being merged were marked as decommitted.
4377 (WTF::TCMalloc_PageHeap::IncrementalScavenge): Mark as decommitted after releasing the span.
4378 (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Add an assertion to catch a decommitted span being returned to the application
4379 without first being recommitted.
4380 (WTF::TCMalloc_Central_FreeList::Populate): Ditto.
4381 * wtf/TCSystemAlloc.cpp: Stub out TCMalloc_SystemCommit.
4382 * wtf/TCSystemAlloc.h:
4384 2008-06-23 Mark Rowe <mrowe@apple.com>
4386 Reviewed by Sam Weinig.
4388 Remove the sample member of Span when NO_TCMALLOC_SAMPLES is defined.
4390 * wtf/FastMalloc.cpp:
4391 (WTF::TCMalloc_PageHeap::Delete): Only update Span::sample if NO_TCMALLOC_SAMPLES is not defined.
4392 (WTF::TCMallocStats::do_free): Ditto.
4394 2008-06-23 Darin Adler <darin@apple.com>
4398 - work toward https://bugs.webkit.org/show_bug.cgi?id=19721
4400 More preparation toward making functions work on primitive types without
4401 creating wrapper objects. No speedup this time, but prepares for a future
4402 speedup without slowing things down.
4404 SunSpider reports no change.
4406 - Eliminated the implementsCall, callAsFunction and construct virtual
4407 functions from JSObject. Instead, the CallData and ConstructData for
4408 a native function includes a function pointer that the caller can use
4409 directly. Changed all call sites to use CallData and ConstructData.
4411 - Changed the "this" argument to native functions to be a JSValue rather
4412 than a JSObject. This prepares us for passing primitives into these
4413 functions. The conversion to an object now must be done inside the
4414 function. Critically, if it's a function that can be called on a DOM
4415 window object, then we have to be sure to call toThisObject on the
4416 argument before we use it for anything even if it's already an object.
4418 - Eliminated the practice of using constructor objects in the global
4419 object to make objects of the various basic types. Since these
4420 constructors can't be replaced by script, there's no reason to involve
4421 a constructor object at all. Added functions to do the construction
4424 - Made some more class members private and protected, including virtual
4425 function overrides. This can catch code using unnecessarily slow virtual
4426 function code paths when the type of an object is known statically. If we
4427 later find a new reason use the members outside the class it's easy to
4428 make them public again.
4430 - Moved the declarations of the native implementations for functions out
4431 of header files. These can have internal linkage and be declared inside
4434 - Changed PrototypeFunction to take function pointers with the right
4435 arguments to be put directly into CallData. This eliminates the
4436 need to have a separate PrototypeReflexiveFunction, and reveals that the
4437 real purpose of that class included something else specific to eval --
4438 storage of a cached global object. So renamed PrototypeReflexiveFunction
4439 to GlobalEvalFunction.
4441 * API/JSCallbackConstructor.cpp:
4442 (KJS::constructJSCallback):
4443 (KJS::JSCallbackConstructor::getConstructData):
4444 * API/JSCallbackConstructor.h:
4445 * API/JSCallbackFunction.cpp:
4446 (KJS::JSCallbackFunction::implementsHasInstance):
4447 (KJS::JSCallbackFunction::call):
4448 (KJS::JSCallbackFunction::getCallData):
4449 * API/JSCallbackFunction.h:
4450 (KJS::JSCallbackFunction::classInfo):
4451 * API/JSCallbackObject.h:
4452 (KJS::JSCallbackObject::classRef):
4453 (KJS::JSCallbackObject::classInfo):
4454 * API/JSCallbackObjectFunctions.h:
4455 (KJS::::getConstructData):
4457 (KJS::::getCallData):
4459 * API/JSObjectRef.cpp:
4460 (JSObjectMakeFunction):
4461 (JSObjectIsFunction):
4462 (JSObjectCallAsFunction):
4463 (JSObjectCallAsConstructor):
4464 * JavaScriptCore.exp:
4466 (KJS::jsTypeStringForValue):
4467 (KJS::Machine::privateExecute):
4468 * kjs/ArrayPrototype.cpp:
4469 (KJS::arrayProtoFuncToString):
4470 (KJS::arrayProtoFuncToLocaleString):
4471 (KJS::arrayProtoFuncJoin):
4472 (KJS::arrayProtoFuncConcat):
4473 (KJS::arrayProtoFuncPop):
4474 (KJS::arrayProtoFuncPush):
4475 (KJS::arrayProtoFuncReverse):
4476 (KJS::arrayProtoFuncShift):
4477 (KJS::arrayProtoFuncSlice):
4478 (KJS::arrayProtoFuncSort):
4479 (KJS::arrayProtoFuncSplice):
4480 (KJS::arrayProtoFuncUnShift):
4481 (KJS::arrayProtoFuncFilter):
4482 (KJS::arrayProtoFuncMap):
4483 (KJS::arrayProtoFuncEvery):
4484 (KJS::arrayProtoFuncForEach):
4485 (KJS::arrayProtoFuncSome):
4486 (KJS::arrayProtoFuncIndexOf):
4487 (KJS::arrayProtoFuncLastIndexOf):
4488 (KJS::ArrayConstructor::ArrayConstructor):
4489 (KJS::constructArrayWithSizeQuirk):
4490 (KJS::constructWithArrayConstructor):
4491 (KJS::ArrayConstructor::getConstructData):
4492 (KJS::callArrayConstructor):
4493 (KJS::ArrayConstructor::getCallData):
4494 * kjs/ArrayPrototype.h:
4495 * kjs/BooleanObject.cpp:
4496 (KJS::booleanProtoFuncToString):
4497 (KJS::booleanProtoFuncValueOf):
4498 (KJS::constructBoolean):
4499 (KJS::constructWithBooleanConstructor):
4500 (KJS::BooleanConstructor::getConstructData):
4501 (KJS::callBooleanConstructor):
4502 (KJS::BooleanConstructor::getCallData):
4503 (KJS::constructBooleanFromImmediateBoolean):
4504 * kjs/BooleanObject.h:
4507 * kjs/ConstructData.h:
4509 * kjs/FunctionPrototype.cpp:
4510 (KJS::callFunctionPrototype):
4511 (KJS::FunctionPrototype::getCallData):
4512 (KJS::functionProtoFuncToString):
4513 (KJS::functionProtoFuncApply):
4514 (KJS::functionProtoFuncCall):
4515 (KJS::constructWithFunctionConstructor):
4516 (KJS::FunctionConstructor::getConstructData):
4517 (KJS::callFunctionConstructor):
4518 (KJS::FunctionConstructor::getCallData):
4519 (KJS::constructFunction):
4520 * kjs/FunctionPrototype.h:
4522 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
4523 (KJS::JSArray::sort):
4524 (KJS::constructEmptyArray):
4525 (KJS::constructArray):
4527 (KJS::JSArray::classInfo):
4528 * kjs/JSFunction.cpp:
4529 (KJS::JSFunction::call):
4530 (KJS::globalFuncEval):
4531 (KJS::globalFuncParseInt):
4532 (KJS::globalFuncParseFloat):
4533 (KJS::globalFuncIsNaN):
4534 (KJS::globalFuncIsFinite):
4535 (KJS::globalFuncDecodeURI):
4536 (KJS::globalFuncDecodeURIComponent):
4537 (KJS::globalFuncEncodeURI):
4538 (KJS::globalFuncEncodeURIComponent):
4539 (KJS::globalFuncEscape):
4540 (KJS::globalFuncUnescape):
4541 (KJS::globalFuncKJSPrint):
4542 (KJS::PrototypeFunction::PrototypeFunction):
4543 (KJS::PrototypeFunction::getCallData):
4544 (KJS::GlobalEvalFunction::GlobalEvalFunction):
4545 (KJS::GlobalEvalFunction::mark):
4547 (KJS::InternalFunction::classInfo):
4548 (KJS::InternalFunction::functionName):
4549 (KJS::JSFunction::classInfo):
4550 (KJS::GlobalEvalFunction::cachedGlobalObject):
4551 * kjs/JSGlobalObject.cpp:
4552 (KJS::JSGlobalObject::reset):
4553 (KJS::JSGlobalObject::mark):
4554 * kjs/JSGlobalObject.h:
4555 (KJS::JSGlobalObject::JSGlobalObject):
4556 (KJS::JSGlobalObject::evalFunction):
4557 * kjs/JSImmediate.cpp:
4558 (KJS::JSImmediate::toObject):
4559 * kjs/JSNotAnObject.cpp:
4560 * kjs/JSNotAnObject.h:
4562 (KJS::JSObject::put):
4563 (KJS::callDefaultValueFunction):
4564 (KJS::JSObject::defaultValue):
4565 (KJS::JSObject::lookupGetter):
4566 (KJS::JSObject::lookupSetter):
4567 (KJS::JSObject::hasInstance):
4568 (KJS::JSObject::fillGetterPropertySlot):
4569 (KJS::Error::create):
4570 (KJS::constructEmptyObject):
4572 (KJS::GetterSetter::GetterSetter):
4573 (KJS::GetterSetter::getter):
4574 (KJS::GetterSetter::setGetter):
4575 (KJS::GetterSetter::setter):
4576 (KJS::GetterSetter::setSetter):
4578 (KJS::JSCell::deleteProperty):
4582 * kjs/MathObject.cpp:
4583 (KJS::mathProtoFuncAbs):
4584 (KJS::mathProtoFuncACos):
4585 (KJS::mathProtoFuncASin):
4586 (KJS::mathProtoFuncATan):
4587 (KJS::mathProtoFuncATan2):
4588 (KJS::mathProtoFuncCeil):
4589 (KJS::mathProtoFuncCos):
4590 (KJS::mathProtoFuncExp):
4591 (KJS::mathProtoFuncFloor):
4592 (KJS::mathProtoFuncLog):
4593 (KJS::mathProtoFuncMax):
4594 (KJS::mathProtoFuncMin):
4595 (KJS::mathProtoFuncPow):
4596 (KJS::mathProtoFuncRandom):
4597 (KJS::mathProtoFuncRound):
4598 (KJS::mathProtoFuncSin):
4599 (KJS::mathProtoFuncSqrt):
4600 (KJS::mathProtoFuncTan):
4602 * kjs/NumberObject.cpp:
4603 (KJS::numberProtoFuncToString):
4604 (KJS::numberProtoFuncToLocaleString):
4605 (KJS::numberProtoFuncValueOf):
4606 (KJS::numberProtoFuncToFixed):
4607 (KJS::numberProtoFuncToExponential):
4608 (KJS::numberProtoFuncToPrecision):
4609 (KJS::NumberConstructor::NumberConstructor):
4610 (KJS::constructWithNumberConstructor):
4611 (KJS::NumberConstructor::getConstructData):
4612 (KJS::callNumberConstructor):
4613 (KJS::NumberConstructor::getCallData):
4614 (KJS::constructNumber):
4615 (KJS::constructNumberFromImmediateNumber):
4616 * kjs/NumberObject.h:
4617 (KJS::NumberObject::classInfo):
4618 (KJS::NumberConstructor::classInfo):
4619 * kjs/PropertySlot.cpp:
4620 (KJS::PropertySlot::functionGetter):
4621 * kjs/RegExpObject.cpp:
4622 (KJS::regExpProtoFuncTest):
4623 (KJS::regExpProtoFuncExec):
4624 (KJS::regExpProtoFuncCompile):
4625 (KJS::regExpProtoFuncToString):
4626 (KJS::callRegExpObject):
4627 (KJS::RegExpObject::getCallData):
4628 (KJS::constructRegExp):
4629 (KJS::constructWithRegExpConstructor):
4630 (KJS::RegExpConstructor::getConstructData):
4631 (KJS::callRegExpConstructor):
4632 (KJS::RegExpConstructor::getCallData):
4633 * kjs/RegExpObject.h:
4634 (KJS::RegExpConstructor::classInfo):
4636 (GlobalObject::GlobalObject):
4645 * kjs/date_object.cpp:
4647 (KJS::formatLocaleDate):
4648 (KJS::fillStructuresUsingDateArgs):
4649 (KJS::DateInstance::getTime):
4650 (KJS::DateInstance::getUTCTime):
4651 (KJS::DateConstructor::DateConstructor):
4652 (KJS::constructDate):
4653 (KJS::DateConstructor::getConstructData):
4655 (KJS::DateConstructor::getCallData):
4659 (KJS::dateProtoFuncToString):
4660 (KJS::dateProtoFuncToUTCString):
4661 (KJS::dateProtoFuncToDateString):
4662 (KJS::dateProtoFuncToTimeString):
4663 (KJS::dateProtoFuncToLocaleString):
4664 (KJS::dateProtoFuncToLocaleDateString):
4665 (KJS::dateProtoFuncToLocaleTimeString):
4666 (KJS::dateProtoFuncValueOf):
4667 (KJS::dateProtoFuncGetTime):
4668 (KJS::dateProtoFuncGetFullYear):
4669 (KJS::dateProtoFuncGetUTCFullYear):
4670 (KJS::dateProtoFuncToGMTString):
4671 (KJS::dateProtoFuncGetMonth):
4672 (KJS::dateProtoFuncGetUTCMonth):
4673 (KJS::dateProtoFuncGetDate):
4674 (KJS::dateProtoFuncGetUTCDate):
4675 (KJS::dateProtoFuncGetDay):
4676 (KJS::dateProtoFuncGetUTCDay):
4677 (KJS::dateProtoFuncGetHours):
4678 (KJS::dateProtoFuncGetUTCHours):
4679 (KJS::dateProtoFuncGetMinutes):
4680 (KJS::dateProtoFuncGetUTCMinutes):
4681 (KJS::dateProtoFuncGetSeconds):
4682 (KJS::dateProtoFuncGetUTCSeconds):
4683 (KJS::dateProtoFuncGetMilliSeconds):
4684 (KJS::dateProtoFuncGetUTCMilliseconds):
4685 (KJS::dateProtoFuncGetTimezoneOffset):
4686 (KJS::dateProtoFuncSetTime):
4687 (KJS::setNewValueFromTimeArgs):
4688 (KJS::setNewValueFromDateArgs):
4689 (KJS::dateProtoFuncSetMilliSeconds):
4690 (KJS::dateProtoFuncSetUTCMilliseconds):
4691 (KJS::dateProtoFuncSetSeconds):
4692 (KJS::dateProtoFuncSetUTCSeconds):
4693 (KJS::dateProtoFuncSetMinutes):
4694 (KJS::dateProtoFuncSetUTCMinutes):
4695 (KJS::dateProtoFuncSetHours):
4696 (KJS::dateProtoFuncSetUTCHours):
4697 (KJS::dateProtoFuncSetDate):
4698 (KJS::dateProtoFuncSetUTCDate):
4699 (KJS::dateProtoFuncSetMonth):
4700 (KJS::dateProtoFuncSetUTCMonth):
4701 (KJS::dateProtoFuncSetFullYear):
4702 (KJS::dateProtoFuncSetUTCFullYear):
4703 (KJS::dateProtoFuncSetYear):
4704 (KJS::dateProtoFuncGetYear):
4705 * kjs/date_object.h:
4706 (KJS::DateInstance::internalNumber):
4707 (KJS::DateInstance::classInfo):
4708 * kjs/error_object.cpp:
4709 (KJS::errorProtoFuncToString):
4710 (KJS::constructError):
4711 (KJS::constructWithErrorConstructor):
4712 (KJS::ErrorConstructor::getConstructData):
4713 (KJS::callErrorConstructor):
4714 (KJS::ErrorConstructor::getCallData):
4715 (KJS::NativeErrorConstructor::construct):
4716 (KJS::constructWithNativeErrorConstructor):
4717 (KJS::NativeErrorConstructor::getConstructData):
4718 (KJS::callNativeErrorConstructor):
4719 (KJS::NativeErrorConstructor::getCallData):
4720 * kjs/error_object.h:
4721 (KJS::NativeErrorConstructor::classInfo):
4723 (KJS::JSNumberCell::toObject):
4724 (KJS::JSNumberCell::toThisObject):
4725 (KJS::GetterSetter::mark):
4726 (KJS::GetterSetter::toPrimitive):
4727 (KJS::GetterSetter::toBoolean):
4728 (KJS::GetterSetter::toNumber):
4729 (KJS::GetterSetter::toString):
4730 (KJS::GetterSetter::toObject):
4731 (KJS::InternalFunction::InternalFunction):
4732 (KJS::InternalFunction::implementsHasInstance):
4736 (KJS::FuncDeclNode::makeFunction):
4737 (KJS::FuncExprNode::makeFunction):
4738 * kjs/object_object.cpp:
4739 (KJS::objectProtoFuncValueOf):
4740 (KJS::objectProtoFuncHasOwnProperty):
4741 (KJS::objectProtoFuncIsPrototypeOf):
4742 (KJS::objectProtoFuncDefineGetter):
4743 (KJS::objectProtoFuncDefineSetter):
4744 (KJS::objectProtoFuncLookupGetter):
4745 (KJS::objectProtoFuncLookupSetter):
4746 (KJS::objectProtoFuncPropertyIsEnumerable):
4747 (KJS::objectProtoFuncToLocaleString):
4748 (KJS::objectProtoFuncToString):
4749 (KJS::ObjectConstructor::ObjectConstructor):
4750 (KJS::constructObject):
4751 (KJS::constructWithObjectConstructor):
4752 (KJS::ObjectConstructor::getConstructData):
4753 (KJS::callObjectConstructor):
4754 (KJS::ObjectConstructor::getCallData):
4755 * kjs/object_object.h:
4756 * kjs/string_object.cpp:
4758 (KJS::stringProtoFuncToString):
4759 (KJS::stringProtoFuncValueOf):
4760 (KJS::stringProtoFuncCharAt):
4761 (KJS::stringProtoFuncCharCodeAt):
4762 (KJS::stringProtoFuncConcat):
4763 (KJS::stringProtoFuncIndexOf):
4764 (KJS::stringProtoFuncLastIndexOf):
4765 (KJS::stringProtoFuncMatch):
4766 (KJS::stringProtoFuncSearch):
4767 (KJS::stringProtoFuncReplace):
4768 (KJS::stringProtoFuncSlice):
4769 (KJS::stringProtoFuncSplit):
4770 (KJS::stringProtoFuncSubstr):
4771 (KJS::stringProtoFuncSubstring):
4772 (KJS::stringProtoFuncToLowerCase):
4773 (KJS::stringProtoFuncToUpperCase):
4774 (KJS::stringProtoFuncToLocaleLowerCase):
4775 (KJS::stringProtoFuncToLocaleUpperCase):
4776 (KJS::stringProtoFuncLocaleCompare):
4777 (KJS::stringProtoFuncBig):
4778 (KJS::stringProtoFuncSmall):
4779 (KJS::stringProtoFuncBlink):
4780 (KJS::stringProtoFuncBold):
4781 (KJS::stringProtoFuncFixed):
4782 (KJS::stringProtoFuncItalics):
4783 (KJS::stringProtoFuncStrike):
4784 (KJS::stringProtoFuncSub):
4785 (KJS::stringProtoFuncSup):
4786 (KJS::stringProtoFuncFontcolor):
4787 (KJS::stringProtoFuncFontsize):
4788 (KJS::stringProtoFuncAnchor):
4789 (KJS::stringProtoFuncLink):
4790 (KJS::stringFromCharCode):
4791 (KJS::StringConstructor::StringConstructor):
4792 (KJS::constructWithStringConstructor):
4793 (KJS::StringConstructor::getConstructData):
4794 (KJS::callStringConstructor):
4795 (KJS::StringConstructor::getCallData):
4796 * kjs/string_object.h:
4798 2008-06-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4802 Bug 19716: REGRESSION (SquirrelFish): Reproducible crash after entering a username at mint.com
4803 <https://bugs.webkit.org/show_bug.cgi?id=19716>
4805 When unwinding callframes for exceptions, check whether the callframe
4806 was created by a reentrant native call to JavaScript after tearing off
4807 the local variables instead of before.
4810 (KJS::Machine::unwindCallFrame):
4812 2008-06-23 Mark Rowe <mrowe@apple.com>
4814 Reviewed by Oliver Hunt.
4816 Get testapi passing again in a debug build.
4819 (main): Update the expected output of calling JSValueMakeString on a function object.
4821 2008-06-21 Mark Rowe <mrowe@apple.com>
4823 Reviewed by Sam Weinig.
4825 Print a blank line when exiting the jsc interactive mode to ensure that the shell
4826 prompt will start on a new line.
4831 2008-06-21 Mark Rowe <mrowe@apple.com>
4833 Rubber-stamped by Sam Weinig.
4835 Tweak the paths of the items in the "tests" group to clean things up a little.
4837 * JavaScriptCore.xcodeproj/project.pbxproj:
4839 2008-06-21 Mark Rowe <mrowe@apple.com>
4841 Rubber-stamped by Sam Weinig.
4843 Fix jsc to link against libedit.dylib rather than libedit.2.dylib.
4845 * JavaScriptCore.xcodeproj/project.pbxproj:
4847 2008-06-21 Mark Rowe <mrowe@apple.com>
4849 Reviewed by Sam Weinig.
4851 Copy the JavaScriptCore shell (jsc) into JavaScriptCore.framework so that it will
4852 be included in nightly builds.
4853 https://bugs.webkit.org/show_bug.cgi?id=19691
4855 * JavaScriptCore.xcodeproj/project.pbxproj:
4857 2008-06-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4859 Reviewed by Mark Rowe.
4861 Fix the build for non-Mac Darwin platforms by disabling their support
4862 for readline in the JavaScript shell.
4866 2008-06-20 Timothy Hatcher <timothy@apple.com>
4868 Use member function pointers for the Profile::forEach function.
4869 Eliminating a few static functions and simplified things a little.
4871 Reviewed by Alexey Proskuryakov.
4873 * JavaScriptCore.exp: Change the symbol for forEach.
4874 * profiler/Profile.cpp:
4875 (KJS::Profile::forEach): Use a member function pointer.
4876 * profiler/Profile.h:
4877 (KJS::Profile::sortTotalTimeDescending): Pass a function pointer.
4878 (KJS::Profile::sortTotalTimeAscending): Ditto.
4879 (KJS::Profile::sortSelfTimeDescending): Ditto.
4880 (KJS::Profile::sortSelfTimeAscending): Ditto.
4881 (KJS::Profile::sortCallsDescending): Ditto.
4882 * profiler/ProfileNode.h:
4883 (KJS::ProfileNode::sortTotalTimeDescending): No longer static.
4884 (KJS::ProfileNode::sortTotalTimeAscending): Ditto.
4885 (KJS::ProfileNode::sortSelfTimeDescending): Ditto.
4886 (KJS::ProfileNode::sortSelfTimeAscending): Ditto.
4887 (KJS::ProfileNode::sortCallsDescending): Ditto.
4889 2008-06-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4893 Remove unused destructors.
4898 2008-06-20 Timothy Hatcher <timothy@apple.com>
4900 Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
4901 and stopping a profile from the Develop menu. Also prevents
4902 inserting an incorrect parent node as the new head after profiling
4903 is stopped from the Develop menu.
4905 Reviewed by Dan Bernstein.
4907 * profiler/Profile.cpp:
4908 (KJS::Profile::stopProfiling): If the current node is already the head
4909 then there is no more need to record future nodes in didExecute.
4910 (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
4911 into here since this was the only caller. When setting the total time
4912 keep any current total time while adding the self time of the head.
4913 (KJS::Profile::setupCurrentNodeAsStopped): Removed.
4914 * profiler/Profile.h: Removed setupCurrentNodeAsStopped.
4916 2008-06-20 Kevin Ollivier <kevino@theolliviers.com>
4918 !USE(MULTIPLE_THREADS) on Darwin build fix
4920 * kjs/InitializeThreading.cpp:
4921 (KJS::initializeThreading):
4924 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4928 * profiler/Profile.cpp:
4929 (KJS::Profile::removeProfileStart):
4930 (KJS::Profile::removeProfileEnd):
4932 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4938 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4940 Reviewed by Tim and Dan.
4942 <rdar://problem/6024846> JSProfiler: ASSERT hit in Profiler.
4943 - Because InspectorController can call startProfiling() and
4944 stopProfiling() we cannot assert that console.profile() and
4945 console.profileEnd() will be in the profile tree.
4947 * profiler/Profile.cpp:
4948 (KJS::Profile::removeProfileStart):
4949 (KJS::Profile::removeProfileEnd):
4951 2008-06-20 Kevin McCullough <kmccullough@apple.com>
4955 <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
4956 if profiling is started and finished within the same function. (19230)
4957 - Now we profile one more stack frame up from the last frame to allocate
4958 the time spent in it, if it exists.
4960 * JavaScriptCore.exp:
4961 * VM/Machine.cpp: We need to let the profiler know when the JS program
4962 has finished since that is what will actually stop the profiler instead
4963 of just calling stopProfiling().
4964 (KJS::Machine::execute):
4965 * profiler/Profile.cpp:
4966 (KJS::Profile::create): Moved from Profile.h since it was getting pretty
4968 (KJS::Profile::Profile): We now have a client, which is a listener who
4969 we will return this profile to, once it has actually finished.
4970 (KJS::Profile::stopProfiling): Instead of fully stopping the profiler
4971 here, we set the flag and keep it profiling in the background.
4972 (KJS::Profile::didFinishAllExecution): This is where the profiler
4973 actually finishes and creates the (idle) node if one should be made.
4974 (KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
4975 needed by the profiler as it runs silently in the background.
4976 (KJS::Profile::removeProfileEnd): Ditto.
4977 (KJS::Profile::willExecute): Don't profile new functions if we have
4979 (KJS::Profile::didExecute): Only record one more return as all the
4980 remaining time will be attributed to that function.
4981 (KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
4982 * profiler/Profile.h: Added functions and variables for the above
4984 (KJS::Profile::client):
4985 * profiler/ProfileNode.h:
4986 (KJS::CallIdentifier::toString): Debug method.
4987 * profiler/Profiler.cpp: Added support for the ProfilerClient.
4988 (KJS::Profiler::startProfiling):
4989 (KJS::Profiler::stopProfiling): No longer return sthe profile.
4990 (KJS::Profiler::didFinishAllExecution): Now returns the profile to the
4991 client instead of stopProfiling.
4992 * profiler/Profiler.h:
4993 (KJS::ProfilerClient::~ProfilerClient): Clients will implement this
4996 2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
5000 Surpress compiler warning (int vs unsigned comparison).
5002 * wtf/unicode/qt4/UnicodeQt4.h:
5003 (WTF::Unicode::toLower):
5005 2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
5007 Reviewed by Timothy Hatcher.
5009 Introduce compiler define for MinGW, to have COMPILER(MINGW).
5013 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5017 Make Machine per-JSGlobalData.
5020 (KJS::CodeBlock::dump):
5021 * VM/CodeGenerator.cpp:
5022 (KJS::CodeGenerator::emitOpcode):
5025 (KJS::Machine::unwindCallFrame):
5026 (KJS::Machine::throwException):
5027 (KJS::Machine::execute):
5028 (KJS::Machine::debug):
5030 * kjs/DebuggerCallFrame.cpp:
5031 (KJS::DebuggerCallFrame::evaluate):
5032 * kjs/DebuggerCallFrame.h:
5033 (KJS::DebuggerCallFrame::DebuggerCallFrame):
5034 * kjs/ExecState.cpp:
5035 (KJS::ExecState::ExecState):
5037 (KJS::ExecState::machine):
5038 * kjs/JSFunction.cpp:
5039 (KJS::JSFunction::callAsFunction):
5040 (KJS::JSFunction::argumentsGetter):
5041 (KJS::JSFunction::callerGetter):
5042 (KJS::JSFunction::construct):
5043 (KJS::globalFuncEval):
5044 * kjs/JSGlobalData.cpp:
5045 (KJS::JSGlobalData::JSGlobalData):
5046 * kjs/JSGlobalData.h:
5047 * kjs/interpreter.cpp:
5048 (KJS::Interpreter::evaluate):
5050 2008-06-19 Alp Toker <alp@nuanti.com>
5052 GTK+/autotools build fix. JSGlobalObject.cpp in now in
5053 AllInOneFile.cpp and shouldn't be built separately.
5057 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5061 Get rid of some threadInstance calls.
5063 * kjs/JSGlobalObject.cpp:
5064 (KJS::JSGlobalObject::init):
5066 (KJS::Parser::parse):
5070 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5074 Fix an assertion failure at startup.
5076 * kjs/JSObject.h: (KJS::JSObject::JSObject): Allow jsNull prototype in an assertion (I had
5077 it fixed in a wrong copy of the file, so I wasn't getting the failure).
5079 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5083 * kjs/collector.cpp:
5085 (KJS::allocateBlock):
5087 No, #if PLATFORM(UNIX) was not right. I've just moved the unsafe initialization back for now,
5088 as the platforms that use that code path do not use multiple threads yet.
5090 2008-06-19 Alexey Proskuryakov <ap@webkit.org>
5092 Windows and Qt build fixes.
5095 * kjs/collector.cpp:
5097 Wrapped m_pagesize in #if PLATFORM(UNIX), which should better match the sequence of #elifs
5098 in allocateBlock(). Changed MIN_ARRAY_SIZE to be explicitly size_t, as this type is different
5099 on different platforms.
5101 2008-06-17 Alexey Proskuryakov <ap@webkit.org>
5105 Prepare JavaScript heap for being per-thread.
5107 * kjs/ExecState.h: Shuffle includes, making it possible to include ExecState.h in JSValue.h.
5108 (KJS::ExecState::heap): Added an accessor.
5110 * API/JSBase.cpp: (JSGarbageCollect): Collect both shared and per-thread heaps.
5112 * API/JSContextRef.cpp: (JSGlobalContextCreate): When allocating JSGlobalObject, indicate
5113 that it belongs to a shared heap.
5115 * JavaScriptCore.xcodeproj/project.pbxproj:
5116 * kjs/AllInOneFile.cpp:
5117 Moved JSGlobalObject.cpp to AllInOneFile, as a build fix for inlineAllocate magic.
5119 * VM/CodeGenerator.h: (KJS::CodeGenerator::globalExec): Added an accessor (working via
5122 * VM/RegisterFile.h:
5123 (KJS::RegisterFile::mark):
5124 * VM/RegisterFileStack.h:
5125 (KJS::RegisterFileStack::mark):
5126 Made these pseudo-mark functions take Heap*.
5128 * kjs/InitializeThreading.cpp:
5129 (KJS::initializeThreading): Initialize heap introspector.
5131 * kjs/JSGlobalData.h: Added Heap to the structure.
5133 * kjs/JSGlobalData.cpp:
5134 (KJS::JSGlobalData::JSGlobalData): Initialize Heap.
5135 (KJS::JSGlobalData::sharedInstance): Added a method to access shared global data instance
5138 * kjs/JSGlobalObject.cpp:
5139 (KJS::JSGlobalObject::~JSGlobalObject): Changed to work with per-thread head; fixed list
5141 (KJS::JSGlobalObject::init): Changed to work with per-thread head.
5142 (KJS::JSGlobalObject::put): Assert that a cross-heap operation is not being attempted.
5143 (KJS::JSGlobalObject::reset): Pass ExecState* where now required.
5144 (KJS::JSGlobalObject::mark): Pass the current heap to RegisterFileStack::mark.
5145 (KJS::JSGlobalObject::operator new): Overload operator new to use per-thread or shared heap.
5146 * kjs/JSGlobalObject.h: Removed static s_head member.
5148 * kjs/PropertyMap.h: (KJS::PropertyMap::PropertyMap): Removed unused SavedProperty.
5150 * kjs/collector.h: Turned Collector into an actual object with its own data, renamed to Heap.
5151 (KJS::Heap::initializeHeapIntrospector): Added.
5152 (KJS::Heap::heap): Added a method to determine which heap a JSValue is in, if any.
5153 (KJS::Heap::allocate): Made non-static.
5154 (KJS::Heap::inlineAllocateNumber): Ditto.
5155 (KJS::Heap::markListSet): Ditto.
5156 (KJS::Heap::cellBlock): Ditto.
5157 (KJS::Heap::cellOffset): Ditto.
5158 (KJS::Heap::isCellMarked): Ditto.
5159 (KJS::Heap::markCell): Ditto.
5160 (KJS::Heap::reportExtraMemoryCost): Ditto.
5161 (KJS::CollectorBlock): Added a back-reference to Heap for Heap::heap() method.
5162 (KJS::SmallCellCollectorBlock): Ditto.
5164 * kjs/collector.cpp: Changed MIN_ARRAY_SIZE to a #define to avoid a PIC branch. Removed
5165 main thread related machinery.
5166 (KJS::Heap::Heap): Initialize the newly added data members.
5167 (KJS::allocateBlock): Marked NEVER_INLINE, as this is a rare case that uses a PIC branch.
5168 Moved static pagesize to the class to make it safely initialized.
5169 (KJS::Heap::heapAllocate): Initialize heap back reference after a new block is allocated.
5170 (KJS::Heap::registerThread): Removed introspector initialization, as it is now performed
5171 in InitializeThreading.cpp.
5172 (KJS::Heap::markOtherThreadConservatively): Assert that the "other thread" case only occurs
5173 for legacy clients using a shared heap.
5174 (KJS::Heap::markStackObjectsConservatively): Moved fastMallocForbid/Allow down here, since
5175 it doesn't need to be forbidden during other GC phases.
5177 * kjs/JSImmediate.h:
5181 Moved from JSvalue.h, to make these usable in files that cannot include JSValue.h (such
5184 * API/JSCallbackObjectFunctions.h:
5185 (KJS::::staticFunctionGetter):
5186 * API/JSClassRef.cpp:
5187 (OpaqueJSClass::prototype):
5188 * API/JSObjectRef.cpp:
5190 (JSObjectMakeFunctionWithCallback):
5191 (JSObjectMakeConstructor):
5192 (JSObjectMakeFunction):
5193 * API/JSValueRef.cpp:
5194 (JSValueMakeNumber):
5195 (JSValueMakeString):
5196 * JavaScriptCore.exp:
5197 * VM/CodeGenerator.cpp:
5198 (KJS::CodeGenerator::emitLoad):
5199 * VM/JSPropertyNameIterator.cpp:
5200 (KJS::JSPropertyNameIterator::create):
5201 (KJS::JSPropertyNameIterator::next):
5203 (KJS::jsAddSlowCase):
5205 (KJS::jsTypeStringForValue):
5206 (KJS::scopeChainForCall):
5207 (KJS::Machine::throwException):
5208 (KJS::Machine::execute):
5209 (KJS::Machine::privateExecute):
5210 (KJS::Machine::retrieveArguments):
5211 * kjs/ArrayPrototype.cpp:
5212 (KJS::arrayProtoFuncToString):
5213 (KJS::arrayProtoFuncToLocaleString):
5214 (KJS::arrayProtoFuncJoin):
5215 (KJS::arrayProtoFuncConcat):
5216 (KJS::arrayProtoFuncPop):
5217 (KJS::arrayProtoFuncPush):
5218 (KJS::arrayProtoFuncShift):
5219 (KJS::arrayProtoFuncSlice):
5220 (KJS::arrayProtoFuncSplice):
5221 (KJS::arrayProtoFuncUnShift):
5222 (KJS::arrayProtoFuncFilter):
5223 (KJS::arrayProtoFuncMap):
5224 (KJS::arrayProtoFuncEvery):
5225 (KJS::arrayProtoFuncForEach):
5226 (KJS::arrayProtoFuncSome):
5227 (KJS::arrayProtoFuncIndexOf):
5228 (KJS::arrayProtoFuncLastIndexOf):
5229 (KJS::ArrayConstructor::ArrayConstructor):
5230 (KJS::ArrayConstructor::construct):
5231 (KJS::ArrayConstructor::callAsFunction):
5232 * kjs/BooleanObject.cpp:
5233 (KJS::BooleanPrototype::BooleanPrototype):
5234 (KJS::booleanProtoFuncToString):
5235 (KJS::BooleanConstructor::BooleanConstructor):
5236 (KJS::BooleanConstructor::construct):
5237 * kjs/FunctionPrototype.cpp:
5238 (KJS::FunctionPrototype::FunctionPrototype):
5239 (KJS::functionProtoFuncToString):
5240 (KJS::FunctionConstructor::FunctionConstructor):
5241 (KJS::FunctionConstructor::construct):
5242 * kjs/JSActivation.cpp:
5243 (KJS::JSActivation::createArgumentsObject):
5245 (KJS::JSArray::JSArray):
5246 (KJS::JSArray::lengthGetter):
5247 * kjs/JSFunction.cpp:
5248 (KJS::JSFunction::lengthGetter):
5249 (KJS::JSFunction::construct):
5250 (KJS::Arguments::Arguments):
5253 (KJS::globalFuncParseInt):
5254 (KJS::globalFuncParseFloat):
5255 (KJS::globalFuncEscape):
5256 (KJS::globalFuncUnescape):
5257 (KJS::PrototypeFunction::PrototypeFunction):
5258 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
5259 * kjs/JSImmediate.cpp:
5260 (KJS::JSImmediate::toObject):
5262 (KJS::JSLock::registerThread):
5264 (KJS::JSObject::put):
5265 (KJS::JSObject::defineGetter):
5266 (KJS::JSObject::defineSetter):
5267 (KJS::Error::create):
5269 (KJS::JSObject::putDirect):
5271 (KJS::JSString::JSString):
5273 (KJS::JSCell::operator new):
5275 (KJS::jsOwnedString):
5277 (KJS::JSNumberCell::operator new):
5278 (KJS::jsNumberCell):
5281 (KJS::JSCell::marked):
5282 (KJS::JSCell::mark):
5283 (KJS::JSValue::toJSNumber):
5284 * kjs/MathObject.cpp:
5285 (KJS::MathObject::getValueProperty):
5286 (KJS::mathProtoFuncAbs):
5287 (KJS::mathProtoFuncACos):
5288 (KJS::mathProtoFuncASin):
5289 (KJS::mathProtoFuncATan):
5290 (KJS::mathProtoFuncATan2):
5291 (KJS::mathProtoFuncCeil):
5292 (KJS::mathProtoFuncCos):
5293 (KJS::mathProtoFuncExp):
5294 (KJS::mathProtoFuncFloor):
5295 (KJS::mathProtoFuncLog):
5296 (KJS::mathProtoFuncMax):
5297 (KJS::mathProtoFuncMin):
5298 (KJS::mathProtoFuncPow):
5299 (KJS::mathProtoFuncRandom):
5300 (KJS::mathProtoFuncRound):
5301 (KJS::mathProtoFuncSin):
5302 (KJS::mathProtoFuncSqrt):
5303 (KJS::mathProtoFuncTan):
5304 * kjs/NumberObject.cpp:
5305 (KJS::NumberPrototype::NumberPrototype):
5306 (KJS::numberProtoFuncToString):
5307 (KJS::numberProtoFuncToLocaleString):
5308 (KJS::numberProtoFuncToFixed):
5309 (KJS::numberProtoFuncToExponential):
5310 (KJS::numberProtoFuncToPrecision):
5311 (KJS::NumberConstructor::NumberConstructor):
5312 (KJS::NumberConstructor::getValueProperty):
5313 (KJS::NumberConstructor::construct):
5314 (KJS::NumberConstructor::callAsFunction):
5315 * kjs/RegExpObject.cpp:
5316 (KJS::RegExpPrototype::RegExpPrototype):
5317 (KJS::regExpProtoFuncToString):
5318 (KJS::RegExpObject::getValueProperty):
5319 (KJS::RegExpConstructor::RegExpConstructor):
5320 (KJS::RegExpMatchesArray::fillArrayInstance):
5321 (KJS::RegExpConstructor::arrayOfMatches):
5322 (KJS::RegExpConstructor::getBackref):
5323 (KJS::RegExpConstructor::getLastParen):
5324 (KJS::RegExpConstructor::getLeftContext):
5325 (KJS::RegExpConstructor::getRightContext):
5326 (KJS::RegExpConstructor::getValueProperty):
5327 (KJS::RegExpConstructor::construct):
5328 * kjs/RegExpObject.h:
5330 (GlobalObject::GlobalObject):
5335 * kjs/date_object.cpp:
5336 (KJS::formatLocaleDate):
5337 (KJS::DatePrototype::DatePrototype):
5338 (KJS::DateConstructor::DateConstructor):
5339 (KJS::DateConstructor::construct):
5340 (KJS::DateConstructor::callAsFunction):
5341 (KJS::DateFunction::DateFunction):
5342 (KJS::DateFunction::callAsFunction):
5343 (KJS::dateProtoFuncToString):
5344 (KJS::dateProtoFuncToUTCString):
5345 (KJS::dateProtoFuncToDateString):
5346 (KJS::dateProtoFuncToTimeString):
5347 (KJS::dateProtoFuncToLocaleString):
5348 (KJS::dateProtoFuncToLocaleDateString):
5349 (KJS::dateProtoFuncToLocaleTimeString):
5350 (KJS::dateProtoFuncValueOf):
5351 (KJS::dateProtoFuncGetTime):
5352 (KJS::dateProtoFuncGetFullYear):
5353 (KJS::dateProtoFuncGetUTCFullYear):
5354 (KJS::dateProtoFuncToGMTString):
5355 (KJS::dateProtoFuncGetMonth):
5356 (KJS::dateProtoFuncGetUTCMonth):
5357 (KJS::dateProtoFuncGetDate):
5358 (KJS::dateProtoFuncGetUTCDate):
5359 (KJS::dateProtoFuncGetDay):
5360 (KJS::dateProtoFuncGetUTCDay):
5361 (KJS::dateProtoFuncGetHours):
5362 (KJS::dateProtoFuncGetUTCHours):
5363 (KJS::dateProtoFuncGetMinutes):
5364 (KJS::dateProtoFuncGetUTCMinutes):
5365 (KJS::dateProtoFuncGetSeconds):
5366 (KJS::dateProtoFuncGetUTCSeconds):
5367 (KJS::dateProtoFuncGetMilliSeconds):
5368 (KJS::dateProtoFuncGetUTCMilliseconds):
5369 (KJS::dateProtoFuncGetTimezoneOffset):
5370 (KJS::dateProtoFuncSetTime):
5371 (KJS::setNewValueFromTimeArgs):
5372 (KJS::setNewValueFromDateArgs):
5373 (KJS::dateProtoFuncSetYear):
5374 (KJS::dateProtoFuncGetYear):
5375 * kjs/error_object.cpp:
5376 (KJS::ErrorPrototype::ErrorPrototype):
5377 (KJS::errorProtoFuncToString):
5378 (KJS::ErrorConstructor::ErrorConstructor):
5379 (KJS::ErrorConstructor::construct):
5380 (KJS::NativeErrorPrototype::NativeErrorPrototype):
5381 (KJS::NativeErrorConstructor::NativeErrorConstructor):
5382 (KJS::NativeErrorConstructor::construct):
5385 (KJS::StringObject::create):
5386 (KJS::JSString::lengthGetter):
5387 (KJS::JSString::indexGetter):
5388 (KJS::JSString::indexNumericPropertyGetter):
5389 * kjs/interpreter.cpp:
5391 (KJS::ArgList::slowAppend):
5394 (KJS::staticFunctionGetter):
5395 (KJS::cacheGlobalObject):
5397 (KJS::Node::emitThrowError):
5398 (KJS::StringNode::emitCode):
5399 (KJS::ArrayNode::emitCode):
5400 (KJS::FuncDeclNode::makeFunction):
5401 (KJS::FuncExprNode::makeFunction):
5403 * kjs/object_object.cpp:
5404 (KJS::ObjectPrototype::ObjectPrototype):
5405 (KJS::objectProtoFuncToLocaleString):
5406 (KJS::objectProtoFuncToString):
5407 (KJS::ObjectConstructor::ObjectConstructor):
5408 (KJS::ObjectConstructor::construct):
5412 * kjs/string_object.cpp:
5413 (KJS::StringObject::StringObject):
5414 (KJS::StringPrototype::StringPrototype):
5416 (KJS::stringProtoFuncCharAt):
5417 (KJS::stringProtoFuncCharCodeAt):
5418 (KJS::stringProtoFuncConcat):
5419 (KJS::stringProtoFuncIndexOf):
5420 (KJS::stringProtoFuncLastIndexOf):
5421 (KJS::stringProtoFuncMatch):
5422 (KJS::stringProtoFuncSearch):
5423 (KJS::stringProtoFuncReplace):
5424 (KJS::stringProtoFuncSlice):
5425 (KJS::stringProtoFuncSplit):
5426 (KJS::stringProtoFuncSubstr):
5427 (KJS::stringProtoFuncSubstring):
5428 (KJS::stringProtoFuncToLowerCase):
5429 (KJS::stringProtoFuncToUpperCase):
5430 (KJS::stringProtoFuncToLocaleLowerCase):
5431 (KJS::stringProtoFuncToLocaleUpperCase):
5432 (KJS::stringProtoFuncLocaleCompare):
5433 (KJS::stringProtoFuncBig):
5434 (KJS::stringProtoFuncSmall):
5435 (KJS::stringProtoFuncBlink):
5436 (KJS::stringProtoFuncBold):
5437 (KJS::stringProtoFuncFixed):
5438 (KJS::stringProtoFuncItalics):
5439 (KJS::stringProtoFuncStrike):
5440 (KJS::stringProtoFuncSub):
5441 (KJS::stringProtoFuncSup):
5442 (KJS::stringProtoFuncFontcolor):
5443 (KJS::stringProtoFuncFontsize):
5444 (KJS::stringProtoFuncAnchor):
5445 (KJS::stringProtoFuncLink):
5446 (KJS::StringConstructor::StringConstructor):
5447 (KJS::StringConstructor::construct):
5448 (KJS::StringConstructor::callAsFunction):
5449 (KJS::StringConstructorFunction::StringConstructorFunction):
5450 (KJS::StringConstructorFunction::callAsFunction):
5451 * kjs/string_object.h:
5452 (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
5454 Updated for the above changes.
5456 2008-06-17 Timothy Hatcher <timothy@apple.com>
5458 Added a type to DebuggerCallFrame so the under interface can
5459 distinguish anonymous functions and program call frames.
5461 https://bugs.webkit.org/show_bug.cgi?id=19585
5463 Reviewed by Geoff Garen.
5465 * JavaScriptCore.exp: Export the DebuggerCallFrame::type symbol.
5466 * kjs/DebuggerCallFrame.cpp:
5467 (KJS::DebuggerCallFrame::type): Added.
5468 * kjs/DebuggerCallFrame.h:
5470 2008-06-17 Eric Seidel <eric@webkit.org>
5474 Remove bogus ASSERT which tripped every time for those who use PAC files.
5477 (KJS::Parser::parse):
5479 2008-06-17 Kevin McCullough <kmccullough@apple.com>
5483 <rdar://problem/5951534> JSProfiler: Don't profile console.profile()
5484 or console.profileEnd()
5486 * profiler/Profile.cpp:
5487 (KJS::Profile::stopProfiling): Moved the creation of the (idle) node to
5488 the Profile (not ProfileNode). This makes sense since the Profile
5489 should be the one to modify the profile tree. Also each stopProfiling()
5490 does not need to check if it's the head node anymore. Also fixed an
5491 oddity where I was using willExecute to create the node.
5492 (KJS::Profile::removeProfileStart): Removes the call to console.profile
5493 that started this profile.
5494 (KJS::Profile::removeProfileEnd): Removes the call to console.profileEnd
5495 that ended this profile.
5496 * profiler/Profile.h:
5497 * profiler/ProfileNode.cpp: Moved the creation of the (idle) node to
5499 (KJS::ProfileNode::stopProfiling):
5500 * profiler/ProfileNode.h: Added some helper functions and whitespace to
5501 facilitate readability and the removal of profile() and profileEnd()
5502 from the Profile tree.
5503 (KJS::CallIdentifier::operator const char* ):
5504 (KJS::ProfileNode::firstChild):
5505 (KJS::ProfileNode::lastChild):
5506 (KJS::ProfileNode::removeChild):
5507 (KJS::ProfileNode::toString):
5509 2008-06-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
5511 Rubber stamped by Adam Roben.
5513 Include JSGlobalObject.h to fix the build.
5515 * kjs/ScopeChain.cpp:
5517 2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5521 Reduce code duplication in emitReadModifyAssignment().
5524 (KJS::emitReadModifyAssignment):
5526 2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5530 Sort includes alphabetically.
5534 2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5538 Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
5539 <https://bugs.webkit.org/show_bug.cgi?id=19596>
5541 When growing SegmentedVector, we start adding segments at the position
5542 of the last segment, overwriting it. The destructor frees allocated
5543 segments starting at the segment of index 1, because the segment of
5544 index 0 is assumed to be the initial inline segment. This causes a leak
5545 of the segment that is referenced by index 0. Modifying grow() so that
5546 it starts adding segments at the position after the last segment fixes
5549 Since the initial segment is a special case in the lookup code, this
5550 bug never manifested itself via incorrect results.
5552 * VM/SegmentedVector.h:
5553 (KJS::SegmentedVector::grow):
5555 2008-06-16 Maciej Stachowiak <mjs@apple.com>
5559 - removed nearly unused types.h and LocalStorageEntry.h headers
5561 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5562 * JavaScriptCore.xcodeproj/project.pbxproj:
5564 * kjs/LocalStorageEntry.h: Removed.
5565 * kjs/RegExpObject.cpp:
5566 * kjs/error_object.cpp:
5569 * kjs/types.h: Removed.
5571 2008-06-16 Alp Toker <alp@nuanti.com>
5573 Rubber-stamped by Geoff.
5575 Change c++ to c in minidom and testapi emacs mode line comments.
5582 2008-06-16 Alexey Proskuryakov <ap@webkit.org>
5584 Trying to fix Windows build.
5586 * kjs/PropertyNameArray.h:
5587 * kjs/identifier.cpp:
5590 2008-06-16 Geoffrey Garen <ggaren@apple.com>
5592 Reviewed by Oliver Hunt.
5594 Slight cleanup to the SymbolTableEntry class.
5596 Renamed isEmpty to isNull, since we usually use "empty" to mean "holds
5597 the valid, empty value", and "null" to mean "holds no value".
5599 Changed an "== 0" to a "!", to match our style guidelines.
5601 Added some ASSERTs to verify the (possibly questionable) assumption that
5602 all register indexes will have their high two bits set. Also clarified a
5603 comment to make that assumption clear.
5605 2008-06-16 Alexey Proskuryakov <ap@webkit.org>
5609 Initialize functionQueueMutex in a safe manner.
5611 * wtf/MainThread.cpp:
5612 (WTF::functionQueueMutex): Made it an AtomicallyInitializedStatic.
5614 (WTF::dispatchFunctionsFromMainThread):
5615 (WTF::setMainThreadCallbacksPaused):
5616 Assert that the current thread is main, meaning that the callbacksPaused static can be
5619 2008-06-16 Alexey Proskuryakov <ap@webkit.org>
5621 Reviewed by Geoff Garen.
5623 Make Identifier construction use an explicitly passed IdentifierTable.
5625 No change on SunSpider total.
5627 * API/JSCallbackObjectFunctions.h:
5628 (KJS::::getOwnPropertySlot):
5630 (KJS::::deleteProperty):
5631 (KJS::::getPropertyNames):
5632 * API/JSObjectRef.cpp:
5633 (JSObjectMakeFunctionWithCallback):
5634 (JSObjectMakeFunction):
5635 (JSObjectHasProperty):
5636 (JSObjectGetProperty):
5637 (JSObjectSetProperty):
5638 (JSObjectDeleteProperty):
5639 (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
5640 (JSObjectCopyPropertyNames):
5641 * JavaScriptCore.exp:
5642 * VM/CodeGenerator.cpp:
5643 (KJS::CodeGenerator::CodeGenerator):
5644 (KJS::CodeGenerator::registerForLocal):
5645 (KJS::CodeGenerator::isLocal):
5646 (KJS::CodeGenerator::addConstant):
5647 (KJS::CodeGenerator::findScopedProperty):
5648 * VM/CodeGenerator.h:
5649 (KJS::CodeGenerator::globalData):
5650 (KJS::CodeGenerator::propertyNames):
5651 * VM/JSPropertyNameIterator.cpp:
5652 (KJS::JSPropertyNameIterator::create):
5654 (KJS::Machine::throwException):
5655 (KJS::Machine::privateExecute):
5656 * kjs/ArrayPrototype.cpp:
5657 (KJS::ArrayConstructor::ArrayConstructor):
5658 * kjs/BooleanObject.cpp:
5659 (KJS::BooleanConstructor::BooleanConstructor):
5660 * kjs/FunctionPrototype.cpp:
5661 (KJS::FunctionConstructor::FunctionConstructor):
5662 (KJS::FunctionConstructor::construct):
5664 (KJS::JSArray::inlineGetOwnPropertySlot):
5665 (KJS::JSArray::put):
5666 (KJS::JSArray::deleteProperty):
5667 (KJS::JSArray::getPropertyNames):
5668 * kjs/JSFunction.cpp:
5669 (KJS::Arguments::Arguments):
5670 * kjs/JSGlobalData.cpp:
5671 (KJS::JSGlobalData::JSGlobalData):
5672 * kjs/JSGlobalObject.cpp:
5673 (KJS::JSGlobalObject::reset):
5675 (KJS::JSObject::getOwnPropertySlot):
5676 (KJS::JSObject::put):
5677 (KJS::JSObject::putWithAttributes):
5678 (KJS::JSObject::deleteProperty):
5679 (KJS::JSObject::findPropertyHashEntry):
5680 (KJS::JSObject::getPropertyNames):
5681 (KJS::Error::create):
5682 * kjs/JSVariableObject.cpp:
5683 (KJS::JSVariableObject::getPropertyNames):
5684 * kjs/NumberObject.cpp:
5685 (KJS::NumberConstructor::NumberConstructor):
5686 * kjs/PropertyNameArray.cpp:
5687 (KJS::PropertyNameArray::add):
5688 * kjs/PropertyNameArray.h:
5689 (KJS::PropertyNameArray::PropertyNameArray):
5690 (KJS::PropertyNameArray::addKnownUnique):
5691 * kjs/PropertySlot.h:
5692 (KJS::PropertySlot::getValue):
5693 * kjs/RegExpObject.cpp:
5694 (KJS::RegExpConstructor::RegExpConstructor):
5695 * kjs/ScopeChain.cpp:
5696 (KJS::ScopeChainNode::print):
5698 (GlobalObject::GlobalObject):
5699 * kjs/date_object.cpp:
5700 (KJS::DateConstructor::DateConstructor):
5701 * kjs/error_object.cpp:
5702 (KJS::ErrorConstructor::ErrorConstructor):
5703 (KJS::NativeErrorConstructor::NativeErrorConstructor):
5705 * kjs/identifier.cpp:
5706 (KJS::Identifier::add):
5707 (KJS::Identifier::addSlowCase):
5709 (KJS::Identifier::Identifier):
5710 (KJS::Identifier::from):
5711 (KJS::Identifier::equal):
5712 (KJS::Identifier::add):
5716 (KJS::JSString::getOwnPropertySlot):
5718 (KJS::Lexer::Lexer):
5720 (KJS::Lexer::makeIdentifier):
5723 (KJS::HashTable::createTable):
5725 (KJS::HashTable::initializeIfNeeded):
5726 (KJS::HashTable::entry):
5727 (KJS::getStaticPropertySlot):
5728 (KJS::getStaticFunctionSlot):
5729 (KJS::getStaticValueSlot):
5731 * kjs/object_object.cpp:
5732 (KJS::objectProtoFuncHasOwnProperty):
5733 (KJS::objectProtoFuncDefineGetter):
5734 (KJS::objectProtoFuncDefineSetter):
5735 (KJS::objectProtoFuncLookupGetter):
5736 (KJS::objectProtoFuncLookupSetter):
5737 (KJS::objectProtoFuncPropertyIsEnumerable):
5738 (KJS::ObjectConstructor::ObjectConstructor):
5739 * kjs/string_object.cpp:
5740 (KJS::StringObject::getOwnPropertySlot):
5741 (KJS::StringObject::getPropertyNames):
5742 (KJS::StringConstructor::StringConstructor):
5743 Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
5746 * kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
5747 char*, which was incorrect, as that uses the pointer value as a key.
5749 2008-06-16 Thiago Macieira <tjmaciei@trolltech.com>
5753 https://bugs.webkit.org/show_bug.cgi?id=19577
5755 Fix compilation in C++ environments where C99 headers are not present
5757 The stdbool.h header is a C99 feature, defining the "_Bool" type as well as the
5758 "true" and "false" constants. But it's completely unnecessary in C++ as the
5759 language already defines the "bool" type and its two values.
5762 * API/JSContextRef.h:
5763 * API/JSObjectRef.h:
5764 * API/JSStringRef.h:
5767 2008-06-16 Kevin McCullough <kmccullough@apple.com>
5771 <rdar://problem/6012509> JSProfiler: %s are incorrect if you exclude a
5772 top level node like (idle)
5774 * profiler/Profile.cpp:
5775 (KJS::Profile::focus):
5776 (KJS::Profile::exclude): Subtract the selfTime from the totalTime of the
5777 head since its self time will only be non-zero when one of its children
5778 were excluded. Since the head's totalTime is used to calculate %s when
5779 its totalTime is the same as the sum of all its visible childrens' times
5780 their %s will sum to 100%.
5782 2008-06-16 Kevin McCullough <kmccullough@apple.com>
5784 Reviewed by Sam Weinig.
5786 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the profiler.
5788 * profiler/Profile.cpp:
5789 (KJS::Profile::willExecute):
5791 2008-06-16 Kevin McCullough <kmccullough@apple.com>
5795 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
5797 - Remove the last of the uses of recursion in the profiler.
5799 * JavaScriptCore.exp: Export the new function's signature.
5800 * profiler/Profile.cpp:
5801 (KJS::calculateVisibleTotalTime): Added a new static method for
5802 recalculating the visibleTotalTime of methods after focus has changed
5804 (KJS::stopProfiling):
5805 (KJS::Profile::focus): Implemented focus without recursion.
5806 * profiler/Profile.h: Moved implementation into the definition file.
5807 * profiler/ProfileNode.cpp:
5808 (KJS::ProfileNode::traverseNextNodePreOrder): Added an argument for
5809 whether or not to process the children nodes, this allows focus to skip
5810 sub trees which have been set as not visible.
5811 (KJS::ProfileNode::calculateVisibleTotalTime): This function set's a
5812 node's total visible time to the sum of its self time and its children's
5814 (KJS::ProfileNode::focus): Implemented focus without recursion.
5815 * profiler/ProfileNode.h:
5816 (KJS::CallIdentifier::operator!= ):
5817 (KJS::ProfileNode::setActualTotalTime): Expanded setting the total time
5818 so that focus could modify only the visible total time.
5819 (KJS::ProfileNode::setVisibleTotalTime):
5821 2008-06-16 Christian Dywan <christian@twotoasts.de>
5825 https://bugs.webkit.org/show_bug.cgi?id=19552
5826 JavaScriptCore headers use C++ style comments
5828 Replace all C++ style comments with C style multiline
5829 comments and remove all "mode" lines.
5833 * API/JSContextRef.h:
5834 * API/JSObjectRef.h:
5835 * API/JSStringRef.h:
5836 * API/JSStringRefBSTR.h:
5837 * API/JSStringRefCF.h:
5840 * API/JavaScriptCore.h:
5842 2008-06-16 Christian Dywan <christian@twotoasts.de>
5846 https://bugs.webkit.org/show_bug.cgi?id=19557
5847 (JavaScriptCore) minidom uses C++ style comments
5849 Use only C style comments in minidom sources
5852 (JSNode_appendChild):
5853 (JSNode_removeChild):
5856 (JSNodeList_getProperty):
5865 (createStringWithContentsOfFile):
5867 * wtf/UnusedParam.h:
5869 2008-06-16 Adriaan de Groot <groot@kde.org>
5873 Fix compilation on Solaris
5875 On some systems, munmap takes a char* instead of a void* (contrary to POSIX and
5876 Single Unix Specification). Since you can always convert from char* to void*
5877 but not vice-versa, do the casting to char*.
5879 * kjs/collector.cpp:
5880 (KJS::allocateBlock):
5883 2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5887 Make a UnaryOpNode class to reduce boilerplate code for UnaryPlusNode,
5888 NegateNode, BitwiseNotNode, and LogicalNotNode.
5890 * VM/CodeGenerator.h:
5891 (KJS::CodeGenerator::emitToJSNumber):
5893 (KJS::UnaryOpNode::emitCode):
5895 (KJS::UnaryOpNode::UnaryOpNode):
5896 (KJS::UnaryPlusNode::):
5897 (KJS::NegateNode::):
5898 (KJS::NegateNode::precedence):
5899 (KJS::BitwiseNotNode::):
5900 (KJS::BitwiseNotNode::precedence):
5901 (KJS::LogicalNotNode::):
5902 (KJS::LogicalNotNode::precedence):
5904 2008-06-16 Jan Michael Alonzo <jmalonzo@webkit.org>
5910 2008-06-15 Darin Adler <darin@apple.com>
5912 - rename KJS::List to KJS::ArgList
5914 * API/JSCallbackConstructor.cpp:
5915 (KJS::JSCallbackConstructor::construct):
5916 * API/JSCallbackConstructor.h:
5917 * API/JSCallbackFunction.cpp:
5918 (KJS::JSCallbackFunction::callAsFunction):
5919 * API/JSCallbackFunction.h:
5920 * API/JSCallbackObject.h:
5921 * API/JSCallbackObjectFunctions.h:
5923 (KJS::::callAsFunction):
5924 * API/JSObjectRef.cpp:
5925 (JSObjectMakeFunction):
5926 (JSObjectCallAsFunction):
5927 (JSObjectCallAsConstructor):
5928 * JavaScriptCore.exp:
5930 (KJS::Machine::execute):
5931 (KJS::Machine::privateExecute):
5933 * kjs/ArrayPrototype.cpp:
5934 (KJS::arrayProtoFuncToString):
5935 (KJS::arrayProtoFuncToLocaleString):
5936 (KJS::arrayProtoFuncJoin):
5937 (KJS::arrayProtoFuncConcat):
5938 (KJS::arrayProtoFuncPop):
5939 (KJS::arrayProtoFuncPush):
5940 (KJS::arrayProtoFuncReverse):
5941 (KJS::arrayProtoFuncShift):
5942 (KJS::arrayProtoFuncSlice):
5943 (KJS::arrayProtoFuncSort):
5944 (KJS::arrayProtoFuncSplice):
5945 (KJS::arrayProtoFuncUnShift):
5946 (KJS::arrayProtoFuncFilter):
5947 (KJS::arrayProtoFuncMap):
5948 (KJS::arrayProtoFuncEvery):
5949 (KJS::arrayProtoFuncForEach):
5950 (KJS::arrayProtoFuncSome):
5951 (KJS::arrayProtoFuncIndexOf):
5952 (KJS::arrayProtoFuncLastIndexOf):
5953 (KJS::ArrayConstructor::construct):
5954 (KJS::ArrayConstructor::callAsFunction):
5955 * kjs/ArrayPrototype.h:
5956 * kjs/BooleanObject.cpp:
5957 (KJS::booleanProtoFuncToString):
5958 (KJS::booleanProtoFuncValueOf):
5959 (KJS::BooleanConstructor::construct):
5960 (KJS::BooleanConstructor::callAsFunction):
5961 * kjs/BooleanObject.h:
5962 * kjs/CommonIdentifiers.h:
5964 (KJS::ExecState::emptyList):
5965 * kjs/FunctionPrototype.cpp:
5966 (KJS::FunctionPrototype::callAsFunction):
5967 (KJS::functionProtoFuncToString):
5968 (KJS::functionProtoFuncApply):
5969 (KJS::functionProtoFuncCall):
5970 (KJS::FunctionConstructor::construct):
5971 (KJS::FunctionConstructor::callAsFunction):
5972 * kjs/FunctionPrototype.h:
5973 * kjs/JSActivation.cpp:
5974 (KJS::JSActivation::createArgumentsObject):
5976 (KJS::JSArray::JSArray):
5977 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
5979 * kjs/JSFunction.cpp:
5980 (KJS::JSFunction::callAsFunction):
5981 (KJS::JSFunction::construct):
5982 (KJS::IndexToNameMap::IndexToNameMap):
5983 (KJS::Arguments::Arguments):
5986 (KJS::globalFuncEval):
5987 (KJS::globalFuncParseInt):
5988 (KJS::globalFuncParseFloat):
5989 (KJS::globalFuncIsNaN):
5990 (KJS::globalFuncIsFinite):
5991 (KJS::globalFuncDecodeURI):
5992 (KJS::globalFuncDecodeURIComponent):
5993 (KJS::globalFuncEncodeURI):
5994 (KJS::globalFuncEncodeURIComponent):
5995 (KJS::globalFuncEscape):
5996 (KJS::globalFuncUnescape):
5997 (KJS::globalFuncKJSPrint):
5998 (KJS::PrototypeFunction::callAsFunction):
5999 (KJS::PrototypeReflexiveFunction::callAsFunction):
6001 * kjs/JSGlobalData.h:
6002 * kjs/JSImmediate.cpp:
6003 (KJS::JSImmediate::toObject):
6004 * kjs/JSNotAnObject.cpp:
6005 (KJS::JSNotAnObject::construct):
6006 (KJS::JSNotAnObject::callAsFunction):
6007 * kjs/JSNotAnObject.h:
6009 (KJS::JSObject::put):
6010 (KJS::JSObject::construct):
6011 (KJS::JSObject::callAsFunction):
6012 (KJS::Error::create):
6014 * kjs/MathObject.cpp:
6015 (KJS::mathProtoFuncAbs):
6016 (KJS::mathProtoFuncACos):
6017 (KJS::mathProtoFuncASin):
6018 (KJS::mathProtoFuncATan):
6019 (KJS::mathProtoFuncATan2):
6020 (KJS::mathProtoFuncCeil):
6021 (KJS::mathProtoFuncCos):
6022 (KJS::mathProtoFuncExp):
6023 (KJS::mathProtoFuncFloor):
6024 (KJS::mathProtoFuncLog):
6025 (KJS::mathProtoFuncMax):
6026 (KJS::mathProtoFuncMin):
6027 (KJS::mathProtoFuncPow):
6028 (KJS::mathProtoFuncRandom):
6029 (KJS::mathProtoFuncRound):
6030 (KJS::mathProtoFuncSin):
6031 (KJS::mathProtoFuncSqrt):
6032 (KJS::mathProtoFuncTan):
6034 * kjs/NumberObject.cpp:
6035 (KJS::numberProtoFuncToString):
6036 (KJS::numberProtoFuncToLocaleString):
6037 (KJS::numberProtoFuncValueOf):
6038 (KJS::numberProtoFuncToFixed):
6039 (KJS::numberProtoFuncToExponential):
6040 (KJS::numberProtoFuncToPrecision):
6041 (KJS::NumberConstructor::construct):
6042 (KJS::NumberConstructor::callAsFunction):
6043 * kjs/NumberObject.h:
6044 * kjs/RegExpObject.cpp:
6045 (KJS::regExpProtoFuncTest):
6046 (KJS::regExpProtoFuncExec):
6047 (KJS::regExpProtoFuncCompile):
6048 (KJS::regExpProtoFuncToString):
6049 (KJS::RegExpObject::match):
6050 (KJS::RegExpObject::test):
6051 (KJS::RegExpObject::exec):
6052 (KJS::RegExpObject::callAsFunction):
6053 (KJS::RegExpConstructor::construct):
6054 (KJS::RegExpConstructor::callAsFunction):
6055 * kjs/RegExpObject.h:
6065 * kjs/collector.cpp:
6066 (KJS::Collector::collect):
6068 (KJS::Collector::markListSet):
6069 * kjs/date_object.cpp:
6070 (KJS::formatLocaleDate):
6071 (KJS::fillStructuresUsingTimeArgs):
6072 (KJS::fillStructuresUsingDateArgs):
6073 (KJS::DateConstructor::construct):
6074 (KJS::DateConstructor::callAsFunction):
6075 (KJS::DateFunction::callAsFunction):
6076 (KJS::dateProtoFuncToString):
6077 (KJS::dateProtoFuncToUTCString):
6078 (KJS::dateProtoFuncToDateString):
6079 (KJS::dateProtoFuncToTimeString):
6080 (KJS::dateProtoFuncToLocaleString):
6081 (KJS::dateProtoFuncToLocaleDateString):
6082 (KJS::dateProtoFuncToLocaleTimeString):
6083 (KJS::dateProtoFuncValueOf):
6084 (KJS::dateProtoFuncGetTime):
6085 (KJS::dateProtoFuncGetFullYear):
6086 (KJS::dateProtoFuncGetUTCFullYear):
6087 (KJS::dateProtoFuncToGMTString):
6088 (KJS::dateProtoFuncGetMonth):
6089 (KJS::dateProtoFuncGetUTCMonth):
6090 (KJS::dateProtoFuncGetDate):
6091 (KJS::dateProtoFuncGetUTCDate):
6092 (KJS::dateProtoFuncGetDay):
6093 (KJS::dateProtoFuncGetUTCDay):
6094 (KJS::dateProtoFuncGetHours):
6095 (KJS::dateProtoFuncGetUTCHours):
6096 (KJS::dateProtoFuncGetMinutes):
6097 (KJS::dateProtoFuncGetUTCMinutes):
6098 (KJS::dateProtoFuncGetSeconds):
6099 (KJS::dateProtoFuncGetUTCSeconds):
6100 (KJS::dateProtoFuncGetMilliSeconds):
6101 (KJS::dateProtoFuncGetUTCMilliseconds):
6102 (KJS::dateProtoFuncGetTimezoneOffset):
6103 (KJS::dateProtoFuncSetTime):
6104 (KJS::setNewValueFromTimeArgs):
6105 (KJS::setNewValueFromDateArgs):
6106 (KJS::dateProtoFuncSetMilliSeconds):
6107 (KJS::dateProtoFuncSetUTCMilliseconds):
6108 (KJS::dateProtoFuncSetSeconds):
6109 (KJS::dateProtoFuncSetUTCSeconds):
6110 (KJS::dateProtoFuncSetMinutes):
6111 (KJS::dateProtoFuncSetUTCMinutes):
6112 (KJS::dateProtoFuncSetHours):
6113 (KJS::dateProtoFuncSetUTCHours):
6114 (KJS::dateProtoFuncSetDate):
6115 (KJS::dateProtoFuncSetUTCDate):
6116 (KJS::dateProtoFuncSetMonth):
6117 (KJS::dateProtoFuncSetUTCMonth):
6118 (KJS::dateProtoFuncSetFullYear):
6119 (KJS::dateProtoFuncSetUTCFullYear):
6120 (KJS::dateProtoFuncSetYear):
6121 (KJS::dateProtoFuncGetYear):
6122 * kjs/date_object.h:
6124 * kjs/error_object.cpp:
6125 (KJS::errorProtoFuncToString):
6126 (KJS::ErrorConstructor::construct):
6127 (KJS::ErrorConstructor::callAsFunction):
6128 (KJS::NativeErrorConstructor::construct):
6129 (KJS::NativeErrorConstructor::callAsFunction):
6130 * kjs/error_object.h:
6132 (KJS::JSNumberCell::toObject):
6133 (KJS::JSNumberCell::toThisObject):
6135 (KJS::ArgList::getSlice):
6136 (KJS::ArgList::markLists):
6137 (KJS::ArgList::slowAppend):
6139 (KJS::ArgList::ArgList):
6140 (KJS::ArgList::~ArgList):
6141 * kjs/object_object.cpp:
6142 (KJS::objectProtoFuncValueOf):
6143 (KJS::objectProtoFuncHasOwnProperty):
6144 (KJS::objectProtoFuncIsPrototypeOf):
6145 (KJS::objectProtoFuncDefineGetter):
6146 (KJS::objectProtoFuncDefineSetter):
6147 (KJS::objectProtoFuncLookupGetter):
6148 (KJS::objectProtoFuncLookupSetter):
6149 (KJS::objectProtoFuncPropertyIsEnumerable):
6150 (KJS::objectProtoFuncToLocaleString):
6151 (KJS::objectProtoFuncToString):
6152 (KJS::ObjectConstructor::construct):
6153 (KJS::ObjectConstructor::callAsFunction):
6154 * kjs/object_object.h:
6155 * kjs/string_object.cpp:
6157 (KJS::stringProtoFuncToString):
6158 (KJS::stringProtoFuncValueOf):
6159 (KJS::stringProtoFuncCharAt):
6160 (KJS::stringProtoFuncCharCodeAt):
6161 (KJS::stringProtoFuncConcat):
6162 (KJS::stringProtoFuncIndexOf):
6163 (KJS::stringProtoFuncLastIndexOf):
6164 (KJS::stringProtoFuncMatch):
6165 (KJS::stringProtoFuncSearch):
6166 (KJS::stringProtoFuncReplace):
6167 (KJS::stringProtoFuncSlice):
6168 (KJS::stringProtoFuncSplit):
6169 (KJS::stringProtoFuncSubstr):
6170 (KJS::stringProtoFuncSubstring):
6171 (KJS::stringProtoFuncToLowerCase):
6172 (KJS::stringProtoFuncToUpperCase):
6173 (KJS::stringProtoFuncToLocaleLowerCase):
6174 (KJS::stringProtoFuncToLocaleUpperCase):
6175 (KJS::stringProtoFuncLocaleCompare):
6176 (KJS::stringProtoFuncBig):
6177 (KJS::stringProtoFuncSmall):
6178 (KJS::stringProtoFuncBlink):
6179 (KJS::stringProtoFuncBold):
6180 (KJS::stringProtoFuncFixed):
6181 (KJS::stringProtoFuncItalics):
6182 (KJS::stringProtoFuncStrike):
6183 (KJS::stringProtoFuncSub):
6184 (KJS::stringProtoFuncSup):
6185 (KJS::stringProtoFuncFontcolor):
6186 (KJS::stringProtoFuncFontsize):
6187 (KJS::stringProtoFuncAnchor):
6188 (KJS::stringProtoFuncLink):
6189 (KJS::StringConstructor::construct):
6190 (KJS::StringConstructor::callAsFunction):
6191 (KJS::StringConstructorFunction::callAsFunction):
6192 * kjs/string_object.h:
6194 2008-06-15 Darin Adler <darin@apple.com>
6196 - new names for more JavaScriptCore files
6198 * API/JSCallbackFunction.cpp:
6199 * API/JSObjectRef.cpp:
6200 * DerivedSources.make:
6202 * JavaScriptCore.exp:
6203 * JavaScriptCore.pri:
6204 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6205 * JavaScriptCore.xcodeproj/project.pbxproj:
6206 * JavaScriptCoreSources.bkl:
6208 * kjs/AllInOneFile.cpp:
6209 * kjs/ArrayPrototype.cpp: Copied from JavaScriptCore/kjs/array_object.cpp.
6210 * kjs/ArrayPrototype.h: Copied from JavaScriptCore/kjs/array_object.h.
6211 * kjs/BooleanObject.cpp: Copied from JavaScriptCore/kjs/bool_object.cpp.
6212 * kjs/BooleanObject.h: Copied from JavaScriptCore/kjs/bool_object.h.
6213 * kjs/ExecState.cpp:
6215 * kjs/FunctionPrototype.cpp: Copied from JavaScriptCore/kjs/function_object.cpp.
6216 * kjs/FunctionPrototype.h: Copied from JavaScriptCore/kjs/function_object.h.
6217 * kjs/JSArray.cpp: Copied from JavaScriptCore/kjs/array_instance.cpp.
6218 * kjs/JSArray.h: Copied from JavaScriptCore/kjs/array_instance.h.
6219 * kjs/JSFunction.cpp:
6221 * kjs/JSGlobalObject.cpp:
6222 * kjs/JSImmediate.cpp:
6226 * kjs/JSVariableObject.cpp:
6227 * kjs/MathObject.cpp: Copied from JavaScriptCore/kjs/math_object.cpp.
6228 * kjs/MathObject.h: Copied from JavaScriptCore/kjs/math_object.h.
6229 * kjs/NumberObject.cpp: Copied from JavaScriptCore/kjs/number_object.cpp.
6230 * kjs/NumberObject.h: Copied from JavaScriptCore/kjs/number_object.h.
6231 * kjs/PropertyMap.cpp: Copied from JavaScriptCore/kjs/property_map.cpp.
6232 * kjs/PropertyMap.h: Copied from JavaScriptCore/kjs/property_map.h.
6233 * kjs/PropertySlot.cpp: Copied from JavaScriptCore/kjs/property_slot.cpp.
6234 * kjs/PropertySlot.h: Copied from JavaScriptCore/kjs/property_slot.h.
6235 * kjs/RegExpObject.cpp: Copied from JavaScriptCore/kjs/regexp_object.cpp.
6236 * kjs/RegExpObject.h: Copied from JavaScriptCore/kjs/regexp_object.h.
6237 * kjs/ScopeChain.cpp: Copied from JavaScriptCore/kjs/scope_chain.cpp.
6238 * kjs/ScopeChain.h: Copied from JavaScriptCore/kjs/scope_chain.h.
6239 * kjs/ScopeChainMark.h: Copied from JavaScriptCore/kjs/scope_chain_mark.h.
6241 * kjs/array_instance.cpp: Removed.
6242 * kjs/array_instance.h: Removed.
6243 * kjs/array_object.cpp: Removed.
6244 * kjs/array_object.h: Removed.
6245 * kjs/bool_object.cpp: Removed.
6246 * kjs/bool_object.h: Removed.
6247 * kjs/error_object.h:
6248 * kjs/function_object.cpp: Removed.
6249 * kjs/function_object.h: Removed.
6251 * kjs/math_object.cpp: Removed.
6252 * kjs/math_object.h: Removed.
6254 * kjs/number_object.cpp: Removed.
6255 * kjs/number_object.h: Removed.
6256 * kjs/object_object.cpp:
6257 * kjs/property_map.cpp: Removed.
6258 * kjs/property_map.h: Removed.
6259 * kjs/property_slot.cpp: Removed.
6260 * kjs/property_slot.h: Removed.
6261 * kjs/regexp_object.cpp: Removed.
6262 * kjs/regexp_object.h: Removed.
6263 * kjs/scope_chain.cpp: Removed.
6264 * kjs/scope_chain.h: Removed.
6265 * kjs/scope_chain_mark.h: Removed.
6266 * kjs/string_object.cpp:
6267 * kjs/string_object.h:
6269 2008-06-15 Darin Adler <darin@apple.com>
6271 - new names for a few key JavaScriptCore files
6274 * API/JSCallbackConstructor.h:
6275 * API/JSCallbackFunction.cpp:
6276 * API/JSCallbackFunction.h:
6277 * API/JSCallbackObject.h:
6278 * API/JSCallbackObjectFunctions.h:
6280 * API/JSContextRef.cpp:
6281 * API/JSObjectRef.cpp:
6282 * API/JSStringRef.cpp:
6283 * API/JSStringRefCF.cpp:
6284 * API/JSValueRef.cpp:
6286 * JavaScriptCore.pri:
6287 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6288 * JavaScriptCore.xcodeproj/project.pbxproj:
6289 * JavaScriptCoreSources.bkl:
6291 * VM/CodeGenerator.cpp:
6292 * VM/ExceptionHelpers.cpp:
6293 * VM/ExceptionHelpers.h:
6294 * VM/JSPropertyNameIterator.cpp:
6295 * VM/JSPropertyNameIterator.h:
6297 * kjs/AllInOneFile.cpp:
6299 * kjs/DebuggerCallFrame.cpp:
6300 * kjs/ExecState.cpp:
6301 * kjs/JSActivation.cpp:
6302 * kjs/JSFunction.cpp: Copied from JavaScriptCore/kjs/function.cpp.
6303 * kjs/JSFunction.h: Copied from JavaScriptCore/kjs/function.h.
6304 * kjs/JSImmediate.cpp:
6305 * kjs/JSNotAnObject.h:
6306 * kjs/JSObject.cpp: Copied from JavaScriptCore/kjs/object.cpp.
6307 * kjs/JSObject.h: Copied from JavaScriptCore/kjs/object.h.
6308 * kjs/JSString.h: Copied from JavaScriptCore/kjs/internal.h.
6309 * kjs/JSValue.cpp: Copied from JavaScriptCore/kjs/value.cpp.
6310 * kjs/JSValue.h: Copied from JavaScriptCore/kjs/value.h.
6311 * kjs/JSVariableObject.h:
6312 * kjs/JSWrapperObject.h:
6314 * kjs/SymbolTable.h:
6315 * kjs/array_instance.h:
6316 * kjs/collector.cpp:
6317 * kjs/date_object.cpp:
6318 * kjs/date_object.h:
6319 * kjs/error_object.cpp:
6320 * kjs/function.cpp: Removed.
6321 * kjs/function.h: Removed.
6322 * kjs/function_object.cpp:
6323 * kjs/function_object.h:
6326 * kjs/internal.h: Removed.
6331 * kjs/object.cpp: Removed.
6332 * kjs/object.h: Removed.
6333 * kjs/object_object.h:
6334 * kjs/operations.cpp:
6335 * kjs/property_map.cpp:
6336 * kjs/property_slot.cpp:
6337 * kjs/property_slot.h:
6339 * kjs/regexp_object.cpp:
6340 * kjs/scope_chain.cpp:
6341 * kjs/string_object.h:
6343 * kjs/value.cpp: Removed.
6344 * kjs/value.h: Removed.
6345 * profiler/Profile.cpp:
6346 * profiler/Profiler.cpp:
6348 2008-06-15 Darin Adler <darin@apple.com>
6350 Rubber stamped by Sam.
6352 - cut down on confusing uses of "Object" and "Imp" in
6353 JavaScriptCore class names
6355 * API/JSCallbackFunction.cpp:
6356 (KJS::JSCallbackFunction::JSCallbackFunction):
6357 * API/JSCallbackFunction.h:
6359 (KJS::Machine::privateExecute):
6361 (KJS::ExecState::regExpTable):
6362 (KJS::ExecState::regExpConstructorTable):
6363 * kjs/JSGlobalData.cpp:
6364 (KJS::JSGlobalData::JSGlobalData):
6365 (KJS::JSGlobalData::~JSGlobalData):
6366 * kjs/JSGlobalData.h:
6367 * kjs/JSGlobalObject.cpp:
6368 (KJS::JSGlobalObject::reset):
6369 * kjs/JSGlobalObject.h:
6370 (KJS::JSGlobalObject::objectConstructor):
6371 (KJS::JSGlobalObject::functionConstructor):
6372 (KJS::JSGlobalObject::arrayConstructor):
6373 (KJS::JSGlobalObject::booleanConstructor):
6374 (KJS::JSGlobalObject::stringConstructor):
6375 (KJS::JSGlobalObject::numberConstructor):
6376 (KJS::JSGlobalObject::dateConstructor):
6377 (KJS::JSGlobalObject::regExpConstructor):
6378 (KJS::JSGlobalObject::errorConstructor):
6379 (KJS::JSGlobalObject::evalErrorConstructor):
6380 (KJS::JSGlobalObject::rangeErrorConstructor):
6381 (KJS::JSGlobalObject::referenceErrorConstructor):
6382 (KJS::JSGlobalObject::syntaxErrorConstructor):
6383 (KJS::JSGlobalObject::typeErrorConstructor):
6384 (KJS::JSGlobalObject::URIErrorConstructor):
6385 * kjs/array_object.cpp:
6386 (KJS::ArrayConstructor::ArrayConstructor):
6387 (KJS::ArrayConstructor::getConstructData):
6388 (KJS::ArrayConstructor::construct):
6389 (KJS::ArrayConstructor::callAsFunction):
6390 * kjs/array_object.h:
6391 * kjs/bool_object.cpp:
6392 (KJS::BooleanObject::BooleanObject):
6393 (KJS::BooleanPrototype::BooleanPrototype):
6394 (KJS::booleanProtoFuncToString):
6395 (KJS::booleanProtoFuncValueOf):
6396 (KJS::BooleanConstructor::BooleanConstructor):
6397 (KJS::BooleanConstructor::getConstructData):
6398 (KJS::BooleanConstructor::construct):
6399 (KJS::BooleanConstructor::callAsFunction):
6400 * kjs/bool_object.h:
6401 * kjs/date_object.cpp:
6402 (KJS::DatePrototype::DatePrototype):
6403 (KJS::DateConstructor::DateConstructor):
6404 (KJS::DateConstructor::getConstructData):
6405 (KJS::DateConstructor::construct):
6406 (KJS::DateConstructor::callAsFunction):
6407 (KJS::DateFunction::DateFunction):
6408 (KJS::DateFunction::callAsFunction):
6409 * kjs/date_object.h:
6410 * kjs/error_object.cpp:
6411 (KJS::ErrorPrototype::ErrorPrototype):
6412 (KJS::ErrorConstructor::ErrorConstructor):
6413 (KJS::ErrorConstructor::getConstructData):
6414 (KJS::ErrorConstructor::construct):
6415 (KJS::ErrorConstructor::callAsFunction):
6416 (KJS::NativeErrorConstructor::NativeErrorConstructor):
6417 (KJS::NativeErrorConstructor::getConstructData):
6418 (KJS::NativeErrorConstructor::construct):
6419 (KJS::NativeErrorConstructor::callAsFunction):
6420 (KJS::NativeErrorConstructor::mark):
6421 * kjs/error_object.h:
6423 (KJS::JSFunction::JSFunction):
6424 (KJS::JSFunction::mark):
6425 (KJS::JSFunction::getOwnPropertySlot):
6426 (KJS::JSFunction::put):
6427 (KJS::JSFunction::deleteProperty):
6428 (KJS::PrototypeFunction::PrototypeFunction):
6429 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
6430 (KJS::PrototypeReflexiveFunction::mark):
6432 * kjs/function_object.cpp:
6433 (KJS::functionProtoFuncToString):
6434 (KJS::FunctionConstructor::FunctionConstructor):
6435 (KJS::FunctionConstructor::getConstructData):
6436 (KJS::FunctionConstructor::construct):
6437 (KJS::FunctionConstructor::callAsFunction):
6438 * kjs/function_object.h:
6440 (KJS::StringObject::create):
6441 (KJS::JSString::toObject):
6442 (KJS::JSString::toThisObject):
6443 (KJS::JSString::getOwnPropertySlot):
6444 (KJS::InternalFunction::InternalFunction):
6445 (KJS::InternalFunction::getCallData):
6446 (KJS::InternalFunction::implementsHasInstance):
6447 * kjs/math_object.cpp:
6448 (KJS::MathObject::MathObject):
6449 (KJS::MathObject::getOwnPropertySlot):
6450 (KJS::MathObject::getValueProperty):
6451 * kjs/math_object.h:
6452 * kjs/number_object.cpp:
6453 (KJS::NumberObject::NumberObject):
6454 (KJS::NumberPrototype::NumberPrototype):
6455 (KJS::numberProtoFuncToString):
6456 (KJS::numberProtoFuncToLocaleString):
6457 (KJS::numberProtoFuncValueOf):
6458 (KJS::numberProtoFuncToFixed):
6459 (KJS::numberProtoFuncToExponential):
6460 (KJS::numberProtoFuncToPrecision):
6461 (KJS::NumberConstructor::NumberConstructor):
6462 (KJS::NumberConstructor::getOwnPropertySlot):
6463 (KJS::NumberConstructor::getValueProperty):
6464 (KJS::NumberConstructor::getConstructData):
6465 (KJS::NumberConstructor::construct):
6466 (KJS::NumberConstructor::callAsFunction):
6467 * kjs/number_object.h:
6469 (KJS::JSObject::putDirectFunction):
6471 * kjs/object_object.cpp:
6472 (KJS::ObjectConstructor::ObjectConstructor):
6473 (KJS::ObjectConstructor::getConstructData):
6474 (KJS::ObjectConstructor::construct):
6475 (KJS::ObjectConstructor::callAsFunction):
6476 * kjs/object_object.h:
6478 (KJS::RegExp::RegExp):
6479 * kjs/regexp_object.cpp:
6480 (KJS::regExpProtoFuncTest):
6481 (KJS::regExpProtoFuncExec):
6482 (KJS::regExpProtoFuncCompile):
6483 (KJS::regExpProtoFuncToString):
6484 (KJS::RegExpObject::RegExpObject):
6485 (KJS::RegExpObject::~RegExpObject):
6486 (KJS::RegExpObject::getOwnPropertySlot):
6487 (KJS::RegExpObject::getValueProperty):
6488 (KJS::RegExpObject::put):
6489 (KJS::RegExpObject::putValueProperty):
6490 (KJS::RegExpObject::match):
6491 (KJS::RegExpObject::test):
6492 (KJS::RegExpObject::exec):
6493 (KJS::RegExpObject::getCallData):
6494 (KJS::RegExpObject::callAsFunction):
6495 (KJS::RegExpConstructorPrivate::RegExpConstructorPrivate):
6496 (KJS::RegExpConstructor::RegExpConstructor):
6497 (KJS::RegExpConstructor::performMatch):
6498 (KJS::RegExpMatchesArray::RegExpMatchesArray):
6499 (KJS::RegExpMatchesArray::~RegExpMatchesArray):
6500 (KJS::RegExpMatchesArray::fillArrayInstance):
6501 (KJS::RegExpConstructor::arrayOfMatches):
6502 (KJS::RegExpConstructor::getBackref):
6503 (KJS::RegExpConstructor::getLastParen):
6504 (KJS::RegExpConstructor::getLeftContext):
6505 (KJS::RegExpConstructor::getRightContext):
6506 (KJS::RegExpConstructor::getOwnPropertySlot):
6507 (KJS::RegExpConstructor::getValueProperty):
6508 (KJS::RegExpConstructor::put):
6509 (KJS::RegExpConstructor::putValueProperty):
6510 (KJS::RegExpConstructor::getConstructData):
6511 (KJS::RegExpConstructor::construct):
6512 (KJS::RegExpConstructor::callAsFunction):
6513 (KJS::RegExpConstructor::input):
6514 * kjs/regexp_object.h:
6515 * kjs/string_object.cpp:
6516 (KJS::StringObject::StringObject):
6517 (KJS::StringObject::getOwnPropertySlot):
6518 (KJS::StringObject::put):
6519 (KJS::StringObject::deleteProperty):
6520 (KJS::StringObject::getPropertyNames):
6521 (KJS::StringPrototype::StringPrototype):
6522 (KJS::StringPrototype::getOwnPropertySlot):
6524 (KJS::stringProtoFuncToString):
6525 (KJS::stringProtoFuncValueOf):
6526 (KJS::stringProtoFuncCharAt):
6527 (KJS::stringProtoFuncCharCodeAt):
6528 (KJS::stringProtoFuncConcat):
6529 (KJS::stringProtoFuncIndexOf):
6530 (KJS::stringProtoFuncLastIndexOf):
6531 (KJS::stringProtoFuncMatch):
6532 (KJS::stringProtoFuncSearch):
6533 (KJS::stringProtoFuncReplace):
6534 (KJS::stringProtoFuncSlice):
6535 (KJS::stringProtoFuncSplit):
6536 (KJS::stringProtoFuncSubstr):
6537 (KJS::stringProtoFuncSubstring):
6538 (KJS::stringProtoFuncToLowerCase):
6539 (KJS::stringProtoFuncToUpperCase):
6540 (KJS::stringProtoFuncToLocaleLowerCase):
6541 (KJS::stringProtoFuncToLocaleUpperCase):
6542 (KJS::stringProtoFuncLocaleCompare):
6543 (KJS::stringProtoFuncBig):
6544 (KJS::stringProtoFuncSmall):
6545 (KJS::stringProtoFuncBlink):
6546 (KJS::stringProtoFuncBold):
6547 (KJS::stringProtoFuncFixed):
6548 (KJS::stringProtoFuncItalics):
6549 (KJS::stringProtoFuncStrike):
6550 (KJS::stringProtoFuncSub):
6551 (KJS::stringProtoFuncSup):
6552 (KJS::stringProtoFuncFontcolor):
6553 (KJS::stringProtoFuncFontsize):
6554 (KJS::stringProtoFuncAnchor):
6555 (KJS::stringProtoFuncLink):
6556 (KJS::StringConstructor::StringConstructor):
6557 (KJS::StringConstructor::getConstructData):
6558 (KJS::StringConstructor::construct):
6559 (KJS::StringConstructor::callAsFunction):
6560 (KJS::StringConstructorFunction::StringConstructorFunction):
6561 (KJS::StringConstructorFunction::callAsFunction):
6562 * kjs/string_object.h:
6563 (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
6564 * profiler/Profiler.cpp:
6565 (KJS::createCallIdentifier):
6567 2008-06-15 Darin Adler <darin@apple.com>
6569 Rubber stamped by Sam.
6571 - use JS prefix and simpler names for basic JavaScriptCore types,
6572 to complement JSValue and JSObject
6574 * JavaScriptCore.exp:
6580 (KJS::Machine::execute):
6581 (KJS::Machine::retrieveArguments):
6582 (KJS::Machine::retrieveCaller):
6583 (KJS::Machine::getCallFrame):
6584 (KJS::Machine::getFunctionAndArguments):
6587 * kjs/DebuggerCallFrame.cpp:
6588 (KJS::DebuggerCallFrame::functionName):
6590 * kjs/JSActivation.cpp:
6591 (KJS::JSActivation::createArgumentsObject):
6592 * kjs/array_instance.cpp:
6593 (KJS::JSArray::checkConsistency):
6594 (KJS::JSArray::JSArray):
6595 (KJS::JSArray::~JSArray):
6596 (KJS::JSArray::getItem):
6597 (KJS::JSArray::lengthGetter):
6598 (KJS::JSArray::inlineGetOwnPropertySlot):
6599 (KJS::JSArray::getOwnPropertySlot):
6600 (KJS::JSArray::put):
6601 (KJS::JSArray::deleteProperty):
6602 (KJS::JSArray::getPropertyNames):
6603 (KJS::JSArray::increaseVectorLength):
6604 (KJS::JSArray::setLength):
6605 (KJS::JSArray::mark):
6606 (KJS::JSArray::sort):
6607 (KJS::JSArray::compactForSorting):
6608 (KJS::JSArray::lazyCreationData):
6609 (KJS::JSArray::setLazyCreationData):
6610 * kjs/array_instance.h:
6611 * kjs/array_object.cpp:
6612 (KJS::ArrayPrototype::ArrayPrototype):
6613 (KJS::ArrayPrototype::getOwnPropertySlot):
6614 (KJS::arrayProtoFuncToString):
6615 (KJS::arrayProtoFuncToLocaleString):
6616 (KJS::arrayProtoFuncConcat):
6617 (KJS::arrayProtoFuncSort):
6618 (KJS::ArrayObjectImp::construct):
6619 * kjs/array_object.h:
6622 (KJS::JSFunction::JSFunction):
6623 (KJS::JSFunction::mark):
6624 (KJS::JSFunction::getCallData):
6625 (KJS::JSFunction::callAsFunction):
6626 (KJS::JSFunction::argumentsGetter):
6627 (KJS::JSFunction::callerGetter):
6628 (KJS::JSFunction::lengthGetter):
6629 (KJS::JSFunction::getOwnPropertySlot):
6630 (KJS::JSFunction::put):
6631 (KJS::JSFunction::deleteProperty):
6632 (KJS::JSFunction::getParameterName):
6633 (KJS::JSFunction::getConstructData):
6634 (KJS::JSFunction::construct):
6635 (KJS::IndexToNameMap::IndexToNameMap):
6636 (KJS::Arguments::Arguments):
6638 * kjs/function_object.cpp:
6639 (KJS::functionProtoFuncToString):
6640 (KJS::functionProtoFuncApply):
6641 (KJS::FunctionObjectImp::construct):
6643 (KJS::JSString::toPrimitive):
6644 (KJS::JSString::getPrimitiveNumber):
6645 (KJS::JSString::toBoolean):
6646 (KJS::JSString::toNumber):
6647 (KJS::JSString::toString):
6648 (KJS::StringInstance::create):
6649 (KJS::JSString::toObject):
6650 (KJS::JSString::toThisObject):
6651 (KJS::JSString::lengthGetter):
6652 (KJS::JSString::indexGetter):
6653 (KJS::JSString::indexNumericPropertyGetter):
6654 (KJS::JSString::getOwnPropertySlot):
6655 (KJS::JSNumberCell::type):
6656 (KJS::JSNumberCell::toPrimitive):
6657 (KJS::JSNumberCell::getPrimitiveNumber):
6658 (KJS::JSNumberCell::toBoolean):
6659 (KJS::JSNumberCell::toNumber):
6660 (KJS::JSNumberCell::toString):
6661 (KJS::JSNumberCell::toObject):
6662 (KJS::JSNumberCell::toThisObject):
6663 (KJS::JSNumberCell::getUInt32):
6664 (KJS::JSNumberCell::getTruncatedInt32):
6665 (KJS::JSNumberCell::getTruncatedUInt32):
6666 (KJS::GetterSetter::mark):
6667 (KJS::GetterSetter::toPrimitive):
6668 (KJS::GetterSetter::getPrimitiveNumber):
6669 (KJS::GetterSetter::toBoolean):
6670 (KJS::GetterSetter::toNumber):
6671 (KJS::GetterSetter::toString):
6672 (KJS::GetterSetter::toObject):
6673 (KJS::GetterSetter::getOwnPropertySlot):
6674 (KJS::GetterSetter::put):
6675 (KJS::GetterSetter::toThisObject):
6677 (KJS::JSString::JSString):
6678 (KJS::JSString::getStringPropertySlot):
6680 (KJS::FuncDeclNode::makeFunction):
6681 (KJS::FuncExprNode::makeFunction):
6684 (KJS::JSObject::put):
6685 (KJS::JSObject::deleteProperty):
6686 (KJS::JSObject::defineGetter):
6687 (KJS::JSObject::defineSetter):
6688 (KJS::JSObject::lookupGetter):
6689 (KJS::JSObject::lookupSetter):
6690 (KJS::JSObject::fillGetterPropertySlot):
6692 (KJS::GetterSetter::GetterSetter):
6693 * kjs/operations.cpp:
6696 * kjs/property_map.cpp:
6697 (KJS::PropertyMap::containsGettersOrSetters):
6698 * kjs/regexp_object.cpp:
6699 (KJS::RegExpMatchesArray::getOwnPropertySlot):
6700 (KJS::RegExpMatchesArray::put):
6701 (KJS::RegExpMatchesArray::deleteProperty):
6702 (KJS::RegExpMatchesArray::getPropertyNames):
6703 (KJS::RegExpMatchesArray::RegExpMatchesArray):
6704 (KJS::RegExpMatchesArray::fillArrayInstance):
6705 * kjs/string_object.cpp:
6706 (KJS::StringInstance::StringInstance):
6708 (KJS::stringProtoFuncReplace):
6709 (KJS::stringProtoFuncToLowerCase):
6710 (KJS::stringProtoFuncToUpperCase):
6711 (KJS::stringProtoFuncToLocaleLowerCase):
6712 (KJS::stringProtoFuncToLocaleUpperCase):
6713 * kjs/string_object.h:
6714 (KJS::StringInstance::internalValue):
6716 (KJS::JSCell::getNumber):
6717 (KJS::JSCell::getString):
6718 (KJS::JSCell::getObject):
6720 (KJS::jsOwnedString):
6722 (KJS::JSNumberCell::JSNumberCell):
6723 (KJS::jsNumberCell):
6724 (KJS::JSValue::uncheckedGetNumber):
6725 * profiler/Profiler.cpp:
6726 (KJS::createCallIdentifier):
6727 (KJS::createCallIdentifierFromFunctionImp):
6729 2008-06-15 Maciej Stachowiak <mjs@apple.com>
6733 - add emitUnaryOp, emitNullaryOp and emitUnaryOpNoDst; use them
6735 This removes some boilerplate code and also reduces the number of
6736 places that will need to be changed to do on-demand emit of
6737 loads (and thus support k operands).
6739 * VM/CodeGenerator.cpp:
6740 (KJS::CodeGenerator::emitUnaryOp):
6741 (KJS::CodeGenerator::emitNullaryOp):
6742 (KJS::CodeGenerator::emitUnaryOpNoDst):
6743 (KJS::CodeGenerator::emitPushScope):
6744 * VM/CodeGenerator.h:
6745 (KJS::CodeGenerator::emitNewObject):
6746 (KJS::CodeGenerator::emitNewArray):
6747 (KJS::CodeGenerator::emitNot):
6748 (KJS::CodeGenerator::emitBitNot):
6749 (KJS::CodeGenerator::emitToJSNumber):
6750 (KJS::CodeGenerator::emitNegate):
6751 (KJS::CodeGenerator::emitInstanceOf):
6752 (KJS::CodeGenerator::emitTypeOf):
6753 (KJS::CodeGenerator::emitIn):
6754 (KJS::CodeGenerator::emitReturn):
6755 (KJS::CodeGenerator::emitEnd):
6756 (KJS::CodeGenerator::emitGetPropertyNames):
6758 2008-06-15 Alp Toker <alp@nuanti.com>
6760 Rubber-stamped by Maciej.
6762 Install 'jsc' application by default.
6766 2008-06-15 Maciej Stachowiak <mjs@apple.com>
6770 - rename testkjs to jsc
6773 * JavaScriptCore.vcproj/JavaScriptCore.sln:
6774 * JavaScriptCore.vcproj/jsc: Added.
6775 * JavaScriptCore.vcproj/jsc/jsc.vcproj: Copied from JavaScriptCore.vcproj/testkjs/testkjs.vcproj.
6776 * JavaScriptCore.vcproj/testkjs: Removed.
6777 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Removed.
6778 * JavaScriptCore.xcodeproj/project.pbxproj:
6780 * kjs/Shell.cpp: Copied from kjs/testkjs.cpp.
6782 (printUsageStatement):
6784 * kjs/jsc.pro: Copied from kjs/testkjs.pro.
6785 * kjs/testkjs.cpp: Removed.
6786 * kjs/testkjs.pro: Removed.
6787 * tests/mozilla/expected.html:
6788 * tests/mozilla/js1_2/Array/tostring_1.js:
6789 * tests/mozilla/js1_2/Array/tostring_2.js:
6790 * tests/mozilla/jsDriver.pl:
6792 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6798 * JavaScriptCore.xcodeproj/project.pbxproj:
6801 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6805 Change the spelling of PrecMultiplicitave to PrecMultiplicative.
6808 (KJS::MultNode::precedence):
6809 (KJS::DivNode::precedence):
6810 (KJS::ModNode::precedence):
6812 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6816 Remove unused preprocessor macros related to exceptions in the old
6821 2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6825 Bug 19484: More instructions needs to use temporary registers
6826 <https://bugs.webkit.org/show_bug.cgi?id=19484>
6828 Fix codegen for all binary operations so that temporaries are used if
6829 necessary. This was done by making BinaryOpNode and ReverseBinaryOpNode
6830 subclasses of ExpressionNode, and eliminating the custom emitCode()
6831 methods for the individual node classes.
6833 This only adds 3 new instructions to SunSpider code, and there is no
6834 difference in SunSpider execution time.
6836 * VM/CodeGenerator.cpp:
6837 (KJS::CodeGenerator::emitBitNot):
6838 (KJS::CodeGenerator::emitBinaryOp):
6839 * VM/CodeGenerator.h:
6842 (KJS::PreIncResolveNode::emitCode):
6843 (KJS::PreDecResolveNode::emitCode):
6844 (KJS::BinaryOpNode::emitCode):
6845 (KJS::ReverseBinaryOpNode::emitCode):
6846 (KJS::emitReadModifyAssignment):
6847 (KJS::CaseBlockNode::emitCodeForBlock):
6849 (KJS::BinaryOpNode::BinaryOpNode):
6850 (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
6853 (KJS::DivNode::precedence):
6855 (KJS::ModNode::precedence):
6857 (KJS::AddNode::precedence):
6859 (KJS::SubNode::precedence):
6860 (KJS::LeftShiftNode::):
6861 (KJS::LeftShiftNode::precedence):
6862 (KJS::RightShiftNode::):
6863 (KJS::RightShiftNode::precedence):
6864 (KJS::UnsignedRightShiftNode::):
6865 (KJS::UnsignedRightShiftNode::precedence):
6867 (KJS::LessNode::precedence):
6868 (KJS::GreaterNode::):
6869 (KJS::GreaterNode::precedence):
6870 (KJS::LessEqNode::):
6871 (KJS::LessEqNode::precedence):
6872 (KJS::GreaterEqNode::):
6873 (KJS::GreaterEqNode::precedence):
6874 (KJS::InstanceOfNode::):
6875 (KJS::InstanceOfNode::precedence):
6877 (KJS::InNode::precedence):
6879 (KJS::EqualNode::precedence):
6880 (KJS::NotEqualNode::):
6881 (KJS::NotEqualNode::precedence):
6882 (KJS::StrictEqualNode::):
6883 (KJS::StrictEqualNode::precedence):
6884 (KJS::NotStrictEqualNode::):
6885 (KJS::NotStrictEqualNode::precedence):
6886 (KJS::BitAndNode::):
6887 (KJS::BitAndNode::precedence):
6889 (KJS::BitOrNode::precedence):
6890 (KJS::BitXOrNode::):
6891 (KJS::BitXOrNode::precedence):
6892 * kjs/nodes2string.cpp:
6893 (KJS::LessNode::streamTo):
6894 (KJS::GreaterNode::streamTo):
6895 (KJS::LessEqNode::streamTo):
6896 (KJS::GreaterEqNode::streamTo):
6897 (KJS::InstanceOfNode::streamTo):
6898 (KJS::InNode::streamTo):
6899 (KJS::EqualNode::streamTo):
6900 (KJS::NotEqualNode::streamTo):
6901 (KJS::StrictEqualNode::streamTo):
6902 (KJS::NotStrictEqualNode::streamTo):
6903 (KJS::BitAndNode::streamTo):
6904 (KJS::BitXOrNode::streamTo):
6905 (KJS::BitOrNode::streamTo):
6907 2008-06-14 Darin Adler <darin@apple.com>
6909 Rubber stamped by Sam.
6911 - rename a bunch of local symbols within the regular expression code to
6912 follow our usual coding style, and do a few other name tweaks
6914 * pcre/pcre_compile.cpp:
6915 (CompileData::CompileData):
6920 (calculateCompiledPatternLength):
6923 * pcre/pcre_exec.cpp:
6924 (MatchStack::MatchStack):
6925 (MatchStack::canUseStackBufferForNextFrame):
6926 (MatchStack::popCurrentFrame):
6928 (tryFirstByteOptimization):
6929 (tryRequiredByteOptimization):
6931 * pcre/pcre_internal.h:
6933 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6937 Remove redundant uses of get().
6940 (KJS::BracketAccessorNode::emitCode):
6941 (KJS::AddNode::emitCode):
6942 (KJS::SubNode::emitCode):
6943 (KJS::ReadModifyResolveNode::emitCode):
6944 (KJS::AssignDotNode::emitCode):
6945 (KJS::ReadModifyDotNode::emitCode):
6946 (KJS::AssignBracketNode::emitCode):
6947 (KJS::ReadModifyBracketNode::emitCode):
6949 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
6953 Make code generation not use a temporary for the left-hand side of an
6954 expression if the right-hand side is a local variable.
6956 * VM/CodeGenerator.cpp:
6957 (KJS::CodeGenerator::isLocal):
6958 * VM/CodeGenerator.h:
6959 (KJS::CodeGenerator::leftHandSideNeedsCopy):
6960 (KJS::CodeGenerator::emitNodeForLeftHandSide):
6962 (KJS::ResolveNode::isPure):
6963 (KJS::BracketAccessorNode::emitCode):
6964 (KJS::AddNode::emitCode):
6965 (KJS::SubNode::emitCode):
6966 (KJS::ReadModifyResolveNode::emitCode):
6967 (KJS::AssignDotNode::emitCode):
6968 (KJS::ReadModifyDotNode::emitCode):
6969 (KJS::AssignBracketNode::emitCode):
6970 (KJS::ReadModifyBracketNode::emitCode):
6972 (KJS::ExpressionNode::):
6973 (KJS::BooleanNode::):
6974 (KJS::NumberNode::):
6975 (KJS::StringNode::):
6977 2008-06-14 Darin Adler <darin@apple.com>
6981 - more of https://bugs.webkit.org/show_bug.cgi?id=17257
6982 start ref counts at 1 instead of 0 for speed
6985 (KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
6986 * kjs/nodes.h: Replaced refcount with hasOneRef.
6989 (WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
6990 refcount, so this class can be used with the RefCounted template.
6993 (WTF::RefCounted::hasOneRef): Made const, since there's no reason for
6996 2008-06-14 Maciej Stachowiak <mjs@apple.com>
7000 - initialize local vars as side effect of call instead of in bytecode
7001 1.004x speedup on SunSpider.
7003 This removes just the dispatch overhead for these loads - in the
7004 future, dead store elimination might be able to eliminate them
7007 * VM/CodeGenerator.cpp:
7008 (KJS::CodeGenerator::CodeGenerator): For function blocks, don't
7009 emit loads of undefined for var initialization.
7011 (KJS::slideRegisterWindowForCall): Instead, initialize locals
7012 as part of the call.
7014 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7018 Remove helper functions in the parser that are no longer needed.
7022 2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7026 Bug 19484: More instructions needs to use temporary registers
7027 <https://bugs.webkit.org/show_bug.cgi?id=19484>
7029 Make code generation for AddNode and SubNode use temporaries when
7034 (KJS::AddNode::emitCode):
7035 (KJS::SubNode::emitCode):
7040 2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7044 Combine TrueNode and FalseNode to make BooleanNode, and remove the
7045 unused class PlaceholderTrueNode.
7049 (KJS::BooleanNode::emitCode):
7051 (KJS::BooleanNode::):
7052 (KJS::BooleanNode::precedence):
7053 * kjs/nodes2string.cpp:
7054 (KJS::BooleanNode::streamTo):
7056 2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7060 Eliminate the use of temporaries to store the left hand side of an
7061 expression when the right hand side is a constant. This slightly
7062 improves the generated bytecode for a few SunSpider tests, but it is
7063 mostly in preparation for fixing
7065 Bug 19484: More instructions needs to use temporary registers
7066 <https://bugs.webkit.org/show_bug.cgi?id=19484>
7068 * VM/CodeGenerator.h:
7069 (KJS::CodeGenerator::leftHandSideNeedsCopy):
7070 (KJS::CodeGenerator::emitNodeForLeftHandSide):
7072 (KJS::BracketAccessorNode::emitCode):
7073 (KJS::ReadModifyResolveNode::emitCode):
7074 (KJS::AssignDotNode::emitCode):
7075 (KJS::ReadModifyDotNode::emitCode):
7076 (KJS::AssignBracketNode::emitCode):
7077 (KJS::ReadModifyBracketNode::emitCode):
7079 (KJS::ExpressionNode::):
7082 (KJS::NumberNode::):
7083 (KJS::StringNode::):
7085 2008-06-13 Maciej Stachowiak <mjs@apple.com>
7089 - prettify opcode stats output
7091 I changed things to be a bit more aligned, also there is a new
7092 section listing most common opcodes and most common sequences that
7096 (KJS::OpcodeStats::~OpcodeStats):
7099 2008-06-13 Kevin McCullough <kmccullough@apple.com>
7103 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
7105 - Remove recursion from exclude(). This leaves only focus() to fix.
7107 * JavaScriptCore.exp: Change the signatures of the exported functions.
7108 * profiler/Profile.cpp:
7109 (KJS::Profile::forEach): I added a traverseNextNodePreOrder() function
7110 and so needed to distinguish the other function by labeling it
7111 traverseNextNodePostOrder().
7112 (KJS::Profile::exclude): All new exclude that iteratively walks the tree
7113 * profiler/Profile.h:
7114 (KJS::Profile::focus): Add a null check for m_head.
7115 * profiler/ProfileNode.cpp:
7116 (KJS::ProfileNode::traverseNextNodePostOrder): Renamed
7117 (KJS::ProfileNode::traverseNextNodePreOrder): Walks the tree in pre-
7118 order, where the parent is processed before the children.
7119 (KJS::ProfileNode::setTreeVisible): Iterate over the sub-tree and set
7120 all of the nodes visible value. This changes another function that used
7122 (KJS::ProfileNode::exclude): Remove recursion from this function.
7123 Because we now check for m_visible and we are walking the tree in pre-
7124 order we do not need to check if an excluded node is in an excluded
7126 * profiler/ProfileNode.h: Added specific selfTime functions to
7127 facilitate exclude().
7128 (KJS::ProfileNode::setSelfTime):
7129 (KJS::ProfileNode::setActualSelfTime):
7130 (KJS::ProfileNode::setVisibleSelfTime):
7132 2008-06-12 Darin Adler <darin@apple.com>
7136 - https://bugs.webkit.org/show_bug.cgi?id=19434
7137 speed up SunSpider by avoiding some string boxing
7139 Speeds up SunSpider by 1.1%.
7141 Optimized code path for getting built-in properties from strings -- avoid
7142 boxing with a string object in that case. We can make further changes to avoid
7143 even more boxing, but this change alone is a win.
7145 * API/JSCallbackObjectFunctions.h:
7146 (KJS::JSCallbackObject::staticValueGetter): Use isObject instead of inherits
7147 in asssert, since the type of slotBase() is now JSValue, not JSObject.
7148 (KJS::JSCallbackObject::staticFunctionGetter): Ditto.
7149 (KJS::JSCallbackObject::callbackGetter): Ditto.
7152 (KJS::StringImp::getPrimitiveNumber): Updated for change of data member name.
7153 (KJS::StringImp::toBoolean): Ditto.
7154 (KJS::StringImp::toNumber): Ditto.
7155 (KJS::StringImp::toString): Ditto.
7156 (KJS::StringInstance::create): Added; avoids a bit of cut and paste code.
7157 (KJS::StringImp::toObject): Use StringInstance::create.
7158 (KJS::StringImp::toThisObject): Ditto.
7159 (KJS::StringImp::lengthGetter): Added. Replaces the getter that used to live in
7160 the StringInstance class.
7161 (KJS::StringImp::indexGetter): Ditto.
7162 (KJS::StringImp::indexNumericPropertyGetter): Ditto.
7163 (KJS::StringImp::getOwnPropertySlot): Added. Deals with built in properties of
7164 the string class without creating a StringInstance.
7167 (KJS::StringImp::getStringPropertySlot): Added. To be used by both the string
7168 and string object getOwnPropertySlot function.
7171 (KJS::staticFunctionGetter): Updated since slotBase() is now a JSValue rather
7174 * kjs/object.h: Removed PropertySlot::slotBase() function, which can now move
7175 back into property_slot.h where it belongs since it doesn't have to cast to
7178 * kjs/property_slot.cpp:
7179 (KJS::PropertySlot::functionGetter): Updated since slot.slotBase() is now a JSValue*
7180 instead of JSObject*. setGetterSlot still guarantees the base is a JSObject*.
7181 * kjs/property_slot.h:
7182 (KJS::PropertySlot::PropertySlot): Changed base to JSValue* intead of JSCell*.
7183 (KJS::PropertySlot::setStaticEntry): Ditto.
7184 (KJS::PropertySlot::setCustom): Ditto.
7185 (KJS::PropertySlot::setCustomIndex): Ditto.
7186 (KJS::PropertySlot::setCustomNumeric): Ditto.
7187 (KJS::PropertySlot::slotBase): Moved inline here since it no longer involves a
7188 downcast to JSObject*.
7189 (KJS::PropertySlot::setBase): Changed to JSValue*.
7191 * kjs/string_object.cpp:
7192 (KJS::StringInstance::getOwnPropertySlot): Changed to use getStringPropertySlot
7193 instead of coding the properties here. This allows sharing the code with StringImp.
7195 * kjs/string_object.h: Removed inlineGetOwnPropertySlot, lengthGetter, and indexGetter.
7196 Made one of the constructors protected.
7198 * kjs/value.h: Made getOwnPropertySlot private in the JSCell class -- this is better
7199 since it's not the real JSObject getOwnPropertySlot semantic and most callers shouldn't
7202 2008-06-12 Alexey Proskuryakov <ap@webkit.org>
7206 Preparation to making JavaScript heap per-thread.
7208 * kjs/collector.cpp:
7209 (KJS::Collector::collect):
7211 (KJS::Collector::markListSet):
7212 The collector now holds the list of protected lists itself, to be made per-instance.
7214 * kjs/list.h: Changed to hold a pointer to a mark set this list is in, if any.
7215 (KJS::List::List): Explicitly initialize m_size with zero, as m_vector.size() is
7216 guaranteed to be such anyway.
7217 (KJS::List::append): Changed the fast case to only be executed as long as inline buffer
7218 is used, because otherwise, we now do more expensive checks.
7221 (KJS::List::markLists): Renamed from markProtectedListsSlowCase, made it take the list set
7223 (KJS::List::slowAppend): If a non-immediate value is appended, the list needs to be added
7224 to an appropriate Heap's protected list. For now, a static Collector::markListSet() is
7225 used, but the code is layed out in preparation to making the switch to multiple heaps.
7227 * JavaScriptCore.exp: Updated export list.
7229 2008-06-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7233 Bug 19510: CodeBlock::needsFullScopeChain not always set for global code
7234 <https://bugs.webkit.org/show_bug.cgi?id=19510>
7236 This fixes the symptoms by using CodeGenerator::m_codeType to determine
7237 when to use temporaries instead of CodeBlock::needsFullScopeChain, but
7238 it does not fix the problem itself.
7240 * VM/CodeGenerator.h:
7241 (KJS::CodeGenerator::leftHandSideNeedsCopy):
7243 2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7247 Bug 19498: REGRESSION (r34497): crash while loading GMail
7248 <https://bugs.webkit.org/show_bug.cgi?id=19498>
7250 * VM/CodeGenerator.cpp:
7251 (KJS::CodeGenerator::emitJumpIfTrueMayCombine):
7252 (KJS::CodeGenerator::emitJumpIfTrue):
7253 * VM/CodeGenerator.h:
7255 (KJS::DoWhileNode::emitCode):
7256 (KJS::WhileNode::emitCode):
7257 (KJS::ForNode::emitCode):
7258 (KJS::CaseBlockNode::emitCodeForBlock):
7260 2008-06-11 Darin Adler <darin@apple.com>
7264 - a little bit of cleanup and prep for some upcoming optimizations
7266 * JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
7268 (KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
7269 need to make sure the type is unsigned long.
7271 (KJS::Error::create): Eliminated unused error names array, and also put
7272 the strings into the code since there was already a switch statment.
7273 This also avoids having to contemplate a hypothetical access past the
7275 * kjs/object.h: Got rid of errorNames.
7276 * kjs/property_slot.cpp: Deleted unused ungettableGetter.
7277 * kjs/property_slot.h: Ditto.
7278 * wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
7280 2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7284 Bug 19457: Create fused opcodes for tests and conditional jumps
7285 <https://bugs.webkit.org/show_bug.cgi?id=19457>
7287 Add a new jless instruction, and modify the code generator to emit it
7288 instead of the pair (less, jtrue).
7290 Gives a 3.6% improvement on SunSpider.
7293 (KJS::CodeBlock::dump):
7294 * VM/CodeGenerator.cpp:
7295 (KJS::CodeGenerator::CodeGenerator):
7296 (KJS::CodeGenerator::emitOpcode):
7297 (KJS::CodeGenerator::retrieveLastBinaryOp):
7298 (KJS::CodeGenerator::rewindBinaryOp):
7299 (KJS::CodeGenerator::emitJump):
7300 (KJS::CodeGenerator::emitJumpIfTrue):
7301 (KJS::CodeGenerator::emitJumpIfFalse):
7302 (KJS::CodeGenerator::emitMove):
7303 (KJS::CodeGenerator::emitNot):
7304 (KJS::CodeGenerator::emitEqual):
7305 (KJS::CodeGenerator::emitNotEqual):
7306 (KJS::CodeGenerator::emitStrictEqual):
7307 (KJS::CodeGenerator::emitNotStrictEqual):
7308 (KJS::CodeGenerator::emitLess):
7309 (KJS::CodeGenerator::emitLessEq):
7310 (KJS::CodeGenerator::emitPreInc):
7311 (KJS::CodeGenerator::emitPreDec):
7312 (KJS::CodeGenerator::emitPostInc):
7313 (KJS::CodeGenerator::emitPostDec):
7314 (KJS::CodeGenerator::emitToJSNumber):
7315 (KJS::CodeGenerator::emitNegate):
7316 (KJS::CodeGenerator::emitAdd):
7317 (KJS::CodeGenerator::emitMul):
7318 (KJS::CodeGenerator::emitDiv):
7319 (KJS::CodeGenerator::emitMod):
7320 (KJS::CodeGenerator::emitSub):
7321 (KJS::CodeGenerator::emitLeftShift):
7322 (KJS::CodeGenerator::emitRightShift):
7323 (KJS::CodeGenerator::emitUnsignedRightShift):
7324 (KJS::CodeGenerator::emitBitAnd):
7325 (KJS::CodeGenerator::emitBitXOr):
7326 (KJS::CodeGenerator::emitBitOr):
7327 (KJS::CodeGenerator::emitBitNot):
7328 (KJS::CodeGenerator::emitInstanceOf):
7329 (KJS::CodeGenerator::emitTypeOf):
7330 (KJS::CodeGenerator::emitIn):
7331 (KJS::CodeGenerator::emitLoad):
7332 (KJS::CodeGenerator::emitNewObject):
7333 (KJS::CodeGenerator::emitNewArray):
7334 (KJS::CodeGenerator::emitResolve):
7335 (KJS::CodeGenerator::emitGetScopedVar):
7336 (KJS::CodeGenerator::emitPutScopedVar):
7337 (KJS::CodeGenerator::emitResolveBase):
7338 (KJS::CodeGenerator::emitResolveWithBase):
7339 (KJS::CodeGenerator::emitResolveFunction):
7340 (KJS::CodeGenerator::emitGetById):
7341 (KJS::CodeGenerator::emitPutById):
7342 (KJS::CodeGenerator::emitPutGetter):
7343 (KJS::CodeGenerator::emitPutSetter):
7344 (KJS::CodeGenerator::emitDeleteById):
7345 (KJS::CodeGenerator::emitGetByVal):
7346 (KJS::CodeGenerator::emitPutByVal):
7347 (KJS::CodeGenerator::emitDeleteByVal):
7348 (KJS::CodeGenerator::emitPutByIndex):
7349 (KJS::CodeGenerator::emitNewFunction):
7350 (KJS::CodeGenerator::emitNewRegExp):
7351 (KJS::CodeGenerator::emitNewFunctionExpression):
7352 (KJS::CodeGenerator::emitCall):
7353 (KJS::CodeGenerator::emitReturn):
7354 (KJS::CodeGenerator::emitEnd):
7355 (KJS::CodeGenerator::emitConstruct):
7356 (KJS::CodeGenerator::emitPushScope):
7357 (KJS::CodeGenerator::emitPopScope):
7358 (KJS::CodeGenerator::emitDebugHook):
7359 (KJS::CodeGenerator::emitComplexJumpScopes):
7360 (KJS::CodeGenerator::emitJumpScopes):
7361 (KJS::CodeGenerator::emitNextPropertyName):
7362 (KJS::CodeGenerator::emitGetPropertyNames):
7363 (KJS::CodeGenerator::emitCatch):
7364 (KJS::CodeGenerator::emitThrow):
7365 (KJS::CodeGenerator::emitNewError):
7366 (KJS::CodeGenerator::emitJumpSubroutine):
7367 (KJS::CodeGenerator::emitSubroutineReturn):
7368 * VM/CodeGenerator.h:
7370 (KJS::Machine::privateExecute):
7374 2008-06-11 Darin Adler <darin@apple.com>
7378 - fix https://bugs.webkit.org/show_bug.cgi?id=19442
7379 JavaScript array implementation doesn't maintain m_numValuesInVector when sorting
7381 * kjs/array_instance.cpp:
7382 (KJS::ArrayInstance::checkConsistency): Added. Empty inline version for when
7383 consistency checks are turned off.
7384 (KJS::ArrayInstance::ArrayInstance): Check consistency after construction.
7385 (KJS::ArrayInstance::~ArrayInstance): Check consistency before destruction.
7386 (KJS::ArrayInstance::put): Check consistency before and after.
7387 (KJS::ArrayInstance::deleteProperty): Ditto.
7388 (KJS::ArrayInstance::setLength): Ditto.
7389 (KJS::compareByStringPairForQSort): Use typedef for clarity.
7390 (KJS::ArrayInstance::sort): Check consistency before and after. Also broke the loop
7391 to set up sorting into two separate passes. Added FIXMEs about various exception
7392 safety issues. Added code to set m_numValuesInVector after sorting.
7393 (KJS::ArrayInstance::compactForSorting): Ditto.
7395 * kjs/array_instance.h: Added a definition of an enum for the types of consistency
7396 check and a declaration of the consistency checking function.
7398 2008-06-10 Kevin Ollivier <kevino@theolliviers.com>
7400 wx build fix. Link against libedit on Mac since HAVE(READLINE) is defined there.
7404 2008-06-10 Alexey Proskuryakov <ap@webkit.org>
7408 https://bugs.webkit.org/show_bug.cgi?id=16503
7409 match limit takes at least 13% of the time on the SunSpider regexp-dna test
7411 Make the limit test slightly more efficient. It is not clear how much of a win it is,
7412 as the improvement on regexp-dna varies from 2.3% to 0.6% depending on what revision I
7413 apply the patch to. Today, the win on regexp-dna was minimal, but the total win was whopping
7414 0.5%, due to random code generation changes.
7416 * pcre/pcre_exec.cpp: (match): Avoid loading a constant on each iteration.
7418 2008-06-09 Alp Toker <alp@nuanti.com>
7420 gcc3/autotools build fix. Add explicit -O2 -fno-strict-aliasing to
7421 each of the tools since these are no longer set globally.
7425 2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7429 Add an include for readline/history.h to fix the build for Darwin users
7430 with the GNU readline library installed. Also, clean up the style of
7431 the HAVE(READLINE) check.
7436 2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7440 Bug 17531: Add interactive mode to testkjs
7441 <https://bugs.webkit.org/show_bug.cgi?id=17531>
7443 This is a cleaned up version of Sam's earlier patch to add an
7444 interactive mode to testkjs.
7446 Readline support is only enabled on Darwin platforms for now, but
7447 other ports can enable it by defining HAVE_READLINE in kjs/config.h.
7449 * JavaScriptCore.xcodeproj/project.pbxproj:
7455 (printUsageStatement):
7459 2008-06-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7463 Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
7464 <https://bugs.webkit.org/show_bug.cgi?id=19346>
7466 A check for whether a function's caller is eval code accidentally included
7467 the case where the caller's caller is native code. Add a CodeType field to
7468 CodeBlock and use this for the eval caller test instead.
7471 (KJS::CodeBlock::CodeBlock):
7472 (KJS::ProgramCodeBlock::ProgramCodeBlock):
7473 (KJS::EvalCodeBlock::EvalCodeBlock):
7475 (KJS::getCallerFunctionOffset):
7477 (KJS::FunctionBodyNode::generateCode):
7478 (KJS::ProgramNode::generateCode):
7480 2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7482 Reviewed by Dan Bernstein.
7484 Bug 17928: testkjs shouldn't require "-f"
7485 <https://bugs.webkit.org/show_bug.cgi?id=17928>
7488 (printUsageStatement):
7491 2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7495 Bug 17548: JavaScriptCore print(a, b) differs from Spidermonkey Behavior
7496 <https://bugs.webkit.org/show_bug.cgi?id=17548>
7501 2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7505 Bug 17547: JavaScriptCore print() differs from Spidermonkey Behavior
7506 <https://bugs.webkit.org/show_bug.cgi?id=17547>
7511 2008-06-07 Alexey Proskuryakov <ap@webkit.org>
7515 * kjs/JSGlobalData.cpp: Fixed an included file name for case-sensitive file systems, fixed
7516 JSGlobalData::threadInstance() for non-multithreaded builds.
7518 2008-06-07 Alexey Proskuryakov <ap@webkit.org>
7520 Build fix - actually adding JSGlobalData.cpp to non-Mac builds!
7523 * JavaScriptCore.pri:
7524 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7525 * JavaScriptCoreSources.bkl:
7527 2008-06-07 Alexey Proskuryakov <ap@webkit.org>
7529 Try to fix Gtk/gcc 4.3 build.
7531 * kjs/JSGlobalData.h: Include ustring.h instead of forward-declaring UString::Rep.
7533 2008-06-06 Alexey Proskuryakov <ap@webkit.org>
7537 Combine per-thread objects into one, to make it easier to support legacy clients (for
7538 which they shouldn't be really per-thread).
7540 No change on SunSpider total.
7542 * JavaScriptCore.xcodeproj/project.pbxproj: Added JSGlobalData.{h,cpp}
7544 * kjs/JSGlobalData.cpp: Added.
7545 (KJS::JSGlobalData::JSGlobalData):
7546 (KJS::JSGlobalData::~JSGlobalData):
7547 (KJS::JSGlobalData::threadInstance):
7548 * kjs/JSGlobalData.h: Added.
7549 This class encapsulates all data that should be per-thread (or shared between legacy clients).
7550 It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
7553 (KJS::Identifier::Identifier):
7554 Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually,
7555 all of them should, but this will be a separate patch.
7557 * kjs/identifier.cpp:
7558 (KJS::IdentifierTable::literalTable):
7559 (KJS::createIdentifierTable):
7560 (KJS::deleteIdentifierTable):
7561 (KJS::Identifier::add):
7562 (KJS::Identifier::addSlowCase):
7563 Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
7565 * kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
7569 (KJS::EvalFunctionCallNode::emitCode):
7570 (KJS::ScopeNode::ScopeNode):
7571 Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a
7572 temporary measure, they will need to use JSGlobalData explicitly.
7574 * VM/CodeGenerator.cpp:
7575 (KJS::CodeGenerator::CodeGenerator):
7576 * VM/CodeGenerator.h:
7579 * kjs/CommonIdentifiers.cpp:
7580 (KJS::CommonIdentifiers::CommonIdentifiers):
7581 * kjs/CommonIdentifiers.h:
7582 * kjs/DebuggerCallFrame.cpp:
7583 (KJS::DebuggerCallFrame::evaluate):
7584 * kjs/ExecState.cpp:
7585 (KJS::ExecState::ExecState):
7587 (KJS::ExecState::globalData):
7588 (KJS::ExecState::identifierTable):
7589 (KJS::ExecState::propertyNames):
7590 (KJS::ExecState::emptyList):
7591 (KJS::ExecState::lexer):
7592 (KJS::ExecState::parser):
7593 (KJS::ExecState::arrayTable):
7594 (KJS::ExecState::dateTable):
7595 (KJS::ExecState::mathTable):
7596 (KJS::ExecState::numberTable):
7597 (KJS::ExecState::RegExpImpTable):
7598 (KJS::ExecState::RegExpObjectImpTable):
7599 (KJS::ExecState::stringTable):
7600 * kjs/InitializeThreading.cpp:
7601 (KJS::initializeThreadingOnce):
7602 * kjs/JSGlobalObject.cpp:
7603 (KJS::JSGlobalObject::init):
7604 * kjs/JSGlobalObject.h:
7605 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
7606 (KJS::JSGlobalObject::head):
7607 (KJS::JSGlobalObject::globalData):
7609 (KJS::Parser::parse):
7612 (KJS::FunctionImp::getParameterName):
7613 (KJS::IndexToNameMap::unMap):
7614 (KJS::globalFuncEval):
7615 * kjs/function_object.cpp:
7616 (KJS::FunctionObjectImp::construct):
7617 * kjs/interpreter.cpp:
7618 (KJS::Interpreter::checkSyntax):
7619 (KJS::Interpreter::evaluate):
7624 (prettyPrintScript):
7625 Updated for the above changes. Most of threadInstance uses here will need to be replaced with
7626 explicitly passed pointers to support legacy JSC clients.
7628 * JavaScriptCore.exp: Removed KJS::parser().
7630 2008-06-06 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7634 Bug 19424: Add support for logging opcode pair counts
7635 <https://bugs.webkit.org/show_bug.cgi?id=19424>
7638 (KJS::Machine::privateExecute):
7640 (KJS::OpcodeStats::OpcodeStats):
7641 (KJS::compareOpcodeIndices):
7642 (KJS::compareOpcodePairIndices):
7643 (KJS::OpcodeStats::~OpcodeStats):
7644 (KJS::OpcodeStats::recordInstruction):
7645 (KJS::OpcodeStats::resetLastInstruction):
7648 2008-06-06 Kevin McCullough <kmccullough@apple.com>
7652 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
7654 - Change the remaining functions that do not take arguments, from using
7655 recursion to using iteration.
7657 * JavaScriptCore.exp:
7658 * profiler/Profile.cpp:
7659 (KJS::stopProfiling):
7661 (KJS::Profile::stopProfiling): Use foreach instead of recursion.
7662 (KJS::Profile::restoreAll): Ditto.
7663 * profiler/Profile.h:
7664 * profiler/ProfileNode.cpp: Remove recursion.
7665 (KJS::ProfileNode::stopProfiling):
7666 (KJS::ProfileNode::restore):
7667 * profiler/ProfileNode.h:
7669 2008-06-05 Oliver Hunt <oliver@apple.com>
7673 Fix Greater and GreaterEq nodes to emit code for the left
7674 and right sub-expressions in the correct order.
7677 (KJS::GreaterNode::emitCode):
7678 (KJS::GreaterEqNode::emitCode):
7680 2008-06-05 Antti Koivisto <antti@apple.com>
7682 Reviewed by Alp Toker.
7686 * kjs/collector.cpp:
7687 (KJS::getPlatformThreadRegisters):
7689 2008-06-05 Antti Koivisto <antti@apple.com>
7693 Support compiling JavaScriptCore for ARM.
7695 * kjs/collector.cpp:
7696 (KJS::getPlatformThreadRegisters):
7697 (KJS::otherThreadStackPointer):
7699 2008-06-05 Kevin McCullough <kmccullough@apple.com>
7705 * JavaScriptCore.exp:
7706 * profiler/Profile.cpp:
7707 (KJS::Profile::Profile):
7708 (KJS::Profile::stopProfiling):
7709 (KJS::Profile::didExecute):
7710 (KJS::Profile::forEach):
7711 (KJS::Profile::debugPrintData):
7712 (KJS::Profile::debugPrintDataSampleStyle):
7713 * profiler/Profile.h:
7714 (KJS::Profile::callTree):
7715 (KJS::Profile::totalTime):
7716 (KJS::Profile::sortTotalTimeDescending):
7717 (KJS::Profile::sortTotalTimeAscending):
7718 (KJS::Profile::sortSelfTimeDescending):
7719 (KJS::Profile::sortSelfTimeAscending):
7720 (KJS::Profile::sortCallsDescending):
7721 (KJS::Profile::sortCallsAscending):
7722 (KJS::Profile::sortFunctionNameDescending):
7723 (KJS::Profile::sortFunctionNameAscending):
7724 (KJS::Profile::focus):
7725 (KJS::Profile::exclude):
7726 (KJS::Profile::restoreAll):
7728 2008-06-05 Geoffrey Garen <ggaren@apple.com>
7730 Reviewed by Stephanie Lewis.
7732 Added the -fno-move-loop-invariants flag to the pcre_exec.cpp build, to
7733 tell GCC not to perform loop invariant motion, since GCC's loop
7734 invariant motion doesn't do very well with computed goto code.
7736 SunSpider reports no change.
7738 2008-06-05 Geoffrey Garen <ggaren@apple.com>
7740 Reviewed by Stephanie Lewis.
7742 Added the -fno-tree-pre flag to the Machine.cpp build, to tell GCC not
7743 to perform Partial Redundancy Elimination (PRE) on trees in Machine.cpp,
7744 since GCC's PRE doesn't do very well with computed goto code.
7746 SunSpider reports a .7% speedup.
7748 2008-06-05 Geoffrey Garen <ggaren@apple.com>
7750 Reviewed by Stephanie Lewis (or maybe the other way around).
7752 Minor change to PCRE to help out certain compilers.
7754 SunSpider reports no change, maybe a small speedup.
7756 * pcre/pcre_exec.cpp:
7757 (match): Use instructionPtr++ a little less, to avoid confusing the
7760 2008-06-05 Alexey Proskuryakov <ap@webkit.org>
7762 Re-landing an independent part of a previously rolled out threading patch.
7764 * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
7765 (replaced "new T" with "new T()").
7767 2008-06-05 Maciej Stachowiak <mjs@apple.com>
7771 - force inlining of a template function that only has one call site per specialization
7772 1.3% speedup on SunSpider
7774 * kjs/collector.cpp:
7775 (KJS::Collector::heapAllocate): This template function is only
7776 called from allocate() and allocateNumber() (once per
7777 specialization) and the extra call overhead for GC allocation
7778 shows up, so force inlining.
7780 2008-06-05 Maciej Stachowiak <mjs@apple.com>
7782 Reviewed by Alexey and Oliver.
7784 - remove profiler fetch hack
7785 I measure an 0.5% progression from this, others show a wash. It seems not needed any more.
7788 (KJS::Machine::privateExecute):
7790 2008-06-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7794 Bug 19400: subscript operator does not protect base when necessary
7795 <https://bugs.webkit.org/show_bug.cgi?id=19400>
7797 Use a temporary for the base in BracketAccessorNode if the subscript
7798 might possibly modify it.
7802 (KJS::BracketAccessorNode::emitCode):
7804 (KJS::BracketAccessorNode::):
7806 2008-06-04 Sam Weinig <sam@webkit.org>
7808 Reviewed by Maciej Stachowiak.
7810 Big cleanup of formatting and whitespace.
7812 2008-06-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7816 Add an option to dump statistics on executed instructions.
7819 (KJS::Machine::privateExecute):
7821 (KJS::OpcodeStats::~OpcodeStats):
7822 (KJS::OpcodeStats::recordInstruction):
7825 2008-06-04 Kevin McCullough <kmccullough@apple.com>
7829 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
7831 - This patch removes the use of recursion for the sort functions.
7833 * JavaScriptCore.exp: Change the signatures of the functions being
7835 * profiler/Profile.cpp:
7836 (KJS::Profile::sort): This generic function will accept any of the
7837 static sort functions and apply them to the whole tree.
7838 * profiler/Profile.h: All of the sorting functions now call the new
7840 (KJS::Profile::sortTotalTimeDescending):
7841 (KJS::Profile::sortTotalTimeAscending):
7842 (KJS::Profile::sortSelfTimeDescending):
7843 (KJS::Profile::sortSelfTimeAscending):
7844 (KJS::Profile::sortCallsDescending):
7845 (KJS::Profile::sortCallsAscending):
7846 (KJS::Profile::sortFunctionNameDescending):
7847 (KJS::Profile::sortFunctionNameAscending):
7848 * profiler/ProfileNode.cpp:
7849 (KJS::ProfileNode::ProfileNode): m_head used to point to the head node
7850 if this was the head node. It now points to null to make iteration easy
7851 (KJS::ProfileNode::willExecute): Now must check if m_head is null, this
7852 check used to happend in the constructor.
7853 (KJS::ProfileNode::stopProfiling): Again the check is slightly different
7854 to determine if this is the head.
7855 (KJS::ProfileNode::traverseNextNode): This function returns the next
7857 (KJS::ProfileNode::sort): This generic function will sort according to
7858 the comparator passed in, then reset the children pointers to macth the
7860 * profiler/ProfileNode.h: The sorting function were removed from the
7861 definition file and instead use the new generic sort() function
7862 (KJS::ProfileNode::totalPercent): because the head can now be empty we
7863 need to check here too for the head node.
7864 (KJS::ProfileNode::selfPercent): Ditto
7865 (KJS::ProfileNode::firstChild): This function is necessary for the
7866 iterative algorithm in Profile.cpp.
7867 (KJS::ProfileNode::sortTotalTimeDescending):
7868 (KJS::ProfileNode::sortTotalTimeAscending):
7869 (KJS::ProfileNode::sortSelfTimeDescending):
7870 (KJS::ProfileNode::sortSelfTimeAscending):
7871 (KJS::ProfileNode::sortCallsDescending):
7872 (KJS::ProfileNode::sortCallsAscending):
7873 (KJS::ProfileNode::sortFunctionNameDescending):
7874 (KJS::ProfileNode::sortFunctionNameAscending):
7875 (KJS::ProfileNode::childrenBegin):
7876 (KJS::ProfileNode::childrenEnd):
7877 (KJS::ProfileNode::totalTimeDescendingComparator):
7878 (KJS::ProfileNode::totalTimeAscendingComparator):
7879 (KJS::ProfileNode::selfTimeDescendingComparator):
7880 (KJS::ProfileNode::selfTimeAscendingComparator):
7881 (KJS::ProfileNode::callsDescendingComparator):
7882 (KJS::ProfileNode::callsAscendingComparator):
7883 (KJS::ProfileNode::functionNameDescendingComparator):
7884 (KJS::ProfileNode::functionNameAscendingComparator):
7886 2008-06-04 Alexey Proskuryakov <ap@webkit.org>
7890 Fix JSClassCreate to work with old JSCore API threading model.
7892 No change on SunSpider.
7894 * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
7895 a context, there is no way for it to create Identifiers.
7896 Also, added initializeThreading(), just for good measure.
7898 * API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
7899 string here, because propertyNames.add() needs that.
7901 * kjs/identifier.cpp:
7903 (KJS::Identifier::equal):
7906 Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
7907 and to make it possible to use it from StrHash.
7908 Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
7911 * wtf/StrHash.h: Removed.
7912 * kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
7913 used to default to pointer equality). Moved the whole StrHash header into ustring.h.
7915 * JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
7916 jni_class.cpp, and npruntime.cpp).
7918 2008-06-04 Alexey Proskuryakov <ap@webkit.org>
7920 Rubber-stamped by Darin.
7922 Fix spacing in collector.{h,cpp}.
7924 * kjs/collector.cpp:
7927 2008-06-03 Cameron Zwarich <cwzwarich@uwaterloo.ca>
7931 Build fix. The cleanup in r34355 missed a method.
7936 2008-06-03 Darin Adler <darin@apple.com>
7940 - https://bugs.webkit.org/show_bug.cgi?id=19269
7941 speed up SunSpider by eliminating the toObject call for most get/put/delete
7943 Makes standalone SunSpider 1.025x as fast as before.
7945 The getOwnPropertySlot virtual function now takes care of the toObject call
7946 for get. Similarly, the put function (and later deleteProperty) does the
7947 same for those operations. To do this, the virtual functions were moved from
7948 the JSObject class to the JSCell class. Also, since the caller no longer knows
7949 the identity of the "original object", which is used by JavaScript-function
7950 based getters, changed the PropertySlot class so the original object is
7951 already stored in the slot when getOwnPropertySlot is called, if the caller
7952 intends to call getValue.
7954 This affected the old interpreter code enough that the easiest thing for me
7955 was to just delete it. While I am not certain the mysterious slowdown is not
7956 still occurring, the net change is definitely a significant speedup.
7958 * JavaScriptCore.exp: Updated.
7960 * VM/Machine.cpp: Moved the UNLIKELY macro into AlwaysInline.h.
7961 (KJS::resolve): Set up the originalObject in the PropertySlot before
7962 calling getPropertySlot. Also removed the originalObject argument from
7964 (KJS::resolve_skip): Ditto.
7965 (KJS::resolveBaseAndProperty): Ditto.
7966 (KJS::resolveBaseAndFunc): Ditto.
7967 (KJS::Machine::privateExecute): Removed the toObject calls from the get and
7968 put functions where possible, instead calling directly with JSValue and letting
7969 the JSValue and JSCell calls handle toObject. Same for toThisObject.
7971 * kjs/ExecState.h: Removed OldInterpreterExecState.
7973 * API/JSBase.cpp: Updated includes.
7975 * kjs/LocalStorageEntry.h: Removed contents. Later we can remove the file too.
7977 * kjs/array_instance.cpp:
7978 (KJS::ArrayInstance::lengthGetter): Removed originalObject argumet.
7979 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Don't pass a base value to
7980 setValueSlot. Also use UNLIKELY around the "getting elements past the end of
7981 the array" code path; less common than successfully getting an element.
7983 * kjs/array_object.cpp:
7984 (KJS::getProperty): Initialize the PropertySlot with the original object.
7985 Don't pass the original object to the get function.
7986 (KJS::arrayProtoFuncFilter): Ditto.
7987 (KJS::arrayProtoFuncMap): Ditto.
7988 (KJS::arrayProtoFuncEvery): Ditto.
7989 (KJS::arrayProtoFuncForEach): Ditto.
7990 (KJS::arrayProtoFuncSome): Ditto.
7992 * kjs/function_object.cpp:
7993 (KJS::FunctionObjectImp::construct): Removed an obsolete comment.
7995 * kjs/grammar.y: Eliminated support for some of the node types that were
7996 used to optimize executing from the syntax tree.
7999 (KJS::StringImp::toThisObject): Added. Same as toObject.
8000 (KJS::NumberImp::toThisObject): Ditto.
8001 (KJS::GetterSetterImp::getOwnPropertySlot): Added. Not reached.
8002 (KJS::GetterSetterImp::put): Ditto.
8003 (KJS::GetterSetterImp::toThisObject): Ditto.
8005 * kjs/internal.h: Added toThisObject to NumberImp for speed.
8008 (KJS::Lexer::shift): Changed shift to just do a single character, to unroll
8009 the loop and especially to make the one character case faster.
8010 (KJS::Lexer::setCode): Call shift multiple times instead of passing a number.
8011 (KJS::Lexer::lex): Ditto.
8012 (KJS::Lexer::matchPunctuator): Ditto. Also removed unneeded elses after returns.
8013 (KJS::Lexer::scanRegExp): Ditto.
8014 * kjs/lexer.h: Removed the count argument from shift.
8016 * kjs/math_object.cpp:
8017 (KJS::mathProtoFuncPow): Call jsNaN instead of jsNumber(NaN).
8019 * kjs/nodes.cpp: Removed some of the things needed only for the pre-SquirrelFish
8021 (KJS::ForNode::emitCode): Handle cases where some expressions are missing by
8022 not emitting any code at all. The old way was to emit code for "true", but
8023 this is an unnecessary remnant of the old way of doing things.
8025 * kjs/nodes.h: Removed some of the things needed only for the pre-SquirrelFish
8029 (KJS::JSObject::fillGetterPropertySlot): Changed to only pass in the getter
8030 function. The old code passed in a base, but it was never used when
8031 actually getting the property; the toThisObject call was pointless. Also
8032 changed to not pass a base for setUndefined.
8034 * kjs/object.h: Added the new JSCell operations to GetterSetterImp.
8036 (KJS::JSObject::get): Initialize the object in the PropertySlot and don't
8037 pass it in getValue.
8038 (KJS::JSObject::getOwnPropertySlotForWrite): Removed the base argument
8039 in calls to setValueSlot.
8040 (KJS::JSObject::getOwnPropertySlot): Ditto.
8041 (KJS::JSValue::get): Added. Here because it calls through to JSObject.
8042 A version of JSObject::get that also handles the other types of JSValue
8043 by creating the appropriate wrapper. Saves the virtual call to toObject.
8044 (KJS::JSValue::put): Ditto.
8045 (KJS::JSValue::deleteProperty): Ditto.
8047 * kjs/property_slot.cpp:
8048 (KJS::PropertySlot::undefinedGetter): Removed the originalObject argument.
8049 (KJS::PropertySlot::ungettableGetter): Ditto.
8050 (KJS::PropertySlot::functionGetter): Ditto. Use the value in the base
8051 as the "this" object, which will be set to the original object by the new
8052 PropertySlot initialization code. Also call toThisObject. The old code did
8053 not do this, but needed to so we can properly handle the activation object
8054 like the other similar code paths.
8056 * kjs/property_slot.h:
8057 (KJS::PropertySlot::PropertySlot): Added a constructor that takes a base
8058 object. In debug builds, set the base to 0 if you don't pass one.
8059 (KJS::PropertySlot::getValue): Don't take or pass the originalObject.
8060 (KJS::PropertySlot::setValueSlot): Don't take a base object, and clear the
8061 base object in debug builds.
8062 (KJS::PropertySlot::setGetterSlot): Ditto.
8063 (KJS::PropertySlot::setUndefined): Ditto.
8064 (KJS::PropertySlot::setUngettable): Ditto.
8065 (KJS::PropertySlot::slotBase): Assert that a base object is present.
8066 This will fire if someone actually calls the get function without having
8067 passed in a base object and the getter needs it.
8068 (KJS::PropertySlot::setBase): Added. Used by the code that implements
8069 toObject so it can supply the original object after the fact.
8070 (KJS::PropertySlot::clearBase): Added. Clears the base, but is debug-only
8071 code because it's an error to fetch the base if you don't have a guarantee
8074 * API/JSCallbackObject.h:
8075 * API/JSCallbackObjectFunctions.h:
8076 (KJS::JSCallbackObject::cachedValueGetter):
8077 (KJS::JSCallbackObject::staticValueGetter):
8078 (KJS::JSCallbackObject::staticFunctionGetter):
8079 (KJS::JSCallbackObject::callbackGetter):
8080 * kjs/JSActivation.cpp:
8081 (KJS::JSActivation::getOwnPropertySlot):
8082 (KJS::JSActivation::argumentsGetter):
8083 * kjs/JSActivation.h:
8084 * kjs/JSVariableObject.h:
8085 (KJS::JSVariableObject::symbolTableGet):
8086 * kjs/array_instance.h:
8088 (KJS::FunctionImp::argumentsGetter):
8089 (KJS::FunctionImp::callerGetter):
8090 (KJS::FunctionImp::lengthGetter):
8091 (KJS::Arguments::mappedIndexGetter):
8094 (KJS::staticFunctionGetter):
8095 (KJS::staticValueGetter):
8096 * kjs/string_object.cpp:
8097 (KJS::StringInstance::lengthGetter):
8098 (KJS::StringInstance::indexGetter):
8099 (KJS::stringInstanceNumericPropertyGetter):
8100 * kjs/string_object.h:
8101 Removed originalObject arguments from getters. Don't pass base values to
8102 the various PropertySlot functions that no longer take them.
8105 (KJS::JSCell::getOwnPropertySlot): Added. Calls toObject and then sets the slot.
8106 This function has to always return true, because the caller can't walk the prototype
8107 chain. Because of that, we do a getPropertySlot, not getOwnPropertySlot, which works
8108 for the caller. This is private, only called by getOwnPropertySlotInternal.
8109 (KJS::JSCell::put): Added. Calls toObject and then put.
8110 (KJS::JSCell::toThisObject): Added. Calls toObject.
8112 * kjs/value.h: Added get, put, and toThisObject to both JSValue
8113 and JSCell. These take care of the toObject operation without an additional virtual
8114 function call, and so make the common "already an object" case faster.
8116 * wtf/AlwaysInline.h: Moved the UNLIKELY macro here for now. Maybe we can find a
8117 better place later, or rename this header.
8119 2008-06-03 Oliver Hunt <oliver@apple.com>
8123 Bug 12983: Web Inspector break on the debugger keyword
8124 <https://bugs.webkit.org/show_bug.cgi?id=12983>
8126 Added a DebuggerStatementNode to handle codegen, and added a new
8127 DidReachBreakPoint debug event (which will hopefully be useful
8128 if we ever move breakpoint management into JSC proper). Also
8129 added didReachBreakpoint to Debugger to allow us to actually respond
8133 (KJS::debugHookName):
8135 (KJS::Machine::debug):
8140 (KJS::DebuggerStatementNode::emitCode):
8141 (KJS::DebuggerStatementNode::execute):
8143 (KJS::DebuggerStatementNode::):
8144 * kjs/nodes2string.cpp:
8145 (KJS::DebuggerStatementNode::streamTo):
8147 2008-06-03 Maciej Stachowiak <mjs@apple.com>
8151 - document remaining opcodes.
8154 (KJS::Machine::privateExecute): Document call, call_eval,
8155 construct, ret and end opcodes.
8157 2008-06-03 Maciej Stachowiak <mjs@apple.com>
8162 (KJS::Machine::privateExecute): Document throw and catch opcodes.
8164 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8166 Reviewed by Alexey Proskuryakov.
8168 Removed JSObject::call, since it just called JSObject::callAsFunction.
8170 SunSpider reports no change.
8172 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8174 Reviewed by Darin Adler.
8176 A little cleanup in the CodeGenerator.
8178 * VM/CodeGenerator.cpp: A few changes here.
8180 (1) Removed remaining cases of the old hack of putting "this" into the
8181 symbol table; replaced with explicit tracking of m_thisRegister.
8183 (2) Made m_thisRegister behave the same for function, eval, and program
8184 code, removing the static programCodeThis() function.
8186 (3) Added a feature to nix a ScopeNode's declaration stacks when done
8187 compiling, to save memory.
8189 (4) Removed code that copied eval declarations into special vectors: we
8190 just use the originals in the ScopeNode now.
8192 * VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
8193 constructor: we just use get that data from the ScopeNode now.
8196 (KJS::Machine::execute): When executing an eval node, don't iterate a
8197 special copy of its declarations; iterate the originals, instead.
8199 * kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
8200 away into the CodeGenerator. Nodes no longer call shrinkCapacity on
8201 their data directly.
8203 * kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
8204 data stays around even after we've thrown away the AST, unless we explicitly
8205 throw away the declaration data, too. This is useful for eval code, which
8206 needs to reference its declaration data at execution time. (Soon, it will
8207 be useful for program code, too, since program code should do the same.)
8209 2008-06-02 Adam Roben <aroben@apple.com>
8211 Build fix for non-AllInOne builds
8213 * kjs/array_object.cpp: Added a missing #include.
8215 2008-06-02 Kevin McCullough <kmccullough@apple.com>
8217 Took out accidental confilct lines I checked in.
8221 2008-06-02 Kevin McCullough <kmccullough@apple.com>
8225 <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
8227 Implement Next Sibling pointers as groundwork for removing the recursion
8228 limit in the profiler.
8230 * profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
8231 'node' is redundant.
8232 (KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
8233 (KJS::ProfileNode::willExecute): If there are already children then the
8234 new child needs to be the nextSibling of the last child.
8235 (KJS::ProfileNode::didExecute):
8236 (KJS::ProfileNode::addChild): Ditto.
8237 (KJS::ProfileNode::stopProfiling):
8238 (KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
8239 algorithms once the children are sorted their nextSibling pointers need
8240 to be reset to reflect the new order.
8241 (KJS::ProfileNode::sortTotalTimeAscending):
8242 (KJS::ProfileNode::sortSelfTimeDescending):
8243 (KJS::ProfileNode::sortSelfTimeAscending):
8244 (KJS::ProfileNode::sortCallsDescending):
8245 (KJS::ProfileNode::sortCallsAscending):
8246 (KJS::ProfileNode::sortFunctionNameDescending):
8247 (KJS::ProfileNode::sortFunctionNameAscending):
8248 (KJS::ProfileNode::resetChildrensSiblings): This new function simply
8249 loops over all of the children and sets their nextSibling pointers to
8250 the next child in the Vector
8251 (KJS::ProfileNode::debugPrintData):
8252 * profiler/ProfileNode.h:
8253 (KJS::ProfileNode::parent):
8254 (KJS::ProfileNode::setParent):
8255 (KJS::ProfileNode::nextSibling):
8256 (KJS::ProfileNode::setNextSibling):
8257 (KJS::ProfileNode::totalPercent):
8258 (KJS::ProfileNode::selfPercent):
8260 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8262 Reviewed by Maciej Stachowiak.
8264 Removed the recursion limit from JSObject::call, since the VM does
8265 recursion checking now.
8267 This should allow us to remove JSObject::call entirely, netting a small
8271 (KJS::JSObject::call):
8273 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8275 Reviewed by Adele Peterson.
8277 Added a specific affordance for avoiding stack overflow when converting
8278 recursive arrays to string, in preparation for removing generic stack
8279 overflow checking from JSObject::call.
8281 Tested by fast/js/toString-stack-overflow.html.
8283 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8285 Reviewed by Alice Liu.
8287 Refactored some hand-rolled code to call ScopeChain::globalObject instead.
8289 2008-06-02 Geoffrey Garen <ggaren@apple.com>
8291 Reviewed by Darin Adler.
8293 Fixed ASSERT due to execution continuing after an exception is thrown
8296 * kjs/array_instance.cpp:
8297 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
8298 custom comparator function if an exception has been thrown. Just return
8299 1 for everything, so the sort completes quickly. (The result will be
8302 2008-05-30 Timothy Hatcher <timothy@apple.com>
8304 Made the starting line number of scripts be 1-based throughout the engine.
8305 This cleans up script line numbers so they are all consistent now and fixes
8306 some cases where script execution was shown as off by one line in the debugger.
8308 No change in SunSpider.
8310 Reviewed by Oliver Hunt.
8313 (main): Pass a line number of 1 instead of 0 to parser().parse().
8315 (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
8316 to use 1 instead of 2 for the line number.
8318 (KJS::callEval): Pass a line number of 1 instead of 0.
8319 (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
8320 lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
8321 * kjs/DebuggerCallFrame.cpp:
8322 (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
8323 0 to parser().parse().
8325 (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
8326 the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
8327 for release builds to maintain compatibility with the JavaScriptCore API.
8329 (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
8330 * kjs/function_object.cpp:
8331 (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
8333 (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
8335 (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
8336 (functionLoad): Ditto.
8337 (prettyPrintScript): Ditto.
8338 (runWithScripts): Ditto.
8339 * profiler/Profiler.cpp:
8340 (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
8342 2008-05-30 Alexey Proskuryakov <ap@webkit.org>
8346 https://bugs.webkit.org/show_bug.cgi?id=19180
8347 speed up SunSpider by optimizing immediate number cases
8349 Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
8350 parameter to 0...31.
8352 0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
8355 (KJS::Machine::privateExecute):
8357 * kjs/JSImmediate.h:
8358 (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
8361 2008-05-30 Alexey Proskuryakov <ap@webkit.org>
8363 Reviewed by Oliver Hunt.
8365 https://bugs.webkit.org/show_bug.cgi?id=19180
8366 speed up SunSpider by optimizing immediate number cases
8368 Also fixed two JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
8369 parameter to 0...31.
8371 1.6% improvement on SunSpider, without significant regressions on any tests.
8374 (KJS::Machine::privateExecute):
8375 Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
8376 cases, making them less dependent on gcc's ability to properly assign registers. With this,
8377 I could move exception checks back into slow code paths, and saw less randomness in general.
8379 * kjs/JSImmediate.h:
8380 (KJS::JSImmediate::rightShiftImmediateNumbers):
8383 2008-05-29 Maciej Stachowiak <mjs@apple.com>
8387 - fixed <rdar://problem/5972943> REGRESSION(r33979): Flash clips do not play on cnn.com
8389 Finally blocks could clobber registers that had to remain live
8390 until they returned. This patch takes a conservative approach and
8391 makes sure that finally blocks do not reuse any registers that
8392 were previously allocated for the function. In the future this
8393 could probably be tightened up to be less profligate with the
8394 register allocation.
8396 * VM/CodeGenerator.cpp:
8397 (KJS::CodeGenerator::highestUsedRegister):
8398 * VM/CodeGenerator.h:
8400 (KJS::TryNode::emitCode):
8402 2008-05-29 Steve Falkenburg <sfalken@apple.com>
8406 * kjs/array_instance.cpp:
8408 2008-05-29 Alexey Proskuryakov <ap@webkit.org>
8412 https://bugs.webkit.org/show_bug.cgi?id=19294
8413 <rdar://problem/5969062> A crash when iterating over a sparse array backwards.
8415 * kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
8416 doesn't cause a PIC branch.
8417 (KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
8418 preserving class invariants.
8419 (KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
8420 the vector from the map in all code paths.
8422 2008-05-29 Thiago Macieira <tjmaciei@trolltech.com>
8426 Fix compilation in Solaris with Sun CC
8428 Lots of WebKit code uses C99 functions that, strict as it
8429 is, the Solaris system doesn't provide in C++. So we must define them
8430 for both GCC and the Sun CC.
8434 2008-05-28 Oliver Hunt <oliver@apple.com>
8438 Fix codegen for assignment being used as a function.
8440 FunctionCallValueNode::emitCode failed to account for the
8441 potential of the function expression to allocate arbitrary
8445 (KJS::FunctionCallValueNode::emitCode):
8447 2008-05-27 Geoffrey Garen <ggaren@apple.com>
8449 Reviewed by Tim Hatcher.
8451 Fixed https://bugs.webkit.org/show_bug.cgi?id=19183
8452 REGRESSION (r33979): Crash in DebuggerCallFrame::functionName when
8453 clicking button in returnEvent-crash.html
8455 Added two new debugger hooks, willExecuteProgram and didExecuteProgram,
8456 along with code to generate them, code to invoke them when unwinding
8457 due to an exception, and code to dump them.
8459 SunSpider reports no change.
8462 (KJS::debugHookName): I had to mark this function NEVER_INLINE to avoid
8463 a .4% performance regression. The mind boggles.
8465 2008-05-28 Adam Roben <aroben@apple.com>
8467 Fix JavaScriptCore tests on OS X
8469 We were quoting the path to testkjs too late, after it had already
8470 been combined with spaces and other options.
8472 * tests/mozilla/jsDriver.pl:
8473 (top level): Move path quoting from here...
8474 (sub get_kjs_engine_command): ...to here.
8476 2008-05-28 Anders Carlsson <andersca@apple.com>
8480 <rdar://problem/5968071> "const f" crashes in JavaScriptCore
8482 Make sure to null check the initializer.
8485 (KJS::ConstDeclNode::emitCodeSingle):
8487 2008-05-28 Adam Roben <aroben@apple.com>
8489 Make run-javascriptcore-tests work with a space in the path to testkjs
8491 Reviewed by Alexey Proskuryakov.
8493 * tests/mozilla/jsDriver.pl: Quote the path to the engine so that
8494 spaces will be interpreted correctly.
8496 2008-05-28 Alexey Proskuryakov <ap@webkit.org>
8498 Fixed a misguiding comment - my measurement for negative numbers only included cases
8499 where both operands were negative, which is not very interesting.
8503 2008-05-28 Alexey Proskuryakov <ap@webkit.org>
8507 Based on a patch by Oliver Hunt.
8509 https://bugs.webkit.org/show_bug.cgi?id=19180
8510 speed up SunSpider by optimizing immediate number cases
8512 1.4% speedup on SunSpider.
8515 (KJS::Machine::privateExecute):
8516 * kjs/JSImmediate.h:
8517 (KJS::JSImmediate::incImmediateNumber):
8518 (KJS::JSImmediate::decImmediateNumber):
8519 Added fast paths for ++ and --.
8521 (KJS::JSImmediate::canDoFastAdditiveOperations): Corrected a comment.
8523 2008-05-28 Alexey Proskuryakov <ap@webkit.org>
8527 https://bugs.webkit.org/show_bug.cgi?id=19180
8528 speed up SunSpider by optimizing immediate number cases
8530 2% speedup overall, maximum 10% on controlflow-recursive and bitops-3bit-bits-in-byte,
8531 but a 4% regression on bitops-bits-in-byte and bitops-bitwise-and.
8533 * kjs/JSImmediate.h:
8534 (KJS::JSImmediate::canDoFastAdditiveOperations):
8535 (KJS::JSImmediate::addImmediateNumbers):
8536 (KJS::JSImmediate::subImmediateNumbers):
8537 Added fast cases that work with positive values less than 2^30.
8540 (KJS::Machine::privateExecute): Use the above operations. Also updated SunSpider frequencies
8541 with my results (looks like tag values have changed, not sure what caused the minor variation
8542 in actual frequencies).
8544 2008-05-27 Adam Roben <aroben@apple.com>
8548 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
8549 Remove code that appended Cygwin's /bin directory to PATH.
8550 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
8551 Prepend Cygwin's /bin directory to PATH. We prepend instead of append
8552 so that Cygwin's utilities will win out over Win32 versions of the
8553 same utilities (particularly perl). We do the prepend here instead of
8554 in the Makefile because nmake doesn't seem to like prepending to PATH
8555 inside the Makefile. This also matches the way WebCoreGenerated works.
8557 2008-05-27 Adam Roben <aroben@apple.com>
8561 A better fix is on the way.
8563 * DerivedSources.make:
8564 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
8566 2008-05-27 Adam Roben <aroben@apple.com>
8570 * DerivedSources.make: Don't generate the bytecode docs if
8571 OMIT_BYTECODE_DOCS is set to 1.
8572 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Set
8573 OMIT_BYTECODE_DOCS for production builds.
8575 2008-05-27 Anders Carlsson <andersca@apple.com>
8577 Reviewed by Geoff and Maciej.
8579 <rdar://problem/5806428>
8580 https://bugs.webkit.org/show_bug.cgi?id=17925
8581 Crash in KJS::JSObject::put after setting this.__proto__
8583 Set slotIsWriteable to false for __proto__, we want setting __proto__ to go through JSObject::put instead.
8586 (KJS::JSObject::getOwnPropertySlotForWrite):
8588 2008-05-27 Kevin Ollivier <kevino@theolliviers.com>
8590 wx build fixes to catch up with SquirrelFish, etc.
8592 * JavaScriptCoreSources.bkl:
8596 2008-05-27 Darin Adler <darin@apple.com>
8598 Reviewed by Tim Hatcher.
8600 - https://bugs.webkit.org/show_bug.cgi?id=19180
8601 speed up SunSpider by optimizing immediate number cases
8603 Add immediate number cases for the &, |, and ^ operators.
8604 Makes standalone SunSpider 1.010x faster.
8607 (KJS::Machine::privateExecute): Add areBothImmediateNumbers special cases
8608 for the &, |, and ^ operators.
8610 * kjs/JSImmediate.h:
8611 (KJS::JSImmediate::xorImmediateNumbers): Added.
8612 (KJS::JSImmediate::orImmediateNumbers): Added.
8614 2008-05-26 Stephanie Lewis <slewis@apple.com>
8620 2008-05-26 Maciej Stachowiak <mjs@apple.com>
8624 - make addStaticGlobals protected instead of private so subclasses can use it
8626 * JavaScriptCore.exp:
8627 * kjs/JSGlobalObject.h:
8629 2008-05-26 Geoffrey Garen <ggaren@apple.com>
8631 Reviewed by Darin Adler.
8633 Fixed <rdar://problem/5960859> After an eval of a non-string or a syntax
8634 error, all profile stack frames are incorrect
8636 SunSpider reports a .3% speedup, possibly because eval of a string is a
8637 little more efficient now.
8640 (KJS::callEval): Make sure to call didExecute when returning early. I
8641 simplified this function to remove one early return, making the job
8642 of adding special code to early returns easier.
8644 (KJS::Machine::execute): Use the new function ExecState when notifying
8645 the profiler. (This doesn't change behavior now, but it might prevent
8646 subtle errors in the future.)
8648 2008-05-23 Tor Arne Vestbø <tavestbo@trolltech.com>
8652 Fixed toLower and toUpper implementations to allow being called
8653 with a null result pointer and resultLength, to determine the
8654 number of characters needed for the case conversion.
8656 * wtf/unicode/qt4/UnicodeQt4.h:
8657 (WTF::Unicode::toLower):
8658 (WTF::Unicode::toUpper):
8660 2008-05-25 Alexey Proskuryakov <ap@webkit.org>
8662 Fixing a typo in the previous commit made as a last minute change.
8664 * kjs/regexp_object.cpp:
8666 2008-05-24 Alexey Proskuryakov <ap@webkit.org>
8670 Changed regular expression matching result array to be lazily filled, because many callers
8671 only care about it being non-null.
8673 2% improvement on Acid3 test 26.
8675 * kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses
8677 * kjs/array_instance.h:
8678 (KJS::ArrayInstance::lazyCreationData):
8679 (KJS::ArrayInstance::setLazyCreationData):
8680 Added methods to access it from subclasses.
8682 * kjs/regexp_object.cpp:
8683 (KJS::RegExpMatchesArray::RegExpMatchesArray):
8684 (KJS::RegExpMatchesArray::getOwnPropertySlot):
8685 (KJS::RegExpMatchesArray::put):
8686 (KJS::RegExpMatchesArray::deleteProperty):
8687 (KJS::RegExpMatchesArray::getPropertyNames):
8688 (KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded):
8689 (KJS::RegExpMatchesArray::~RegExpMatchesArray):
8690 (KJS::RegExpObjectImp::arrayOfMatches):
8691 RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until
8692 accessed for the first time.
8694 2008-05-24 Alp Toker <alp@nuanti.com>
8696 Win32/gcc build fix. Remove MSVC assumption.
8699 (TCMalloc_SlowLock):
8701 2008-05-24 Oleg Finkelshteyn <olegfink@gmail.com>
8703 Rubber-stamped, tweaked and landed by Alexey.
8705 Build fix for gcc 4.3.
8707 * JavaScriptCore/kjs/testkjs.cpp:
8708 * JavaScriptCore/VM/CodeBlock.cpp:
8709 Add missing standard includes.
8711 2008-05-23 Anders Carlsson <andersca@apple.com>
8715 <rdar://problem/5959886> REGRESSION: Assertion failure in JSImmediate::toString when loading GMail (19217)
8717 Change List to store a JSValue*** pointer + an offset instead of a JSValue** pointer to protect against the case where
8718 a register file changes while a list object points to its buffer.
8721 (KJS::Machine::privateExecute):
8722 * kjs/JSActivation.cpp:
8723 (KJS::JSActivation::createArgumentsObject):
8725 (KJS::List::getSlice):
8729 (KJS::List::append):
8732 (KJS::List::buffer):
8734 2008-05-23 Kevin McCullough <kmccullough@apple.com>
8738 <rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
8740 -Use a simple depth limit to restrict too deep of recursion.
8742 * profiler/Profile.cpp:
8743 (KJS::Profile::willExecute):
8744 (KJS::Profile::didExecute):
8745 * profiler/Profile.h:
8747 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8749 Rolling back in r34085, with performance resolved.
8751 Apparently, passing the eval function to callEval gave GCC a hernia.
8753 Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.
8755 Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
8759 (KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
8760 when unwinding from inside eval and/or program code: detect the
8761 difference, and do the right thing. Also, be sure to notify the profiler
8762 *before* deref'ing the scope chain, since the profiler uses the scope chain.
8764 (KJS::Machine::execute): Fixed incorrect reporting / crash when calling
8765 a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
8766 should not invoke the didExecute hook, because op_ret already does that.
8767 Also, use the new function's ExecState when calling out to the profiler.
8768 (Not important now, but could have become a subtle bug later.)
8770 (KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
8771 profiling JS functions: notify the profiler *before* deref'ing the scope
8772 chain, since the profiler uses the scope chain.
8775 (KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
8777 * profiler/Profile.cpp: Added a comment to explain a subtlety that only
8778 Kevin and I understood previously. (Now, the whole world can understand!)
8780 * profiler/Profiler.cpp:
8781 (KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was
8782 a hack to fix bugs that no longer exist.
8784 Finally, sped things up a little bit by changing the "Is the profiler
8785 running?" check into an ASSERT, since we only call into the profiler
8788 (KJS::Profiler::willExecute):
8789 (KJS::Profiler::didExecute):
8791 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8793 Reviewed by Oliver Hunt.
8795 - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
8797 SunSpider reports no change.
8799 This is a reworking of r34073, which I rolled out because it caused
8802 * VM/CodeGenerator.cpp:
8803 (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
8804 properties whose names collide with new functions. (Don't use putWithAttributes
8805 because that tries to write to the register file, which hasn't grown to
8806 fit this program yet.)
8808 2008-05-23 Darin Adler <darin@apple.com>
8810 Reviewed by Mark Rowe.
8812 As allocateNumber is used via jsNumberCell outside of JavaScriptCore,
8813 we need to provide a non-inlined version of it to avoid creating a
8814 weak external symbol.
8816 * JavaScriptCore.exp:
8817 * kjs/AllInOneFile.cpp:
8818 * kjs/collector.cpp:
8819 (KJS::Collector::allocate):
8820 (KJS::Collector::allocateNumber):
8822 (KJS::Collector::allocate):
8823 (KJS::Collector::inlineAllocateNumber):
8825 (KJS::NumberImp::operator new):
8827 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8829 Rolled out r34073 because it caused lots of layout test crashes.
8831 2008-05-23 Geoffrey Garen <ggaren@apple.com>
8833 Rolled out r34085 because it measured as a 7.6% performance regression.
8835 2008-05-23 Adam Roben <aroben@apple.com>
8839 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add the
8840 profiler directory to the include path.
8842 2008-05-23 Oliver Hunt <oliver@apple.com>
8846 SQUIRRELFISH: JavaScript error messages are missing informative text
8849 Tidy up error messages, makes a couple of them provide slightly more info.
8850 Inexplicably leads to a 1% SunSpider Progression.
8852 * VM/ExceptionHelpers.cpp:
8854 (KJS::createInvalidParamError):
8855 (KJS::createNotAConstructorError):
8856 (KJS::createNotAFunctionError):
8857 * VM/ExceptionHelpers.h:
8861 2008-05-23 Oliver Hunt <oliver@apple.com>
8865 Fix call stack reported by profiler when entering event handlers.
8867 JSObject::call was arbitrarily notifying the profiler when it was
8868 called, even if it was JS code, which notifies the profile on entry
8872 (KJS::JSObject::call):
8874 2008-05-16 Alp Toker <alp@nuanti.com>
8876 Build fix for gcc 3. Default constructor required in ExecState,
8877 used by OldInterpreterExecState.
8880 (KJS::ExecState::ExecState):
8882 2008-05-23 Mark Rowe <mrowe@apple.com>
8884 Reviewed by Oliver Hunt.
8886 Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.
8888 Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
8889 register file may be too close to its maximum size to grow successfully. By using grow,
8890 checking the result and throwing a stack overflow error we can avoid crashing.
8893 (KJS::Machine::execute):
8894 * VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
8896 2008-05-23 Oliver Hunt <oliver@apple.com>
8900 Remove JAVASCRIPT_PROFILER define
8904 (KJS::Machine::unwindCallFrame):
8905 (KJS::Machine::execute):
8906 (KJS::Machine::privateExecute):
8909 (KJS::JSObject::call):
8911 2008-05-23 Oliver Hunt <oliver@apple.com>
8913 <rdar://problem/5951561> Turn on JavaScript Profiler
8915 Reviewed by Kevin McCullough.
8917 Flipped the switch on the profiler, rearranged how we
8918 signal the the profiler is active so that calls aren't
8919 needed in the general case.
8921 Also fixed the entry point for Machine::execute(FunctionBodyNode..)
8922 to correctly indicate function exit.
8924 Results in a 0.7-1.0% regression in SunSpider :-(
8928 (KJS::Machine::unwindCallFrame):
8929 (KJS::Machine::execute):
8930 (KJS::Machine::privateExecute):
8932 * profiler/Profiler.cpp:
8933 (KJS::Profiler::profiler):
8934 (KJS::Profiler::startProfiling):
8935 (KJS::Profiler::stopProfiling):
8936 * profiler/Profiler.h:
8937 (KJS::Profiler::enabledProfilerReference):
8939 2008-05-23 Simon Hausmann <hausmann@webkit.org>
8941 Fix the Qt build by adding profiler/ to the include search path.
8943 * JavaScriptCore.pri:
8945 2008-05-22 Kevin McCullough <kmccullough@apple.com>
8949 Fix a bug in the profiler where time in the current function is given to
8952 * profiler/Profile.cpp:
8953 (KJS::Profile::didExecute): Set the start time and then call didExecute
8954 to calculate the time spent in this function.
8955 * profiler/ProfileNode.cpp: Remove confusing calculations that are no
8957 (KJS::ProfileNode::insertNode):
8958 * profiler/ProfileNode.h: Expose access to the start time to allow the
8959 simpler time calculations above.
8960 (KJS::ProfileNode::startTime):
8961 (KJS::ProfileNode::setStartTime):
8963 2008-05-22 Adam Roben <aroben@apple.com>
8965 Show "(Function object)" instead of "(JSInpectorCallbackWrapper
8966 object)" in profiles
8968 Reviewed by Kevin McCullough.
8970 * profiler/Profiler.cpp:
8971 (KJS::createCallIdentifier): Use JSObject::className instead of
8972 getting the class name from the ClassInfo directly. JSObject
8973 subclasses can override className to provide a custom class name, and
8974 it seems like we should honor that.
8976 2008-05-22 Timothy Hatcher <timothy@apple.com>
8978 Added Profile::restoreAll and added ProfileNode::restoreAll
8981 Reviewed by Adam Roben.
8983 * JavaScriptCore.exp:
8984 * profiler/Profile.h:
8986 2008-05-22 Alp Toker <alp@nuanti.com>
8988 GTK+ build fix. Add JavaScriptCore/profiler to include path.
8992 2008-05-22 Adam Roben <aroben@apple.com>
8994 Implement sub-millisecond profiling on Windows
8996 Reviewed by Kevin McCullough.
8998 * profiler/ProfileNode.cpp:
8999 (KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
9000 other platforms, we use getCurrentUTCTimeWithMicroseconds.
9001 (KJS::ProfileNode::endAndRecordCall): Use getCount instead of
9002 getCurrentUTCTimeWithMicroseconds.
9003 (KJS::ProfileNode::startTimer): Ditto.
9005 2008-05-22 Adam Roben <aroben@apple.com>
9007 Fix a profiler assertion when calling a NodeList as a function
9009 Reviewed by Kevin McCullough.
9011 * profiler/Profiler.cpp:
9012 (KJS::createCallIdentifier): Don't assert when a non-function object
9013 is called as a function. Instead, build up a CallIdentifier using the
9014 object's class name.
9016 2008-05-22 Kevin McCullough <kmccullough@apple.com>
9020 <rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
9022 -Implement 'exclude'; where the excluded node attributes its time to its
9025 * JavaScriptCore.exp: Export the exclude function.
9026 * profiler/Profile.h:
9027 (KJS::Profile::exclude):
9028 * profiler/ProfileNode.cpp:
9029 (KJS::ProfileNode::setTreeVisible): New function that allows a change in
9030 visiblitiy to be propogated to all the children of a node.
9031 (KJS::ProfileNode::exclude): If the node matches the callIdentifier then
9032 set the visiblity of this node and all of its children to false and
9033 attribute it's total time to it's caller's self time.
9034 * profiler/ProfileNode.h:
9036 2008-05-22 Mark Rowe <mrowe@apple.com>
9038 Reviewed by Oliver Hunt.
9040 Fix access to static global variables in Windows release builds.
9042 * kjs/JSGlobalObject.h: Don't store a reference to an Identifier
9043 in GlobalPropertyInfo as the Identifier is likely to be a temporary
9044 and therefore may be destroyed before the GlobalPropertyInfo.
9046 2008-05-22 Kevin McCullough <kmccullough@apple.com>
9053 2008-05-22 Kevin McCullough <kmccullough@apple.com>
9057 <rdar://problem/5951561> Turn on JavaScript Profiler
9058 Get basic JS profiling working.
9059 Even with this patch the profiler will not be compiled in because we do
9060 not know the extend, if any, of the performance regression it would cause
9061 when it is not in use. However with these changes, if the profiler were
9062 on, it would not crash and show good profiling data.
9064 * VM/Machine.cpp: Instrument the calls sites that are needed for profiling.
9066 (KJS::Machine::unwindCallFrame):
9067 (KJS::Machine::execute):
9068 (KJS::Machine::privateExecute):
9069 * kjs/function.cpp: Ditto.
9070 (KJS::globalFuncEval):
9071 * kjs/interpreter.cpp: Ditto.
9072 (KJS::Interpreter::evaluate):
9073 * profiler/Profile.cpp:
9074 (KJS::Profile::willExecute):
9075 (KJS::Profile::didExecute): Because we do not get a good context when
9076 startProfiling is called it is possible that m_currentNode will be at the
9077 top of the known stack when a didExecute() is called. What we then do is
9078 create a new node that represents the function being exited and insert
9079 it between the head and the currently known children, since they should
9080 be children of this new node.
9081 * profiler/ProfileNode.cpp:
9082 (KJS::ProfileNode::ProfileNode):
9083 (KJS::ProfileNode::willExecute): Rename the add function for consistency.
9084 (KJS::ProfileNode::addChild): Appends the child to this node but also
9085 sets the parent pointer of the children to this node.
9086 (KJS::ProfileNode::insertNode): Insert a node between this node and its
9087 children. Also set the time for the new node since it is now exiting
9088 and we don't really know when it started.
9089 (KJS::ProfileNode::stopProfiling):
9090 (KJS::ProfileNode::startTimer):
9091 * profiler/ProfileNode.h:
9092 (KJS::CallIdentifier::toString): Added for debugging.
9093 (KJS::ProfileNode::setParent):
9094 (KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the
9095 visibleTotalTime not the visibleSelfTime.
9096 (KJS::ProfileNode::children):
9097 (KJS::ProfileNode::toString): Added for debugging.
9098 * profiler/Profiler.cpp: remove unecessary calls.
9099 (KJS::Profiler::startProfiling):
9101 2008-05-22 Sam Weinig <sam@webkit.org>
9103 Reviewed by Oliver Hunt.
9105 Rename register arguments for op_call, op_call_eval, op_end, and op_construct
9106 to document what they are for.
9108 * VM/CodeGenerator.cpp:
9109 (KJS::CodeGenerator::emitCall):
9110 (KJS::CodeGenerator::emitCallEval):
9111 (KJS::CodeGenerator::emitEnd):
9112 (KJS::CodeGenerator::emitConstruct):
9113 * VM/CodeGenerator.h:
9115 (KJS::Machine::privateExecute):
9117 2008-05-22 Oliver Hunt <oliver@apple.com>
9121 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9122 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9124 Last of the multiscope look up optimisations. This is a wash overall on SunSpider
9125 but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
9126 ... applied to any non-local var).
9129 (KJS::PostIncResolveNode::emitCode):
9130 (KJS::PostDecResolveNode::emitCode):
9131 (KJS::PreIncResolveNode::emitCode):
9132 (KJS::PreDecResolveNode::emitCode):
9133 (KJS::ReadModifyResolveNode::emitCode):
9135 2008-05-22 David Kilzer <ddkilzer@apple.com>
9137 <rdar://problem/5954233> Add method to release free memory from FastMalloc
9139 Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
9141 * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
9142 * wtf/FastMalloc.cpp:
9143 (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
9144 system malloc and FastMalloc code paths.
9145 * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
9147 2008-05-22 Oliver Hunt <oliver@apple.com>
9151 Roll out r34020 as it causes recursion tests to fail.
9154 (KJS::JSObject::call):
9156 2008-05-22 Oliver Hunt <oliver@apple.com>
9160 Don't leak the SymbolTable when compiling eval code.
9163 (KJS::EvalNode::generateCode):
9165 2008-05-22 Simon Hausmann <hausmann@webkit.org>
9171 * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
9172 * VM/LabelID.h: Include limits.h for UINT_MAX.
9173 * wtf/VectorTraits.h: Include memory for std::auto_ptr.
9175 2008-05-22 Geoffrey Garen <ggaren@apple.com>
9177 Reviewed by Adam Roben.
9179 Removed the old recursion guard mechanism, since squirrelfish has its
9180 own mechanism. Also removed some old JS call tracing code, since we
9181 have other ways to do that, too.
9183 SunSpider reports no change.
9186 (KJS::JSObject::call):
9188 2008-05-22 Maciej Stachowiak <mjs@apple.com>
9192 - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
9195 (KJS::WithNode::emitCode):
9196 (KJS::TryNode::emitCode):
9198 2008-05-21 Kevin McCullough <kmccullough@apple.com>
9200 Reviewed by Maciej and Geoff.
9202 <rdar://problem/5951561> Turn on JavaScript Profiler
9203 -As part of the effort to turn on the profiler it would be helpful if it
9204 did not need ExecStates to represent the stack location of the currently
9205 executing statement.
9206 -We now create each node as necessary with a reference to the current
9207 node and each node knows its parent so that the tree can be made without
9210 * profiler/Profile.cpp:
9211 (KJS::Profile::Profile): The current node starts at the head.
9212 (KJS::Profile::stopProfiling): The current node is cleared when profiling
9214 (KJS::Profile::willExecute): The current node either adds a new child or
9215 starts and returns a reference to an already existing child if the call
9216 ID that is requested already exists.
9217 (KJS::Profile::didExecute): The current node finishes and returns its
9219 * profiler/Profile.h: Use a single callIdentifier instead of a vector
9220 since we no longer use the whole stack.
9221 * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
9223 (KJS::ProfileNode::ProfileNode): Initialize the parent.
9224 (KJS::ProfileNode::didExecute): Record the time and return the parent.
9225 (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
9226 already a child, start it and return it, otherwise create a new one and
9228 (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
9229 * profiler/ProfileNode.h: Utilize the parent.
9230 (KJS::ProfileNode::create):
9231 (KJS::ProfileNode::parent):
9232 * profiler/Profiler.cpp:
9233 (KJS::Profiler::startProfiling): Here is the only place where the
9234 ExecState is used to figure out where in the stack the profiler is
9235 currently profiling.
9236 (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
9237 of a vector of them.
9238 (KJS::Profiler::willExecute): Ditto.
9239 (KJS::Profiler::didExecute): Ditto.
9240 (KJS::createCallIdentifier): Create only one CallIdentifier.
9241 (KJS::createCallIdentifierFromFunctionImp): Ditto.
9242 * profiler/Profiler.h:
9244 2008-05-21 Darin Adler <darin@apple.com>
9248 - https://bugs.webkit.org/show_bug.cgi?id=19180
9249 speed up the < operator for the case when both values are integers
9251 Makes standalone SunSpider 1.022x faster.
9254 (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
9256 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9258 Reviewed by Oliver and Sam.
9260 - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
9262 Track global this value in the scope chain so we can retrieve it
9263 efficiently but it follows lexical scope properly.
9266 (KJS::ExecState::globalThisValue):
9267 * kjs/JSGlobalObject.h:
9268 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
9269 * kjs/function_object.cpp:
9270 (KJS::FunctionObjectImp::construct):
9271 * kjs/scope_chain.h:
9272 (KJS::ScopeChainNode::ScopeChainNode):
9273 (KJS::ScopeChainNode::globalThisObject):
9274 (KJS::ScopeChainNode::push):
9275 (KJS::ScopeChain::ScopeChain):
9277 2008-05-21 Kevin McCullough <kmccullough@apple.com>
9283 2008-05-21 Kevin McCullough <kmccullough@apple.com>
9287 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
9289 - This patch updatest the times of the visible nodes correctly, but to do
9290 so, some of the design of the ProfileNode changed.
9292 * JavaScriptCore.exp: export focus' symbol.
9293 * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
9294 the profile tree to get up-to-date accurate total profile time.
9295 (KJS::Profile::Profile): Pass 0 for the head node.
9296 (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
9297 passed into it, since it can get it from the head and it does not need to
9298 be told it is the head because it can figure it out on it's own.
9299 (KJS::Profile::willExecute): Set the head node for each created node.
9300 * profiler/Profile.h:
9301 (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
9302 would have to create, now focus() takes a ProfileNode that they should
9303 already have a reference to and focus() can extract the CallIdentifier
9305 * profiler/ProfileNode.cpp: Create actual and visible versions fo the
9306 total and self times for focus and exclude. Also add a head node
9307 reference so that nodes can get information from their head.
9308 (KJS::ProfileNode::ProfileNode):
9309 (KJS::ProfileNode::stopProfiling): Rename the total and self time
9310 variables and set the visual ones to the actual ones, so that without any
9311 changes to the visual versions of these variables, their times will match
9313 (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
9314 to be visible if this node is visible. If this node does not match the
9315 CallIdentifier being focused then the visibleTotalTime is only updated if
9316 one or more of it's children is the CallIdentifier being focused.
9317 (KJS::ProfileNode::restoreAll): Restores all variables with respect to
9318 the visible data in the ProfileNode.
9319 (KJS::ProfileNode::endAndRecordCall): Name change.
9320 (KJS::ProfileNode::debugPrintData): Dump the new variables.
9321 (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
9322 * profiler/ProfileNode.h: Use the new variables and reference to the head
9324 (KJS::ProfileNode::create):
9325 (KJS::ProfileNode::totalTime):
9326 (KJS::ProfileNode::setTotalTime):
9327 (KJS::ProfileNode::selfTime):
9328 (KJS::ProfileNode::setSelfTime):
9329 (KJS::ProfileNode::totalPercent):
9330 (KJS::ProfileNode::selfPercent):
9331 (KJS::ProfileNode::setVisible):
9333 2008-05-21 Alp Toker <alp@nuanti.com>
9335 GTK+/UNIX testkjs build fix. Include signal.h.
9339 2008-05-21 Oliver Hunt <oliver@apple.com>
9341 Yet more windows build fixes
9343 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9345 2008-05-21 Oliver Hunt <oliver@apple.com>
9347 Yet more windows build fixes
9349 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9351 2008-05-21 Alp Toker <alp@nuanti.com>
9353 GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
9354 changes into account.
9358 2008-05-21 Oliver Hunt <oliver@apple.com>
9360 Add DebuggerCallFrame.{h,cpp} to the project file
9362 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9364 2008-05-21 Alp Toker <alp@nuanti.com>
9366 GTK+ port build fixes following squirrelfish merge r33979.
9370 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9374 - save a hash lookup wne writing to global properties
9375 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
9378 (KJS::resolveBase): Check for being a the end of the scope chain
9381 2008-05-21 Alp Toker <alp@nuanti.com>
9383 Rubber-stamped by Maciej.
9385 Replace non-standard #pragma marks with comments to avoid compiler
9388 * profiler/ProfileNode.cpp:
9390 2008-05-21 Geoffrey Garen <ggaren@apple.com>
9392 Reviewed by Mark Rowe.
9394 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
9396 * JavaScriptCore.exp:
9397 * kjs/JSGlobalObject.cpp:
9398 (KJS::JSGlobalObject::defineGetter):
9399 (KJS::JSGlobalObject::defineSetter):
9400 * kjs/JSGlobalObject.h:
9402 === End merge of squirrelfish ===
9404 2008-05-21 Geoffrey Garen <ggaren@apple.com>
9406 Reviewed by Tim Hatcher.
9408 Merged with trunk WebCore's new debugger.
9410 * kjs/DebuggerCallFrame.cpp:
9411 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
9412 the exception value from the return value. The WebKit debugger treats
9413 them as one, but the WebCore debugger doesn't.
9415 * kjs/DebuggerCallFrame.h:
9416 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
9417 the dynamic global object, since the debugger doesn't want the lexical
9420 2008-05-21 Oliver Hunt <oliver@apple.com>
9424 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9425 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9427 Optimise cross scope assignment, 0.4% progression in sunspider.
9430 (KJS::CodeBlock::dump):
9431 * VM/CodeGenerator.cpp:
9432 (KJS::CodeGenerator::emitPutScopedVar):
9433 * VM/CodeGenerator.h:
9435 (KJS::Machine::privateExecute):
9438 (KJS::AssignResolveNode::emitCode):
9440 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9444 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
9445 0.5% speedup on SunSpider
9447 * kjs/JSGlobalObject.h:
9448 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
9449 because symbol table access is likely to have been optimized.
9451 2008-05-21 Oliver Hunt <oliver@apple.com>
9455 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9456 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9458 Optimise multiscope lookup of statically resolvable function calls.
9459 SunSpider reports a 1.5% improvement, including 37% on
9460 controlflow-recursive for some reason :D
9463 (KJS::CodeBlock::dump):
9464 * VM/CodeGenerator.cpp:
9465 (KJS::CodeGenerator::emitResolve):
9466 * VM/CodeGenerator.h:
9468 (KJS::FunctionCallResolveNode::emitCode):
9470 2008-05-21 Maciej Stachowiak <mjs@apple.com>
9474 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
9475 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
9477 * JavaScriptCore.exp:
9478 * kjs/JSGlobalObject.h:
9479 (KJS::JSGlobalObject::getOwnPropertySlot):
9480 * kjs/JSVariableObject.h:
9481 (KJS::JSVariableObject::symbolTableGet):
9483 (KJS::JSObject::getDirectLocation):
9484 (KJS::JSObject::getOwnPropertySlotForWrite):
9485 * kjs/property_map.cpp:
9486 (KJS::PropertyMap::getLocation):
9487 * kjs/property_map.h:
9488 * kjs/property_slot.h:
9489 (KJS::PropertySlot::putValue):
9491 2008-05-20 Oliver Hunt <oliver@apple.com>
9495 Bug 19116: SquirrelFish shouldn't regress on variable lookups
9496 <https://bugs.webkit.org/show_bug.cgi?id=19116>
9498 This restores multiscope optimisation to simple resolve, producing
9499 a 2.6% progression in SunSpider. Have verified that none of the
9500 sites broken by the multiscope optimisation in trunk were effected
9504 (KJS::CodeBlock::dump):
9506 (KJS::CodeBlock::CodeBlock):
9507 * VM/CodeGenerator.cpp:
9508 (KJS::CodeGenerator::findScopedProperty):
9509 (KJS::CodeGenerator::emitResolve):
9510 * VM/CodeGenerator.h:
9513 (KJS::Machine::privateExecute):
9515 * kjs/JSVariableObject.h:
9517 2008-05-20 Oliver Hunt <oliver@apple.com>
9519 Fixerate the windows build.
9521 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9522 * VM/CodeGenerator.cpp:
9523 * VM/RegisterFile.h:
9524 * kjs/JSGlobalObject.h:
9526 * kjs/interpreter.h:
9528 2008-05-20 Oliver Hunt <oliver@apple.com>
9532 Bug 19110: SquirrelFish: Google Maps - no maps
9533 <https://bugs.webkit.org/show_bug.cgi?id=19110>
9535 Correct a comedy of errors present in my original patch to "fix"
9536 exceptions occurring midway through pre and post increment. This
9537 solution is cleaner than the original, doesn't need the additional
9538 opcodes, and as an added benefit does not break Google Maps.
9540 Sunspider reports a 0.4% progression.
9543 (KJS::CodeBlock::dump):
9544 * VM/CodeGenerator.cpp:
9545 * VM/CodeGenerator.h:
9547 (KJS::Machine::privateExecute):
9550 (KJS::PreIncResolveNode::emitCode):
9551 (KJS::PreDecResolveNode::emitCode):
9552 (KJS::PreIncBracketNode::emitCode):
9553 (KJS::PreDecBracketNode::emitCode):
9554 (KJS::PreIncDotNode::emitCode):
9555 (KJS::PreDecDotNode::emitCode):
9557 2008-05-20 Maciej Stachowiak <mjs@apple.com>
9561 - inline JSGlobalObject::getOwnPropertySlot
9562 1% improvement on in-browser SunSpider (a wash command-line)
9564 * kjs/JSGlobalObject.cpp:
9565 * kjs/JSGlobalObject.h:
9566 (KJS::JSGlobalObject::getOwnPropertySlot):
9568 2008-05-18 Oliver Hunt <oliver@apple.com>
9572 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
9573 <https://bugs.webkit.org/show_bug.cgi?id=18752>
9575 Handle exceptions thrown by toString conversion in subscript operators,
9576 this should basically complete exception handling in SquirrelFish.
9578 Sunspider reports no regression.
9581 (KJS::Machine::privateExecute):
9583 2008-05-17 Geoffrey Garen <ggaren@apple.com>
9585 Reviewed by Oliver Hunt.
9587 [Reapplying patch with previously missing files from r33553 -- Oliver]
9591 SunSpider reports no change.
9593 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
9594 and created a debugger folder.
9596 * VM/CodeGenerator.cpp:
9597 (KJS::CodeGenerator::generate): If the debugger is attached, always
9598 generate full scope chains for its sake.
9601 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
9602 due to an exception, so it doesn't keep stale call frames around.
9604 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
9605 debugger can distinguish them from function call frames.
9607 (KJS::Machine::debug): Simplified this function, since the debugger
9608 doesn't actually need all the information we used to provide.
9610 (KJS::Machine::privateExecute): Treat debugging hooks like other function
9611 calls, so the code we hook into (the debugger UI) can be optimized.
9613 * kjs/debugger.cpp: Nixed these default callback implementations and
9614 made the callbacks pure virtual instead, so the compiler could tell me
9615 if I made a mistake in one of the subclasses.
9617 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
9618 callbacks. Changed from passing an ExecState* to passing a
9619 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
9620 information anymore.
9623 (KJS::globalFuncEval): Easiest bug fix evar!
9625 [Previously missing files from r33553]
9626 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
9627 (KJS::DebuggerCallFrame::functionName):
9628 (KJS::DebuggerCallFrame::thisObject):
9629 (KJS::DebuggerCallFrame::evaluateScript):
9630 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
9631 (KJS::DebuggerCallFrame::DebuggerCallFrame):
9632 (KJS::DebuggerCallFrame::scopeChain):
9633 (KJS::DebuggerCallFrame::exception):
9635 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
9639 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
9640 <https://bugs.webkit.org/show_bug.cgi?id=18991>
9642 Fix the last remaining blocking cases of this bug.
9646 (KJS::ReadModifyResolveNode::emitCode):
9648 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
9654 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
9655 <https://bugs.webkit.org/show_bug.cgi?id=18991>
9657 Ensure that the code generated for assignments uses temporaries whenever
9658 necessary. This patch covers the vast majority of situations, but there
9659 are still a few left.
9661 This patch also adds some missing cases to CodeBlock::dump().
9664 (KJS::CodeBlock::dump):
9665 * VM/CodeGenerator.h:
9666 (KJS::CodeGenerator::destinationForAssignResult):
9667 (KJS::CodeGenerator::leftHandSideNeedsCopy):
9668 (KJS::CodeGenerator::emitNodeForLeftHandSide):
9672 (KJS::AssignDotNode::emitCode):
9673 (KJS::ReadModifyDotNode::emitCode):
9674 (KJS::AssignBracketNode::emitCode):
9675 (KJS::ReadModifyBracketNode::emitCode):
9676 (KJS::ForInNode::ForInNode):
9678 (KJS::ReadModifyResolveNode::):
9679 (KJS::AssignResolveNode::):
9680 (KJS::ReadModifyBracketNode::):
9681 (KJS::AssignBracketNode::):
9682 (KJS::AssignDotNode::):
9683 (KJS::ReadModifyDotNode::):
9685 2008-05-17 Oliver Hunt <oliver@apple.com>
9689 Bug 19106: SquirrelFish: Activation is not marked correctly
9690 <https://bugs.webkit.org/show_bug.cgi?id=19106>
9692 We can't rely on the symbol table for a count of the number of globals
9693 we need to mark as that misses duplicate parameters and 'this'. Now we
9694 use the actual local register count from the codeBlock.
9696 * kjs/JSActivation.cpp:
9697 (KJS::JSActivation::mark):
9699 2008-05-16 Oliver Hunt <oliver@apple.com>
9703 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
9704 <https://bugs.webkit.org/show_bug.cgi?id=19076>
9706 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
9707 to allocate the global 'this' register safely at any point after initialisation of the Global
9710 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
9711 support for the static slot optimisation for the global Math object which brings it to a 0.3%
9714 * VM/CodeGenerator.cpp:
9715 (KJS::CodeGenerator::programCodeThis):
9716 (KJS::CodeGenerator::CodeGenerator):
9717 (KJS::CodeGenerator::addParameter):
9718 * VM/CodeGenerator.h:
9720 (KJS::Machine::execute):
9722 * kjs/JSGlobalObject.cpp:
9723 (KJS::JSGlobalObject::reset):
9724 * kjs/JSGlobalObject.h:
9725 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
9726 (KJS::JSGlobalObject::addStaticGlobals):
9729 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
9731 Reviewed by Oliver Hunt.
9733 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
9734 <https://bugs.webkit.org/show_bug.cgi?id=19098>
9736 When doing code generation for a statement list, increase the reference
9737 count on a register that might eventually be returned, so that it doesn't
9738 get clobbered by a request for a new temporary.
9741 (KJS::statementListEmitCode):
9743 2008-05-16 Maciej Stachowiak <mjs@apple.com>
9747 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
9748 https://bugs.webkit.org/show_bug.cgi?id=19044
9750 * kjs/JSActivation.cpp:
9751 (KJS::JSActivation::copyRegisters): Use numLocals from the code
9752 block rather than the size of the symbol table for the number of
9753 registers to copy, to account for duplicate parameters and vars
9754 with the same name as parameters (we still have potentially
9755 suboptimal codegen in that we allocate a local register for the
9756 var in the latter case but it is never used).
9758 2008-05-15 Geoffrey Garen <ggaren@apple.com>
9762 We regret to inform you that your program is crashing because you were
9766 (KJS::Machine::privateExecute): Math is hard.
9768 2008-05-14 Geoffrey Garen <ggaren@apple.com>
9770 Reviewed by Oliver Hunt.
9772 A little more debugger action: filled in op_debug. All debugger control
9773 flow works now, but variable inspection and backtraces still don't.
9775 SunSpider reports no change.
9777 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
9780 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
9781 NEVER_INLINE function to avoid a stunning 10% performance regression.
9782 Also factored out a common function for retrieving the function and
9783 arguments from a call frame.
9785 * kjs/JSActivation.cpp:
9786 (KJS::JSActivation::createArgumentsObject): Use the new factored out
9787 function mentioned above.
9790 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
9791 sourceId we send to the debugger matches the sourceId recorded in the
9794 * kjs/nodes.cpp: Emit debugging hooks.
9796 2008-05-14 Oliver Hunt <oliver@apple.com>
9800 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
9801 <https://bugs.webkit.org/show_bug.cgi?id=19024>
9803 This fixes a number of issues. The most important is that we now check every register
9804 file for tainting rather than just looking for function register files as that was
9805 insufficient. Additionally guarded against implicit re-entry into Eval code.
9807 Also added a few additional assertions to reduce the amout of time between something
9808 going wrong and us seeing the error.
9811 (KJS::Machine::execute):
9812 (KJS::Machine::privateExecute):
9813 * VM/RegisterFile.cpp:
9814 (KJS::RegisterFile::growBuffer):
9815 (KJS::RegisterFile::addGlobalSlots):
9816 * VM/RegisterFileStack.cpp:
9817 (KJS::RegisterFileStack::pushGlobalRegisterFile):
9818 (KJS::RegisterFileStack::pushFunctionRegisterFile):
9819 * VM/RegisterFileStack.h:
9820 (KJS::RegisterFileStack::inImplicitCall):
9822 2008-05-14 Geoffrey Garen <ggaren@apple.com>
9824 Reviewed by Oliver Hunt.
9826 A little more debugger action: emit opcodes for debugger hooks. Right
9827 now, the opcode implementation is just a stub.
9829 SunSpider reports no change.
9831 Some example codegen for "function f() { 1; }":
9833 [ 0] dbg DidEnterCallFrame
9834 [ 2] dbg WillExecuteStatement
9835 [ 4] load tr0, 1(@k0)
9836 [ 7] load tr0, undefined(@k1)
9837 [ 10] dbg WillLeaveCallFrame
9840 2008-05-14 Oliver Hunt <oliver@apple.com>
9844 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
9845 <https://bugs.webkit.org/show_bug.cgi?id=19025>
9847 Simple fix -- move the use of functionBodyNode to after the null check.
9849 * kjs/function_object.cpp:
9850 (KJS::FunctionObjectImp::construct):
9852 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9854 Reviewed by Oliver Hunt.
9856 Fixed a codegen crash with run-time parse errors.
9858 SunSpider reports no change.
9860 emitThrowError needs to return the temporary holding the error, not dst,
9861 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
9862 parameter at all, since exceptions should not modify the destination
9865 2008-05-13 Oliver Hunt <oliver@apple.com>
9869 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
9870 <https://bugs.webkit.org/show_bug.cgi?id=19027>
9872 This fixes the codegen issues for the pre-inc/decrement operators
9873 to prevent incorrectly clobbering the destination in the event of
9877 (KJS::CodeBlock::dump):
9878 * VM/CodeGenerator.cpp:
9879 (KJS::CodeGenerator::emitPreInc):
9880 (KJS::CodeGenerator::emitPreDec):
9881 * VM/CodeGenerator.h:
9883 (KJS::Machine::privateExecute):
9886 (KJS::PreIncResolveNode::emitCode):
9887 (KJS::PreDecResolveNode::emitCode):
9888 (KJS::PreIncBracketNode::emitCode):
9889 (KJS::PreDecBracketNode::emitCode):
9890 (KJS::PreIncDotNode::emitCode):
9891 (KJS::PreDecDotNode::emitCode):
9893 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9895 Reviewed by Oliver Hunt.
9897 A little more debugger action: supply a real line number, sourceId,
9898 and sourceURL in op_new_error.
9900 SunSpider reports a .2% speedup. Not sure what that's about.
9903 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
9906 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
9909 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9911 Reviewed by Oliver Hunt.
9913 A little more debugger action: implemented the exception callback.
9915 SunSpider reports a .2% speedup. Not sure what that's about.
9917 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
9918 owner ScopeNode so we can retrieve data from it. This allows us to
9919 stop storing copies of the data ourselves. Also, store a "this" register
9920 instead of a code type, since we were only using the code type to
9921 calculate the "this" register.
9923 * VM/CodeGenerator.cpp:
9924 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
9925 above. Also, take care of removing "this" from the symbol table after
9926 codegen is done, since relying on the timing of a destructor for correct
9927 behavior is not so good.
9930 (KJS::Machine::throwException): Invoke the debugger's exception callback.
9931 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
9933 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9935 Reviewed by Oliver Hunt.
9937 Removed some unused exception machinery.
9939 SunSpider reports a .3% speedup.
9941 * API/JSCallbackObject.h:
9942 * API/JSCallbackObjectFunctions.h:
9943 * JavaScriptCore.exp:
9945 (KJS::Machine::privateExecute):
9951 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9953 Reviewed by Oliver Hunt.
9955 A little more debugger action.
9958 * kjs/debugger.h: Removed debuggersPresent because it was unused.
9959 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
9960 is faster and simpler. Changed all functions to return void instead of
9961 bool, because no clients ever return false, and we don't want to support
9964 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
9965 (KJS::Node::handleException):
9966 (KJS::BreakpointCheckStatement::execute):
9967 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
9969 2008-05-13 Oliver Hunt <oliver@apple.com>
9973 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
9974 <https://bugs.webkit.org/show_bug.cgi?id=18752>
9976 Replace old attempt at "branchless" exceptions as the extra information
9977 being passed made gcc an unhappy compiler, replacing these custom toNumber
9978 calls with ordinary toNumber logic (by relying on toNumber now preventing
9979 side effects after an exception has been thrown) provided sufficient leeway
9980 to add the additional checks for the remaining unchecked cases.
9982 This leaves only toString conversions in certain contexts as possibly
9988 (KJS::resolveBaseAndProperty):
9989 (KJS::resolveBaseAndFunc):
9990 (KJS::Machine::privateExecute):
9993 (KJS::JSValue::safeGetNumber):
9995 2008-05-13 Geoffrey Garen <ggaren@apple.com>
9997 Reviewed by Oliver Hunt.
9999 First steps toward supporting the debugger API: support the sourceParsed
10000 callback; plus some minor fixups.
10002 SunSpider reports no regression.
10004 * VM/CodeGenerator.h: Removed a misleading comment.
10006 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
10007 implement the sourceParsed callback -- that way, we only have to
10008 implement the callback in one place.
10010 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
10011 was to demonstrate the misapplication of design patterns.
10013 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
10014 reduce copying, and not to return a value, because pausing execution
10015 after parsing is complicated, and no clients needed that ability, anyway.
10017 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
10018 didFinishParsing -- that simplifies some code down the road.
10020 * kjs/nodes.cpp: Don't generate special AST nodes just because the
10021 debugger is attached -- that's a relic of the old AST execution model,
10022 and those nodes haven't been maintained.
10024 2008-05-13 Oliver Hunt <oliver@apple.com>
10028 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
10029 <https://bugs.webkit.org/show_bug.cgi?id=18752>
10031 First step: prevent incorrect evaluation of valueOf/toString conversion
10032 in right hand side of expression after earlier conversion throws.
10034 * API/JSCallbackObjectFunctions.h:
10037 (KJS::JSObject::defaultValue):
10039 2008-05-12 Oliver Hunt <oliver@apple.com>
10043 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
10044 <https://bugs.webkit.org/show_bug.cgi?id=18934>
10046 Unfortunately we cannot create new statically optimised globals if there are any
10047 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
10048 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
10051 (KJS::Machine::execute):
10052 * VM/RegisterFileStack.cpp:
10053 (KJS::RegisterFileStack::pushFunctionRegisterFile):
10054 * VM/RegisterFileStack.h:
10056 2008-05-12 Geoffrey Garen <ggaren@apple.com>
10058 Reviewed by Maciej Stachowiak.
10060 Introduced support for function.caller.
10062 Improved support for walking interesting scopes for function introspection.
10064 This fixes all remaining layout tests not blocked by rebasing to trunk.
10066 SunSpider reports no change.
10069 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
10071 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
10073 Reviewed by Oliver.
10075 Bug 18961: SQUIRRELFISH: Gmail doesn't load
10076 <https://bugs.webkit.org/show_bug.cgi?id=18961>
10078 Fix codegen for logical nodes so that they don't use their destination
10082 (KJS::LogicalAndNode::emitCode):
10083 (KJS::LogicalOrNode::emitCode):
10085 2008-05-10 Maciej Stachowiak <mjs@apple.com>
10087 Reviewed by Oliver.
10089 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
10090 https://bugs.webkit.org/show_bug.cgi?id=18869
10092 Three layout tests are fixed:
10093 fast/js/toString-elision-trailing-comma.html
10094 fast/js/toString-prefix-postfix-preserve-parens.html
10095 fast/js/kde/lval-exceptions.html
10097 Functions now save a shared subrange of the original source used
10098 to make them (so in the common case this adds no storage above the
10101 * kjs/SourceProvider.h: Added.
10102 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
10103 to the source for a JavaScript program. This allows function objects to have access to their
10104 original source without copying.
10105 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
10106 (KJS::UStringSourceProvider::create):
10107 (KJS::UStringSourceProvider::getRange):
10108 (KJS::UStringSourceProvider::data):
10109 (KJS::UStringSourceProvider::length):
10110 (KJS::UStringSourceProvider::UStringSourceProvider):
10111 * kjs/SourceRange.h: Added.
10112 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
10113 the source, to encapsulate on-demand access to the source of a function.
10114 (KJS::SourceRange::toString):
10116 (KJS::eval): Pass a UStringSourceProvider to the parser.
10118 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
10120 (KJS::Parser::parse): Take a SourceProvider.
10122 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
10123 use it to get the raw buffer and length.
10125 (KJS::Lexer::sourceRange): Convenience function to get a source
10126 range based on the lexer's source provieder, and char offsets
10127 right before and after the desired range.
10128 * kjs/function.cpp:
10129 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
10130 * kjs/function_object.cpp:
10131 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
10132 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
10133 * kjs/grammar.y: When parsing a function declaration, function
10134 expression, or getter or setter, tell the function body about its
10136 * kjs/interpreter.cpp:
10137 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
10138 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
10139 * kjs/interpreter.h:
10141 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
10142 (KJS::FunctionBodyNode::toSourceString): Get the source string out
10143 of the SourceRange.
10144 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
10145 (KJS::FuncDeclNode::): ditto
10147 (prettyPrintScript): Use a SourceProvider appropriately.
10148 * JavaScriptCore.exp: Export new symbols.
10149 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
10150 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
10152 2008-05-09 Oliver Hunt <oliver@apple.com>
10154 Reviewed by Maciej.
10156 Bring back RegisterFile tainting in order to correctly handle
10157 natively implemented getters and setters that re-enter JavaScript
10160 (KJS::Machine::privateExecute):
10161 * VM/RegisterFile.h:
10162 * kjs/function.cpp:
10163 (KJS::FunctionImp::callAsFunction):
10165 (KJS::JSObject::put):
10166 (KJS::tryGetAndCallProperty):
10167 * kjs/property_slot.cpp:
10168 (KJS::PropertySlot::functionGetter):
10170 2008-05-09 Maciej Stachowiak <mjs@apple.com>
10172 Reviewed by Oliver.
10174 - track character offsets of open and close braces, in preparation for saving function source
10176 I verified that there is no performance regression from this change.
10181 (KJS::Lexer::matchPunctuator):
10184 2008-05-09 Oliver Hunt <oliver@apple.com>
10188 * kjs/JSGlobalObject.cpp:
10189 (KJS::JSGlobalObject::restoreLocalStorage):
10191 2008-05-09 Oliver Hunt <oliver@apple.com>
10195 Build fixes for SquirrelFish on windows.
10197 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
10198 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
10200 * kjs/JSGlobalObject.cpp:
10201 (KJS::JSGlobalObject::restoreLocalStorage):
10202 * kjs/collector.cpp:
10203 (KJS::Collector::allocate):
10204 (KJS::Collector::allocateNumber):
10206 (KJS::Collector::allocate):
10207 (KJS::Collector::allocateNumber):
10208 * kjs/property_slot.cpp:
10210 2008-05-08 Maciej Stachowiak <mjs@apple.com>
10214 - fix activation tearoff in the case where functions are called with too many arguments
10217 fast/canvas/patternfill-repeat.html
10218 fast/dom/SelectorAPI/bug-17313.html
10221 (KJS::slideRegisterWindowForCall):
10222 (KJS::scopeChainForCall):
10223 (KJS::Machine::execute):
10224 (KJS::Machine::privateExecute):
10226 2008-05-08 Geoffrey Garen <ggaren@apple.com>
10228 Reviewed by Oliver Hunt.
10230 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
10232 SunSpider reports a small speedup. Not sure what that's about.
10234 * VM/CodeBlock.cpp:
10235 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
10236 This helped me while debugging.
10239 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
10240 off, don't use the scope chain. Inside eval, the scope chain doesn't
10241 belong to us; it belongs to our calling function.
10243 Also, don't use the needsFullScopeChain flag to decide whether to tear
10244 off the activation. "function.arguments" can create an activation
10245 for a function whose needsFullScopeChain flag is set to false.
10247 2008-05-08 Maciej Stachowiak <mjs@apple.com>
10249 Reviewed by Oliver.
10251 - fix function.call for calls of more than 8 arguments
10253 Fixes svg/carto.net/button.svg
10256 (KJS::List::getSlice): properly set up the m_buffer of the target list.
10258 2008-05-08 Maciej Stachowiak <mjs@apple.com>
10260 Reviewed by Oliver.
10262 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
10265 - fast/regex/early-acid3-86.html
10266 - http/tests/misc/acid3.html
10269 (KJS::RegExpNode::emitCode):
10271 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
10273 Reviewed by Oliver.
10275 Fix a performance regression caused by the introduction of property
10276 attributes to SymbolTable in r32859 by encoding the attributes and the
10277 register index into a single field of SymbolTableEntry.
10279 This leaves Node::optimizeVariableAccess() definitely broken, although
10280 it was probably not entirely correct in SquirrelFish before this change.
10283 (KJS::missingThisObjectMarker):
10284 * VM/CodeGenerator.cpp:
10285 (KJS::CodeGenerator::addVar):
10286 (KJS::CodeGenerator::CodeGenerator):
10287 (KJS::CodeGenerator::registerForLocal):
10288 (KJS::CodeGenerator::registerForLocalConstInit):
10289 (KJS::CodeGenerator::isLocalConstant):
10290 (KJS::CodeGenerator::addConstant):
10291 (KJS::CodeGenerator::emitCall):
10292 * VM/CodeGenerator.h:
10293 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
10295 (KJS::Machine::privateExecute):
10296 * kjs/JSGlobalObject.cpp:
10297 (KJS::JSGlobalObject::saveLocalStorage):
10298 * kjs/JSVariableObject.cpp:
10299 (KJS::JSVariableObject::getPropertyNames):
10300 (KJS::JSVariableObject::getPropertyAttributes):
10301 * kjs/JSVariableObject.h:
10302 (KJS::JSVariableObject::symbolTableGet):
10303 (KJS::JSVariableObject::symbolTablePut):
10304 (KJS::JSVariableObject::symbolTablePutWithAttributes):
10305 * kjs/SymbolTable.h:
10306 (KJS::SymbolTableEntry::SymbolTableEntry):
10307 (KJS::SymbolTableEntry::isEmpty):
10308 (KJS::SymbolTableEntry::getIndex):
10309 (KJS::SymbolTableEntry::getAttributes):
10310 (KJS::SymbolTableEntry::setAttributes):
10311 (KJS::SymbolTableEntry::isReadOnly):
10313 (KJS::getSymbolTableEntry):
10314 (KJS::PostIncResolveNode::optimizeVariableAccess):
10315 (KJS::PostDecResolveNode::optimizeVariableAccess):
10316 (KJS::DeleteResolveNode::optimizeVariableAccess):
10317 (KJS::TypeOfResolveNode::optimizeVariableAccess):
10318 (KJS::PreIncResolveNode::optimizeVariableAccess):
10319 (KJS::PreDecResolveNode::optimizeVariableAccess):
10320 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
10321 (KJS::AssignResolveNode::optimizeVariableAccess):
10322 (KJS::ProgramNode::initializeSymbolTable):
10324 2008-05-06 Maciej Stachowiak <mjs@apple.com>
10326 Rubber stamped by Oliver.
10328 - add missing ! in an assert that I failed to reverse
10330 * VM/CodeGenerator.cpp:
10331 (KJS::CodeGenerator::CodeGenerator):
10333 2008-05-06 Maciej Stachowiak <mjs@apple.com>
10335 Reviewed by Oliver.
10337 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
10338 https://bugs.webkit.org/show_bug.cgi?id=18868
10340 The basic approach is to have "this" only be present in the symbol
10341 table at compile time, not runtime.
10343 * VM/CodeGenerator.cpp:
10344 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
10345 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
10347 * VM/CodeGenerator.h:
10349 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
10351 2008-05-06 Geoffrey Garen <ggaren@apple.com>
10353 Reviewed by Oliver Hunt.
10355 Trivial support for function.arguments: Currently, we only support
10356 function.arguments from within the scope of function.
10358 This fixes the remaining Mozilla JS test failures.
10360 SunSpider reports no change.
10362 * JavaScriptCore.exp:
10365 (KJS::Machine::privateExecute): Separated scope chain deref from
10366 activation register copying: since it is now possible for client code
10367 to create an activation on behalf of a function that otherwise wouldn't
10368 need one, having an activation no longer necessarily means that you need
10369 to deref the scope chain.
10371 (KJS::Machine::getCallFrame): For now, this function only examines the
10372 current scope. Walking parent scopes requires some refactoring in the
10373 way we track execution stacks.
10375 * kjs/ExecState.cpp:
10376 (KJS::ExecState::ExecState): We use a negative call frame offset to
10377 indicate that a given scope is not a function call scope.
10379 2008-05-05 Oliver Hunt <oliver@apple.com>
10383 Fix call frame set up for native -> JS function calls.
10386 (KJS::Machine::execute):
10388 2008-05-05 Geoffrey Garen <ggaren@apple.com>
10390 Reviewed by Maciej Stachowiak.
10392 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
10394 SunSpider reports a .4% speedup. Not sure what that's about.
10397 (KJS::Machine::privateExecute): Check for exception return from equal,
10398 since toPrimitive can throw.
10400 * kjs/operations.cpp:
10401 (KJS::strictEqual): In response to an error I made in an earlier version
10402 of this patch, I changed strictEqual to make clear the fact that it
10403 performs no conversions and can't throw, making it slightly more efficient
10406 2008-05-05 Maciej Stachowiak <mjs@apple.com>
10408 Reviewed by Oliver.
10410 - fix some dumb mistakes in my last patch
10412 * VM/CodeGenerator.cpp:
10413 (KJS::CodeGenerator::emitPushScope):
10414 (KJS::CodeGenerator::emitGetPropertyNames):
10416 (KJS::Machine::privateExecute):
10418 2008-05-05 Maciej Stachowiak <mjs@apple.com>
10420 Reviewed by Oliver.
10422 - document opcodes relating to jumps, scopes, and property name iteration
10424 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
10425 next_pname and jmp_scopes.
10427 * VM/CodeGenerator.cpp:
10428 (KJS::CodeGenerator::emitJump):
10429 (KJS::CodeGenerator::emitJumpIfTrue):
10430 (KJS::CodeGenerator::emitJumpIfFalse):
10431 (KJS::CodeGenerator::emitPushScope):
10432 (KJS::CodeGenerator::emitNextPropertyName):
10433 (KJS::CodeGenerator::emitGetPropertyNames):
10434 * VM/CodeGenerator.h:
10436 (KJS::Machine::privateExecute):
10438 (KJS::LogicalAndNode::emitCode):
10439 (KJS::LogicalOrNode::emitCode):
10440 (KJS::ConditionalNode::emitCode):
10441 (KJS::IfNode::emitCode):
10442 (KJS::IfElseNode::emitCode):
10443 (KJS::DoWhileNode::emitCode):
10444 (KJS::WhileNode::emitCode):
10445 (KJS::ForNode::emitCode):
10446 (KJS::ForInNode::emitCode):
10447 (KJS::WithNode::emitCode):
10449 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
10451 Reviewed by Oliver.
10453 Bug 18749: SQUIRRELFISH: const support is broken
10454 <https://bugs.webkit.org/show_bug.cgi?id=18749>
10456 Adds support for const during code generation.
10458 Fixes 2 layout tests.
10461 * VM/CodeGenerator.cpp:
10462 (KJS::CodeGenerator::addVar):
10463 (KJS::CodeGenerator::CodeGenerator):
10464 (KJS::CodeGenerator::isLocalConstant):
10465 * VM/CodeGenerator.h:
10466 (KJS::CodeGenerator::addVar):
10468 (KJS::PostIncResolveNode::emitCode):
10469 (KJS::PostDecResolveNode::emitCode):
10470 (KJS::PreIncResolveNode::emitCode):
10471 (KJS::PreDecResolveNode::emitCode):
10472 (KJS::ReadModifyResolveNode::emitCode):
10473 (KJS::AssignResolveNode::emitCode):
10475 2008-05-04 Maciej Stachowiak <mjs@apple.com>
10479 - document some more opcodes (and fix argument names)
10481 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
10483 * VM/CodeGenerator.cpp:
10484 (KJS::CodeGenerator::emitEqual):
10485 (KJS::CodeGenerator::emitNotEqual):
10486 (KJS::CodeGenerator::emitStrictEqual):
10487 (KJS::CodeGenerator::emitNotStrictEqual):
10488 (KJS::CodeGenerator::emitLess):
10489 (KJS::CodeGenerator::emitLessEq):
10490 * VM/CodeGenerator.h:
10492 (KJS::Machine::privateExecute):
10494 (KJS::LessNode::emitCode):
10495 (KJS::GreaterNode::emitCode):
10496 (KJS::LessEqNode::emitCode):
10497 (KJS::GreaterEqNode::emitCode):
10498 (KJS::EqualNode::emitCode):
10499 (KJS::NotEqualNode::emitCode):
10500 (KJS::StrictEqualNode::emitCode):
10501 (KJS::NotStrictEqualNode::emitCode):
10502 (KJS::CaseBlockNode::emitCodeForBlock):
10504 2008-05-04 Geoffrey Garen <ggaren@apple.com>
10506 Reviewed by Maciej Stachowiak.
10508 More scaffolding for f.arguments.
10510 Track the offset of the last call frame in the ExecState, so we can
10511 produce a backtrace at any time.
10513 Also, record numLocals, the sum of numVars + numParameters, in each code
10514 block, to make updates to the ExecState a little cheaper than they
10515 would be otherwise.
10517 We now use numLocals in a bunch of places where we used to calculate
10518 numVars + numParameters or -numVars - numParameters.
10520 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
10522 2008-05-04 Oliver Hunt <oliver@apple.com>
10526 Whoops, correctly handle properties that don't exist in the
10529 * kjs/JSVariableObject.h:
10530 (KJS::JSVariableObject::symbolTablePutWithAttributes):
10532 2008-05-04 Oliver Hunt <oliver@apple.com>
10536 Add attribute information to SymbolTable as ground work for
10537 various DontEnum and ReadOnly issues.
10539 * VM/CodeGenerator.cpp:
10540 (KJS::CodeGenerator::addVar):
10541 (KJS::CodeGenerator::CodeGenerator):
10542 (KJS::CodeGenerator::registerForLocal):
10543 (KJS::CodeGenerator::registerForLocalConstInit):
10544 (KJS::CodeGenerator::addConstant):
10546 (KJS::Machine::execute):
10547 * kjs/JSGlobalObject.cpp:
10548 (KJS::JSGlobalObject::saveLocalStorage):
10549 * kjs/JSVariableObject.cpp:
10550 (KJS::JSVariableObject::getPropertyNames):
10551 (KJS::JSVariableObject::getPropertyAttributes):
10552 * kjs/JSVariableObject.h:
10553 (KJS::JSVariableObject::symbolTablePut):
10554 (KJS::JSVariableObject::symbolTablePutWithAttributes):
10555 * kjs/SymbolTable.h:
10556 (KJS::SymbolTableEntry::SymbolTableEntry):
10557 (KJS::SymbolTableIndexHashTraits::emptyValue):
10559 (KJS::getSymbolTableEntry):
10560 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
10561 (KJS::AssignResolveNode::optimizeVariableAccess):
10562 (KJS::ProgramNode::initializeSymbolTable):
10564 2008-05-04 Geoffrey Garen <ggaren@apple.com>
10566 Reviewed by Oliver Hunt.
10568 More scaffolding for f.arguments.
10570 Store the register file associated with an ExecState in the ExecState.
10572 SunSpider reports no change.
10574 * kjs/JSGlobalObject.h:
10575 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
10576 registerFileStack above globalExec, so it gets initialized first.
10577 Removed remnants of old activation scheme.
10579 2008-05-04 Maciej Stachowiak <mjs@apple.com>
10581 Rubber stamped by Oliver.
10583 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
10587 resolve_base_and_property --> resolve_with_base
10588 resolve_base_and_func --> resolve_func
10589 get_prop_id --> get_by_id
10590 put_prop_id --> put_by_id
10591 delete_prop_id --> del_by_id
10592 get_prop_val --> get_by_val
10593 put_prop_val --> put_by_val
10594 delete_prop_val --> del_by_val
10595 put_prop_index --> put_by_index
10597 * VM/CodeBlock.cpp:
10598 (KJS::printUnaryOp):
10599 (KJS::printBinaryOp):
10600 (KJS::printConditionalJump):
10601 (KJS::CodeBlock::dump):
10602 * VM/CodeGenerator.cpp:
10603 (KJS::CodeGenerator::emitEqual):
10604 (KJS::CodeGenerator::emitNotEqual):
10605 (KJS::CodeGenerator::emitResolveWithBase):
10606 (KJS::CodeGenerator::emitResolveFunction):
10607 (KJS::CodeGenerator::emitGetById):
10608 (KJS::CodeGenerator::emitPutById):
10609 (KJS::CodeGenerator::emitDeleteById):
10610 (KJS::CodeGenerator::emitGetByVal):
10611 (KJS::CodeGenerator::emitPutByVal):
10612 (KJS::CodeGenerator::emitDeleteByVal):
10613 (KJS::CodeGenerator::emitPutByIndex):
10614 * VM/CodeGenerator.h:
10616 (KJS::Machine::privateExecute):
10619 (KJS::ArrayNode::emitCode):
10620 (KJS::PropertyListNode::emitCode):
10621 (KJS::BracketAccessorNode::emitCode):
10622 (KJS::DotAccessorNode::emitCode):
10623 (KJS::EvalFunctionCallNode::emitCode):
10624 (KJS::FunctionCallResolveNode::emitCode):
10625 (KJS::FunctionCallBracketNode::emitCode):
10626 (KJS::FunctionCallDotNode::emitCode):
10627 (KJS::PostIncResolveNode::emitCode):
10628 (KJS::PostDecResolveNode::emitCode):
10629 (KJS::PostIncBracketNode::emitCode):
10630 (KJS::PostDecBracketNode::emitCode):
10631 (KJS::PostIncDotNode::emitCode):
10632 (KJS::PostDecDotNode::emitCode):
10633 (KJS::DeleteResolveNode::emitCode):
10634 (KJS::DeleteBracketNode::emitCode):
10635 (KJS::DeleteDotNode::emitCode):
10636 (KJS::TypeOfResolveNode::emitCode):
10637 (KJS::PreIncResolveNode::emitCode):
10638 (KJS::PreDecResolveNode::emitCode):
10639 (KJS::PreIncBracketNode::emitCode):
10640 (KJS::PreDecBracketNode::emitCode):
10641 (KJS::PreIncDotNode::emitCode):
10642 (KJS::PreDecDotNode::emitCode):
10643 (KJS::ReadModifyResolveNode::emitCode):
10644 (KJS::AssignResolveNode::emitCode):
10645 (KJS::AssignDotNode::emitCode):
10646 (KJS::ReadModifyDotNode::emitCode):
10647 (KJS::AssignBracketNode::emitCode):
10648 (KJS::ReadModifyBracketNode::emitCode):
10649 (KJS::ConstDeclNode::emitCodeSingle):
10650 (KJS::ForInNode::emitCode):
10651 (KJS::TryNode::emitCode):
10653 2008-05-04 Oliver Hunt <oliver@apple.com>
10655 Reviewed by Maciej.
10657 Fix assertion when accessing arguments object with too many arguments provided
10659 The arguments constructor was assuming that the register offset given for argv
10660 was an absolute offset into the registerfile, rather than the offset from the
10661 frame. This patches corrects that issue.
10663 * kjs/JSActivation.cpp:
10664 (KJS::JSActivation::createArgumentsObject):
10666 2008-05-04 Geoffrey Garen <ggaren@apple.com>
10668 Rubber stamped by Sam Weinig.
10670 Cleaned up Machine.cpp according to our style guidelines: moved static
10671 data to the top of the file; moved stand-alone functions below that;
10672 moved the Machine constructor above other Machine member functions.
10674 2008-05-03 Maciej Stachowiak <mjs@apple.com>
10678 - fix accidental breakage from last patch
10681 (KJS::Machine::privateExecute):
10683 2008-05-03 Maciej Stachowiak <mjs@apple.com>
10687 - a bunch more opcode documentation and corresponding parameter name fixes
10689 I renamed a few opcodes:
10691 type_of --> typeof (that's what the JS operator is named)
10692 instance_of --> instanceof (ditto)
10693 create_error --> new_error (for consistency with other new_* opcodes)
10695 I documented the following opcodes:
10717 I also fixed formatting on some existing opcode docs.
10719 * VM/CodeBlock.cpp:
10720 (KJS::CodeBlock::dump):
10721 * VM/CodeGenerator.cpp:
10722 (KJS::CodeGenerator::emitMove):
10723 (KJS::CodeGenerator::emitNot):
10724 (KJS::CodeGenerator::emitPreInc):
10725 (KJS::CodeGenerator::emitPreDec):
10726 (KJS::CodeGenerator::emitPostInc):
10727 (KJS::CodeGenerator::emitPostDec):
10728 (KJS::CodeGenerator::emitToJSNumber):
10729 (KJS::CodeGenerator::emitNegate):
10730 (KJS::CodeGenerator::emitBitNot):
10731 (KJS::CodeGenerator::emitInstanceOf):
10732 (KJS::CodeGenerator::emitTypeOf):
10733 (KJS::CodeGenerator::emitIn):
10734 (KJS::CodeGenerator::emitLoad):
10735 (KJS::CodeGenerator::emitNewObject):
10736 (KJS::CodeGenerator::emitNewArray):
10737 (KJS::CodeGenerator::emitNewRegExp):
10738 (KJS::CodeGenerator::emitNewError):
10739 * VM/CodeGenerator.h:
10740 (KJS::CodeGenerator::scopeDepth):
10741 (KJS::CodeGenerator::addVar):
10743 (KJS::Machine::privateExecute):
10746 (KJS::Node::emitThrowError):
10747 (KJS::RegExpNode::emitCode):
10748 (KJS::TypeOfValueNode::emitCode):
10749 (KJS::UnaryPlusNode::emitCode):
10750 (KJS::NegateNode::emitCode):
10751 (KJS::BitwiseNotNode::emitCode):
10752 (KJS::LogicalNotNode::emitCode):
10753 (KJS::InstanceOfNode::emitCode):
10754 (KJS::InNode::emitCode):
10756 2008-05-03 Maciej Stachowiak <mjs@apple.com>
10758 Reviewed by Geoff and Sam.
10760 - generate HTML bytecode docs at build time
10762 * DerivedSources.make:
10764 * docs/make-bytecode-docs.pl: Added.
10766 2008-05-03 Geoffrey Garen <ggaren@apple.com>
10768 Reviewed by Sam Weinig.
10770 Update ExecState::m_scopeChain when switching scope chains inside the
10773 This fixes uses of lexicalGlobalObject, such as, in a subframe
10775 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
10777 and a bunch of the security failures listed in
10778 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
10779 seemingly because of regressions in exception messages).
10781 SunSpider reports no change.
10783 * VM/Machine.cpp: Factored out scope chain updating into a common
10784 function that takes care to update ExecState::m_scopeChain, too.
10786 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
10787 could update ExecState::m_scopeChain, even though that value is
10788 read-only for everyone else.
10790 * kjs/JSGlobalObject.h:
10791 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
10792 this client to be a little friendlier to ExecState's internal
10793 storage type for scope chain data.
10795 2008-05-03 Geoffrey Garen <ggaren@apple.com>
10797 Reviewed by Sam Weinig.
10799 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
10800 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
10802 SunSpider reports no change.
10805 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
10806 since the direct threaded interpreter will goto across its destructor.
10808 2008-05-03 Geoffrey Garen <ggaren@apple.com>
10810 Reviewed by Oliver Hunt.
10812 A bit more efficient fix than r32832: Don't copy globals into function
10813 register files; instead, have the RegisterFileStack track only the base
10814 of the last *global* register file, so the global object's register
10815 references stay good.
10817 SunSpider reports a .3% speedup. Not sure what that's about.
10819 2008-05-03 Oliver Hunt <oliver@apple.com>
10821 Reviewed by Maciej.
10823 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
10824 <https://bugs.webkit.org/show_bug.cgi?id=18864>
10826 Add new opcodes to allow us to add getters and setters to an object. These are
10827 only used by the codegen for object literals.
10829 * VM/CodeGenerator.cpp:
10830 (KJS::CodeGenerator::emitPutGetter):
10831 (KJS::CodeGenerator::emitPutSetter):
10832 * VM/CodeGenerator.h:
10834 (KJS::Machine::privateExecute):
10837 (KJS::PropertyListNode::emitCode):
10839 2008-05-02 Maciej Stachowiak <mjs@apple.com>
10841 Reviewed by Oliver.
10843 - properly copy globals into and out of implicit call register
10844 files, otherwise they will fail at global lookup
10846 Fixes fast/js/array-tostring-and-join.html layout test.
10848 * VM/RegisterFileStack.cpp:
10849 (KJS::RegisterFileStack::pushGlobalRegisterFile):
10850 (KJS::RegisterFileStack::popGlobalRegisterFile):
10851 (KJS::RegisterFileStack::pushFunctionRegisterFile):
10852 (KJS::RegisterFileStack::popFunctionRegisterFile):
10854 2008-05-02 Geoffrey Garen <ggaren@apple.com>
10856 Reviewed by Oliver Hunt.
10858 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
10859 SQUIRRELFISH: incorrect eval used in some cases
10861 Changed all code inside the machine to fetch the lexical global object
10862 directly from the scope chain, instead of from the ExecState.
10864 Clients who fetch the lexical global object through the ExecState
10867 SunSpider reports no change.
10870 (KJS::Machine::privateExecute): Fetch the lexical global object from
10874 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
10875 this function into ScopeChainNode, but kept this function around to
10876 support existing clients.
10878 2008-05-02 Geoffrey Garen <ggaren@apple.com>
10880 Rubber stamped by Oliver Hunt.
10882 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
10884 * JavaScriptCore.xcodeproj/project.pbxproj:
10885 * kjs/AllInOneFile.cpp:
10887 2008-05-01 Oliver Hunt <oliver@apple.com>
10889 Reviewed by Geoff and Maciej.
10891 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
10892 <https://bugs.webkit.org/show_bug.cgi?id=18827>
10894 Remove safe/unsafe RegisterFile concept, and instead just add additional
10895 logic to ensure we always push/pop RegisterFiles when executing getters
10896 and setters, similar to the logic for valueOf and toString.
10899 (KJS::Machine::privateExecute):
10900 * VM/RegisterFile.h:
10901 * kjs/function.cpp:
10902 (KJS::FunctionImp::callAsFunction):
10904 (KJS::JSObject::put):
10905 * kjs/property_slot.cpp:
10906 (KJS::PropertySlot::functionGetter):
10908 2008-05-01 Oliver Hunt <oliver@apple.com>
10912 Rename unsafeForReentry to safeForReentry to avoid double negatives.
10915 (KJS::Machine::privateExecute):
10916 * VM/RegisterFile.h:
10917 * kjs/function.cpp:
10918 (KJS::FunctionImp::callAsFunction):
10920 2008-05-01 Oliver Hunt <oliver@apple.com>
10922 Reviewed by Maciej.
10924 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
10925 <https://bugs.webkit.org/show_bug.cgi?id=18827>
10927 This patch makes getters and setters work. It does this by
10928 tracking whether the RegisterFile is "safe", that is whether
10929 the interpreter is in a state that in which it can handle
10930 the RegisterFile being reallocated.
10934 (KJS::Machine::privateExecute):
10935 * VM/RegisterFile.h:
10936 * kjs/function.cpp:
10937 (KJS::FunctionImp::callAsFunction):
10939 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10941 Release build fix: Always compile in "isGlobalObject", since it's
10942 listed in our .exp file.
10944 * kjs/ExecState.cpp:
10945 (KJS::ExecState::isGlobalObject):
10948 2008-04-30 Oliver Hunt <oliver@apple.com>
10950 Reviewed by Maciej.
10952 Minor code restructuring to prepare for getters and setters,
10953 also helps exception semantics a bit.
10956 (KJS::Machine::privateExecute):
10958 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10964 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10966 Debug build fix: export a missing symbol.
10968 * JavaScriptCore.exp:
10970 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10972 Reviewed by Oliver Hunt.
10974 A little more ExecState refactoring: Now, only the global object creates
10977 Also inlined ExecState::lexicalGlobalObject().
10979 SunSpider reports no change.
10981 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10983 WebCore build fix: forward-declare ScopeChain.
10985 * kjs/interpreter.h:
10987 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10989 Build fix for JavaScriptGlue: export a missing symbol.
10991 * JavaScriptCore.exp:
10993 2008-04-30 Geoffrey Garen <ggaren@apple.com>
10995 Reviewed by Oliver Hunt.
10997 Removed a lot of unused bits from ExecState, moving them into
10998 OldInterpreterExecState, the fake scaffolding class.
11000 The clutter was making it hard to see the forest from the trees.
11002 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
11005 2008-04-29 Oliver Hunt <oliver@apple.com>
11007 Reviewed by Maciej.
11009 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
11010 <https://bugs.webkit.org/show_bug.cgi?id=18643>
11012 Prevent static slot optimisation for new variables and functions in
11013 globally re-entrant code called from an an implicit function call.
11015 This is necessary to prevent us from needing to resize the global
11016 slot portion of the root RegisterFile during an implicit (and hence
11017 unguarded) function call.
11019 * VM/CodeGenerator.cpp:
11020 (KJS::CodeGenerator::CodeGenerator):
11021 * VM/CodeGenerator.h:
11023 (KJS::Machine::execute):
11024 * VM/RegisterFile.h:
11025 * VM/RegisterFileStack.cpp:
11026 (KJS::RegisterFileStack::pushGlobalRegisterFile):
11027 (KJS::RegisterFileStack::popGlobalRegisterFile):
11028 (KJS::RegisterFileStack::pushFunctionRegisterFile):
11029 (KJS::RegisterFileStack::popFunctionRegisterFile):
11030 * VM/RegisterFileStack.h:
11031 (KJS::RegisterFileStack::inImplicitFunctionCall):
11032 (KJS::RegisterFileStack::lastGlobal):
11034 (KJS::ProgramNode::generateCode):
11036 (KJS::ProgramNode::):
11038 2008-04-29 Geoffrey Garen <ggaren@apple.com>
11040 Reviewed by Oliver Hunt.
11042 In nested program code, don't propogate "this" back to the parent
11043 register file. ("this" should remain constant in the parent register
11044 file, regardless of the scripts it invokes.)
11046 * VM/RegisterFile.cpp:
11047 (KJS::RegisterFile::copyGlobals):
11049 2008-04-28 Oliver Hunt <oliver@apple.com>
11053 Restore base pointer when popping a global RegisterFile
11055 * VM/RegisterFileStack.cpp:
11056 (KJS::RegisterFileStack::popGlobalRegisterFile):
11058 2008-04-28 Oliver Hunt <oliver@apple.com>
11062 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
11063 <https://bugs.webkit.org/show_bug.cgi?id=18643>
11065 Partial fix. This results in all implicit calls to toString or valueOf
11066 executing in a separate RegisterFile, so ensuring that the the pointers
11067 in the triggering interpreter don't get trashed. This still leaves the
11068 task of preventing new global re-entry from toString and valueOf from
11069 clobbering the RegisterFile.
11072 (KJS::Machine::execute):
11073 * VM/RegisterFileStack.cpp:
11074 (KJS::RegisterFileStack::pushFunctionRegisterFile):
11075 (KJS::RegisterFileStack::popFunctionRegisterFile):
11076 * VM/RegisterFileStack.h:
11078 (KJS::tryGetAndCallProperty):
11080 2008-04-28 Geoffrey Garen <ggaren@apple.com>
11082 Reviewed by Maciej Stachowiak.
11084 Simplified activation object a bit: No need to store the callee
11085 in the activation object -- we can pull it out of the call frame
11086 when needed, instead.
11088 SunSpider reports no change.
11090 2008-04-28 Geoffrey Garen <ggaren@apple.com>
11092 Reviewed by Maciej Stachowiak.
11094 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
11096 Substantially more handling of "arguments": "arguments" works fully
11097 now, but "f.arguments" still doesn't work.
11099 Fixes 10 regression tests.
11101 SunSpider reports no regression.
11103 * kjs/JSActivation.cpp:
11104 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
11105 List to pass to the arguments object constructor.
11107 * JavaScriptCore.xcodeproj/project.pbxproj:
11108 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
11109 because that seems to make GCC happy. (Previously, I had added
11110 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
11111 happy. So it goes.)
11113 2008-04-28 Geoffrey Garen <ggaren@apple.com>
11115 Reviewed by Maciej Stachowiak.
11117 Groundwork for more handling of "arguments". I'm not checking in the
11118 actual handling of "arguments" yet, because it still needs a little
11119 fiddling to avoid a performance regression.
11121 SunSpider reports no change.
11124 (KJS::initializeCallFrame): Put argc in the register file, so the
11125 arguments object can find it later, to determine arguments.length.
11128 (KJS::FunctionBodyNode::): Added a special code accessor for when you
11129 know the code has already been generated, and you don't have a scopeChain
11130 to supply for potential code generation. (This is the case when the
11131 activation object creates the arguments object.)
11133 2008-04-28 Oliver Hunt <oliver@apple.com>
11137 Replace unsafe use of auto_ptr in Vector with manual memory
11140 * VM/RegisterFileStack.cpp:
11141 (KJS::RegisterFileStack::~RegisterFileStack):
11142 (KJS::RegisterFileStack::popRegisterFile):
11143 * VM/RegisterFileStack.h:
11145 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11147 Reviewed by Maciej.
11149 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
11150 <https://bugs.webkit.org/show_bug.cgi?id=18746>
11152 Change the base to the correct value of the 'this' object after the direct
11153 eval test instead of before.
11155 Fixes 5 layout tests.
11158 (KJS::Machine::privateExecute):
11160 (KJS::EvalFunctionCallNode::emitCode):
11162 2008-04-26 Maciej Stachowiak <mjs@apple.com>
11164 Reviewed by Oliver.
11166 - document all property getting, setting and deleting opcodes
11168 (And fix function parameter names to match corresponding opcode parameter names.)
11170 * VM/CodeGenerator.cpp:
11171 (KJS::CodeGenerator::emitResolve):
11172 (KJS::CodeGenerator::emitResolveBase):
11173 (KJS::CodeGenerator::emitResolveBaseAndProperty):
11174 (KJS::CodeGenerator::emitResolveBaseAndFunc):
11175 (KJS::CodeGenerator::emitGetPropId):
11176 (KJS::CodeGenerator::emitPutPropId):
11177 (KJS::CodeGenerator::emitDeletePropId):
11178 (KJS::CodeGenerator::emitPutPropVal):
11179 * VM/CodeGenerator.h:
11182 (KJS::resolveBase):
11183 (KJS::resolveBaseAndProperty):
11184 (KJS::resolveBaseAndFunc):
11185 (KJS::Machine::privateExecute):
11187 (KJS::ResolveNode::emitCode):
11188 (KJS::ArrayNode::emitCode):
11189 (KJS::PropertyListNode::emitCode):
11190 (KJS::BracketAccessorNode::emitCode):
11191 (KJS::EvalFunctionCallNode::emitCode):
11192 (KJS::FunctionCallResolveNode::emitCode):
11193 (KJS::FunctionCallBracketNode::emitCode):
11194 (KJS::PostIncResolveNode::emitCode):
11195 (KJS::PostDecResolveNode::emitCode):
11196 (KJS::PostIncBracketNode::emitCode):
11197 (KJS::PostDecBracketNode::emitCode):
11198 (KJS::PostIncDotNode::emitCode):
11199 (KJS::PostDecDotNode::emitCode):
11200 (KJS::DeleteResolveNode::emitCode):
11201 (KJS::TypeOfResolveNode::emitCode):
11202 (KJS::PreIncResolveNode::emitCode):
11203 (KJS::PreDecResolveNode::emitCode):
11204 (KJS::PreIncBracketNode::emitCode):
11205 (KJS::PreDecBracketNode::emitCode):
11206 (KJS::AssignResolveNode::emitCode):
11207 (KJS::AssignDotNode::emitCode):
11208 (KJS::ReadModifyDotNode::emitCode):
11209 (KJS::AssignBracketNode::emitCode):
11210 (KJS::ReadModifyBracketNode::emitCode):
11211 (KJS::ConstDeclNode::emitCodeSingle):
11213 2008-04-26 Oliver Hunt <oliver@apple.com>
11215 Reviewed by Maciej.
11217 Bug 18628: SQUIRRELFISH: need to support recursion limit
11218 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11220 Basically completes recursion limiting. There is still some
11221 tuning we may want to do to make things better in the face of
11222 very bad code, but certainly nothing worse than anything already
11225 Also fixes a WebKit test by fixing the exception text :D
11227 * JavaScriptCore.exp:
11228 * VM/ExceptionHelpers.cpp:
11230 (KJS::Machine::execute):
11231 * VM/RegisterFile.cpp:
11232 (KJS::RegisterFile::growBuffer):
11233 (KJS::RegisterFile::addGlobalSlots):
11234 * VM/RegisterFile.h:
11235 (KJS::RegisterFile::grow):
11236 (KJS::RegisterFile::uncheckedGrow):
11237 * VM/RegisterFileStack.cpp:
11238 (KJS::RegisterFileStack::pushRegisterFile):
11239 * VM/RegisterFileStack.h:
11241 2008-04-25 Oliver Hunt <oliver@apple.com>
11245 Bug 18628: SQUIRRELFISH: need to support recursion limit
11246 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11248 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
11249 seems reasonable as it is greater than the old eval limit, and a long way short of
11250 the reentry depth needed to overflow the stack.
11253 (KJS::Machine::execute):
11256 2008-04-25 Geoffrey Garen <ggaren@apple.com>
11258 Reviewed by Sam Weinig.
11260 A tiny bit of cleanup to the regexp code.
11262 Removed some static_cast.
11264 Removed createRegExpImp because it's no longer used.
11266 2008-04-25 Oliver Hunt <oliver@apple.com>
11268 Reviewed by Maciej.
11270 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
11271 <https://bugs.webkit.org/show_bug.cgi?id=18736>
11273 Ensure the "default" target is correct in the absence of an explicit default handler.
11276 (KJS::CaseBlockNode::emitCodeForBlock):
11278 2008-04-25 Oliver Hunt <oliver@apple.com>
11280 Reviewed by Maciej.
11282 Bug 18628: SQUIRRELFISH: need to support recursion limit
11283 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11285 More bounds checking.
11288 (KJS::Machine::execute):
11289 * VM/RegisterFile.cpp:
11290 (KJS::RegisterFile::growBuffer):
11291 * VM/RegisterFile.h:
11293 2008-04-25 Maciej Stachowiak <mjs@apple.com>
11295 Reviewed by Oliver.
11297 - fix signal catching magic
11299 The signal handlers are restored to _exit but are only set when
11300 running under run-javascriptcore-tests. fprintf from a signal
11301 handler is not safe.
11306 * tests/mozilla/jsDriver.pl:
11308 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11310 Reviewed by Maciej.
11312 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
11313 <https://bugs.webkit.org/show_bug.cgi?id=18732>
11315 Fixes another regression test.
11318 (KJS::Machine::privateExecute):
11320 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11322 Reviewed by Maciej.
11324 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
11325 <https://bugs.webkit.org/show_bug.cgi?id=18728>
11327 Fixes another regression test.
11330 (KJS::RegExpNode::emitCode):
11332 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11334 Reviewed by Geoffrey Garen.
11336 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
11337 <https://bugs.webkit.org/show_bug.cgi?id=18735>
11339 The overloaded toThisObject method was not copied over to JSActivation.
11341 Fixes two regression tests.
11343 * kjs/JSActivation.cpp:
11344 (KJS::JSActivation::toThisObject):
11345 * kjs/JSActivation.h:
11347 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11349 Reviewed by Oliver Hunt.
11351 Added support for arguments.callee.
11353 2008-04-24 Oliver Hunt <oliver@apple.com>
11355 Reviewed by Maciej.
11357 Bug 18628: SQUIRRELFISH: need to support recursion limit
11358 <https://bugs.webkit.org/show_bug.cgi?id=18628>
11360 Partial fix -- this gets us some of the required bounds checking, but not
11361 complete coverage. But it does manage to do them without regressing :D
11363 * VM/ExceptionHelpers.cpp:
11364 (KJS::createError):
11365 (KJS::createStackOverflowError):
11366 * VM/ExceptionHelpers.h:
11368 (KJS::slideRegisterWindowForCall):
11369 (KJS::Machine::execute):
11370 (KJS::Machine::privateExecute):
11371 * VM/RegisterFile.cpp:
11372 * VM/RegisterFile.h:
11373 (KJS::RegisterFile::):
11374 (KJS::RegisterFile::RegisterFile):
11375 (KJS::RegisterFile::grow):
11377 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11379 Reviewed by Oliver Hunt.
11381 A tiny bit more handling of "arguments": create a real, but mostly
11382 hollow, arguments object.
11384 Fixes 2 regression tests.
11386 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11388 Reviewed by Oliver.
11390 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
11391 <https://bugs.webkit.org/show_bug.cgi?id=18717>
11393 Fixes a regression test, but exposes the failure of another due to the
11394 lack of getters and setters.
11397 (KJS::ConstDeclNode::emitCodeSingle):
11398 (KJS::ConstDeclNode::emitCode):
11399 (KJS::ConstStatementNode::emitCode):
11400 (KJS::VarStatementNode::emitCode):
11403 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11405 Reviewed by Sam Weinig.
11407 Print a CRASH statement when crashing, so test failures are not a
11414 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11416 Reviewed by Geoffrey Garen.
11418 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
11419 <https://bugs.webkit.org/show_bug.cgi?id=18716>
11421 This fixes 2 more regression tests.
11424 (KJS::TypeOfResolveNode::emitCode):
11426 2008-04-24 Geoffrey Garen <ggaren@apple.com>
11428 Reviewed by Sam Weinig.
11430 Put the callee in the call frame.
11432 Necessary in order to support "arguments" and "arguments.callee".
11434 Also fixes a latent GC bug, where an executing function could be
11435 subject to GC if the register holding it were overwritten. Here's
11436 an example that would have caused problems:
11440 // Flood the machine stack to eliminate any old pointers to f.
11443 // Overwrite f in the register file.
11447 for (var i = 0; i < 5000; ++i) {
11451 // Welcome to crash-ville.
11460 * VM/Machine.h: Changed the order of arguments to
11461 execute(FunctionBodyNode*...) to match the other execute functions.
11462 * kjs/function.cpp: Updated to match new argument requirements from
11463 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
11464 rest of JavaScriptCore.
11466 SunSpider reports no change.
11468 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
11470 Reviewed by Maciej.
11472 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
11473 <https://bugs.webkit.org/show_bug.cgi?id=18707>
11475 This fixes 4 more regression tests.
11480 2008-04-23 Maciej Stachowiak <mjs@apple.com>
11482 Reviewed by Oliver.
11484 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
11488 * VM/SegmentedVector.h:
11489 (KJS::SegmentedVector::grow):
11491 2008-04-23 Geoffrey Garen <ggaren@apple.com>
11493 Reviewed by Maciej Stachowiak.
11495 Degenerate handling of "arguments" as a property of the activation
11496 object. Currently, we just return a vanilla object.
11498 SunSpider reports no change.
11502 ecma_3/Function/regress-94506.js.
11504 Reveals to have been secretly broken:
11506 ecma_3/Function/15.3.4.3-1.js
11507 ecma_3/Function/15.3.4.4-1.js
11509 These tests were passing incorrectly. testkjs creates a global array
11510 named "arguments" to hold command-line arguments. That array was
11511 tricking these tests into thinking that an arguments object with length
11512 0 had been created. Since our new vanilla object shadows the global
11513 property named arguments, that object no longer fools these tests into
11516 Net change: +1 failing test.
11518 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
11519 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
11521 2008-04-23 Maciej Stachowiak <mjs@apple.com>
11523 Reviewed by Oliver.
11525 - save and restore callFrame
11528 (KJS::slideRegisterWindowForCall):
11529 (KJS::Machine::execute):
11530 (KJS::Machine::privateExecute):
11534 2008-04-23 Geoffrey Garen <ggaren@apple.com>
11536 Reviewed by Maciej Stachowiak.
11538 Fixed scopes for named function expressions.
11540 Fixes one regression test.
11544 (1) The function's name is supposed to have attributes DontDelete,
11545 ReadOnly, regardless of the type of code executing.
11547 (2) Push the name object on the function's scope chain, rather than
11548 the ExecState's scope chain because, well, that's where it belongs.
11550 2008-04-23 Geoffrey Garen <ggaren@apple.com>
11552 Reviewed by Oliver Hunt.
11554 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
11556 I did this as a first step toward removing nodes.cpp from
11557 AllInOneFile.cpp, but I'm putting that larger project aside for now.
11559 2008-04-23 Maciej Stachowiak <mjs@apple.com>
11561 Rubber stamped by Geoff.
11563 - add OldInterpreterExecState class and use it in dead code
11565 This will allow removing things from the real ExecState class
11566 without having to figure out how to remove all this code without
11567 getting a perf regression.
11570 (KJS::ExpressionNode::evaluateToNumber):
11571 (KJS::ExpressionNode::evaluateToBoolean):
11572 (KJS::ExpressionNode::evaluateToInt32):
11573 (KJS::ExpressionNode::evaluateToUInt32):
11574 (KJS::Node::setErrorCompletion):
11575 (KJS::Node::throwError):
11576 (KJS::Node::throwUndefinedVariableError):
11577 (KJS::Node::handleException):
11578 (KJS::Node::rethrowException):
11579 (KJS::BreakpointCheckStatement::execute):
11580 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
11581 (KJS::NullNode::evaluate):
11582 (KJS::FalseNode::evaluate):
11583 (KJS::TrueNode::evaluate):
11584 (KJS::NumberNode::evaluate):
11585 (KJS::NumberNode::evaluateToNumber):
11586 (KJS::NumberNode::evaluateToBoolean):
11587 (KJS::NumberNode::evaluateToInt32):
11588 (KJS::NumberNode::evaluateToUInt32):
11589 (KJS::ImmediateNumberNode::evaluate):
11590 (KJS::ImmediateNumberNode::evaluateToInt32):
11591 (KJS::ImmediateNumberNode::evaluateToUInt32):
11592 (KJS::StringNode::evaluate):
11593 (KJS::StringNode::evaluateToNumber):
11594 (KJS::StringNode::evaluateToBoolean):
11595 (KJS::RegExpNode::evaluate):
11596 (KJS::ThisNode::evaluate):
11597 (KJS::ResolveNode::inlineEvaluate):
11598 (KJS::ResolveNode::evaluate):
11599 (KJS::ResolveNode::evaluateToNumber):
11600 (KJS::ResolveNode::evaluateToBoolean):
11601 (KJS::ResolveNode::evaluateToInt32):
11602 (KJS::ResolveNode::evaluateToUInt32):
11603 (KJS::getSymbolTableEntry):
11604 (KJS::ResolveNode::optimizeVariableAccess):
11605 (KJS::LocalVarAccessNode::inlineEvaluate):
11606 (KJS::LocalVarAccessNode::evaluate):
11607 (KJS::LocalVarAccessNode::evaluateToNumber):
11608 (KJS::LocalVarAccessNode::evaluateToBoolean):
11609 (KJS::LocalVarAccessNode::evaluateToInt32):
11610 (KJS::LocalVarAccessNode::evaluateToUInt32):
11611 (KJS::getNonLocalSymbol):
11612 (KJS::ScopedVarAccessNode::inlineEvaluate):
11613 (KJS::ScopedVarAccessNode::evaluate):
11614 (KJS::ScopedVarAccessNode::evaluateToNumber):
11615 (KJS::ScopedVarAccessNode::evaluateToBoolean):
11616 (KJS::ScopedVarAccessNode::evaluateToInt32):
11617 (KJS::ScopedVarAccessNode::evaluateToUInt32):
11618 (KJS::NonLocalVarAccessNode::inlineEvaluate):
11619 (KJS::NonLocalVarAccessNode::evaluate):
11620 (KJS::NonLocalVarAccessNode::evaluateToNumber):
11621 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
11622 (KJS::NonLocalVarAccessNode::evaluateToInt32):
11623 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
11624 (KJS::ElementNode::optimizeVariableAccess):
11625 (KJS::ElementNode::evaluate):
11626 (KJS::ArrayNode::optimizeVariableAccess):
11627 (KJS::ArrayNode::evaluate):
11628 (KJS::ObjectLiteralNode::optimizeVariableAccess):
11629 (KJS::ObjectLiteralNode::evaluate):
11630 (KJS::PropertyListNode::optimizeVariableAccess):
11631 (KJS::PropertyListNode::evaluate):
11632 (KJS::PropertyNode::optimizeVariableAccess):
11633 (KJS::PropertyNode::evaluate):
11634 (KJS::BracketAccessorNode::optimizeVariableAccess):
11635 (KJS::BracketAccessorNode::inlineEvaluate):
11636 (KJS::BracketAccessorNode::evaluate):
11637 (KJS::BracketAccessorNode::evaluateToNumber):
11638 (KJS::BracketAccessorNode::evaluateToBoolean):
11639 (KJS::BracketAccessorNode::evaluateToInt32):
11640 (KJS::BracketAccessorNode::evaluateToUInt32):
11641 (KJS::DotAccessorNode::optimizeVariableAccess):
11642 (KJS::DotAccessorNode::inlineEvaluate):
11643 (KJS::DotAccessorNode::evaluate):
11644 (KJS::DotAccessorNode::evaluateToNumber):
11645 (KJS::DotAccessorNode::evaluateToBoolean):
11646 (KJS::DotAccessorNode::evaluateToInt32):
11647 (KJS::DotAccessorNode::evaluateToUInt32):
11648 (KJS::ArgumentListNode::optimizeVariableAccess):
11649 (KJS::ArgumentListNode::evaluateList):
11650 (KJS::ArgumentsNode::optimizeVariableAccess):
11651 (KJS::NewExprNode::optimizeVariableAccess):
11652 (KJS::NewExprNode::inlineEvaluate):
11653 (KJS::NewExprNode::evaluate):
11654 (KJS::NewExprNode::evaluateToNumber):
11655 (KJS::NewExprNode::evaluateToBoolean):
11656 (KJS::NewExprNode::evaluateToInt32):
11657 (KJS::NewExprNode::evaluateToUInt32):
11658 (KJS::ExpressionNode::resolveAndCall):
11659 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
11660 (KJS::EvalFunctionCallNode::evaluate):
11661 (KJS::FunctionCallValueNode::optimizeVariableAccess):
11662 (KJS::FunctionCallValueNode::evaluate):
11663 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
11664 (KJS::FunctionCallResolveNode::inlineEvaluate):
11665 (KJS::FunctionCallResolveNode::evaluate):
11666 (KJS::FunctionCallResolveNode::evaluateToNumber):
11667 (KJS::FunctionCallResolveNode::evaluateToBoolean):
11668 (KJS::FunctionCallResolveNode::evaluateToInt32):
11669 (KJS::FunctionCallResolveNode::evaluateToUInt32):
11670 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
11671 (KJS::LocalVarFunctionCallNode::evaluate):
11672 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
11673 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
11674 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
11675 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
11676 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
11677 (KJS::ScopedVarFunctionCallNode::evaluate):
11678 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
11679 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
11680 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
11681 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
11682 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
11683 (KJS::NonLocalVarFunctionCallNode::evaluate):
11684 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
11685 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
11686 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
11687 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
11688 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
11689 (KJS::FunctionCallBracketNode::evaluate):
11690 (KJS::FunctionCallDotNode::optimizeVariableAccess):
11691 (KJS::FunctionCallDotNode::inlineEvaluate):
11692 (KJS::FunctionCallDotNode::evaluate):
11693 (KJS::FunctionCallDotNode::evaluateToNumber):
11694 (KJS::FunctionCallDotNode::evaluateToBoolean):
11695 (KJS::FunctionCallDotNode::evaluateToInt32):
11696 (KJS::FunctionCallDotNode::evaluateToUInt32):
11697 (KJS::PostIncResolveNode::optimizeVariableAccess):
11698 (KJS::PostIncResolveNode::evaluate):
11699 (KJS::PostIncLocalVarNode::evaluate):
11700 (KJS::PostDecResolveNode::optimizeVariableAccess):
11701 (KJS::PostDecResolveNode::evaluate):
11702 (KJS::PostDecLocalVarNode::evaluate):
11703 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
11704 (KJS::PostDecLocalVarNode::evaluateToNumber):
11705 (KJS::PostDecLocalVarNode::evaluateToBoolean):
11706 (KJS::PostDecLocalVarNode::evaluateToInt32):
11707 (KJS::PostDecLocalVarNode::evaluateToUInt32):
11708 (KJS::PostfixBracketNode::optimizeVariableAccess):
11709 (KJS::PostIncBracketNode::evaluate):
11710 (KJS::PostDecBracketNode::evaluate):
11711 (KJS::PostfixDotNode::optimizeVariableAccess):
11712 (KJS::PostIncDotNode::evaluate):
11713 (KJS::PostDecDotNode::evaluate):
11714 (KJS::PostfixErrorNode::evaluate):
11715 (KJS::DeleteResolveNode::optimizeVariableAccess):
11716 (KJS::DeleteResolveNode::evaluate):
11717 (KJS::LocalVarDeleteNode::evaluate):
11718 (KJS::DeleteBracketNode::optimizeVariableAccess):
11719 (KJS::DeleteBracketNode::evaluate):
11720 (KJS::DeleteDotNode::optimizeVariableAccess):
11721 (KJS::DeleteDotNode::evaluate):
11722 (KJS::DeleteValueNode::optimizeVariableAccess):
11723 (KJS::DeleteValueNode::evaluate):
11724 (KJS::VoidNode::optimizeVariableAccess):
11725 (KJS::VoidNode::evaluate):
11726 (KJS::TypeOfValueNode::optimizeVariableAccess):
11727 (KJS::TypeOfResolveNode::optimizeVariableAccess):
11728 (KJS::LocalVarTypeOfNode::evaluate):
11729 (KJS::TypeOfResolveNode::evaluate):
11730 (KJS::TypeOfValueNode::evaluate):
11731 (KJS::PreIncResolveNode::optimizeVariableAccess):
11732 (KJS::PreIncLocalVarNode::evaluate):
11733 (KJS::PreIncResolveNode::evaluate):
11734 (KJS::PreDecResolveNode::optimizeVariableAccess):
11735 (KJS::PreDecLocalVarNode::evaluate):
11736 (KJS::PreDecResolveNode::evaluate):
11737 (KJS::PreIncConstNode::evaluate):
11738 (KJS::PreDecConstNode::evaluate):
11739 (KJS::PostIncConstNode::evaluate):
11740 (KJS::PostDecConstNode::evaluate):
11741 (KJS::PrefixBracketNode::optimizeVariableAccess):
11742 (KJS::PreIncBracketNode::evaluate):
11743 (KJS::PreDecBracketNode::evaluate):
11744 (KJS::PrefixDotNode::optimizeVariableAccess):
11745 (KJS::PreIncDotNode::evaluate):
11746 (KJS::PreDecDotNode::evaluate):
11747 (KJS::PrefixErrorNode::evaluate):
11748 (KJS::UnaryPlusNode::optimizeVariableAccess):
11749 (KJS::UnaryPlusNode::evaluate):
11750 (KJS::UnaryPlusNode::evaluateToBoolean):
11751 (KJS::UnaryPlusNode::evaluateToNumber):
11752 (KJS::UnaryPlusNode::evaluateToInt32):
11753 (KJS::UnaryPlusNode::evaluateToUInt32):
11754 (KJS::NegateNode::optimizeVariableAccess):
11755 (KJS::NegateNode::evaluate):
11756 (KJS::NegateNode::evaluateToNumber):
11757 (KJS::BitwiseNotNode::optimizeVariableAccess):
11758 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
11759 (KJS::BitwiseNotNode::evaluate):
11760 (KJS::BitwiseNotNode::evaluateToNumber):
11761 (KJS::BitwiseNotNode::evaluateToBoolean):
11762 (KJS::BitwiseNotNode::evaluateToInt32):
11763 (KJS::BitwiseNotNode::evaluateToUInt32):
11764 (KJS::LogicalNotNode::optimizeVariableAccess):
11765 (KJS::LogicalNotNode::evaluate):
11766 (KJS::LogicalNotNode::evaluateToBoolean):
11767 (KJS::MultNode::optimizeVariableAccess):
11768 (KJS::MultNode::inlineEvaluateToNumber):
11769 (KJS::MultNode::evaluate):
11770 (KJS::MultNode::evaluateToNumber):
11771 (KJS::MultNode::evaluateToBoolean):
11772 (KJS::MultNode::evaluateToInt32):
11773 (KJS::MultNode::evaluateToUInt32):
11774 (KJS::DivNode::optimizeVariableAccess):
11775 (KJS::DivNode::inlineEvaluateToNumber):
11776 (KJS::DivNode::evaluate):
11777 (KJS::DivNode::evaluateToNumber):
11778 (KJS::DivNode::evaluateToInt32):
11779 (KJS::DivNode::evaluateToUInt32):
11780 (KJS::ModNode::optimizeVariableAccess):
11781 (KJS::ModNode::inlineEvaluateToNumber):
11782 (KJS::ModNode::evaluate):
11783 (KJS::ModNode::evaluateToNumber):
11784 (KJS::ModNode::evaluateToBoolean):
11785 (KJS::ModNode::evaluateToInt32):
11786 (KJS::ModNode::evaluateToUInt32):
11787 (KJS::throwOutOfMemoryErrorToNumber):
11788 (KJS::addSlowCase):
11789 (KJS::addSlowCaseToNumber):
11791 (KJS::addToNumber):
11792 (KJS::AddNode::optimizeVariableAccess):
11793 (KJS::AddNode::evaluate):
11794 (KJS::AddNode::inlineEvaluateToNumber):
11795 (KJS::AddNode::evaluateToNumber):
11796 (KJS::AddNode::evaluateToInt32):
11797 (KJS::AddNode::evaluateToUInt32):
11798 (KJS::AddNumbersNode::inlineEvaluateToNumber):
11799 (KJS::AddNumbersNode::evaluate):
11800 (KJS::AddNumbersNode::evaluateToNumber):
11801 (KJS::AddNumbersNode::evaluateToInt32):
11802 (KJS::AddNumbersNode::evaluateToUInt32):
11803 (KJS::AddStringsNode::evaluate):
11804 (KJS::AddStringLeftNode::evaluate):
11805 (KJS::AddStringRightNode::evaluate):
11806 (KJS::SubNode::optimizeVariableAccess):
11807 (KJS::SubNode::inlineEvaluateToNumber):
11808 (KJS::SubNode::evaluate):
11809 (KJS::SubNode::evaluateToNumber):
11810 (KJS::SubNode::evaluateToInt32):
11811 (KJS::SubNode::evaluateToUInt32):
11812 (KJS::LeftShiftNode::optimizeVariableAccess):
11813 (KJS::LeftShiftNode::inlineEvaluateToInt32):
11814 (KJS::LeftShiftNode::evaluate):
11815 (KJS::LeftShiftNode::evaluateToNumber):
11816 (KJS::LeftShiftNode::evaluateToInt32):
11817 (KJS::LeftShiftNode::evaluateToUInt32):
11818 (KJS::RightShiftNode::optimizeVariableAccess):
11819 (KJS::RightShiftNode::inlineEvaluateToInt32):
11820 (KJS::RightShiftNode::evaluate):
11821 (KJS::RightShiftNode::evaluateToNumber):
11822 (KJS::RightShiftNode::evaluateToInt32):
11823 (KJS::RightShiftNode::evaluateToUInt32):
11824 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
11825 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
11826 (KJS::UnsignedRightShiftNode::evaluate):
11827 (KJS::UnsignedRightShiftNode::evaluateToNumber):
11828 (KJS::UnsignedRightShiftNode::evaluateToInt32):
11829 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
11832 (KJS::LessNode::optimizeVariableAccess):
11833 (KJS::LessNode::inlineEvaluateToBoolean):
11834 (KJS::LessNode::evaluate):
11835 (KJS::LessNode::evaluateToBoolean):
11836 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
11837 (KJS::LessNumbersNode::evaluate):
11838 (KJS::LessNumbersNode::evaluateToBoolean):
11839 (KJS::LessStringsNode::inlineEvaluateToBoolean):
11840 (KJS::LessStringsNode::evaluate):
11841 (KJS::LessStringsNode::evaluateToBoolean):
11842 (KJS::GreaterNode::optimizeVariableAccess):
11843 (KJS::GreaterNode::inlineEvaluateToBoolean):
11844 (KJS::GreaterNode::evaluate):
11845 (KJS::GreaterNode::evaluateToBoolean):
11846 (KJS::LessEqNode::optimizeVariableAccess):
11847 (KJS::LessEqNode::inlineEvaluateToBoolean):
11848 (KJS::LessEqNode::evaluate):
11849 (KJS::LessEqNode::evaluateToBoolean):
11850 (KJS::GreaterEqNode::optimizeVariableAccess):
11851 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
11852 (KJS::GreaterEqNode::evaluate):
11853 (KJS::GreaterEqNode::evaluateToBoolean):
11854 (KJS::InstanceOfNode::optimizeVariableAccess):
11855 (KJS::InstanceOfNode::evaluate):
11856 (KJS::InstanceOfNode::evaluateToBoolean):
11857 (KJS::InNode::optimizeVariableAccess):
11858 (KJS::InNode::evaluate):
11859 (KJS::InNode::evaluateToBoolean):
11860 (KJS::EqualNode::optimizeVariableAccess):
11861 (KJS::EqualNode::inlineEvaluateToBoolean):
11862 (KJS::EqualNode::evaluate):
11863 (KJS::EqualNode::evaluateToBoolean):
11864 (KJS::NotEqualNode::optimizeVariableAccess):
11865 (KJS::NotEqualNode::inlineEvaluateToBoolean):
11866 (KJS::NotEqualNode::evaluate):
11867 (KJS::NotEqualNode::evaluateToBoolean):
11868 (KJS::StrictEqualNode::optimizeVariableAccess):
11869 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
11870 (KJS::StrictEqualNode::evaluate):
11871 (KJS::StrictEqualNode::evaluateToBoolean):
11872 (KJS::NotStrictEqualNode::optimizeVariableAccess):
11873 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
11874 (KJS::NotStrictEqualNode::evaluate):
11875 (KJS::NotStrictEqualNode::evaluateToBoolean):
11876 (KJS::BitAndNode::optimizeVariableAccess):
11877 (KJS::BitAndNode::evaluate):
11878 (KJS::BitAndNode::inlineEvaluateToInt32):
11879 (KJS::BitAndNode::evaluateToNumber):
11880 (KJS::BitAndNode::evaluateToBoolean):
11881 (KJS::BitAndNode::evaluateToInt32):
11882 (KJS::BitAndNode::evaluateToUInt32):
11883 (KJS::BitXOrNode::optimizeVariableAccess):
11884 (KJS::BitXOrNode::inlineEvaluateToInt32):
11885 (KJS::BitXOrNode::evaluate):
11886 (KJS::BitXOrNode::evaluateToNumber):
11887 (KJS::BitXOrNode::evaluateToBoolean):
11888 (KJS::BitXOrNode::evaluateToInt32):
11889 (KJS::BitXOrNode::evaluateToUInt32):
11890 (KJS::BitOrNode::optimizeVariableAccess):
11891 (KJS::BitOrNode::inlineEvaluateToInt32):
11892 (KJS::BitOrNode::evaluate):
11893 (KJS::BitOrNode::evaluateToNumber):
11894 (KJS::BitOrNode::evaluateToBoolean):
11895 (KJS::BitOrNode::evaluateToInt32):
11896 (KJS::BitOrNode::evaluateToUInt32):
11897 (KJS::LogicalAndNode::optimizeVariableAccess):
11898 (KJS::LogicalAndNode::evaluate):
11899 (KJS::LogicalAndNode::evaluateToBoolean):
11900 (KJS::LogicalOrNode::optimizeVariableAccess):
11901 (KJS::LogicalOrNode::evaluate):
11902 (KJS::LogicalOrNode::evaluateToBoolean):
11903 (KJS::ConditionalNode::optimizeVariableAccess):
11904 (KJS::ConditionalNode::evaluate):
11905 (KJS::ConditionalNode::evaluateToBoolean):
11906 (KJS::ConditionalNode::evaluateToNumber):
11907 (KJS::ConditionalNode::evaluateToInt32):
11908 (KJS::ConditionalNode::evaluateToUInt32):
11909 (KJS::valueForReadModifyAssignment):
11910 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
11911 (KJS::AssignResolveNode::optimizeVariableAccess):
11912 (KJS::ReadModifyLocalVarNode::evaluate):
11913 (KJS::AssignLocalVarNode::evaluate):
11914 (KJS::ReadModifyConstNode::evaluate):
11915 (KJS::AssignConstNode::evaluate):
11916 (KJS::ReadModifyResolveNode::evaluate):
11917 (KJS::AssignResolveNode::evaluate):
11918 (KJS::AssignDotNode::optimizeVariableAccess):
11919 (KJS::AssignDotNode::evaluate):
11920 (KJS::ReadModifyDotNode::optimizeVariableAccess):
11921 (KJS::ReadModifyDotNode::evaluate):
11922 (KJS::AssignErrorNode::evaluate):
11923 (KJS::AssignBracketNode::optimizeVariableAccess):
11924 (KJS::AssignBracketNode::evaluate):
11925 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
11926 (KJS::ReadModifyBracketNode::evaluate):
11927 (KJS::CommaNode::optimizeVariableAccess):
11928 (KJS::CommaNode::evaluate):
11929 (KJS::ConstDeclNode::optimizeVariableAccess):
11930 (KJS::ConstDeclNode::handleSlowCase):
11931 (KJS::ConstDeclNode::evaluateSingle):
11932 (KJS::ConstDeclNode::evaluate):
11933 (KJS::ConstStatementNode::optimizeVariableAccess):
11934 (KJS::ConstStatementNode::execute):
11935 (KJS::statementListExecute):
11936 (KJS::BlockNode::optimizeVariableAccess):
11937 (KJS::BlockNode::execute):
11938 (KJS::EmptyStatementNode::execute):
11939 (KJS::ExprStatementNode::optimizeVariableAccess):
11940 (KJS::ExprStatementNode::execute):
11941 (KJS::VarStatementNode::optimizeVariableAccess):
11942 (KJS::VarStatementNode::execute):
11943 (KJS::IfNode::optimizeVariableAccess):
11944 (KJS::IfNode::execute):
11945 (KJS::IfElseNode::optimizeVariableAccess):
11946 (KJS::IfElseNode::execute):
11947 (KJS::DoWhileNode::optimizeVariableAccess):
11948 (KJS::DoWhileNode::execute):
11949 (KJS::WhileNode::optimizeVariableAccess):
11950 (KJS::WhileNode::execute):
11951 (KJS::ForNode::optimizeVariableAccess):
11952 (KJS::ForNode::execute):
11953 (KJS::ForInNode::optimizeVariableAccess):
11954 (KJS::ForInNode::execute):
11955 (KJS::ContinueNode::execute):
11956 (KJS::BreakNode::execute):
11957 (KJS::ReturnNode::optimizeVariableAccess):
11958 (KJS::ReturnNode::execute):
11959 (KJS::WithNode::optimizeVariableAccess):
11960 (KJS::WithNode::execute):
11961 (KJS::CaseClauseNode::optimizeVariableAccess):
11962 (KJS::CaseClauseNode::evaluate):
11963 (KJS::CaseClauseNode::executeStatements):
11964 (KJS::ClauseListNode::optimizeVariableAccess):
11965 (KJS::CaseBlockNode::optimizeVariableAccess):
11966 (KJS::CaseBlockNode::executeBlock):
11967 (KJS::SwitchNode::optimizeVariableAccess):
11968 (KJS::SwitchNode::execute):
11969 (KJS::LabelNode::optimizeVariableAccess):
11970 (KJS::LabelNode::execute):
11971 (KJS::ThrowNode::optimizeVariableAccess):
11972 (KJS::ThrowNode::execute):
11973 (KJS::TryNode::optimizeVariableAccess):
11974 (KJS::TryNode::execute):
11975 (KJS::ProgramNode::initializeSymbolTable):
11976 (KJS::ScopeNode::optimizeVariableAccess):
11977 (KJS::ProgramNode::processDeclarations):
11978 (KJS::EvalNode::processDeclarations):
11979 (KJS::ProgramNode::execute):
11980 (KJS::EvalNode::execute):
11981 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
11982 (KJS::FuncDeclNode::execute):
11983 (KJS::FuncExprNode::evaluate):
11986 (KJS::FalseNode::):
11988 (KJS::ArgumentsNode::):
11990 2008-04-23 Oliver Hunt <oliver@apple.com>
11994 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
11995 <https://bugs.webkit.org/show_bug.cgi?id=18672>
11997 Add a SegmentedVector type, which provides a Vector<T> which maintains
11998 existing memory locations during resize. This allows dynamically sizing
11999 local, temporary and label "vectors" in CodeGenerator.
12001 * JavaScriptCore.xcodeproj/project.pbxproj:
12002 * VM/CodeGenerator.cpp:
12003 (KJS::CodeGenerator::addVar):
12004 (KJS::CodeGenerator::CodeGenerator):
12005 (KJS::CodeGenerator::newTemporary):
12006 (KJS::CodeGenerator::newLabel):
12007 * VM/CodeGenerator.h:
12008 * VM/SegmentedVector.h: Added.
12009 (KJS::SegmentedVector::SegmentedVector):
12010 (KJS::SegmentedVector::~SegmentedVector):
12011 (KJS::SegmentedVector::last):
12012 (KJS::SegmentedVector::append):
12013 (KJS::SegmentedVector::removeLast):
12014 (KJS::SegmentedVector::size):
12015 (KJS::SegmentedVector::operator[]):
12016 (KJS::SegmentedVector::resize):
12017 (KJS::SegmentedVector::shrink):
12018 (KJS::SegmentedVector::grow):
12020 2008-04-23 Geoffrey Garen <ggaren@apple.com>
12022 Reviewed by Maciej Stachowiak.
12024 A little refactoring in preparation for supporting 'arguments'.
12026 Fixes 2 regression tests.
12028 SunSpider reports no change.
12030 We now check the activation register, instead of the codeBlock, to
12031 determine whether we need to tear off the activation. This is to support
12032 "f.arguments", which will create an activation/arguments pair for f,
12033 even though the needsFullScopeChain flag is false for f's codeBlock.
12035 The test fixes resulted from calling initializeCallFrame for re-entrant
12036 function code, instead of initializing (not enough) parts of the call
12039 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12043 - propagate the "this" value properly to local eval
12045 (fixes a measly one regression test)
12048 (KJS::CodeBlock::CodeBlock):
12049 (KJS::ProgramCodeBlock::ProgramCodeBlock):
12050 (KJS::EvalCodeBlock::EvalCodeBlock):
12052 (KJS::Machine::privateExecute):
12054 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12056 Reviewed by Maciej.
12058 Add support for function declarations in eval code.
12060 (this fixes 12 more regression tests)
12063 * VM/CodeGenerator.cpp:
12064 (KJS::CodeGenerator::CodeGenerator):
12065 * VM/CodeGenerator.h:
12067 (KJS::Machine::execute):
12069 (KJS::EvalNode::generateCode):
12071 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12073 Reviewed by Oliver.
12075 Implement LabelNode.
12077 * VM/CodeGenerator.cpp:
12078 (KJS::CodeGenerator::pushJumpContext):
12079 (KJS::CodeGenerator::jumpContextForContinue):
12080 (KJS::CodeGenerator::jumpContextForBreak):
12081 * VM/CodeGenerator.h:
12083 (KJS::DoWhileNode::emitCode):
12084 (KJS::WhileNode::emitCode):
12085 (KJS::ForNode::emitCode):
12086 (KJS::ForInNode::emitCode):
12087 (KJS::ContinueNode::emitCode):
12088 (KJS::BreakNode::emitCode):
12089 (KJS::SwitchNode::emitCode):
12090 (KJS::LabelNode::emitCode):
12092 2008-04-22 Geoffrey Garen <ggaren@apple.com>
12094 Reviewed by Oliver Hunt.
12096 Fixed crash when unwinding from exceptions inside eval.
12099 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
12100 current call frame's scope chain is an activation: it can be the global
12103 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12108 (main): Convert signals to exit codes, so that crashing tests are
12109 detected as regression test failures.
12111 2008-04-22 Geoffrey Garen <ggaren@apple.com>
12113 Reviewed by Oliver Hunt and Maciej Stachowiak.
12115 Renamed "needsActivation" to "needsFullScopeChain" because lying will
12116 make hair grow on the backs of your hands.
12118 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12120 Reviewed by Maciej Stachowiak.
12122 Fixed ScopeChainNode lifetime problems:
12124 (1) In "with" and "catch" scopes, we would construct a ScopeChain
12125 object and then jump across its destructor, leaking the ScopeChainNode
12128 (2) In global and eval scopes, we would fail to initially ref
12129 "scopeChain", causing us to overrelease it later. Now that we ref
12130 "scopeChain" properly, we also need to deref it when the script
12133 SunSpider reports a .2% regression, but an earlier round of ScopeChain
12134 refactoring was a .4% speedup, so there.
12136 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12138 Reviewed by Alexey.
12140 - use global object instead of null for "this" on unqualified calls
12142 This fixes 10 more JSC test regressions.
12145 (KJS::Machine::privateExecute):
12147 2008-04-22 Maciej Stachowiak <mjs@apple.com>
12149 Reviewed by Oliver.
12151 - throw proper exceptions for objects that don't implement call or construct
12153 This fixes 21 more JSC test regressions. It is also seemingly an
12156 * VM/ExceptionHelpers.cpp:
12157 (KJS::createNotAnObjectError):
12158 (KJS::createNotAConstructorError):
12159 (KJS::createNotAFunctionError):
12160 * VM/ExceptionHelpers.h:
12162 (KJS::Machine::privateExecute):
12164 2008-04-21 Oliver Hunt <oliver@apple.com>
12168 Implement emitCode for ConstDeclNode.
12170 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
12172 * VM/CodeGenerator.cpp:
12173 (KJS::CodeGenerator::registerForLocalConstInit):
12174 * VM/CodeGenerator.h:
12176 (KJS::AssignResolveNode::emitCode):
12177 (KJS::ConstDeclNode::emitCodeSingle):
12178 (KJS::ConstDeclNode::emitCode):
12179 (KJS::ConstStatementNode::emitCode):
12182 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12186 - add some support for the split window object
12188 This fixes many layout tests.
12191 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
12192 wrapper global, if one exists, as the "this" object.
12193 * kjs/function.cpp:
12194 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
12197 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12199 Reviewed by Oliver.
12201 - restore ScopeChain::operator= to avoid crash on many layout tests
12203 Otherwise, FunctionImp::setScope would cause a reference
12204 underflow. I implemented using the copy construct and swap idiom.
12206 * kjs/scope_chain.h:
12207 (KJS::ScopeChain::swap):
12208 (KJS::ScopeChain::operator=):
12210 2008-04-21 Oliver Hunt <oliver@apple.com>
12214 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
12215 <https://bugs.webkit.org/show_bug.cgi?id=18649>
12217 Allocate a callframe for eval() and initialise with a null codeBlock to
12218 indicate native code. This prevents the unwinder from clobbering the
12222 (KJS::Machine::execute):
12224 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12226 Reviewed by Sam Weinig.
12228 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
12229 ScopeChain::print to ScopeChainNode.
12231 ScopeChain is now nothing more than a resource-handling wrapper around
12234 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12236 Reviewed by Maciej.
12238 Bug 18671: SquirrelFish: continue inside switch fails
12239 <https://bugs.webkit.org/show_bug.cgi?id=18671>
12241 * VM/CodeGenerator.cpp:
12242 (KJS::CodeGenerator::jumpContextForLabel):
12243 * VM/CodeGenerator.h:
12245 (KJS::ContinueNode::emitCode):
12247 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12249 Reviewed by Sam Weinig.
12251 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
12252 rearranging scope_chain.h a bit.
12254 SunSpider reports no change.
12256 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12258 Reviewed by Sam Weinig.
12260 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
12261 on the knowledge that the ScopeChain is never empty.
12263 SunSpider reports no change.
12265 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12267 Reviewed by Oliver Hunt.
12269 Moved begin() and end() from ScopeChain to ScopeChainNode.
12271 Also marked a few methods "const".
12273 SunSpider reports no change.
12275 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12277 Reviewed by Maciej Stachowiak.
12279 Turned ScopeChain::depth into a stand-alone function, and simplified it
12282 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
12283 the true depth of the ScopeChain -- just the Machine's perspective of
12284 its depth within a given call frame.
12286 SunSpider reports no change.
12288 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12290 Reviewed by Maciej Stachowiak.
12292 Removed indirection in ScopeChain::ref / ScopeChain::deref.
12294 SunSpider reports no change.
12296 * kjs/scope_chain.h:
12297 (KJS::ScopeChain::ScopeChain):
12298 (KJS::ScopeChain::~ScopeChain):
12299 (KJS::ScopeChain::clear):
12301 2008-04-21 Oliver Hunt <oliver@apple.com>
12306 (KJS::ConstDeclNode::evaluateSingle):
12308 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12310 Reviewed by Oliver.
12312 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
12313 <https://bugs.webkit.org/show_bug.cgi?id=18664>
12315 Correctly throw a SyntaxError when parsing of eval code fails.
12320 2008-04-21 Oliver Hunt <oliver@apple.com>
12324 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
12326 Make sure we correct the register state before jumping to vm_throw.
12329 (KJS::Machine::privateExecute):
12331 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12333 Reviewed by Maciej Stachowiak.
12335 Simplified ScopeChain ref/deref.
12337 SunSpider reports a .4% speedup.
12339 * kjs/scope_chain.h:
12340 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
12341 ScopeChainNodes are initialized with a refCount of 1, so the loop was
12342 guaranteed to iterate exactly once.
12344 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12346 Reviewed by Maciej Stachowiak.
12348 Removed support for empty ScopeChains.
12350 SunSpider reports no change.
12352 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12354 Reviewed by Maciej Stachowiak.
12356 Removed some completely unused ScopeChain member functions.
12358 SunSpider reports no change.
12360 2008-04-21 Geoffrey Garen <ggaren@apple.com>
12362 Reviewed by Maciej Stachowiak.
12364 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
12366 SunSpider reports no change.
12368 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12370 Rubber stamped by Alexey.
12377 2008-04-21 Maciej Stachowiak <mjs@apple.com>
12379 Reviewed by Oliver.
12381 - only print "End:" output when -d flag is passed.
12383 This fixes half of our failing JSC regression tests.
12388 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12390 Reviewed by Maciej.
12392 Add support for variable declarations in eval code.
12395 (KJS::EvalCodeBlock::EvalCodeBlock):
12396 * VM/CodeGenerator.cpp:
12397 (KJS::CodeGenerator::CodeGenerator):
12398 * VM/CodeGenerator.h:
12400 (KJS::Machine::execute):
12402 * kjs/function.cpp:
12403 (KJS::globalFuncEval):
12405 (KJS::EvalNode::generateCode):
12409 2008-04-20 Oliver Hunt <oliver@apple.com>
12411 Reviewed by Maciej.
12413 Throw exceptions for invalid continue, break, and return statements.
12415 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
12417 * VM/CodeGenerator.cpp:
12418 (KJS::CodeGenerator::CodeGenerator):
12419 (KJS::CodeGenerator::pushJumpContext):
12420 (KJS::CodeGenerator::popJumpContext):
12421 (KJS::CodeGenerator::jumpContextForLabel):
12422 * VM/CodeGenerator.h:
12424 (KJS::Node::emitThrowError):
12425 (KJS::ContinueNode::emitCode):
12426 (KJS::BreakNode::emitCode):
12427 (KJS::ReturnNode::emitCode):
12430 2008-04-20 Geoffrey Garen <ggaren@apple.com>
12432 Reviewed by Oliver Hunt.
12434 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
12435 things that used to be inlined automatically.
12437 1.9% speedup on SunSpider.
12439 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
12440 that GCC is making fewer decisions. The speedup seems to confirm that.
12442 2008-04-20 Oliver Hunt <oliver@apple.com>
12444 Reviewed by Maciej.
12446 Bug 18642: Iterator context may get placed into the return register, leading to much badness
12447 <https://bugs.webkit.org/show_bug.cgi?id=18642>
12449 To prevent incorrectly reusing what will become the result register for
12450 eval and global code execution, we need to request and ref the destination
12451 in advance of codegen. Unfortunately this may lead to unnecessary copying,
12452 although in future we can probably limit this. Curiously SunSpider shows
12453 a progression in a number of tests, although it comes out as a wash overall.
12456 (KJS::EvalNode::emitCode):
12457 (KJS::ProgramNode::emitCode):
12459 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
12461 Reviewed by Maciej.
12463 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
12465 * VM/CodeBlock.cpp:
12466 (KJS::CodeBlock::dump):
12467 * VM/CodeGenerator.cpp:
12468 (KJS::CodeGenerator::emitCreateError):
12469 * VM/CodeGenerator.h:
12471 (KJS::Machine::privateExecute):
12474 (KJS::PostfixErrorNode::emitCode):
12475 (KJS::PrefixErrorNode::emitCode):
12476 (KJS::AssignErrorNode::emitCode):
12479 2008-04-20 Oliver Hunt <oliver@apple.com>
12481 Reviewed by Geoff and Mark.
12483 Provide line number information in exceptions
12485 Simple patch, adds line number information metadata to CodeBlock
12486 and a simple method to get the line number responsible for a given
12489 * VM/CodeBlock.cpp:
12490 (KJS::CodeBlock::lineNumberForVPC):
12492 * VM/CodeGenerator.h:
12493 (KJS::CodeGenerator::emitNode):
12495 (KJS::Machine::throwException):
12497 2008-04-20 Oliver Hunt <oliver@apple.com>
12499 Reviewed by Maciej.
12501 Provide "sourceURL" in exceptions
12505 (KJS::Machine::throwException):
12507 (KJS::EvalNode::generateCode):
12508 (KJS::ProgramNode::generateCode):
12510 2008-04-19 Oliver Hunt <oliver@apple.com>
12512 Reviewed by Maciej.
12514 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
12516 This patch just a preparation for tracking line numbers.
12519 (KJS::ObjectLiteralNode::emitCode):
12520 (KJS::PropertyListNode::emitCode):
12521 (KJS::ArgumentListNode::emitCode):
12522 (KJS::TryNode::emitCode):
12524 2008-04-19 Oliver Hunt <oliver@apple.com>
12526 Reviewed by Maciej.
12528 Bug 18619: Support continue, break, and return in try .. finally blocks
12529 <https://bugs.webkit.org/show_bug.cgi?id=18619>
12531 This patch replaces the current partial finally support (which uses code
12532 duplication to achieve what it does) with a subroutine based approach.
12533 This has a number of advantages over code duplication:
12534 * Reduced code size
12535 * Simplified exception handling as the finaliser code only exists in
12536 one place, so no "magic" is needed to get the correct handler for a
12538 * When we support instruction to line number mapping we won't need to
12539 worry about the dramatic code movement caused by duplication
12541 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
12542 to enter and exit the finaliser subroutines, happily SunSpider reports
12543 a performance progression (gcc amazes me) and ubench reports a wash.
12545 While jsr and sret provide a mechanism that allows us to enter and exit
12546 any arbitrary finaliser we need to, it was still necessary to increase
12547 the amount of information tracked when entering and exiting both finaliser
12548 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
12549 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
12550 now use a scopeContextStack to ensure that we pop scopes and execute
12551 finalisers in the correct order. This increases the cost of "with" nodes
12552 during codegen, but it should not be significant enough to effect real
12553 world performance and greatly simplifies codegen for return, break and
12554 continue when interacting with finalisers.
12556 * VM/CodeBlock.cpp:
12557 (KJS::CodeBlock::dump):
12558 Pretty printing of jsr/sret opcodes
12560 * VM/CodeGenerator.cpp:
12561 (KJS::CodeGenerator::CodeGenerator):
12562 (KJS::CodeGenerator::emitPushScope):
12563 (KJS::CodeGenerator::emitPopScope):
12564 Dynamic scopes need to be tracked on the scopeContextStack now
12566 (KJS::CodeGenerator::pushFinallyContext):
12567 (KJS::CodeGenerator::popFinallyContext):
12568 Handle entry and exit from code regions with finalisers. This is
12569 needed solely to support return, continue and break inside finaliser
12572 (KJS::CodeGenerator::emitComplexJumpScopes):
12573 Helper function for emitJumpScopes to handle the complex codegen
12574 needed to handle return, continue and break inside a finaliser region
12576 (KJS::CodeGenerator::emitJumpScopes):
12577 Updated to be aware of finalisers, if a cross-scope jump occurs inside
12578 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
12579 we can handle the normal (trivial) case with a single instruction.
12581 (KJS::CodeGenerator::emitJumpSubroutine):
12582 (KJS::CodeGenerator::emitSubroutineReturn):
12583 Trivial opcode emitter functions.
12585 * VM/CodeGenerator.h:
12586 (KJS::CodeGenerator::scopeDepth):
12588 (KJS::Machine::privateExecute):
12589 Implement op_jsr and op_sret.
12592 Ad op_jsr and op_sret
12595 (KJS::TryNode::emitCode):
12596 Fix codegen for new finaliser model.
12598 2008-04-17 Mark Rowe <mrowe@apple.com>
12600 Rubber-stamped by Oliver Hunt.
12602 Remove unnecessary files from testkjs, testapi and minidom targets.
12604 * JavaScriptCore.xcodeproj/project.pbxproj:
12606 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12608 Reviewed by Oliver Hunt.
12610 Fixed ASSERT seen during run-sunspider of a debug build.
12612 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
12613 runs all tests in one global environment, so you end up with more than
12614 128 locals. This is just a stop-gap until we code up a real
12615 solution to arbitrary symbol and label limits.
12617 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12619 Reviewed by Oliver Hunt.
12621 Fixed a bug in exception unwinding, where we wouldn't deref the scope
12622 chain in global scope, so we would leak ScopeChainNodes when exceptions
12623 were thrown inside "with" and "catch" scopes.
12625 Also did some cleanup of the unwinding code along the way.
12627 Scope chain reference counting is still wrong in a few ways. I thought
12628 I would fix this portion of it first.
12630 run-sunspider shows no change.
12633 (KJS::Machine::unwindCallFrame):
12634 (KJS::Machine::throwException):
12635 (KJS::Machine::privateExecute):
12638 2008-04-17 Oliver Hunt <oliver@apple.com>
12640 Reviewed by Maciej.
12642 Add more exception checking to toNumber conversions
12644 This corrects op_pre_dec, op_negate, op_mod and op_sub.
12647 (KJS::Machine::privateExecute):
12649 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
12651 Reviewed by Oliver Hunt.
12655 Introduced a new opcode: op_call_eval. In the normal case, it performs
12656 an eval. In the case where eval has been overridden in some way, it
12657 performs a function call.
12659 * VM/CodeGenerator.h: Added a feature so the code generator knows not
12660 to optimized locals in eval code.
12662 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12664 Reviewed by Sam Weinig.
12666 Added some ASSERTs to document codegen failures in
12667 run-javascriptcore-tests.
12669 For all tests, program-level codegen now either succeeds, or fails with
12672 * VM/CodeGenerator.cpp:
12673 (KJS::CodeGenerator::addVar):
12674 (KJS::CodeGenerator::CodeGenerator):
12675 (KJS::CodeGenerator::newTemporary):
12676 (KJS::CodeGenerator::newLabel):
12678 2008-04-17 Geoffrey Garen <ggaren@apple.com>
12680 Reviewed by Maciej Stachowiak.
12682 Fixed another case of a dst register being an unreferenced temporary
12683 (caused an ASSERT when running the full sunspider suite).
12686 (KJS::CaseBlockNode::emitCodeForBlock):
12688 2008-04-16 Maciej Stachowiak <mjs@apple.com>
12692 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
12694 * VM/CodeBlock.cpp:
12695 (KJS::CodeBlock::dump):
12696 * VM/CodeGenerator.cpp:
12697 (KJS::CodeGenerator::emitMul):
12698 (KJS::CodeGenerator::emitDiv):
12699 (KJS::CodeGenerator::emitMod):
12700 (KJS::CodeGenerator::emitSub):
12701 (KJS::CodeGenerator::emitLeftShift):
12702 (KJS::CodeGenerator::emitRightShift):
12703 (KJS::CodeGenerator::emitUnsignedRightShift):
12704 (KJS::CodeGenerator::emitBitAnd):
12705 (KJS::CodeGenerator::emitBitXOr):
12706 (KJS::CodeGenerator::emitBitOr):
12707 * VM/CodeGenerator.h:
12709 (KJS::Machine::privateExecute):
12712 (KJS::MultNode::emitCode):
12713 (KJS::DivNode::emitCode):
12714 (KJS::ModNode::emitCode):
12715 (KJS::SubNode::emitCode):
12716 (KJS::LeftShiftNode::emitCode):
12717 (KJS::RightShiftNode::emitCode):
12718 (KJS::UnsignedRightShiftNode::emitCode):
12719 (KJS::BitAndNode::emitCode):
12720 (KJS::BitXOrNode::emitCode):
12721 (KJS::BitOrNode::emitCode):
12722 (KJS::emitReadModifyAssignment):
12723 (KJS::ReadModifyResolveNode::emitCode):
12725 2008-04-16 Oliver Hunt <oliver@apple.com>
12729 Exception checks for toNumber in op_pre_inc
12731 This is somewhat more convoluted than the simple hadException checks
12732 we currently use. Instead we use special toNumber conversions that
12733 select between the exception and ordinary vPC. This allows us to
12734 remove any branches in the common case (incrementing a number).
12736 * API/JSCallbackObject.h:
12737 * API/JSCallbackObjectFunctions.h:
12740 * JavaScriptCore.exp:
12741 * JavaScriptCore.xcodeproj/project.pbxproj:
12742 * VM/JSPropertyNameIterator.cpp:
12743 (KJS::JSPropertyNameIterator::toNumber):
12744 * VM/JSPropertyNameIterator.h:
12746 (KJS::Machine::privateExecute):
12748 * kjs/ExecState.cpp:
12749 (KJS::ExecState::ExecState):
12751 * kjs/JSNotAnObject.cpp:
12752 (KJS::JSNotAnObject::toNumber):
12753 * kjs/JSNotAnObject.h:
12754 * kjs/internal.cpp:
12755 (KJS::StringImp::toNumber):
12756 (KJS::NumberImp::toNumber):
12757 (KJS::GetterSetterImp::toNumber):
12760 (KJS::JSObject::toNumber):
12763 (KJS::JSValue::toNumber):
12765 2008-04-16 Maciej Stachowiak <mjs@apple.com>
12769 - ensure that activations are kept in a register to protect them from GC
12771 Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
12772 that is what is now kept there, and there is no more need to keep the scope chain in
12776 (KJS::initializeCallFrame):
12777 (KJS::scopeChainForCall):
12781 2008-04-16 Geoffrey Garen <ggaren@apple.com>
12783 Reviewed by Oliver Hunt.
12785 Made "this" work in program code / global scope.
12787 The machine can initialize "this" prior to execution because it knows
12788 that, for program code, "this" is always stored in lr1.
12791 (KJS::Machine::execute):
12794 * kjs/interpreter.cpp:
12795 (KJS::Interpreter::evaluate):
12797 2008-04-16 Geoffrey Garen <ggaren@apple.com>
12799 Reviewed by Oliver Hunt.
12801 Fixed a codegen bug when returning from inside a dynamic scope (a with
12802 or catch block): we need to pop any dynamic scope(s) that have been
12803 added so op_ret can find the activation object at the top of the scope
12807 (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
12808 scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
12809 and then branching to the return instruction.
12811 2008-04-16 Maciej Stachowiak <mjs@apple.com>
12815 - document the add and get_prop_id opcodes
12817 In addition to adding documentation in comments, I changed
12818 references to register IDs or indices relating to these opcodes to
12819 have meaningful names instead of r0 r1 r2.
12821 * VM/CodeGenerator.cpp:
12822 (KJS::CodeGenerator::emitAdd):
12823 * VM/CodeGenerator.h:
12825 (KJS::Machine::privateExecute):
12827 (KJS::DotAccessorNode::emitCode):
12828 (KJS::FunctionCallDotNode::emitCode):
12829 (KJS::PostIncDotNode::emitCode):
12830 (KJS::PostDecDotNode::emitCode):
12831 (KJS::PreIncDotNode::emitCode):
12832 (KJS::PreDecDotNode::emitCode):
12833 (KJS::AddNode::emitCode):
12834 (KJS::ReadModifyDotNode::emitCode):
12836 2008-04-15 Geoffrey Garen <ggaren@apple.com>
12838 Reviewed by Oliver Hunt and Maciej Stachowiak.
12840 Fixed a codegen bug in with and switch, and added an ASSERT to
12841 make sure it doesn't happen again.
12843 emitCode() assumes that dst, if non-zero, is either referenced or
12844 non-temporary (i.e., it assumes that newTemporary() will return a
12845 register not equal to dst). Certain callers to emitCode() weren't
12846 guaranteeing that to be so, so temporary register values were being
12849 * VM/CodeGenerator.h:
12850 (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
12853 (KJS::CommaNode::emitCode): Reference the dst we pass.
12855 (KJS::WithNode::emitCode): No need to pass an explicit dst register.
12857 (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
12858 (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
12860 * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
12863 2008-04-15 Oliver Hunt <oliver@apple.com>
12865 Reviewed by Maciej.
12867 Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
12868 <https://bugs.webkit.org/show_bug.cgi?id=18526>
12870 Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
12873 (KJS::resolveBaseAndFunc):
12874 (KJS::Machine::privateExecute):
12876 2008-04-15 Maciej Stachowiak <mjs@apple.com>
12878 Reviewed by Oliver.
12880 - fix incorrect result on 3d-raytrace test
12882 Oliver found and tracked down this bug, I just typed in the fix.
12885 (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
12886 account for the space for local variables.
12888 2008-04-15 Maciej Stachowiak <mjs@apple.com>
12890 Reviewed by Oliver.
12892 - fix codegen handling of dst registers
12894 1.006x speedup (not sure why).
12896 Most emitCode functions take an optional "dst" parameter that says
12897 where the output of the instruction should be written. I made some
12898 functions for convenient handling of the dst register:
12900 * VM/CodeGenerator.h:
12901 (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
12902 it is not null and is a temporary, otherwise allocates a new temporary. This is
12903 intended for cases where an intermediate value might be written into the dst
12905 (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
12906 register that was used as a temp destination. Picks the right thing for the final
12907 output. Intended to be used as the output register for the instruction that generates
12908 the final value of a particular node.
12910 (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
12911 RegisterID; moves from the register to dst if dst is defined and
12912 different from the register. This is intended for cases where the
12913 result of a node is already in a specific register (likely a
12914 local), and so no code needs to be generated unless a specific
12915 destination has been requested, in which case a move is needed.
12917 I also applied these methods throughout emitCode functions. In
12918 some cases this was just cleanup, in other cases I fixed actual
12919 codegen bugs. Below I have given specific comments for the cases
12920 where I believe I fixed a codegen bug, or improved quality of codegen.
12923 (KJS::NullNode::emitCode):
12924 (KJS::FalseNode::emitCode):
12925 (KJS::TrueNode::emitCode):
12926 (KJS::NumberNode::emitCode):
12927 (KJS::StringNode::emitCode):
12928 (KJS::RegExpNode::emitCode):
12929 (KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
12930 the same as the this register (the unlikely case of "this = this");
12931 (KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
12932 is the same as the local regiester, in the local var case (the
12933 unlikely case of "x = x");
12934 (KJS::ArrayNode::emitCode): Fixed a codegen bug where array
12935 literal element expressions may have observed an intermediate
12936 value of constructing the array.
12937 (KJS::ObjectLiteralNode::emitCode):
12938 (KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
12939 property definition expressions may have obesrved an intermediate value of
12940 constructing the object.
12941 (KJS::BracketAccessorNode::emitCode):
12942 (KJS::DotAccessorNode::emitCode):
12943 (KJS::NewExprNode::emitCode):
12944 (KJS::FunctionCallValueNode::emitCode):
12945 (KJS::FunctionCallBracketNode::emitCode):
12946 (KJS::FunctionCallDotNode::emitCode):
12947 (KJS::PostIncResolveNode::emitCode):
12948 (KJS::PostDecResolveNode::emitCode):
12949 (KJS::PostIncBracketNode::emitCode):
12950 (KJS::PostDecBracketNode::emitCode):
12951 (KJS::PostIncDotNode::emitCode):
12952 (KJS::PostDecDotNode::emitCode):
12953 (KJS::DeleteResolveNode::emitCode):
12954 (KJS::DeleteBracketNode::emitCode):
12955 (KJS::DeleteDotNode::emitCode):
12956 (KJS::DeleteValueNode::emitCode):
12957 (KJS::VoidNode::emitCode):
12958 (KJS::TypeOfResolveNode::emitCode):
12959 (KJS::TypeOfValueNode::emitCode):
12960 (KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
12961 value would not be output to the dst register in the local var case.
12962 (KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
12963 value would not be output to the dst register in the local var case.
12964 (KJS::PreIncBracketNode::emitCode):
12965 (KJS::PreDecBracketNode::emitCode):
12966 (KJS::PreIncDotNode::emitCode):
12967 (KJS::PreDecDotNode::emitCode):
12968 (KJS::UnaryPlusNode::emitCode):
12969 (KJS::NegateNode::emitCode):
12970 (KJS::BitwiseNotNode::emitCode):
12971 (KJS::LogicalNotNode::emitCode):
12972 (KJS::MultNode::emitCode):
12973 (KJS::DivNode::emitCode):
12974 (KJS::ModNode::emitCode):
12975 (KJS::AddNode::emitCode):
12976 (KJS::SubNode::emitCode):
12977 (KJS::LeftShiftNode::emitCode):
12978 (KJS::RightShiftNode::emitCode):
12979 (KJS::UnsignedRightShiftNode::emitCode):
12980 (KJS::LessNode::emitCode):
12981 (KJS::GreaterNode::emitCode):
12982 (KJS::LessEqNode::emitCode):
12983 (KJS::GreaterEqNode::emitCode):
12984 (KJS::InstanceOfNode::emitCode):
12985 (KJS::InNode::emitCode):
12986 (KJS::EqualNode::emitCode):
12987 (KJS::NotEqualNode::emitCode):
12988 (KJS::StrictEqualNode::emitCode):
12989 (KJS::NotStrictEqualNode::emitCode):
12990 (KJS::BitAndNode::emitCode):
12991 (KJS::BitXOrNode::emitCode):
12992 (KJS::BitOrNode::emitCode):
12993 (KJS::LogicalAndNode::emitCode):
12994 (KJS::LogicalOrNode::emitCode):
12995 (KJS::ConditionalNode::emitCode):
12996 (KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
12997 needed for fixes below.
12998 (KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
12999 the expression may observe an intermediate value.
13000 (KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
13001 expression may observe an intermediate value.
13002 (KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
13003 expression may observe an intermediate value.
13004 (KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
13005 expression may observe an intermediate value.
13006 (KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
13007 (KJS::ReturnNode::emitCode): Void return should return undefined, not null.
13008 (KJS::FuncExprNode::emitCode):
13010 2008-04-15 Maciej Stachowiak <mjs@apple.com>
13014 - fix huge performance regression (from trunk) in string-unpack-code
13016 This restores string-unpack-code performance to parity with
13017 trunk (2.27x speedup relative to previous SquirrelFish)
13020 (KJS::Machine::execute): Shrink register file after call to avoid
13021 growing repeatedly.
13023 2008-04-15 Geoffrey Garen <ggaren@apple.com>
13025 Reviewed by Sam Weinig.
13027 Fixed dumpCallFrame to match our new convention of passing around a
13028 ScopeChainNode* instead of a ScopeChain*.
13030 * JavaScriptCore.exp:
13032 (KJS::Machine::dumpCallFrame):
13035 2008-04-15 Oliver Hunt <oliver@apple.com>
13037 Reviewed by Maciej.
13039 Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
13040 <https://bugs.webkit.org/show_bug.cgi?id=18436>
13042 Add op_resolve_base_and_property for read/modify/write operations,
13043 this adds a "superinstruction" to resolve the base and value of a
13044 property simultaneously. Just using resolveBase and resolve results
13045 in an 5% regression in ubench, 30% in loop-empty-resolve (which is
13046 expected). 1.3% progression in sunspider, 2.1% in ubench, with a
13047 21% gain in loop-empty-resolve. The only outlier is function-missing-args
13048 which gets a 3% regression that I could never resolve.
13050 * VM/CodeBlock.cpp:
13051 (KJS::CodeBlock::dump):
13052 * VM/CodeGenerator.cpp:
13053 (KJS::CodeGenerator::emitResolveBaseAndProperty):
13054 * VM/CodeGenerator.h:
13056 (KJS::resolveBaseAndProperty):
13057 (KJS::Machine::privateExecute):
13060 (KJS::PostIncResolveNode::emitCode):
13061 (KJS::PostDecResolveNode::emitCode):
13062 (KJS::PreIncResolveNode::emitCode):
13063 (KJS::PreDecResolveNode::emitCode):
13064 (KJS::ReadModifyResolveNode::emitCode):
13066 2008-04-15 Maciej Stachowiak <mjs@apple.com>
13068 Reviewed by Oliver.
13070 - fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
13071 https://bugs.webkit.org/show_bug.cgi?id=18508
13073 3d-raytrace and string-unpack-code now run.
13075 The basic approach is to pass around ScopeChainNode* instead of
13076 ScopeChain*, which in addition to not becoming suddenly an invalid
13077 pointer also saves an indirection.
13079 This is an 0.4% speedup on SunSpider --squirrelfish (1.8% on --ubench)
13083 (KJS::resolveBase):
13084 (KJS::resolveBaseAndFunc):
13085 (KJS::initializeCallFrame):
13086 (KJS::scopeChainForCall):
13087 (KJS::Machine::unwindCallFrame):
13088 (KJS::Machine::throwException):
13089 (KJS::Machine::execute):
13090 (KJS::Machine::privateExecute):
13095 (KJS::EvalNode::generateCode):
13096 (KJS::FunctionBodyNode::generateCode):
13097 (KJS::ProgramNode::generateCode):
13098 (KJS::ProgramNode::processDeclarations):
13099 (KJS::EvalNode::processDeclarations):
13100 (KJS::FuncDeclNode::makeFunction):
13101 (KJS::FuncExprNode::makeFunction):
13103 (KJS::ProgramNode::):
13105 (KJS::FunctionBodyNode::):
13107 * kjs/scope_chain.h:
13108 (KJS::ScopeChainNode::ScopeChainNode):
13109 (KJS::ScopeChainNode::deref):
13110 (KJS::ScopeChainIterator::ScopeChainIterator):
13111 (KJS::ScopeChainIterator::operator*):
13112 (KJS::ScopeChainIterator::operator->):
13113 (KJS::ScopeChain::ScopeChain):
13114 (KJS::ScopeChain::node):
13115 (KJS::ScopeChain::deref):
13116 (KJS::ScopeChain::ref):
13117 (KJS::ScopeChainNode::ref):
13118 (KJS::ScopeChainNode::release):
13119 (KJS::ScopeChainNode::begin):
13120 (KJS::ScopeChainNode::end):
13122 2008-04-14 Geoffrey Garen <ggaren@apple.com>
13124 Reviewed by Oliver Hunt.
13126 Fixed crash when accessing registers in a torn-off activation object.
13128 * kjs/JSActivation.cpp:
13129 (KJS::JSActivation::copyRegisters): Update our registerOffset after
13130 copying our registers, since our offset should now be relative to
13131 our private register array, not the shared register file.
13133 2008-04-14 Maciej Stachowiak <mjs@apple.com>
13135 Reviewed by Oliver.
13137 - fix a codegen flaw that makes some tests run way too fast or way too slow
13139 The basic problem was that FunctionCallResolveNode results in
13140 codegen which can incorrectly write an intermediate value into the
13141 dst register even when that is a local. I added convenience
13142 functions to CodeGenerator for getting this right, but for now I
13143 only fixed FunctionCallResolve.
13145 * VM/CodeGenerator.h:
13146 (KJS::CodeGenerator::tempDestination):
13147 (KJS::CodeGenerator::):
13149 (KJS::FunctionCallResolveNode::emitCode):
13151 2008-04-14 Gabor Loki <loki@inf.u-szeged.hu>
13153 Reviewed and slightly tweaked by Geoffrey Garen.
13155 Bug 18489: Squirrelfish doesn't build on linux
13156 <https://bugs.webkit.org/show_bug.cgi?id=18489>
13158 * JavaScriptCore.pri: Add VM into include path and its files into
13160 * VM/JSPropertyNameIterator.cpp: Fix include name
13161 * VM/Machine.cpp: Add UNLIKELY macro for GCC
13162 * VM/Machine.h: Add missing includes
13163 * VM/RegisterFile.cpp: Add missing include
13164 * kjs/testkjs.pro: Add VM into include path
13166 2008-04-14 Geoffrey Garen <ggaren@apple.com>
13168 Reviewed by Sam Weinig.
13170 Restored OwnPtr in some places where I had removed it previously. We
13171 can have an OwnPtr to an undefined class in a header as long as the
13172 class's destructor isn't in the header.
13174 2008-04-14 Geoffrey Garen <ggaren@apple.com>
13176 Reviewed by Sam Weinig.
13178 Fixed access to "this" inside dynamic scopes.
13180 * VM/CodeGenerator.cpp:
13181 (KJS::CodeGenerator::registerForLocal): Always return a register for
13182 "this", even if we're not optimizing access to other locals. Because
13183 "this" is a keyword, it's always in a register and always accessible.
13185 * VM/CodeGenerator.h:
13186 (KJS::CodeGenerator::shouldOptimizeLocals): Factored out a function
13187 for determining whether we should optimize access to locals, since
13188 eval will need to make this test a little more complicated.
13190 2008-04-14 Maciej Stachowiak <mjs@apple.com>
13194 - fix crash when running SunSpider full harness
13196 When growing the register file's buffer to make space for new globals,
13197 make sure to copy accounting for the fact that the new space is logically
13198 at the beginning of the buffer in this case, instead of at the end as when
13199 growing for a new call frame.
13201 * VM/RegisterFile.cpp:
13202 (KJS::RegisterFile::newBuffer):
13203 (KJS::RegisterFile::growBuffer):
13204 (KJS::RegisterFile::addGlobalSlots):
13205 * VM/RegisterFile.h:
13207 2008-04-11 Geoffrey Garen <ggaren@apple.com>
13209 Reviewed by Sam Weinig.
13211 Mark constant pools for global and eval code (collectively known as
13212 "program code"). (Constant pools for function code are already marked by
13215 The global object is responsible for marking program code constant
13216 pools. Code blocks add themselves to the mark set at creation time, and
13217 remove themselves from the mark set at destruction time.
13219 sunspider --squirrelfish reports a 1% speedup, perhaps because
13220 generateCode() is now non-virtual.
13222 * kjs/nodes.cpp: I had to use manual init and delete in this file
13223 because putting an OwnPtr into the header would have created a circular
13226 2008-04-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
13228 Reviewed by Maciej.
13230 Bug 18231: Improve support for function call nodes in SquirrelFish
13231 <https://bugs.webkit.org/show_bug.cgi?id=18231>
13233 Use correct value of 'this' for function calls.
13235 * VM/CodeBlock.cpp:
13236 (KJS::CodeBlock::dump):
13237 * VM/CodeGenerator.cpp:
13238 (KJS::CodeGenerator::emitResolveBaseAndFunc):
13239 * VM/CodeGenerator.h:
13241 (KJS::resolveBaseAndFunc):
13242 (KJS::Machine::privateExecute):
13245 (KJS::FunctionCallResolveNode::emitCode):
13247 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13249 This time for sure.
13251 * kjs/interpreter.cpp:
13252 (KJS::Interpreter::evaluate):
13254 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13256 Reviewed by Sam Weinig.
13258 Fixed Interpreter::execute to honor the new model for returning non-NULL
13259 values when an exception is thrown.
13261 * kjs/interpreter.cpp:
13262 (KJS::Interpreter::evaluate):
13264 2008-04-10 Oliver Hunt <oliver@apple.com>
13268 Fix SquirrelFish interpreter to pass internal exceptions back to
13269 native code correctly.
13271 * JavaScriptCore.xcodeproj/project.pbxproj:
13273 (KJS::Machine::privateExecute):
13275 2008-04-10 Sam Weinig <sam@webkit.org>
13277 Reviewed by Geoffrey Garen.
13279 Replace the use of getCallData in op_construct with the new
13280 getConstructData function that replaces implementsConstruct.
13282 * API/JSCallbackConstructor.cpp:
13283 (KJS::JSCallbackConstructor::getConstructData):
13284 * API/JSCallbackConstructor.h:
13285 * API/JSCallbackObject.h:
13286 * API/JSCallbackObjectFunctions.h:
13287 (KJS::::getConstructData):
13288 (KJS::::construct):
13289 * API/JSObjectRef.cpp:
13290 (JSObjectIsConstructor):
13291 * JavaScriptCore.exp:
13292 * JavaScriptCore.xcodeproj/project.pbxproj:
13294 (KJS::Machine::privateExecute):
13296 * kjs/ConstructData.h: Copied from JavaScriptCore/kjs/CallData.h.
13297 * kjs/array_object.cpp:
13298 (KJS::ArrayObjectImp::getConstructData):
13299 * kjs/array_object.h:
13300 * kjs/bool_object.cpp:
13301 (KJS::BooleanObjectImp::getConstructData):
13302 * kjs/bool_object.h:
13303 * kjs/date_object.cpp:
13304 (KJS::DateObjectImp::getConstructData):
13305 * kjs/date_object.h:
13306 * kjs/error_object.cpp:
13307 (KJS::ErrorObjectImp::getConstructData):
13308 (KJS::NativeErrorImp::getConstructData):
13309 * kjs/error_object.h:
13310 * kjs/function.cpp:
13311 (KJS::FunctionImp::getCallData):
13312 (KJS::FunctionImp::getConstructData):
13313 (KJS::FunctionImp::construct):
13315 * kjs/function_object.cpp:
13316 (KJS::FunctionObjectImp::getConstructData):
13317 * kjs/function_object.h:
13319 (KJS::NewExprNode::inlineEvaluate):
13320 * kjs/number_object.cpp:
13321 (KJS::NumberObjectImp::getConstructData):
13322 * kjs/number_object.h:
13325 * kjs/object_object.cpp:
13326 (KJS::ObjectObjectImp::getConstructData):
13327 * kjs/object_object.h:
13328 * kjs/regexp_object.cpp:
13329 (KJS::RegExpObjectImp::getConstructData):
13330 * kjs/regexp_object.h:
13331 * kjs/string_object.cpp:
13332 (KJS::StringObjectImp::getConstructData):
13333 * kjs/string_object.h:
13335 (KJS::JSCell::getConstructData):
13337 (KJS::JSValue::getConstructData):
13339 2008-04-10 Oliver Hunt <oliver@apple.com>
13343 Bug 18420: SquirrelFish: need to throw Reference and Type errors
13344 when attempting invalid operations on JSValues
13346 Add validation and exception checks to SquirrelFish so that the
13347 correct exceptions are thrown for undefined variables, type errors
13348 and toObject failure. Also handle exceptions thrown by native
13351 * JavaScriptCore.xcodeproj/project.pbxproj:
13352 * VM/ExceptionHelpers.cpp: Added.
13354 (KJS::createError):
13355 (KJS::createUndefinedVariableError):
13356 * VM/ExceptionHelpers.h: Added.
13360 Modified to signal failure
13361 (KJS::isNotObject):
13362 Wrapper for JSValue::isObject and exception creation (these need
13363 to be merged, lest GCC go off the deep end)
13364 (KJS::Machine::privateExecute):
13365 Adding the many exception and validity checks.
13367 * kjs/JSNotAnObject.cpp: Added.
13368 Stub object used to reduce the need for multiple exception checks
13369 when toObject fails.
13370 (KJS::JSNotAnObject::toPrimitive):
13371 (KJS::JSNotAnObject::getPrimitiveNumber):
13372 (KJS::JSNotAnObject::toBoolean):
13373 (KJS::JSNotAnObject::toNumber):
13374 (KJS::JSNotAnObject::toString):
13375 (KJS::JSNotAnObject::toObject):
13376 (KJS::JSNotAnObject::mark):
13377 (KJS::JSNotAnObject::getOwnPropertySlot):
13378 (KJS::JSNotAnObject::put):
13379 (KJS::JSNotAnObject::deleteProperty):
13380 (KJS::JSNotAnObject::defaultValue):
13381 (KJS::JSNotAnObject::construct):
13382 (KJS::JSNotAnObject::callAsFunction):
13383 (KJS::JSNotAnObject::getPropertyNames):
13384 * kjs/JSNotAnObject.h: Added.
13385 (KJS::JSNotAnObject::JSNotAnObject):
13386 * kjs/JSImmediate.cpp:
13387 (KJS::JSImmediate::toObject):
13388 modified to create an JSNotAnObject rather than throwing an exception
13391 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13393 Reviewed by Oliver Hunt.
13395 Pass a function body node its function's scope chain, rather than the
13396 current execution context's scope chain, when compiling it.
13398 This doesn't matter yet, but it will once we start using the scope
13399 chain during compilation.
13401 sunspider --squirrelfish notes a tiny speedup.
13404 (KJS::Machine::privateExecute):
13406 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13408 Reviewed by Oliver Hunt.
13410 Fix two bugs when throwing exceptions from re-entrant JS calls:
13412 (1) Don't shrink the register file to 0, since our caller may still
13415 (2) In case of exception, return jsNull() instead of 0 because,
13416 surprisingly, some JavaScriptCore clients rely on a function's return
13417 value being safe to operate on even if the function threw an exception.
13421 - Changed FunctionImp::callAsFunction to honor the new semantics of
13422 exceptions not returning 0.
13424 - Renamed "handlerPC" to "handlerVPC" to match other uses of "VPC".
13426 - Renamed "exceptionData" to "exceptionValue", because "data" seemed to
13427 imply something more than just a JSValue.
13429 - Merged prepareException into throwException, since throwException was
13430 its only caller, and it seemed weird that throwException didn't take
13431 an exception as an argument.
13433 sunspider --squirrelfish does not seem to complain on my machine, but it
13434 complains a little (.6%) on Oliver's.
13436 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13438 Reviewed by Maciej Stachowiak.
13440 Fixed op_construct for CallTypeNative to reacquire "r" before setting
13441 its return value, since registerBase can theoretically change during the
13442 execution of arbitrary code. (Not sure if any native constructors
13443 actually make this possible.)
13445 sunspider --squirrelfish does not seem to complain.
13448 (KJS::Machine::privateExecute):
13450 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13452 Reviewed by Oliver Hunt and Sam Weinig.
13454 Re-entrant execution of function code (global code -> built-in function
13457 Miraculously, sunspider --squirrelfish does not seem to complain.
13459 A re-entrant function call is the same as a normal function call with
13460 one exception: the re-entrant call leaves everything except for
13461 CallerCodeBlock in the call frame header uninitialized, since the call
13462 doesn't need to return to JS code. (It sets CallerCodeBlock to 0, to
13463 indicate that the call shouldn't return to JS code.)
13465 Also fixed a few issues along the way:
13467 - Fixed two bugs in the read-write List implementation that caused
13468 m_size and m_buffer to go stale.
13470 - Changed native call code to update "r" *before* setting the return
13471 value, since the call may in turn call JS code, which changes the value
13474 - Migrated initialization of "r" outside of Machine::privateExecute,
13475 because global code and function code initialize "r" differently.
13477 - Migrated a codegen warning from Machine::privateExecute to the wiki.
13479 - Removed unnecessary "r" parameter from slideRegisterWindowForCall
13482 (KJS::slideRegisterWindowForCall):
13483 (KJS::scopeChainForCall):
13484 (KJS::Machine::execute):
13485 (KJS::Machine::privateExecute):
13487 * kjs/function.cpp:
13488 (KJS::FunctionImp::callAsFunction):
13490 (KJS::List::getSlice):
13492 (KJS::List::clear):
13494 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13496 Reviewed by Oliver.
13498 - fix problem with code generation for return with no argument
13503 (KJS::ReturnNode::emitCode):
13505 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13507 Reviewed by Oliver.
13509 - Implement support for JS constructors
13511 access-binary-trees and access-nbody now run.
13513 Inexplicably a 1% speedup.
13516 (KJS::initializeCallFrame):
13517 (KJS::Machine::privateExecute):
13521 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13523 Reviewed by Oliver.
13525 - More code cleanup in preparation for JS constructors
13527 Factor the remaining interesting parts of JS function calls into
13528 slideRegisterWindowForCall and scopeChainForCall.
13531 (KJS::slideRegisterWindowForCall):
13532 (KJS::scopeChainForCall):
13533 (KJS::Machine::privateExecute):
13535 2008-04-10 Maciej Stachowiak <mjs@apple.com>
13539 - Code cleanup in preparation for JS constructors
13541 - Renamed returnInfo to callFrame.
13542 - Made an enum which defines what goes where in the call frame.
13543 - Factored out initializeCallFrame function from op_call
13545 * VM/CodeGenerator.cpp:
13546 (KJS::CodeGenerator::emitCall):
13547 (KJS::CodeGenerator::emitConstruct):
13549 (KJS::Machine::dumpRegisters):
13550 (KJS::initializeCallFrame):
13551 (KJS::Machine::unwindCallFrame):
13552 (KJS::Machine::execute):
13553 (KJS::Machine::privateExecute):
13557 2008-04-10 Geoffrey Garen <ggaren@apple.com>
13559 Reviewed by Oliver Hunt.
13561 Fixed two bugs in register allocation for function calls:
13563 (1) op_call used to allocate codeBlock->numVars too many registers for
13564 each call frame, due to duplicated math. Fixing this revealed...
13566 (2) By unconditionally calling resize(), op_call used to truncate the
13567 register file when calling a function whose registers fit wholly within
13568 the register file already allocated by its caller.
13570 sunspider --squirrelfish reports no regression.
13572 I also threw in a little extra formatting to dumpCallFrame, because it
13573 helped me debug these issues.
13576 (KJS::Machine::dumpRegisters):
13577 (KJS::Machine::execute):
13578 (KJS::Machine::privateExecute):
13579 * VM/RegisterFile.h:
13580 (KJS::RegisterFile::shrink):
13581 (KJS::RegisterFile::grow):
13582 * VM/RegisterFileStack.cpp:
13583 (KJS::RegisterFileStack::popRegisterFile):
13585 2008-04-09 Geoffrey Garen <ggaren@apple.com>
13587 Reviewed by Oliver Hunt.
13589 Next step toward re-entrant execution of function code (global code ->
13590 built-in function -> JS function):
13592 Made op_ret return from Machine::privateExecute if its calling codeBlock
13595 I'm checking this in by itself to demonstrate that a more clever
13596 mechanism is not necessary for performance.
13598 sunspider --squirrelfish reports no regression.
13602 (KJS::Machine::execute):
13603 (KJS::Machine::privateExecute):
13605 2008-04-09 Geoffrey Garen <ggaren@apple.com>
13607 Reviewed by Maciej Stachowiak.
13609 Next step toward re-entrant execution of function code (global code ->
13610 built-in function -> JS function):
13612 Made Machine::execute return a value.
13614 Sketched out some code for Machine::execute for functions -- still
13615 doesn't work yet, though.
13617 sunspider --squirrelfish reports no regression.
13620 (KJS::Machine::execute):
13621 (KJS::Machine::privateExecute):
13623 * kjs/interpreter.cpp:
13624 (KJS::Interpreter::evaluate):
13628 2008-04-09 Geoffrey Garen <ggaren@apple.com>
13630 Reviewed by Sam Weinig.
13632 First step toward re-entrant execution of function code (global code ->
13633 built-in function -> JS function):
13635 Tiny bit of refactoring in the Machine class.
13637 sunspider --squirrelfish reports no regression.
13640 (KJS::Machine::dumpRegisters):
13641 (KJS::Machine::unwindCallFrame):
13642 (KJS::Machine::execute):
13643 (KJS::Machine::privateExecute):
13645 (KJS::Machine::isGlobalCallFrame):
13646 * kjs/interpreter.cpp:
13647 (KJS::Interpreter::evaluate):
13649 2008-04-08 Geoffrey Garen <ggaren@apple.com>
13651 Reviewed by Oliver Hunt.
13653 Support for re-entrant execution of global code (global code -> built-in
13654 function -> global code).
13656 Keep a stack of register files instead of just one. Globals propogate
13657 between register files as the register files enter and exit the stack.
13659 An activation still uses its own register file's base as its
13660 registerBase, but the global object uses the register file *stack*'s
13661 registerBase, which updates dynamically to match the register file at
13662 the top of the stack.
13664 sunspider --squirrelfish reports no regression.
13666 2008-04-08 Maciej Stachowiak <mjs@apple.com>
13670 - initial preparatory work for JS constructors
13672 1) Allocate registers for the returnInfo block and "this" value when generating code for
13673 op_construct. These are not used yet, but the JS branch of op_construct will use them.
13675 2) Adjust argc and argv appropriately for native constructor calls.
13677 3) Assign return value in a more straightforward way in op_ret since this is actually
13678 a bit faster (and makes up for the allocation of extra registers above).
13680 * VM/CodeGenerator.cpp:
13681 (KJS::CodeGenerator::emitConstruct):
13683 (KJS::Machine::privateExecute):
13685 2008-04-07 Geoffrey Garen <ggaren@apple.com>
13687 Reviewed by Maciej Stachowiak.
13689 Fixed crashing SunSpider tests.
13691 Let's just pretend this never happened, bokay?
13693 * VM/CodeGenerator.cpp:
13694 (KJS::CodeGenerator::CodeGenerator):
13695 * VM/CodeGenerator.h:
13696 * VM/RegisterFile.cpp:
13697 (KJS::RegisterFile::addGlobals):
13699 2008-04-07 Geoffrey Garen <ggaren@apple.com>
13701 Reviewed by Oliver Hunt.
13703 Restored dumping of generated code as a command-line switch:
13704 run-testkjs -d will do it.
13706 2008-04-07 Geoffrey Garen <ggaren@apple.com>
13708 Reviewed by Oliver Hunt.
13710 Next step toward supporting re-entrant evaluation: Moved register file
13711 maintenance code into a proper "RegisterFile" class.
13713 There's a subtle change to the register file's internal layout: for
13714 global code / the global object, registerOffset is always 0 now. In
13715 other words, all register counting starts at 0, not 0 + (number of
13716 global variables). The helps simplify accounting when the number of
13717 global variables changes.
13719 2008-04-07 Oliver Hunt <oliver@apple.com>
13723 Bug 18338: Support exceptions in SquirrelFish <http://bugs.webkit.org/show_bug.cgi?id=18338>
13725 Initial support for exceptions in SquirrelFish, only supports finalisers in the
13726 simple cases (eg. exceptions and non-goto/return across finaliser boundaries).
13727 This doesn't add the required exception checks to existing code, it merely adds
13728 support for throw, catch, and the required stack unwinding.
13730 * VM/CodeBlock.cpp:
13731 (KJS::CodeBlock::dump):
13732 (KJS::CodeBlock::getHandlerForVPC):
13734 * VM/CodeGenerator.cpp:
13735 (KJS::CodeGenerator::emitCatch):
13736 (KJS::CodeGenerator::emitThrow):
13737 * VM/CodeGenerator.h:
13738 * VM/JSPropertyNameIterator.cpp:
13739 (KJS::JSPropertyNameIterator::create):
13741 (KJS::prepareException):
13742 (KJS::Machine::unwindCallFrame):
13743 (KJS::Machine::throwException):
13744 (KJS::Machine::privateExecute):
13748 (KJS::ThrowNode::emitCode):
13749 (KJS::TryNode::emitCode):
13751 * kjs/scope_chain.cpp:
13752 (KJS::ScopeChain::depth):
13753 * kjs/scope_chain.h:
13755 2008-04-06 Geoffrey Garen <ggaren@apple.com>
13757 Reviewed by Oliver Hunt.
13759 First step toward supporting re-entrant evaluation: Switch register
13760 clients from using "registers", a pointer to a register vector, to
13761 "registerBase", an indirect pointer to the logical first entry in the
13762 register file. (The logical first entry is the first entry that is not
13763 a global variable).
13765 With a vector, offsets into the register file remain good when the
13766 underlying buffer reallocates, but they go bad when the logical
13767 first entry moves. (The logical first entry moves when new global
13768 variables get added to the beginning of the register file.) With an
13769 indirect pointer to the logical first entry, offsets will remain good
13772 1.4% speedup on sunspider --squirrelfish. I suspect this is due to
13773 reduced allocation when creating closures, and reduced indirection
13774 through the register vector.
13776 * wtf/Vector.h: Added an accessor for an indirect pointer to the vector's
13777 buffer, which we currently use (incorrectly) for registerBase. This is
13778 temporary scaffolding to allow us to change client code without
13781 2008-04-06 Sam Weinig <sam@webkit.org>
13783 Reviewed by Oliver Hunt.
13785 Implement codegen for ReadModifyDotNode.
13788 (KJS::ReadModifyDotNode::emitCode):
13791 2008-04-06 Sam Weinig <sam@webkit.org>
13793 Reviewed by Oliver Hunt.
13795 Fix codegen for PostIncDotNode and implement codegen for PostIncBracketNode,
13796 PostDecBracketNode and PostDecDotNode.
13799 (KJS::PostIncBracketNode::emitCode):
13800 (KJS::PostDecBracketNode::emitCode):
13801 (KJS::PostIncDotNode::emitCode):
13802 (KJS::PostDecDotNode::emitCode):
13805 2008-04-06 Sam Weinig <sam@webkit.org>
13807 Reviewed by Geoffrey Garen.
13809 Implement codegen for PreDecResolveNode, PreIncBracketNode, PreDecBracketNode,
13810 PreIncDotNode and PreDecDotNode. This required adding one new op code, op_pre_dec.
13812 * VM/CodeBlock.cpp:
13813 (KJS::CodeBlock::dump):
13814 * VM/CodeGenerator.cpp:
13815 (KJS::CodeGenerator::emitPreDec):
13816 * VM/CodeGenerator.h:
13818 (KJS::Machine::privateExecute):
13821 (KJS::PreDecResolveNode::emitCode):
13822 (KJS::PreIncBracketNode::emitCode):
13823 (KJS::PreDecBracketNode::emitCode):
13824 (KJS::PreIncDotNode::emitCode):
13825 (KJS::PreDecDotNode::emitCode):
13828 2008-04-06 Geoffrey Garen <ggaren@apple.com>
13830 Reviewed by Sam Weinig.
13832 Improved register dumping, plus a liberal smattering of "const". Here's
13833 what the new format looks like:
13835 (gdb) call (void)dumpCallFrame(codeBlock, scopeChain, registers->begin(), r)
13836 4 instructions; 48 bytes at 0x509210; 3 locals (2 parameters); 1 temporaries
13838 [ 0] load lr1, undefined(@k0)
13839 [ 3] load lr1, 2(@k1)
13840 [ 6] add tr0, lr2, lr1
13849 ----------------------------------------
13850 use | address | value
13851 ----------------------------------------
13852 [return info] | 0x80ac08 | 0x5081c0
13853 [return info] | 0x80ac0c | 0x508e90
13854 [return info] | 0x80ac10 | 0x504acc
13855 [return info] | 0x80ac14 | 0x2
13856 [return info] | 0x80ac18 | 0x0
13857 [return info] | 0x80ac1c | 0x7
13858 [return info] | 0x80ac20 | 0x0
13859 ----------------------------------------
13860 [param] | 0x80ac24 | 0x1
13861 [param] | 0x80ac28 | 0x7
13862 [var] | 0x80ac2c | 0xb
13863 [temp] | 0x80ac30 | 0xf
13865 2008-04-06 Geoffrey Garen <ggaren@apple.com>
13867 Reviewed by Sam Weinig.
13869 Support for evaluating multiple scripts in the same global environment.
13870 (Still don't support re-entrant evaluation yet.)
13872 The main changes here are:
13874 (1) Obey the ECMA 10.1.3 rules regarding how to resolve collisions when
13875 a given symbol is declared more than once. (This patch fixes the same
13876 issue for function code, too.)
13878 (2) In the case of var and/or function collisions, reuse the existing
13879 storage slot. For global code, this is required for previously
13880 generated instructions to continue to work. For function code, it's
13881 more of a "nice to have": it makes register layout in the case of
13882 collisions easier to understand, and has the added benefit of saving
13885 (3) Allocate slots in the CodeGenerator's m_locals vector in parallel
13886 to register indexes in the symbol table. This ensures that, given an
13887 index in the symbol table, we can find the corresponding RegisterID
13888 without hashing, which speeds up codegen.
13890 I moved responsibility for emitting var and function initialization
13891 instructions into the CodeGenerator, because bookkeeping in cases where
13892 var, function, and/or parameter names collide requires a lot of
13893 internal knowledge about the CodeGenerator.
13895 * VM/CodeGenerator.cpp:
13896 (KJS::CodeGenerator::addVar): Removed responsibility for checking whether
13897 a var declaration overwrites "arguments", because the check is
13898 inappropriate for global code, which may not have a pre-existing
13899 "arguments" symbol in scope. Also changed this function to return a
13900 boolean indicating whether addVar actually created a new RegisterID,
13901 or just reused an old one.
13903 (KJS::CodeGenerator::CodeGenerator): Split out the constructors for
13904 function code and global code, since they're quite different now.
13906 (KJS::CodeGenerator::registerForLocal): This function does its job
13907 without any hashing now.
13909 * VM/Machine.cpp: Move old globals and update "r" before executing a
13910 new script. That way, old globals stay at a constant offset from "r",
13911 and previously optimized code still works.
13913 * VM/RegisterID.h: Added the ability to allocate a RegisterID before
13914 initializing its index field. We use this for parameters now.
13916 * kjs/JSVariableObject.h:
13917 (KJS::JSVariableObject::symbolTableGet): Changed the ungettable getter
13918 ASSERT to account for the fact that symbol indexes are all negative.
13920 2008-04-05 Sam Weinig <sam@webkit.org>
13922 Reviewed by Geoffrey Garen.
13924 Implement codegen for InNode.
13926 * VM/CodeBlock.cpp:
13927 (KJS::CodeBlock::dump):
13928 * VM/CodeGenerator.cpp:
13929 (KJS::CodeGenerator::emitIn):
13930 * VM/CodeGenerator.h:
13932 (KJS::Machine::privateExecute):
13935 (KJS::InNode::emitCode):
13938 2008-04-05 Sam Weinig <sam@webkit.org>
13940 Reviewed by Oliver Hunt.
13942 - Implement codegen for DeleteResolveNode, DeleteBracketNode, DeleteDotNode and DeleteValueNode.
13944 * VM/CodeBlock.cpp:
13945 (KJS::CodeBlock::dump):
13946 * VM/CodeGenerator.cpp:
13947 (KJS::CodeGenerator::emitGetPropId):
13948 (KJS::CodeGenerator::emitPutPropId):
13949 (KJS::CodeGenerator::emitDeletePropId):
13950 (KJS::CodeGenerator::emitDeletePropVal):
13951 (KJS::CodeGenerator::emitPutPropIndex):
13952 * VM/CodeGenerator.h:
13954 (KJS::Machine::privateExecute):
13957 (KJS::DeleteResolveNode::emitCode):
13958 (KJS::DeleteBracketNode::emitCode):
13959 (KJS::DeleteDotNode::emitCode):
13960 (KJS::DeleteValueNode::emitCode):
13963 2008-04-04 Sam Weinig <sam@webkit.org>
13965 Reviewed by Oliver Hunt.
13967 - Implement codegen for Switch statements.
13969 * VM/CodeGenerator.cpp:
13970 (KJS::CodeGenerator::pushJumpContext):
13971 (KJS::CodeGenerator::popJumpContext):
13972 (KJS::CodeGenerator::jumpContextForLabel):
13973 * VM/CodeGenerator.h:
13974 Rename LoopContext to JumpContext now that it used of Switch statements in addition
13978 (KJS::DoWhileNode::emitCode):
13979 (KJS::WhileNode::emitCode):
13980 (KJS::ForNode::emitCode):
13981 (KJS::ForInNode::emitCode):
13982 (KJS::ContinueNode::emitCode):
13983 (KJS::BreakNode::emitCode):
13984 (KJS::CaseBlockNode::emitCodeForBlock):
13985 (KJS::SwitchNode::emitCode):
13987 (KJS::CaseClauseNode::expr):
13988 (KJS::CaseClauseNode::children):
13989 (KJS::CaseBlockNode::):
13991 2008-04-03 Maciej Stachowiak <mjs@apple.com>
13995 - fix crash in codegen from new nodes
13997 * VM/CodeGenerator.cpp:
13998 (KJS::CodeGenerator::emitConstruct):
14001 2008-04-03 Maciej Stachowiak <mjs@apple.com>
14006 (KJS::ReadModifyResolveNode::emitCode):
14007 (KJS::ReadModifyBracketNode::emitCode):
14010 2008-04-02 Maciej Stachowiak <mjs@apple.com>
14014 - take a shot at marking constant pools for global and eval code
14016 Geoff says this won't really work in all cases but is an ok stopgap.
14018 * kjs/JSGlobalObject.cpp:
14019 (KJS::JSGlobalObject::mark):
14021 2008-04-02 Maciej Stachowiak <mjs@apple.com>
14025 - fix 2x perf regression in 3d-morph
14028 (KJS::Machine::privateExecute): If we subbed in null for the global object,
14029 don't toObject it, since that will throw an exception (very slowly).
14031 2008-04-02 Maciej Stachowiak <mjs@apple.com>
14033 Rubber stamped by Geoff
14035 - fix Release build
14038 (KJS::getNonLocalSymbol):
14040 2008-04-02 Geoffrey Garen <ggaren@apple.com>
14042 Reviewed by Oliver Hunt.
14044 Removed the last vestiges of LocalStorage from JSVariableObject and
14047 * kjs/JSGlobalObject.cpp:
14048 (KJS::JSGlobalObject::saveLocalStorage): Save and restore from/to
14049 registers. Use stub isReadOnly and isDontEnum methods for now, until
14050 we really implement attributes in the symbol table.
14051 (KJS::JSGlobalObject::restoreLocalStorage):
14052 (KJS::JSGlobalObject::reset):
14054 * kjs/JSVariableObject.cpp:
14055 (KJS::JSVariableObject::getPropertyNames): Use stub isDontEnum method
14057 (KJS::JSVariableObject::getPropertyAttributes): ditto
14059 * kjs/JSVariableObject.h: Removed LocalStorage from JSVariableObjectData.
14060 Removed mark method, because subclasses implement different strategies for
14062 (KJS::JSVariableObject::isReadOnly): Stub method
14063 (KJS::JSVariableObject::isDontEnum): ditto
14065 Changed the code below to ASSERT_NOT_REACHED() and return 0, since it
14066 can no longer retrieve LocalStorage from the ExecState. (Eventually,
14067 we'll just remove this code and all its friends, but that's a task for
14070 * kjs/ExecState.cpp:
14071 (KJS::ExecState::ExecState):
14072 * kjs/function.cpp:
14073 (KJS::ActivationImp::markChildren):
14076 (KJS::getNonLocalSymbol):
14077 (KJS::ScopeNode::optimizeVariableAccess):
14078 (KJS::ProgramNode::processDeclarations):
14080 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14082 Reviewed by Maciej Stachowiak.
14086 To get things working, I had to roll out
14087 http://trac.webkit.org/projects/webkit/changeset/31226 for the time
14090 * VM/CodeBlock.h: Removed obsolete function.
14093 (KJS::Machine::privateExecute): For the sake of re-entrancy, we track
14094 and restore the global object's old rOffset value. (No way to test this
14095 yet, but I think it will work.)
14097 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14101 - mark the constant pool (at least for function code blocks)
14103 * VM/CodeBlock.cpp:
14104 (KJS::CodeBlock::mark):
14106 * kjs/function.cpp:
14107 (KJS::FunctionImp::mark):
14109 (KJS::ScopeNode::mark):
14111 (KJS::FuncExprNode::body):
14112 (KJS::FuncDeclNode::body):
14114 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14116 Reviewed by Beth Dakin.
14118 Cleaned up a few loose ends.
14120 * JavaScriptCore.exp: Export dumpRegisters, so it's visible to gdb even
14121 if we don't explicitly call it in the source text.
14124 (KJS::Machine::privateExecute): No need to call dumpRegisters anymore,
14125 since that was just a hack for gdb's sake.
14127 * kjs/JSActivation.h: Removed obsolete comment.
14129 * VM/CodeGenerator.cpp: Added ASSERTs to verify that the localCount
14130 we're given matches the number of locals actually allocated.
14132 * VM/CodeGenerator.h:
14133 (KJS::CodeGenerator::CodeGenerator): Changed "localCount" to include
14134 the parameter count, since we're using the word "local" to mean
14135 parameter, var, function, or "this". Renamed "m_nextLocal" to
14136 "m_nextVar", since "m_nextLocal" doesn't contrast well with
14139 Also moved tracking of implicit "this" parameter from here...
14142 (KJS::FunctionBodyNode::generateCode): ... to here
14143 (KJS::ProgramNode::generateCode): ... and here
14145 * VM/CodeBlock.cpp:
14146 (KJS::CodeBlock::dump): Added missing "\n".
14148 2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14150 Reviewed by Oliver.
14152 Bug 18274: ResolveNode::emitCode() doesn't make a new temporary when dst
14153 is 0, leading to incorrect codegen
14154 <http://bugs.webkit.org/show_bug.cgi?id=18274>
14157 (KJS::FunctionCallBracketNode::emitCode):
14158 (KJS::FunctionCallDotNode::emitCode):
14160 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14162 Reviewed by Oliver.
14164 - fix bug in for..in codegen (gotta use ident, not m_ident)
14167 (KJS::ForInNode::emitCode):
14169 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14171 Reviewed by Oliver.
14173 - Add suport for regexp literals
14175 * VM/CodeBlock.cpp:
14176 (KJS::regexpToSourceString):
14178 (KJS::CodeBlock::dump):
14180 * VM/CodeGenerator.cpp:
14181 (KJS::CodeGenerator::addRegExp):
14182 (KJS::CodeGenerator::emitNewRegExp):
14183 * VM/CodeGenerator.h:
14185 (KJS::Machine::privateExecute):
14188 (KJS::RegExpNode::emitCode):
14191 2008-04-01 Oliver Hunt <oliver@apple.com>
14195 Add support for for..in nodes
14197 Added two new opcodes to get_pnames and next_pname to handle iterating
14198 over the set of properties on an object. This iterator is explicitly
14199 invalidated and the property name array is released on standard exit
14200 from the loop, otherwise we rely on GC to do the clean up for us.
14202 * JavaScriptCore.xcodeproj/project.pbxproj:
14203 * VM/CodeBlock.cpp:
14204 (KJS::CodeBlock::dump):
14205 * VM/CodeGenerator.cpp:
14206 (KJS::CodeGenerator::emitNextPropertyName):
14207 (KJS::CodeGenerator::emitGetPropertyNames):
14208 * VM/CodeGenerator.h:
14209 * VM/JSPropertyNameIterator.cpp: Added.
14210 (KJS::JSPropertyNameIterator::JSPropertyNameIterator):
14211 (KJS::JSPropertyNameIterator::type):
14212 (KJS::JSPropertyNameIterator::toPrimitive):
14213 (KJS::JSPropertyNameIterator::getPrimitiveNumber):
14214 (KJS::JSPropertyNameIterator::toBoolean):
14215 (KJS::JSPropertyNameIterator::toNumber):
14216 (KJS::JSPropertyNameIterator::toString):
14217 (KJS::JSPropertyNameIterator::toObject):
14218 (KJS::JSPropertyNameIterator::mark):
14219 (KJS::JSPropertyNameIterator::next):
14220 (KJS::JSPropertyNameIterator::invalidate):
14221 (KJS::JSPropertyNameIterator::~JSPropertyNameIterator):
14222 (KJS::JSPropertyNameIterator::create):
14223 * VM/JSPropertyNameIterator.h: Added.
14225 (KJS::Machine::privateExecute):
14229 * kjs/PropertyNameArray.h:
14231 (KJS::ForInNode::emitCode):
14235 2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14237 Reviewed by Maciej.
14239 Change CodeGenerator::emitCall() so it increments the reference count of
14240 registers passed to it, and change its callers so they don't needlessly
14241 increment the reference count of the registers they are passing.
14243 * VM/CodeGenerator.cpp:
14244 (KJS::CodeGenerator::emitCall):
14246 (KJS::FunctionCallResolveNode::emitCode):
14247 (KJS::FunctionCallDotNode::emitCode):
14249 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14251 Reviewed by Oliver.
14253 - generate call for PostIncDotNode
14256 (KJS::PostIncDotNode::emitCode):
14259 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14263 - fix build (not sure how this ever worked?)
14266 (KJS::FunctionCallBracketNode::emitCode):
14268 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14272 - generate code for FunctionCallBracketNode
14275 (KJS::FunctionCallBracketNode::emitCode):
14278 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14282 - Fix two crashing SunSpider tests
14285 (KJS::Machine::privateExecute): set up 'this' properly for native calls.
14287 (KJS::List::List): Fix intialization of buffer and size from
14288 vector, the initialization order was wrong.
14290 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14292 Build fix: marked ASSERT-only variables as UNUSED_PARAMs.
14295 (KJS::Machine::privateExecute):
14296 * kjs/JSVariableObject.h:
14297 (KJS::JSVariableObject::symbolTableInitializeVariable):
14299 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14301 Reviewed by Oliver Hunt.
14303 Next step toward global code: Moved get, put, and initializeVariable
14304 functionality up into JSVariableObject, and changed JSActivation to
14307 * kjs/JSActivation.cpp:
14308 (KJS::JSActivation::JSActivation):
14309 (KJS::JSActivation::getOwnPropertySlot):
14310 (KJS::JSActivation::put):
14311 (KJS::JSActivation::initializeVariable):
14312 * kjs/JSVariableObject.h:
14313 (KJS::JSVariableObject::valueAt):
14314 (KJS::JSVariableObject::isReadOnly):
14315 (KJS::JSVariableObject::symbolTableGet):
14316 (KJS::JSVariableObject::symbolTablePut):
14317 (KJS::JSVariableObject::symbolTableInitializeVariable):
14319 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14323 - fix HashTable assertion on some SunSpider tests
14325 Don't use -1 as the deleted value for JSValue*-keyed hashtables,
14326 since it is a valid value (it's the immediate for -1).
14328 * VM/CodeGenerator.h:
14329 (KJS::CodeGenerator::JSValueHashTraits::emptyValue):
14330 (KJS::CodeGenerator::JSValueHashTraits::deletedValue):
14331 * kjs/JSImmediate.h:
14332 (KJS::JSImmediate::impossibleValue):
14334 2008-04-01 Sam Weinig <sam@webkit.org>
14336 Reviewed by Maciej Stachowiak.
14338 Add support for calling Native constructors like new Array().
14340 * VM/CodeBlock.cpp:
14341 (KJS::CodeBlock::dump):
14342 * VM/CodeGenerator.cpp:
14343 (KJS::CodeGenerator::emitConstruct):
14344 * VM/CodeGenerator.h:
14346 (KJS::Machine::privateExecute):
14349 (KJS::NewExprNode::emitCode):
14352 2008-04-01 Maciej Stachowiak <mjs@apple.com>
14356 - add some missing toOpbject calls to avoid crashing when calling methods on primitives
14359 (KJS::Machine::privateExecute):
14361 2008-04-01 Geoffrey Garen <ggaren@apple.com>
14363 Reviewed by Oliver Hunt.
14365 Changed Machine::dumpRegisters to take a pointer instead of a reference,
14366 so gdb understands how to call it.
14369 (KJS::Machine::dumpRegisters):
14370 (KJS::Machine::privateExecute):
14373 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14375 Reviewed by Maciej.
14377 Fix CodeGenerator::addConstant() so it uses the functionExpressions
14378 counter for function expressions, not the functions counter.
14380 * VM/CodeGenerator.cpp:
14381 (KJS::CodeGenerator::addConstant):
14383 2008-03-31 Sam Weinig <sam@webkit.org>
14385 Reviewed by Geoffrey Garen.
14387 Add emitCode support for TypeOfResolveNode and TypeOfValueNode.
14388 Added new opcode op_type_of to handle them.
14390 * VM/CodeBlock.cpp:
14391 (KJS::CodeBlock::dump):
14392 * VM/CodeGenerator.cpp:
14393 (KJS::CodeGenerator::emitNot):
14394 (KJS::CodeGenerator::emitInstanceOf):
14395 (KJS::CodeGenerator::emitTypeOf):
14396 * VM/CodeGenerator.h:
14398 (KJS::jsTypeStringForValue):
14399 (KJS::Machine::privateExecute):
14402 (KJS::TypeOfResolveNode::emitCode):
14403 (KJS::TypeOfValueNode::emitCode):
14406 2008-03-31 Sam Weinig <sam@webkit.org>
14408 Reviewed by Oliver Hunt.
14410 Fix non-computed goto version of isOpcode. op_end is a valid opcode.
14413 (KJS::Machine::isOpcode):
14415 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14417 Reviewed by Maciej Stachowiak.
14421 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14423 Reviewed by Geoffrey Garen.
14425 Add support for FunctionCallDotNode.
14428 (KJS::FunctionCallDotNode::emitCode):
14431 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14433 Reviewed by Beth Dakin.
14435 Next step toward global code: Removed more obsolete API, moved
14436 saveLocalStorage and restoreLocalStorage to JSGlobalObject subclass,
14437 since it's only intended for use there.
14440 * JavaScriptCore.exp:
14441 * kjs/Activation.h:
14442 * kjs/JSGlobalObject.cpp:
14443 (KJS::JSGlobalObject::saveLocalStorage):
14444 (KJS::JSGlobalObject::restoreLocalStorage):
14445 * kjs/JSGlobalObject.h:
14446 * kjs/JSVariableObject.cpp:
14447 * kjs/JSVariableObject.h:
14448 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
14449 * kjs/function.cpp:
14450 (KJS::ActivationImp::ActivationImp):
14452 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14454 Reviewed by Beth Dakin.
14456 Next step toward global code: subclass JSActivation + JSActivationData
14457 from JSVariableObject + JSVariableObjectData.
14459 JSActivation now relies on JSVariableObject for access to registers and
14460 symbol table, and for some delete functionality, but not for anything
14463 (KJS::JSActivation::mark): Cleaned up the style here a little bit.
14465 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14467 Reviewed by Beth Dakin.
14469 Next step toward global code: store "rOffset" in JSVariableObjectData.
14471 * kjs/JSGlobalObject.h:
14472 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
14473 * kjs/JSVariableObject.h:
14474 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
14476 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14478 Reviewed by Maciej Stachowiak.
14480 Next steps toward global code:
14482 * Moved access to the register file into JSVariableObject.
14484 * Added more ASSERTs to indicate obsolete APIs there are just hanging
14485 around to stave off build failures.
14487 * kjs/JSGlobalObject.h:
14488 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
14489 * kjs/JSVariableObject.h:
14490 (KJS::JSVariableObject::registers):
14491 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
14492 (KJS::JSVariableObject::JSVariableObject):
14494 2008-03-31 Sam Weinig <sam@webkit.org>
14496 Reviewed by Oliver. Tweaked somewhat by Maciej.
14498 - implement codegen for ReadModifyResolveNode
14501 (KJS::emitReadModifyAssignment):
14502 (KJS::ReadModifyResolveNode::emitCode):
14505 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14509 Fix the build -- r31492 removed activation tear-off, but r31493 used it.
14512 (KJS::FuncExprNode::makeFunction):
14514 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14516 Reviewed by Maciej.
14518 Add support for FuncExprNode to SquirrelFish.
14520 * VM/CodeBlock.cpp:
14521 (KJS::CodeBlock::dump):
14523 * VM/CodeGenerator.cpp:
14524 (KJS::CodeGenerator::addConstant):
14525 (KJS::CodeGenerator::emitNewFunctionExpression):
14526 * VM/CodeGenerator.h:
14528 (KJS::Machine::privateExecute):
14531 (KJS::FuncExprNode::emitCode):
14532 (KJS::FuncExprNode::makeFunction):
14535 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14537 Reviewed by Maciej Stachowiak.
14539 First step toward global code: removed some obsolete JSGlobalObject
14540 APIs, changing clients to ASSERT_NOT_REACHED.
14542 Activation tear-off and scope chain pushing is obsolete because we
14543 statically detect whether an activation + scope node is required.
14545 The variableObject() and activationObject() accessors are obsolete
14546 because they haven't been maintained, and they're mostly used by
14547 node evaluation code, anyway.
14549 The localStorage() accessor is obsolete because everything is in
14550 registers now, and it's mostly used by node evaluation code, anyway.
14552 2008-03-31 Maciej Stachowiak <mjs@apple.com>
14556 - implement codegen for bracket accessor and bracket assign
14558 * VM/CodeBlock.cpp:
14559 (KJS::CodeBlock::dump):
14560 * VM/CodeGenerator.cpp:
14561 (KJS::CodeGenerator::emitGetPropVal):
14562 (KJS::CodeGenerator::emitPutPropVal):
14563 * VM/CodeGenerator.h:
14565 (KJS::Machine::privateExecute):
14568 (KJS::BracketAccessorNode::emitCode):
14569 (KJS::AssignBracketNode::emitCode):
14572 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14576 Removed FIXME that I just fixed.
14578 Added ASSERT to cover an error previously only covered by a FIXME.
14580 * kjs/JSActivation.cpp:
14581 (KJS::JSActivation::getOwnPropertySlot):
14583 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14587 Fixed indentation inside op_call. (I had left this code badly indented
14588 to make the behavior-changing diff clearer.)
14591 (KJS::Machine::privateExecute):
14593 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14595 Reviewed by Sam Weinig.
14597 Fixed up logging of jump instructions to follow the following style:
14599 jump offset(->absoluteTarget)
14601 * VM/CodeBlock.cpp:
14602 (KJS::CodeBlock::dump):
14604 2008-03-31 Geoffrey Garen <ggaren@apple.com>
14606 Reviewed by Sam Weinig.
14608 Changed the SymbolTable API to use int instead of size_t. It has been
14609 using int internally for a while now (since squirrelfish symbols can
14610 have negative indices).
14612 2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14614 Reviewed by Maciej.
14616 Add support for FunctionCallValueNode.
14619 (KJS::FunctionCallValueNode::emitCode):
14622 2008-03-31 Maciej Stachowiak <mjs@apple.com>
14624 Reviewed by Oliver.
14626 1) Implemented array literals
14628 2) Renamed op_object_get and op_object_put to op_get_prop_id and
14629 op_put_prop_id in preparation for new variants.
14631 * VM/CodeBlock.cpp:
14632 (KJS::CodeBlock::dump):
14633 * VM/CodeGenerator.cpp:
14634 (KJS::CodeGenerator::emitNewArray):
14635 (KJS::CodeGenerator::emitGetPropId):
14636 (KJS::CodeGenerator::emitPutPropId):
14637 (KJS::CodeGenerator::emitPutPropIndex):
14638 * VM/CodeGenerator.h:
14639 (KJS::CodeGenerator::CodeGenerator):
14640 (KJS::CodeGenerator::propertyNames):
14642 (KJS::Machine::privateExecute):
14645 (KJS::ArrayNode::emitCode):
14646 (KJS::PropertyListNode::emitCode):
14647 (KJS::DotAccessorNode::emitCode):
14648 (KJS::PostIncResolveNode::emitCode):
14649 (KJS::PreIncResolveNode::emitCode):
14650 (KJS::AssignResolveNode::emitCode):
14651 (KJS::AssignDotNode::emitCode):
14654 2008-03-30 Geoffrey Garen <ggaren@apple.com>
14656 Reviewed by Oliver Hunt.
14658 Implemented native function calls. (Re-entering from native code back
14659 to JS doesn't work yet, though.)
14661 0.2% speedup overall, due to some inlining tweaks. 3.6% regression on
14662 function-empty.js, since we're making a new virtual call and taking a
14663 new branch inside every op_call.
14665 I adjusted the JavaScriptCore calling convention to minimize overhead,
14668 The machine calls a single virtual function, "getCallData", to get all
14669 the data it needs for a function call. Native code still uses the old
14670 "isObject()" check followed by an "implementsCall()" check, which
14671 aliases to "getCallData". (We can optimize native code to use getCallData
14674 To supply a list of arguments, the machine calls a new List constructor
14675 that just takes a pointer and a length, without copying. Native code
14676 still appends to the list one argument at a time. (We can optimize
14677 native code to use the new List constructor at our leisure.)
14680 (KJS::Machine::privateExecute): Changed resize() call to grow() call,
14681 to encourage the compiler to inline the Vector code.
14683 * kjs/CallData.h: Added.
14684 (KJS::): CallData is a union because eventually native calls will stuff
14685 a function pointer into it, to eliminate the callAsFunction virtual call.
14687 * kjs/function.cpp:
14688 (KJS::FunctionImp::callAsFunction): Changed this to an ASSERT since
14689 it's not implemented yet.
14691 * kjs/list.h: Made the List class two-faced, to support the old way and
14692 the new way during this transition phase: lists can be made read-only
14693 with just a pointer and a legnth, or you can append to them one item
14697 (KJS::jsUndefined): Marked this function ALWAYS_INLINE for the benefit
14698 of a certain compiler that doesn't know what's best for it.
14700 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14702 Reviewed by Oliver.
14704 Dump code that codegen can't handle yet, so it's easier to prioritize missing nodes.
14707 (KJS::Node::emitCode):
14709 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14711 Reviewed by Oliver.
14713 Improve dumping of bytecode and fix coding style accordingly.
14715 Registers are printed as lr1 for locals, tr1 for temp registers. Identifiers print as
14716 foobar(@id0) and constants print as "foo"(@k1) or 312.4(@k2) or the like. Constant and
14717 identifier tables are dumped for reference.
14719 * VM/CodeBlock.cpp:
14720 (KJS::escapeQuotes):
14721 (KJS::valueToSourceString):
14722 (KJS::registerName):
14723 (KJS::constantName):
14725 (KJS::printUnaryOp):
14726 (KJS::printBinaryOp):
14727 (KJS::CodeBlock::dump):
14730 (KJS::resolveBase):
14731 (KJS::Machine::privateExecute):
14733 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14735 Reviewed by Oliver.
14737 Implement StringNode and VoidNode (both pretty trivial).
14740 (KJS::StringNode::emitCode):
14741 (KJS::VoidNode::emitCode):
14744 2008-03-30 Maciej Stachowiak <mjs@apple.com>
14748 Implement CommaNode.
14751 (KJS::CommaNode::emitCode):
14754 2008-03-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14756 Reviewed by Maciej.
14758 Adds support for dot notation and object literals.
14760 * VM/CodeBlock.cpp:
14761 (KJS::CodeBlock::dump):
14762 * VM/CodeGenerator.cpp:
14763 (KJS::CodeGenerator::emitNewObject):
14764 * VM/CodeGenerator.h:
14766 (KJS::Machine::privateExecute):
14769 (KJS::ObjectLiteralNode::emitCode):
14770 (KJS::PropertyListNode::emitCode):
14771 (KJS::DotAccessorNode::emitCode):
14772 (KJS::AssignDotNode::emitCode):
14775 2008-03-29 Geoffrey Garen <ggaren@apple.com>
14777 Reviewed by Maciej Stachowiak.
14779 Mark the register file.
14781 It's a conservative mark for now, but once registers are typed, we can
14784 1.4% regression regardless of whether we actually do the marking.
14785 GCC is is worth every penny.
14788 (KJS::Machine::privateExecute): Most of the changes here are just for
14789 the fact that "registers" is a pointer now.
14791 * kjs/JSGlobalObject.cpp: The global object owns the register file now.
14793 2008-03-28 Oliver Hunt <oliver@apple.com>
14795 Reviewed by Maciej.
14797 Bug 18204: SquirrelFish: continue/break do not correctly handle scope popping
14798 <http://bugs.webkit.org/show_bug.cgi?id=18204>
14800 We now track the scope depth as part of a loop context, and add an
14801 extra instruction op_jump_scopes that is used to perform a jump across
14802 dynamic scope boundaries.
14804 * VM/CodeBlock.cpp:
14805 (KJS::CodeBlock::dump):
14806 * VM/CodeGenerator.cpp:
14807 (KJS::CodeGenerator::emitJumpScopes):
14808 * VM/CodeGenerator.h:
14810 (KJS::Machine::privateExecute):
14813 (KJS::ContinueNode::emitCode):
14814 (KJS::BreakNode::emitCode):
14816 2008-03-28 Sam Weinig <sam@webkit.org>
14818 Reviewed by Geoffrey Garen.
14820 Add emitCode support for ConditionalNode.
14823 (KJS::ConditionalNode::emitCode):
14826 2008-03-28 Geoffrey Garen <ggaren@apple.com>
14828 Reviewed by Oliver Hunt.
14830 Responding to feedback, added some comments, fixed up a few names, and
14831 clarified that "locals" always means all local variables, functions,
14834 2008-03-28 Geoffrey Garen <ggaren@apple.com>
14836 Reviewed by Oliver Hunt.
14838 Added support for "this".
14840 Supply an implicit "this" value as the first argument to every function.
14841 Alias the "this" keyword to that argument.
14843 1% regression overall, 2.5% regression on empty function calls. Seems
14844 like a reasonable cost for now, since we're doing more work.
14845 (Eventually, we might decide to create a version of op_call specialized
14846 for a known null "this" value.)
14848 * VM/CodeBlock.cpp:
14849 (KJS::CodeBlock::dump):
14850 * VM/CodeGenerator.cpp:
14851 (KJS::CodeGenerator::emitCall):
14852 * VM/CodeGenerator.h:
14853 (KJS::CodeGenerator::CodeGenerator):
14855 (KJS::Machine::privateExecute):
14856 * kjs/CommonIdentifiers.cpp:
14857 (KJS::CommonIdentifiers::CommonIdentifiers):
14858 * kjs/CommonIdentifiers.h:
14860 (KJS::ThisNode::emitCode):
14861 (KJS::FunctionCallResolveNode::emitCode):
14864 2008-03-28 Oliver Hunt <oliver@apple.com>
14868 Bug 18192: Squirrelfish needs support for break and continue
14869 <http://bugs.webkit.org/show_bug.cgi?id=18192>
14871 Added a loop context stack to the code generator to provide the
14872 correct jump labels for continue and goto. Added logic to the
14873 currently implemented loop constructs to manage entry and exit
14874 from the loop contexts. Finally, implemented codegen for break
14875 and continue (and a pass through for LabelNode)
14877 * VM/CodeGenerator.cpp:
14878 (KJS::CodeGenerator::pushLoopContext):
14879 (KJS::CodeGenerator::popLoopContext):
14880 (KJS::CodeGenerator::loopContextForIdentifier):
14881 (KJS::CodeGenerator::labelForContinue):
14882 (KJS::CodeGenerator::labelForBreak):
14883 * VM/CodeGenerator.h:
14885 (KJS::DoWhileNode::emitCode):
14886 (KJS::WhileNode::emitCode):
14887 (KJS::ForNode::emitCode):
14888 (KJS::ContinueNode::emitCode):
14889 (KJS::BreakNode::emitCode):
14890 (KJS::LabelNode::emitCode):
14893 2008-03-27 Sam Weinig <sam@webkit.org>
14895 Reviewed by Geoffrey Garen.
14897 Add emitCode support for UnaryPlusNode, NegateNode, BitwiseNotNode and LogicalNotNode.
14899 * VM/CodeBlock.cpp:
14900 (KJS::printUnaryOp):
14901 (KJS::CodeBlock::dump):
14902 * VM/CodeGenerator.cpp:
14903 (KJS::CodeGenerator::emitToJSNumber):
14904 (KJS::CodeGenerator::emitNegate):
14905 (KJS::CodeGenerator::emitBitNot):
14906 (KJS::CodeGenerator::emitNot):
14907 * VM/CodeGenerator.h:
14909 (KJS::Machine::privateExecute):
14912 (KJS::UnaryPlusNode::emitCode):
14913 (KJS::NegateNode::emitCode):
14914 (KJS::BitwiseNotNode::emitCode):
14915 (KJS::LogicalNotNode::emitCode):
14918 2008-03-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
14920 Reviewed by Maciej Stachowiak.
14922 Add support for LogicalAndNode and LogicalOrNode.
14925 (KJS::LogicalAndNode::emitCode):
14926 (KJS::LogicalOrNode::emitCode):
14929 2008-03-27 Sam Weinig <sam@webkit.org>
14931 Clean up code and debug output.
14933 * VM/CodeBlock.cpp:
14934 (KJS::CodeBlock::dump):
14936 (KJS::Machine::privateExecute):
14938 2008-03-27 Geoffrey Garen <ggaren@apple.com>
14940 Moved an ASSERT to a more logical place.
14943 (KJS::Machine::privateExecute):
14945 2008-03-27 Sam Weinig <sam@webkit.org>
14947 Reviewed by Oliver Hunt.
14949 Add emitCode support for InstanceOfNode.
14951 * VM/CodeBlock.cpp:
14952 (KJS::CodeBlock::dump):
14953 * VM/CodeGenerator.cpp:
14954 (KJS::CodeGenerator::emitInstanceOf):
14955 * VM/CodeGenerator.h:
14957 (KJS::Machine::privateExecute):
14960 (KJS::InstanceOfNode::emitCode):
14963 2008-03-27 Oliver Hunt <oliver@apple.com>
14965 Reviewed by Maciej.
14967 Bug 18142: squirrelfish needs to support dynamic scoping/with
14968 <http://bugs.webkit.org/show_bug.cgi?id=18142>
14970 Add support for dynamic scoping and add code to handle 'with'
14973 * VM/CodeBlock.cpp:
14974 (KJS::CodeBlock::dump):
14976 (KJS::CodeBlock::CodeBlock):
14977 * VM/CodeGenerator.cpp:
14978 (KJS::CodeGenerator::getRegister):
14979 (KJS::CodeGenerator::emitPushScope):
14980 (KJS::CodeGenerator::emitPopScope):
14981 * VM/CodeGenerator.h:
14982 (KJS::CodeGenerator::CodeGenerator):
14984 (KJS::Machine::privateExecute):
14987 (KJS::WithNode::emitCode):
14990 2008-03-27 Sam Weinig <sam@webkit.org>
14992 Reviewed by Geoffrey Garen.
14994 Add emitCode support for NullNode, FalseNode, TrueNode, IfNode, IfElseNode, DoWhileNode and WhileNode
14996 * VM/CodeBlock.cpp:
14997 (KJS::CodeBlock::dump): Dump op_jfalse opcode.
14998 * VM/CodeGenerator.cpp:
14999 (KJS::CodeGenerator::emitJumpIfFalse): Identical to emitJumpIfTrue except it emits the op_jfalse opcode.
15000 (KJS::CodeGenerator::emitLoad): Add and emitLoad override for booleans.
15001 * VM/CodeGenerator.h:
15003 (KJS::Machine::privateExecute): Adds execution of op_jfalse. It is identical to op_jtrue, except the
15004 the condition is reversed.
15005 * VM/Opcode.h: Add op_jfalse.
15007 (KJS::NullNode::emitCode): Added.
15008 (KJS::FalseNode::emitCode): Added.
15009 (KJS::TrueNode::emitCode): Added.
15010 (KJS::IfNode::emitCode): Added.
15011 (KJS::IfElseNode::emitCode): Added.
15012 (KJS::DoWhileNode::emitCode): Added.
15013 (KJS::WhileNode::emitCode): Added.
15016 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15018 Nixed an unused List.
15020 The calm before my stormy war against the List class.
15022 * kjs/function_object.cpp:
15023 (KJS::FunctionObjectImp::construct):
15025 2008-03-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
15027 Reviewed by Geoffrey Garen.
15029 Adds support for EqualNode, NotEqualNode, StrictEqualNode, NotStrictEqualNode,
15030 LessEqNode, GreaterNode, GreaterEqNode, MultNode, DivNode, ModNode, SubNode,
15031 LeftShiftNode, RightShiftNode, UnsignedRightShiftNode, BitAndNode, BitXOrNode,
15034 * VM/CodeBlock.cpp:
15035 (KJS::CodeBlock::dump):
15036 * VM/CodeGenerator.cpp:
15037 (KJS::CodeGenerator::emitEqual):
15038 (KJS::CodeGenerator::emitNotEqual):
15039 (KJS::CodeGenerator::emitStrictEqual):
15040 (KJS::CodeGenerator::emitNotStrictEqual):
15041 (KJS::CodeGenerator::emitLessEq):
15042 (KJS::CodeGenerator::emitMult):
15043 (KJS::CodeGenerator::emitDiv):
15044 (KJS::CodeGenerator::emitMod):
15045 (KJS::CodeGenerator::emitSub):
15046 (KJS::CodeGenerator::emitLeftShift):
15047 (KJS::CodeGenerator::emitRightShift):
15048 (KJS::CodeGenerator::emitUnsignedRightShift):
15049 (KJS::CodeGenerator::emitBitAnd):
15050 (KJS::CodeGenerator::emitBitXOr):
15051 (KJS::CodeGenerator::emitBitOr):
15052 * VM/CodeGenerator.h:
15055 (KJS::Machine::privateExecute):
15058 (KJS::MultNode::emitCode):
15059 (KJS::DivNode::emitCode):
15060 (KJS::ModNode::emitCode):
15061 (KJS::SubNode::emitCode):
15062 (KJS::LeftShiftNode::emitCode):
15063 (KJS::RightShiftNode::emitCode):
15064 (KJS::UnsignedRightShiftNode::emitCode):
15065 (KJS::GreaterNode::emitCode):
15066 (KJS::LessEqNode::emitCode):
15067 (KJS::GreaterEqNode::emitCode):
15068 (KJS::EqualNode::emitCode):
15069 (KJS::NotEqualNode::emitCode):
15070 (KJS::StrictEqualNode::emitCode):
15071 (KJS::NotStrictEqualNode::emitCode):
15072 (KJS::BitAndNode::emitCode):
15073 (KJS::BitXOrNode::emitCode):
15074 (KJS::BitOrNode::emitCode):
15077 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15079 Reviewed by Oliver Hunt.
15081 Only print debug dumps in debug builds.
15083 * VM/CodeGenerator.cpp:
15084 (KJS::CodeGenerator::generate):
15086 (KJS::Machine::privateExecute):
15088 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15090 Reviewed by Oliver Hunt.
15092 Moved a few files around in the XCode project.
15094 * JavaScriptCore.xcodeproj/project.pbxproj:
15096 2008-03-26 Geoffrey Garen <ggaren@apple.com>
15098 Reviewed by Oliver Hunt.
15100 Made closures work.
15102 An activation object aliases to the register file until its associated
15103 function returns, at which point it copies the registers for locals and
15104 parameters into an independent storage buffer.
15106 2008-03-24 Geoffrey Garen <ggaren@apple.com>
15108 Reviewed by Oliver Hunt.
15110 Fixed recent 25% regression on simple for loop test. GCC seems to be
15111 very finicky about the code that gets inlined into
15112 Machine::privateExecute.
15114 Everything in this patch is simply the result of experiment.
15116 The resolve and resolve_base opcodes do not seem to have gotten slower
15121 (KJS::resolveBase):
15122 (KJS::Machine::privateExecute):
15125 2008-03-24 Oliver Hunt <oliver@apple.com>
15127 Reviewed by Geoff Garen.
15129 Bug 18059: squirrelfish needs to compile on platforms without computed goto
15130 <http://bugs.webkit.org/show_bug.cgi?id=18059>
15132 "Standard" macro style support for conditionalising the use of computed goto.
15134 * JavaScriptCore.xcodeproj/project.pbxproj:
15136 (KJS::Machine::isOpcode):
15137 (KJS::Machine::privateExecute):
15139 (KJS::Machine::getOpcode):
15140 (KJS::Machine::getOpcodeID):
15144 2008-03-24 Geoffrey Garen <ggaren@apple.com>
15146 Moved my notes from nodes.h to the wiki.
15150 2008-03-24 Geoffrey Garen <ggaren@apple.com>
15152 SquirrelFish lives.
15154 Initial check-in of the code I've been carrying around. Lots of stuff
15155 doesn't work. Plus a bunch of empty files.
15157 === Start merge of squirrelfish ===
15159 2008-05-21 Darin Adler <darin@apple.com>
15161 - try to fix the Windows build
15163 * profiler/Profiler.cpp:
15164 (KJS::Profiler::stopProfiling): Use ptrdiff_t instead of the less-common but incredibly
15165 similar ssize_t type.
15167 (KJS::AVLTree::search): Added a typename for a dependent name that's a type.
15169 2008-05-21 Darin Adler <darin@apple.com>
15171 Reviewed by Anders.
15173 - fix <rdar://problem/5952721> bug in JavaScript arguments object property lookup
15175 Test: fast/js/arguments-bad-index.html
15177 * kjs/function.cpp:
15178 (KJS::IndexToNameMap::IndexToNameMap): Use unsigned instead of int.
15179 (KJS::IndexToNameMap::isMapped): Use unsigned instead of int, and also use the
15180 strict version of the numeric conversion function, since we don't want to allow
15182 (KJS::IndexToNameMap::unMap): Ditto.
15183 (KJS::IndexToNameMap::operator[]): Ditto.
15184 * kjs/function.h: Changed IndexToNameMap::size type from int to unsigned.
15186 2008-05-21 Timothy Hatcher <timothy@apple.com>
15188 Change the Profiler to allow multiple profiles to be running at
15189 the same time. This can happen when you have nested console.profile()
15190 calls. This required two changes. First, the Profiler needed to keep a
15191 Vector of current profiles, instead of one. Second, a Profile needs
15192 to keep track of the global ExecState it started in and the page group
15193 identifier it is tracking.
15195 The stopProfiling call now takes the same arguments as startProfiling.
15196 This makes sure the correct profile is stopped. Passing a null UString
15197 as the title will stop the last profile for the matching ExecState.
15199 <rdar://problem/5951559> Multiple pages profiling can interfere with each other
15201 Reviewed by Kevin McCullough.
15203 * JavaScriptCore.exp: Added new exports. Removed old symbols.
15204 * profiler/Profile.cpp:
15205 (KJS::Profile::Profile): New constructor arguments for the
15206 originatingGlobalExec and pageGroupIdentifier.
15207 (KJS::Profile::stopProfiling): Set the m_originatingGlobalExec to null.
15208 * profiler/Profile.h:
15209 (KJS::Profile::create): Additional arguments.
15210 (KJS::Profile::originatingGlobalExec): Return m_originatingGlobalExec.
15211 (KJS::Profile::pageGroupIdentifier): Return m_pageGroupIdentifier.
15212 * profiler/Profiler.cpp:
15213 (KJS::Profiler::findProfile): Added. Finds a Profile that matches
15214 the ExecState and title.
15215 (KJS::Profiler::startProfiling): Return early if there is already
15216 a Profile with the ExecState and title. If not, create a new profile
15217 and append it to m_currentProfiles.
15218 (KJS::Profiler::stopProfiling): Loops through m_currentProfiles
15219 and find the one matching the ExecState and title. If one is found
15220 call stopProfiling and return the Profile after removing it
15221 from m_currentProfiles.
15222 (KJS::dispatchFunctionToProfiles): Helper inline function to loop through
15223 m_currentProfiles and call a Profile function.
15224 (KJS::Profiler::willExecute): Call dispatchFunctionToProfiles.
15225 (KJS::Profiler::didExecute): Ditto.
15226 * profiler/Profiler.h:
15228 2008-05-21 Alexey Proskuryakov <ap@webkit.org>
15232 <rdar://problem/5908520> REGRESSION (3.1.1-r33033): Crash in WebKit when opening or
15233 refreshing page on people.com
15235 The problem was that STL algorithms do not work with non-conformant comparators, and the
15236 site used sort(function() { return 0.5 - Math.random(); } to randomly shuffle an array.
15238 https://bugs.webkit.org/show_bug.cgi?id=18687
15239 REGRESSION(r32220): ecma/Array/15.4.4.5-3.js test now fails in GMT(BST)
15241 Besides relying on sort stability, this test was just broken, and kept failing with the
15244 Tests: fast/js/sort-randomly.html
15245 fast/js/sort-stability.html
15246 fast/js/comparefn-sort-stability.html
15248 * kjs/avl_tree.h: Added an AVL tree implementation.
15250 * JavaScriptCore.xcodeproj/project.pbxproj:
15251 * wtf/AVLTree.h: Added.
15252 Added an AVL tree implementation.
15254 * kjs/array_instance.cpp:
15255 (KJS::ArrayInstance::increaseVectorLength):
15256 (KJS::ArrayInstance::sort):
15257 (KJS::AVLTreeAbstractorForArrayCompare::get_less):
15258 (KJS::AVLTreeAbstractorForArrayCompare::set_less):
15259 (KJS::AVLTreeAbstractorForArrayCompare::get_greater):
15260 (KJS::AVLTreeAbstractorForArrayCompare::set_greater):
15261 (KJS::AVLTreeAbstractorForArrayCompare::get_balance_factor):
15262 (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
15263 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
15264 (KJS::AVLTreeAbstractorForArrayCompare::compare_key_node):
15265 (KJS::AVLTreeAbstractorForArrayCompare::compare_node_node):
15266 (KJS::AVLTreeAbstractorForArrayCompare::null):
15267 (KJS::ArrayInstance::compactForSorting):
15269 * kjs/array_instance.h: increaseVectorLength() now returns a bool to indicate whether it was
15273 (WTF::Vector::Vector):
15274 (WTF::::operator=):
15276 Make these methods fail instead of crash when allocation fails, matching resize() and
15277 reserveCapacity(), which already had this behavior. Callers need to check for null buffer
15278 after making any Vector call that can try to allocate.
15280 * tests/mozilla/ecma/Array/15.4.4.5-3.js: Fixed the test to use a consistent sort function,
15281 as suggested in comments to a Mozilla bug filed about it (I'll keep tracking the bug to see
15282 what the final resolution is).
15284 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15288 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
15290 - Implements focus by adding the idea of a profileNode being visible and
15291 adding the ability to reset all of the visible flags.
15293 * profiler/Profile.h:
15294 (KJS::Profile::focus):
15295 * profiler/ProfileNode.cpp:
15296 (KJS::ProfileNode::ProfileNode): Initialize the visible flag.
15297 (KJS::ProfileNode::setTreeVisible): Set the visibility of this node and
15298 all of its descendents.
15299 (KJS::ProfileNode::focus): Determine if this node should be visible when
15300 focusing, if the functionName matches this node's function name or if any
15301 of this node's children are visible.
15302 (KJS::ProfileNode::restoreAll): Restore all nodes' visible flag.
15303 (KJS::ProfileNode::debugPrintData):
15304 * profiler/ProfileNode.h:
15305 (KJS::ProfileNode::visible):
15306 (KJS::ProfileNode::setVisible):
15308 2008-05-20 Timothy Hatcher <timothy@apple.com>
15310 Fixes a couple performance issues with the profiler. Also fixes
15311 a regression where some nodes wouldn't be added to the tree.
15313 Reviewed by Kevin McCullough.
15315 * profiler/ProfileNode.cpp:
15316 (KJS::ProfileNode::addChild): Compare callIdentifier instead
15318 * profiler/ProfileNode.h:
15319 (CallIdentifier.operator==): Compare the CallIdentifiers in
15320 an order that fails sooner for non-matches.
15321 (CallIdentifier.callIdentifier): Return the CallIdentifier by
15322 reference to prevent making a new copy each time.
15324 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15328 <rdar://problem/5950796> JSProfiler: dump functions are in the code
15329 Removed dump and logging functions from the Release version of the code
15330 and renamed them to be obviously for debugging only.
15332 * JavaScriptCore.exp:
15333 * profiler/Profile.cpp:
15334 (KJS::Profile::debugPrintData):
15335 (KJS::Profile::debugPrintDataSampleStyle):
15336 * profiler/Profile.h:
15337 * profiler/ProfileNode.cpp:
15338 (KJS::ProfileNode::debugPrintData):
15339 (KJS::ProfileNode::debugPrintDataSampleStyle):
15340 * profiler/ProfileNode.h:
15341 * profiler/Profiler.cpp:
15342 * profiler/Profiler.h:
15344 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15348 <rdar://problem/5950538> JSProfiler: Keep track of non-JS execution time
15349 We now have an extra node that represents the excess non-JS time.
15350 - Also changed "SCRIPT" and "anonymous function" to be more consistent
15353 * profiler/ProfileNode.cpp:
15354 (KJS::ProfileNode::stopProfiling): If this ProfileNode is the head node
15355 create a new child that has the excess execution time.
15356 (KJS::ProfileNode::calculatePercentages): Moved calculation of the
15357 percentages into a function since it's called from multiple places.
15358 * profiler/ProfileNode.h: Add the newly needed functions used above.
15359 (KJS::ProfileNode::setTotalTime):
15360 (KJS::ProfileNode::setSelfTime):
15361 (KJS::ProfileNode::setNumberOfCalls):
15362 * profiler/Profiler.cpp: renamed "SCRIPT" and "anonymous function" to be
15363 consistent with the debugger and use constants that can be localized
15365 (KJS::getCallIdentifiers):
15366 (KJS::getCallIdentifierFromFunctionImp):
15368 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15372 <rdar://problem/5770054> JavaScript profiler (10928)
15373 Removed only profiler-internal use of currentProfile since that concept
15376 * profiler/Profile.h: Now stopProfiling takes a time and bool as
15377 arguments. The time is used to calculate %s from and the bool tells
15378 if this node is the head node and should be the one calculating the time.
15379 (KJS::Profile::stopProfiling):
15380 * profiler/ProfileNode.cpp: Ditto.
15381 (KJS::ProfileNode::stopProfiling):
15382 * profiler/ProfileNode.h: Ditto.
15384 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15386 Accidentally turned on the profiler.
15391 2008-05-20 Kevin McCullough <kmccullough@apple.com>
15395 <rdar://problem/5770054> JavaScript profiler (10928)
15396 Split function name into 3 parts so that the Web Inspector can link it to
15397 the resource location from whence it came.
15399 * kjs/ustring.cpp: Implemented operator> for UStrings
15402 * profiler/Profile.cpp:
15403 (KJS::Profile::Profile): Initialize all 3 values.
15404 (KJS::Profile::willExecute): Use CallIdentifier struct.
15405 (KJS::Profile::didExecute): Ditto.
15406 * profiler/Profile.h: Ditto and remove unused function.
15407 * profiler/ProfileNode.cpp:
15408 (KJS::ProfileNode::ProfileNode): Use CallIdentifier struct.
15409 (KJS::ProfileNode::willExecute): Ditto and fix an issue where we
15410 restarted the m_startTime even though it was already started.
15411 (KJS::ProfileNode::didExecute): Ditto.
15412 (KJS::ProfileNode::findChild): Ditto.
15413 (KJS::functionNameDescendingComparator): Ditto and use new comparator.
15414 (KJS::functionNameAscendingComparator): Ditto.
15415 (KJS::ProfileNode::printDataInspectorStyle): Use CallIdentifier struct.
15416 (KJS::ProfileNode::printDataSampleStyle): Ditto.
15417 * profiler/ProfileNode.h:
15418 (KJS::CallIdentifier::CallIdentifier): Describe the CallIdentifier struct
15419 (KJS::CallIdentifier::operator== ):
15420 (KJS::ProfileNode::create): Use the CallIdentifier struct.
15421 (KJS::ProfileNode::callIdentifier):
15422 (KJS::ProfileNode::functionName): Now only return the function name, not
15423 the url and line number too.
15424 (KJS::ProfileNode::url):
15425 (KJS::ProfileNode::lineNumber):
15426 * profiler/Profiler.cpp: Use the CallIdentifier struct.
15427 (KJS::Profiler::startProfiling):
15428 (KJS::Profiler::willExecute):
15429 (KJS::Profiler::didExecute):
15430 (KJS::getCallIdentifiers):
15431 (KJS::getCallIdentifierFromFunctionImp):
15433 2008-05-20 Timothy Hatcher <timothy@apple.com>
15435 Rename sortFileName{Ascending,Descending} to
15436 sortFunctionName{Ascending,Descending}.
15438 Reviewed by Kevin McCullough.
15440 * JavaScriptCore.exp:
15442 * profiler/Profile.h:
15443 * profiler/ProfileNode.cpp:
15444 (KJS::functionNameDescendingComparator):
15445 (KJS::ProfileNode::sortFunctionNameDescending):
15446 (KJS::functionNameAscendingComparator):
15447 (KJS::ProfileNode::sortFunctionNameAscending):
15448 * profiler/ProfileNode.h:
15450 2008-05-19 Timothy Hatcher <timothy@apple.com>
15452 Make the profiler use higher than millisecond resolution time-stamps.
15454 Reviewed by Kevin McCullough.
15456 * kjs/DateMath.cpp:
15457 (KJS::getCurrentUTCTime): Call getCurrentUTCTimeWithMicroseconds and
15459 (KJS::getCurrentUTCTimeWithMicroseconds): Copied from the previous
15460 implementation of getCurrentUTCTime without the floor call.
15461 * kjs/DateMath.h: Addded getCurrentUTCTimeWithMicroseconds.
15462 * profiler/ProfileNode.cpp:
15463 (KJS::ProfileNode::ProfileNode): Use getCurrentUTCTimeWithMicroseconds.
15465 2008-05-19 Timothy Hatcher <timothy@apple.com>
15467 Fixes a bug in the profiler where call and apply would show up
15468 and double the time spent in a function. We don't want to show call
15469 and apply at all in the profiles. This change excludes them.
15471 Reviewed by Kevin McCullough.
15473 * profiler/ProfileNode.cpp:
15474 (KJS::ProfileNode::stopProfiling): Remove a second for loop and
15475 calculate self time in the existing loop.
15476 * profiler/Profiler.cpp:
15477 (KJS::shouldExcludeFunction): Helper inline function that returns
15478 true in the current function in an InternalFunctionImp and it is
15479 has the functionName call or apply.
15480 (KJS::Profiler::willExecute): Call shouldExcludeFunction and return
15481 early if if returns true.
15482 (KJS::Profiler::didExecute): Ditto.
15484 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15488 <rdar://problem/5770054> JavaScript profiler (10928)
15489 - Implement sorting by function name.
15491 * JavaScriptCore.exp:
15492 * profiler/Profile.h:
15493 (KJS::Profile::sortFileNameDescending):
15494 (KJS::Profile::sortFileNameAscending):
15495 * profiler/ProfileNode.cpp:
15496 (KJS::fileNameDescendingComparator):
15497 (KJS::ProfileNode::sortFileNameDescending):
15498 (KJS::fileNameAscendingComparator):
15499 (KJS::ProfileNode::sortFileNameAscending):
15500 * profiler/ProfileNode.h:
15502 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15506 <rdar://problem/5770054> JavaScript profiler (10928)
15507 - Pass the exec state to profiler when calling startProfiling so that if
15508 profiling is started within an execution context that location is
15509 recorded correctly.
15511 * JavaScriptCore.exp:
15512 * profiler/ProfileNode.cpp:
15513 (KJS::ProfileNode::printDataInspectorStyle): Dump more info for debugging
15515 * profiler/Profiler.cpp:
15516 (KJS::Profiler::startProfiling):
15517 * profiler/Profiler.h:
15519 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15521 Rubberstamped by Geoff.
15523 Turn off the profiler because it is a performance regression.
15527 2008-05-19 Alp Toker <alp@nuanti.com>
15529 Reviewed by Anders and Beth.
15531 http://bugs.webkit.org/show_bug.cgi?id=16495
15532 [GTK] Accessibility support with ATK/AT-SPI
15534 Initial ATK/AT-SPI accessibility support for the GTK+ port.
15538 2008-05-19 Kevin McCullough <kmccullough@apple.com>
15542 <rdar://problem/5770054> JavaScript profiler (10928)
15543 -In an effort to make the profiler as efficient as possible instead of
15544 prepending to a vector we keep the vector in reverse order and operate
15547 * profiler/Profile.cpp:
15548 (KJS::Profile::willExecute):
15549 (KJS::Profile::didExecute):
15550 * profiler/ProfileNode.cpp:
15551 (KJS::ProfileNode::didExecute):
15552 (KJS::ProfileNode::endAndRecordCall):
15553 * profiler/ProfileNode.h:
15554 * profiler/Profiler.cpp:
15555 (KJS::getStackNames):
15557 2008-05-16 Kevin McCullough <kmccullough@apple.com>
15561 <rdar://problem/5770054> JavaScript profiler (10928)
15562 Implement sorting for the profiler.
15563 I chose to sort the profileNodes in place since there is no reason they
15564 need to retain their original order.
15566 * JavaScriptCore.exp: Export the symbols.
15567 * profiler/Profile.h: Add the different ways a profile can be sorted.
15568 (KJS::Profile::sortTotalTimeDescending):
15569 (KJS::Profile::sortTotalTimeAscending):
15570 (KJS::Profile::sortSelfTimeDescending):
15571 (KJS::Profile::sortSelfTimeAscending):
15572 (KJS::Profile::sortCallsDescending):
15573 (KJS::Profile::sortCallsAscending):
15574 * profiler/ProfileNode.cpp: Implement those ways.
15575 (KJS::totalTimeDescendingComparator):
15576 (KJS::ProfileNode::sortTotalTimeDescending):
15577 (KJS::totalTimeAscendingComparator):
15578 (KJS::ProfileNode::sortTotalTimeAscending):
15579 (KJS::selfTimeDescendingComparator):
15580 (KJS::ProfileNode::sortSelfTimeDescending):
15581 (KJS::selfTimeAscendingComparator):
15582 (KJS::ProfileNode::sortSelfTimeAscending):
15583 (KJS::callsDescendingComparator):
15584 (KJS::ProfileNode::sortCallsDescending):
15585 (KJS::callsAscendingComparator):
15586 (KJS::ProfileNode::sortCallsAscending):
15587 * profiler/ProfileNode.h: No longer use a Deque since it cannot be
15588 sorted by std::sort and there was no reason not to use a Vector. I
15589 previously had though I would do prepending but am not.
15590 (KJS::ProfileNode::selfTime):
15591 (KJS::ProfileNode::totalPercent):
15592 (KJS::ProfileNode::selfPercent):
15593 (KJS::ProfileNode::children):
15594 * profiler/Profiler.cpp: Removed these functions as they can be called
15595 directoy on the Profile object after getting the Vector of them.
15596 (KJS::getStackNames):
15597 * profiler/Profiler.h:
15599 2008-05-15 Ariya Hidayat <ariya.hidayat@trolltech.com>
15603 Since WebKitGtk is fully using autotools now, clean-up the .pro/.pri files
15606 * JavaScriptCore.pro:
15609 2008-05-15 Kevin McCullough <kmccullough@apple.com>
15613 * JavaScriptCore.exp:
15615 2008-05-15 Kevin McCullough <kmccullough@apple.com>
15619 <rdar://problem/5770054> JavaScript profiler (10928)
15620 - Cache some values to save on computing them repetitively. This will be
15621 a big savings when we sort since we won't have to walk the tree for
15623 - We cache these values when we end profiling because otherwise we won't
15624 know which profile to get the totalTime for the whole profile from without
15625 retaining a reference to the head profile or looking up the profile from
15626 the list of all profiles.
15627 - Also it's safe to assume we won't be asked for these values while we
15628 are still profiling since the WebInspector only get's profileNodes from
15629 profiles that are in the allProfiles() list and a profile is only added
15630 to that list after it has finished and these values will no longer
15633 * JavaScriptCore.exp:
15634 * profiler/ProfileNode.cpp:
15635 (KJS::ProfileNode::ProfileNode):
15636 (KJS::ProfileNode::stopProfiling):
15637 (KJS::ProfileNode::printDataInspectorStyle):
15638 (KJS::ProfileNode::printDataSampleStyle):
15639 (KJS::ProfileNode::endAndRecordCall):
15640 * profiler/ProfileNode.h:
15641 (KJS::ProfileNode::totalTime):
15642 (KJS::ProfileNode::selfTime):
15643 (KJS::ProfileNode::totalPercent):
15644 (KJS::ProfileNode::selfPercent):
15645 * profiler/Profiler.cpp:
15646 (KJS::Profiler::stopProfiling):
15648 2008-05-15 Simon Hausmann <shausman@trolltech.com>
15650 Reviewed by Holger.
15652 Fix compilation when compiling with MSVC and wchar_t support.
15654 * wtf/unicode/qt4/UnicodeQt4.h:
15655 (WTF::Unicode::foldCase):
15656 (WTF::Unicode::umemcasecmp):
15658 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15662 <rdar://problem/5770054> JavaScript profiler (10928)
15663 - Turn on the profiler.
15667 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15671 <rdar://problem/5770054> JavaScript profiler (10928)
15672 - Expose the new profiler functions to the WebInspector.
15674 * JavaScriptCore.exp:
15676 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15678 Giving credit where credit is due.
15682 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15684 Reviewed by Geoff and Sam.
15686 <rdar://problem/5770054> JavaScript profiler (10928)
15687 Add the ability to get percentages of total and self time for displaying
15688 in the WebInspector.
15690 * profiler/Profile.h:
15691 (KJS::Profile::totalProfileTime):
15692 * profiler/ProfileNode.cpp:
15693 (KJS::ProfileNode::totalPercent):
15694 (KJS::ProfileNode::selfPercent):
15695 * profiler/ProfileNode.h:
15696 * profiler/Profiler.h:
15697 (KJS::Profiler::currentProfile):
15699 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15703 <rdar://problem/5770054> JavaScript profiler (10928)
15704 - Rename FunctionCallProfile to ProfileNode.
15707 * JavaScriptCore.exp:
15708 * JavaScriptCore.pri:
15709 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
15710 * JavaScriptCore.xcodeproj/project.pbxproj:
15711 * JavaScriptCoreSources.bkl:
15712 * profiler/FunctionCallProfile.cpp: Removed.
15713 * profiler/FunctionCallProfile.h: Removed.
15714 * profiler/Profile.cpp:
15715 (KJS::Profile::Profile):
15716 (KJS::Profile::willExecute):
15717 * profiler/Profile.h:
15718 (KJS::Profile::callTree):
15719 * profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp.
15720 (KJS::ProfileNode::ProfileNode):
15721 (KJS::ProfileNode::willExecute):
15722 (KJS::ProfileNode::didExecute):
15723 (KJS::ProfileNode::addChild):
15724 (KJS::ProfileNode::findChild):
15725 (KJS::ProfileNode::stopProfiling):
15726 (KJS::ProfileNode::selfTime):
15727 (KJS::ProfileNode::printDataInspectorStyle):
15728 (KJS::ProfileNode::printDataSampleStyle):
15729 (KJS::ProfileNode::endAndRecordCall):
15730 * profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h.
15731 (KJS::ProfileNode::create):
15732 (KJS::ProfileNode::children):
15733 * profiler/Profiler.cpp:
15735 2008-05-14 Kevin McCullough <kmccullough@apple.com>
15739 <rdar://problem/5770054> JavaScript profiler (10928)
15740 - Have each FunctionCallProfile be able to return it's total and self time.
15742 * JavaScriptCore.exp:
15743 * profiler/FunctionCallProfile.cpp:
15744 (KJS::FunctionCallProfile::selfTime):
15745 * profiler/FunctionCallProfile.h:
15746 (KJS::FunctionCallProfile::totalTime):
15748 2008-05-14 Alexey Proskuryakov <ap@webkit.org>
15752 <rdar://problem/5934376> REGRESSION: A script fails because of a straw BOM character in it.
15754 <https://bugs.webkit.org/show_bug.cgi?id=4931>
15755 Unicode format characters (Cf) should be removed from JavaScript source
15757 Of all Cf characters, we are only removing BOM, because this is what Firefox trunk has
15758 settled upon, after extensive discussion and investigation.
15760 Based on Darin's work on this bug.
15762 Test: fast/js/removing-Cf-characters.html
15765 (KJS::Lexer::setCode): Tweak formatting. Use a call to shift(4) to read in the
15766 first characters, instead of having special case code here.
15767 (KJS::Lexer::shift): Add a loop when reading a character to skip BOM characters.
15769 2008-05-13 Matt Lilek <webkit@mattlilek.com>
15771 Not reviewed, build fix.
15773 * kjs/date_object.cpp:
15774 (KJS::DateObjectFuncImp::callAsFunction):
15776 2008-05-13 Anders Carlsson <andersca@apple.com>
15780 <rdar://problem/5933644> Implement Date.now
15782 Implement Date.now which returns the number of milliseconds since the epoch.
15784 * kjs/CommonIdentifiers.h:
15785 * kjs/date_object.cpp:
15786 (KJS::DateObjectFuncImp::):
15787 (KJS::DateObjectImp::DateObjectImp):
15788 (KJS::DateObjectFuncImp::callAsFunction):
15790 2008-05-13 Kevin McCullough <kmccullough@apple.com>
15792 Giving credit where credit is due.
15796 2008-05-13 Kevin McCullough <kmccullough@apple.com>
15798 Reviewed by Adam and Geoff.
15800 <rdar://problem/5770054> JavaScript profiler (10928)
15801 Use PassRefPtrs instead of RefPtrs when appropriate.
15803 * profiler/FunctionCallProfile.cpp:
15804 (KJS::FunctionCallProfile::addChild):
15805 * profiler/FunctionCallProfile.h:
15806 * profiler/Profile.h:
15807 (KJS::Profile::callTree):
15809 2008-05-13 Kevin McCullough <kmccullough@apple.com>
15813 <rdar://problem/5770054> JavaScript profiler (10928)
15814 - Made some functions static (as per Adam) and changed from using raw
15815 pointers to RefPtr for making these JavaScript Objects.
15817 * profiler/FunctionCallProfile.cpp:
15818 (KJS::FunctionCallProfile::addChild):
15819 (KJS::FunctionCallProfile::findChild):
15820 * profiler/FunctionCallProfile.h:
15821 (KJS::FunctionCallProfile::create):
15822 * profiler/Profile.cpp:
15823 (KJS::Profile::Profile):
15824 (KJS::Profile::willExecute):
15825 (KJS::Profile::didExecute):
15826 (KJS::functionNameCountPairComparator):
15827 * profiler/Profile.h:
15828 (KJS::Profile::create):
15829 (KJS::Profile::title):
15830 (KJS::Profile::callTree):
15831 * profiler/Profiler.cpp:
15832 (KJS::Profiler::startProfiling):
15833 * profiler/Profiler.h:
15834 (KJS::Profiler::allProfiles):
15835 (KJS::Profiler::clearProfiles):
15837 2008-05-13 Alexey Proskuryakov <ap@webkit.org>
15839 Reviewed by Geoffrey Garen.
15841 <rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
15846 (KJS::UString::Rep::createFromUTF8):
15847 Added. Implementation adapted from JSStringCreateWithUTF8CString().
15849 * API/JSStringRef.cpp:
15850 (JSStringCreateWithUTF8CString):
15851 * API/JSClassRef.cpp:
15852 (OpaqueJSClass::OpaqueJSClass):
15853 Use UString::Rep::createFromUTF8().
15855 2008-05-12 Mark Rowe <mrowe@apple.com>
15857 Reviewed by Tim Hatcher.
15859 <rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
15861 Create WebKit availability macros that key off the Mac OS X version being targeted to
15862 determine the WebKit version being targeted. Applications can define
15863 WEBKIT_VERSION_MIN_REQUIRED before including WebKit headers in order to target a specific
15866 The availability header is being added to JavaScriptCore rather than WebKit as JavaScriptCore
15867 is the lowest-level portion of the public WebKit API.
15869 * API/WebKitAvailability.h: Added.
15870 * JavaScriptCore.xcodeproj/project.pbxproj:
15872 2008-05-12 Alexey Proskuryakov <ap@webkit.org>
15874 Reviewed by Maciej.
15876 https://bugs.webkit.org/show_bug.cgi?id=18828
15877 Reproducible crash with PAC file
15879 Naively moving JavaScriptCore into thread-specific data was inappropriate in the face of
15880 exiting JavaScriptCore API clients, which expect a different therading model. Temporarily
15881 disabling ThreadSpecific implementation until this can be sorted out.
15883 * wtf/ThreadSpecific.h:
15884 (WTF::::ThreadSpecific):
15885 (WTF::::~ThreadSpecific):
15889 2008-05-12 Alexey Proskuryakov <ap@webkit.org>
15891 Roll out recent threading changes (r32807, r32810, r32819, r32822) to simplify
15892 SquirrelFish merging.
15895 (JSGarbageCollect):
15896 * API/JSCallbackObjectFunctions.h:
15897 (KJS::::staticFunctionGetter):
15898 * API/JSClassRef.cpp:
15899 (OpaqueJSClass::prototype):
15900 * API/JSObjectRef.cpp:
15902 (JSObjectMakeFunctionWithCallback):
15903 (JSObjectMakeConstructor):
15904 (JSObjectMakeFunction):
15905 * API/JSValueRef.cpp:
15906 (JSValueMakeNumber):
15907 (JSValueMakeString):
15908 * JavaScriptCore.exp:
15910 * kjs/InitializeThreading.cpp:
15911 (KJS::initializeThreadingOnce):
15912 * kjs/JSGlobalObject.cpp:
15913 (KJS::JSGlobalObject::~JSGlobalObject):
15914 (KJS::JSGlobalObject::init):
15915 (KJS::JSGlobalObject::put):
15916 (KJS::JSGlobalObject::reset):
15917 (KJS::JSGlobalObject::tearOffActivation):
15918 * kjs/JSGlobalObject.h:
15919 (KJS::JSGlobalObject::head):
15920 (KJS::JSGlobalObject::perThreadData):
15922 (KJS::JSLock::registerThread):
15924 (KJS::JSLock::JSLock):
15925 * kjs/array_instance.cpp:
15926 (KJS::ArrayInstance::ArrayInstance):
15927 (KJS::ArrayInstance::lengthGetter):
15928 * kjs/array_object.cpp:
15929 (KJS::arrayProtoFuncToString):
15930 (KJS::arrayProtoFuncToLocaleString):
15931 (KJS::arrayProtoFuncJoin):
15932 (KJS::arrayProtoFuncConcat):
15933 (KJS::arrayProtoFuncPop):
15934 (KJS::arrayProtoFuncPush):
15935 (KJS::arrayProtoFuncShift):
15936 (KJS::arrayProtoFuncSlice):
15937 (KJS::arrayProtoFuncSplice):
15938 (KJS::arrayProtoFuncUnShift):
15939 (KJS::arrayProtoFuncFilter):
15940 (KJS::arrayProtoFuncMap):
15941 (KJS::arrayProtoFuncEvery):
15942 (KJS::arrayProtoFuncForEach):
15943 (KJS::arrayProtoFuncSome):
15944 (KJS::arrayProtoFuncIndexOf):
15945 (KJS::arrayProtoFuncLastIndexOf):
15946 (KJS::ArrayObjectImp::ArrayObjectImp):
15947 (KJS::ArrayObjectImp::construct):
15948 * kjs/bool_object.cpp:
15949 (KJS::BooleanPrototype::BooleanPrototype):
15950 (KJS::booleanProtoFuncToString):
15951 (KJS::BooleanObjectImp::BooleanObjectImp):
15952 (KJS::BooleanObjectImp::construct):
15953 * kjs/collector.cpp:
15954 (KJS::allocateBlock):
15955 (KJS::Collector::recordExtraCost):
15956 (KJS::Collector::heapAllocate):
15957 (KJS::Collector::allocate):
15958 (KJS::Collector::allocateNumber):
15959 (KJS::Collector::registerAsMainThread):
15960 (KJS::onMainThread):
15961 (KJS::PlatformThread::PlatformThread):
15962 (KJS::getCurrentPlatformThread):
15963 (KJS::Collector::Thread::Thread):
15964 (KJS::destroyRegisteredThread):
15965 (KJS::initializeRegisteredThreadKey):
15966 (KJS::Collector::registerThread):
15967 (KJS::Collector::markStackObjectsConservatively):
15968 (KJS::Collector::markCurrentThreadConservativelyInternal):
15969 (KJS::Collector::markCurrentThreadConservatively):
15970 (KJS::suspendThread):
15971 (KJS::resumeThread):
15972 (KJS::getPlatformThreadRegisters):
15973 (KJS::otherThreadStackPointer):
15974 (KJS::Collector::markOtherThreadConservatively):
15975 (KJS::protectedValues):
15976 (KJS::Collector::protect):
15977 (KJS::Collector::unprotect):
15978 (KJS::Collector::collectOnMainThreadOnly):
15979 (KJS::Collector::markProtectedObjects):
15980 (KJS::Collector::markMainThreadOnlyObjects):
15981 (KJS::Collector::sweep):
15982 (KJS::Collector::collect):
15983 (KJS::Collector::size):
15984 (KJS::Collector::globalObjectCount):
15985 (KJS::Collector::protectedGlobalObjectCount):
15986 (KJS::Collector::protectedObjectCount):
15987 (KJS::Collector::protectedObjectTypeCounts):
15988 (KJS::Collector::isBusy):
15989 (KJS::Collector::reportOutOfMemoryToAllExecStates):
15991 (KJS::Collector::cellBlock):
15992 (KJS::Collector::cellOffset):
15993 (KJS::Collector::isCellMarked):
15994 (KJS::Collector::markCell):
15995 (KJS::Collector::reportExtraMemoryCost):
15996 * kjs/date_object.cpp:
15997 (KJS::formatLocaleDate):
15998 (KJS::DatePrototype::DatePrototype):
15999 (KJS::DateObjectImp::DateObjectImp):
16000 (KJS::DateObjectImp::construct):
16001 (KJS::DateObjectImp::callAsFunction):
16002 (KJS::DateObjectFuncImp::DateObjectFuncImp):
16003 (KJS::DateObjectFuncImp::callAsFunction):
16004 (KJS::dateProtoFuncToString):
16005 (KJS::dateProtoFuncToUTCString):
16006 (KJS::dateProtoFuncToDateString):
16007 (KJS::dateProtoFuncToTimeString):
16008 (KJS::dateProtoFuncToLocaleString):
16009 (KJS::dateProtoFuncToLocaleDateString):
16010 (KJS::dateProtoFuncToLocaleTimeString):
16011 (KJS::dateProtoFuncValueOf):
16012 (KJS::dateProtoFuncGetTime):
16013 (KJS::dateProtoFuncGetFullYear):
16014 (KJS::dateProtoFuncGetUTCFullYear):
16015 (KJS::dateProtoFuncToGMTString):
16016 (KJS::dateProtoFuncGetMonth):
16017 (KJS::dateProtoFuncGetUTCMonth):
16018 (KJS::dateProtoFuncGetDate):
16019 (KJS::dateProtoFuncGetUTCDate):
16020 (KJS::dateProtoFuncGetDay):
16021 (KJS::dateProtoFuncGetUTCDay):
16022 (KJS::dateProtoFuncGetHours):
16023 (KJS::dateProtoFuncGetUTCHours):
16024 (KJS::dateProtoFuncGetMinutes):
16025 (KJS::dateProtoFuncGetUTCMinutes):
16026 (KJS::dateProtoFuncGetSeconds):
16027 (KJS::dateProtoFuncGetUTCSeconds):
16028 (KJS::dateProtoFuncGetMilliSeconds):
16029 (KJS::dateProtoFuncGetUTCMilliseconds):
16030 (KJS::dateProtoFuncGetTimezoneOffset):
16031 (KJS::dateProtoFuncSetTime):
16032 (KJS::setNewValueFromTimeArgs):
16033 (KJS::setNewValueFromDateArgs):
16034 (KJS::dateProtoFuncSetYear):
16035 (KJS::dateProtoFuncGetYear):
16036 * kjs/error_object.cpp:
16037 (KJS::ErrorPrototype::ErrorPrototype):
16038 (KJS::errorProtoFuncToString):
16039 (KJS::ErrorObjectImp::ErrorObjectImp):
16040 (KJS::ErrorObjectImp::construct):
16041 (KJS::NativeErrorPrototype::NativeErrorPrototype):
16042 (KJS::NativeErrorImp::NativeErrorImp):
16043 (KJS::NativeErrorImp::construct):
16044 * kjs/function.cpp:
16045 (KJS::FunctionImp::lengthGetter):
16046 (KJS::FunctionImp::construct):
16047 (KJS::Arguments::Arguments):
16048 (KJS::ActivationImp::createArgumentsObject):
16051 (KJS::globalFuncParseInt):
16052 (KJS::globalFuncParseFloat):
16053 (KJS::globalFuncEscape):
16054 (KJS::globalFuncUnescape):
16055 (KJS::PrototypeFunction::PrototypeFunction):
16056 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
16057 * kjs/function_object.cpp:
16058 (KJS::FunctionPrototype::FunctionPrototype):
16059 (KJS::functionProtoFuncToString):
16060 (KJS::FunctionObjectImp::FunctionObjectImp):
16061 (KJS::FunctionObjectImp::construct):
16062 * kjs/internal.cpp:
16063 (KJS::StringImp::toObject):
16065 (KJS::StringImp::StringImp):
16066 (KJS::NumberImp::operator new):
16068 (KJS::List::markSet):
16069 (KJS::List::markProtectedListsSlowCase):
16070 (KJS::List::expandAndAppend):
16073 (KJS::List::~List):
16074 (KJS::List::markProtectedLists):
16076 (KJS::staticFunctionGetter):
16077 (KJS::cacheGlobalObject):
16078 * kjs/math_object.cpp:
16079 (KJS::MathObjectImp::getValueProperty):
16080 (KJS::mathProtoFuncAbs):
16081 (KJS::mathProtoFuncACos):
16082 (KJS::mathProtoFuncASin):
16083 (KJS::mathProtoFuncATan):
16084 (KJS::mathProtoFuncATan2):
16085 (KJS::mathProtoFuncCeil):
16086 (KJS::mathProtoFuncCos):
16087 (KJS::mathProtoFuncExp):
16088 (KJS::mathProtoFuncFloor):
16089 (KJS::mathProtoFuncLog):
16090 (KJS::mathProtoFuncMax):
16091 (KJS::mathProtoFuncMin):
16092 (KJS::mathProtoFuncPow):
16093 (KJS::mathProtoFuncRandom):
16094 (KJS::mathProtoFuncRound):
16095 (KJS::mathProtoFuncSin):
16096 (KJS::mathProtoFuncSqrt):
16097 (KJS::mathProtoFuncTan):
16099 (KJS::ParserRefCounted::ParserRefCounted):
16100 (KJS::ParserRefCounted::ref):
16101 (KJS::ParserRefCounted::deref):
16102 (KJS::ParserRefCounted::refcount):
16103 (KJS::ParserRefCounted::deleteNewObjects):
16104 (KJS::Node::handleException):
16105 (KJS::NumberNode::evaluate):
16106 (KJS::StringNode::evaluate):
16107 (KJS::ArrayNode::evaluate):
16108 (KJS::PostIncResolveNode::evaluate):
16109 (KJS::PostIncLocalVarNode::evaluate):
16110 (KJS::PostDecResolveNode::evaluate):
16111 (KJS::PostDecLocalVarNode::evaluate):
16112 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
16113 (KJS::PostIncBracketNode::evaluate):
16114 (KJS::PostDecBracketNode::evaluate):
16115 (KJS::PostIncDotNode::evaluate):
16116 (KJS::PostDecDotNode::evaluate):
16117 (KJS::typeStringForValue):
16118 (KJS::LocalVarTypeOfNode::evaluate):
16119 (KJS::TypeOfResolveNode::evaluate):
16120 (KJS::TypeOfValueNode::evaluate):
16121 (KJS::PreIncLocalVarNode::evaluate):
16122 (KJS::PreIncResolveNode::evaluate):
16123 (KJS::PreDecLocalVarNode::evaluate):
16124 (KJS::PreDecResolveNode::evaluate):
16125 (KJS::PreIncConstNode::evaluate):
16126 (KJS::PreDecConstNode::evaluate):
16127 (KJS::PostIncConstNode::evaluate):
16128 (KJS::PostDecConstNode::evaluate):
16129 (KJS::PreIncBracketNode::evaluate):
16130 (KJS::PreDecBracketNode::evaluate):
16131 (KJS::PreIncDotNode::evaluate):
16132 (KJS::PreDecDotNode::evaluate):
16133 (KJS::NegateNode::evaluate):
16134 (KJS::BitwiseNotNode::evaluate):
16135 (KJS::MultNode::evaluate):
16136 (KJS::DivNode::evaluate):
16137 (KJS::ModNode::evaluate):
16138 (KJS::addSlowCase):
16140 (KJS::AddNumbersNode::evaluate):
16141 (KJS::AddStringsNode::evaluate):
16142 (KJS::AddStringLeftNode::evaluate):
16143 (KJS::AddStringRightNode::evaluate):
16144 (KJS::SubNode::evaluate):
16145 (KJS::LeftShiftNode::evaluate):
16146 (KJS::RightShiftNode::evaluate):
16147 (KJS::UnsignedRightShiftNode::evaluate):
16148 (KJS::BitXOrNode::evaluate):
16149 (KJS::BitOrNode::evaluate):
16150 (KJS::valueForReadModifyAssignment):
16151 (KJS::ForInNode::execute):
16152 (KJS::TryNode::execute):
16153 (KJS::FuncDeclNode::makeFunction):
16154 (KJS::FuncExprNode::evaluate):
16156 * kjs/number_object.cpp:
16157 (KJS::NumberPrototype::NumberPrototype):
16158 (KJS::numberProtoFuncToString):
16159 (KJS::numberProtoFuncToLocaleString):
16160 (KJS::numberProtoFuncToFixed):
16161 (KJS::numberProtoFuncToExponential):
16162 (KJS::numberProtoFuncToPrecision):
16163 (KJS::NumberObjectImp::NumberObjectImp):
16164 (KJS::NumberObjectImp::getValueProperty):
16165 (KJS::NumberObjectImp::construct):
16166 (KJS::NumberObjectImp::callAsFunction):
16168 (KJS::JSObject::call):
16169 (KJS::JSObject::get):
16170 (KJS::JSObject::put):
16171 (KJS::JSObject::defineGetter):
16172 (KJS::JSObject::defineSetter):
16173 (KJS::JSObject::putDirect):
16174 (KJS::Error::create):
16176 * kjs/object_object.cpp:
16177 (KJS::ObjectPrototype::ObjectPrototype):
16178 (KJS::objectProtoFuncToLocaleString):
16179 (KJS::objectProtoFuncToString):
16180 (KJS::ObjectObjectImp::ObjectObjectImp):
16181 (KJS::ObjectObjectImp::construct):
16182 * kjs/property_map.h:
16183 (KJS::SavedProperty::SavedProperty):
16184 (KJS::SavedProperty::init):
16185 (KJS::SavedProperty::~SavedProperty):
16186 (KJS::SavedProperty::name):
16187 (KJS::SavedProperty::value):
16188 (KJS::SavedProperty::attributes):
16191 (KJS::gcUnprotect):
16192 * kjs/regexp_object.cpp:
16193 (KJS::RegExpPrototype::RegExpPrototype):
16194 (KJS::regExpProtoFuncToString):
16195 (KJS::RegExpImp::getValueProperty):
16196 (KJS::RegExpObjectImp::RegExpObjectImp):
16197 (KJS::RegExpObjectImp::arrayOfMatches):
16198 (KJS::RegExpObjectImp::getBackref):
16199 (KJS::RegExpObjectImp::getLastParen):
16200 (KJS::RegExpObjectImp::getLeftContext):
16201 (KJS::RegExpObjectImp::getRightContext):
16202 (KJS::RegExpObjectImp::getValueProperty):
16203 (KJS::RegExpObjectImp::createRegExpImp):
16204 * kjs/regexp_object.h:
16205 * kjs/string_object.cpp:
16206 (KJS::StringInstance::StringInstance):
16207 (KJS::StringInstance::lengthGetter):
16208 (KJS::StringInstance::indexGetter):
16209 (KJS::stringInstanceNumericPropertyGetter):
16210 (KJS::StringPrototype::StringPrototype):
16212 (KJS::stringProtoFuncCharAt):
16213 (KJS::stringProtoFuncCharCodeAt):
16214 (KJS::stringProtoFuncConcat):
16215 (KJS::stringProtoFuncIndexOf):
16216 (KJS::stringProtoFuncLastIndexOf):
16217 (KJS::stringProtoFuncMatch):
16218 (KJS::stringProtoFuncSearch):
16219 (KJS::stringProtoFuncReplace):
16220 (KJS::stringProtoFuncSlice):
16221 (KJS::stringProtoFuncSplit):
16222 (KJS::stringProtoFuncSubstr):
16223 (KJS::stringProtoFuncSubstring):
16224 (KJS::stringProtoFuncToLowerCase):
16225 (KJS::stringProtoFuncToUpperCase):
16226 (KJS::stringProtoFuncToLocaleLowerCase):
16227 (KJS::stringProtoFuncToLocaleUpperCase):
16228 (KJS::stringProtoFuncLocaleCompare):
16229 (KJS::stringProtoFuncBig):
16230 (KJS::stringProtoFuncSmall):
16231 (KJS::stringProtoFuncBlink):
16232 (KJS::stringProtoFuncBold):
16233 (KJS::stringProtoFuncFixed):
16234 (KJS::stringProtoFuncItalics):
16235 (KJS::stringProtoFuncStrike):
16236 (KJS::stringProtoFuncSub):
16237 (KJS::stringProtoFuncSup):
16238 (KJS::stringProtoFuncFontcolor):
16239 (KJS::stringProtoFuncFontsize):
16240 (KJS::stringProtoFuncAnchor):
16241 (KJS::stringProtoFuncLink):
16242 (KJS::StringObjectImp::StringObjectImp):
16243 (KJS::StringObjectImp::construct):
16244 (KJS::StringObjectImp::callAsFunction):
16245 (KJS::StringObjectFuncImp::StringObjectFuncImp):
16246 (KJS::StringObjectFuncImp::callAsFunction):
16247 * kjs/string_object.h:
16248 (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
16250 (GlobalObject::GlobalObject):
16253 (functionReadline):
16257 (KJS::JSCell::operator new):
16259 (KJS::jsOwnedString):
16260 (KJS::jsNumberCell):
16264 (KJS::jsNumberFromAnd):
16265 (KJS::JSCell::marked):
16266 (KJS::JSCell::mark):
16267 (KJS::JSValue::toJSNumber):
16268 * wtf/ThreadSpecific.h:
16271 2008-05-10 Julien Chaffraix <jchaffraix@webkit.org>
16275 * JavaScriptCore.pri: Add profiler/Profile.cpp.
16276 * JavaScriptCoreSources.bkl: Ditto.
16278 2008-05-10 Jan Michael Alonzo <jmalonzo@unpluggable.com>
16280 Reviewed by Maciej.
16284 * GNUmakefile.am: Add Profile.cpp in _sources
16286 2008-05-09 Brady Eidson <beidson@apple.com>
16288 Build Fix. Kevin is an idiot.
16289 ("My name is Kevin McCullough and I approve this message.")
16291 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
16293 2008-05-09 Kevin McCullough <kmccullough@apple.com>
16297 -<rdar://problem/5770054> JavaScript profiler (10928)
16298 -Add Profile class so that all profiles can be stored and retrieved by
16299 the WebInspector when that time comes.
16301 * JavaScriptCore.exp: Export the new function signatures.
16302 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
16304 * profiler/Profile.cpp: Added. This class represents a single run of the
16306 (KJS::Profile::Profile):
16307 (KJS::Profile::willExecute):
16308 (KJS::Profile::didExecute):
16309 (KJS::Profile::printDataInspectorStyle):
16310 (KJS::functionNameCountPairComparator):
16311 (KJS::Profile::printDataSampleStyle):
16312 * profiler/Profile.h: Added. Ditto
16313 (KJS::Profile::stopProfiling):
16314 * profiler/Profiler.cpp: Now the profiler keeps track of many profiles
16315 but only runs one at a time.
16316 (KJS::Profiler::startProfiling):
16317 (KJS::Profiler::stopProfiling):
16318 (KJS::Profiler::willExecute):
16319 (KJS::Profiler::didExecute):
16320 (KJS::Profiler::printDataInspectorStyle):
16321 (KJS::Profiler::printDataSampleStyle):
16322 * profiler/Profiler.h: Ditto.
16323 (KJS::Profiler::~Profiler):
16324 (KJS::Profiler::allProfiles):
16325 (KJS::Profiler::clearProfiles):
16327 2008-05-08 Anders Carlsson <andersca@apple.com>
16331 Enable NPAPI plug-ins on 64-bit.
16335 2008-05-07 Julien Chaffraix <jchaffraix@webkit.org>
16337 Reviewed by Adam Roben.
16339 wx & Gtk build fix.
16341 Add SIZE_MAX definition for the wx port.
16343 * os-win32/stdint.h:
16345 2008-05-07 Ariya Hidayat <ariya.hidayat@trolltech.com>
16349 Support for isMainThread in the Qt port.
16351 * wtf/ThreadingQt.cpp:
16352 (WTF::initializeThreading): Adjusted.
16353 (WTF::isMainThread): Added.
16355 2008-05-05 Darin Adler <darin@apple.com>
16357 Reviewed by John Sullivan.
16359 - fix debug-only leak seen on buildbot
16362 (WTF::HashTable::checkKey): After writing an empty value in, but before constructing a
16363 deleted value on top of it, call the destructor so the empty value doesn't leak.
16365 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16367 Reviewed by Geoffrey Garen.
16369 Get rid of static data in nodes.cpp (well, at least of non-debug one).
16371 No measurable change on SunSpider.
16373 * kjs/InitializeThreading.cpp:
16374 (KJS::initializeThreadingOnce):
16376 (KJS::newTrackedObjects):
16377 (KJS::trackedObjectExtraRefCounts):
16378 (KJS::initializeNodesThreading):
16379 (KJS::ParserRefCounted::ParserRefCounted):
16380 (KJS::ParserRefCounted::ref):
16381 (KJS::ParserRefCounted::deref):
16382 (KJS::ParserRefCounted::refcount):
16383 (KJS::ParserRefCounted::deleteNewObjects):
16385 Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
16387 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16391 Move call stack depth counter to global object.
16393 * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
16395 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
16396 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
16399 (KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now
16400 the only thing in JSObject::call that needs a PIC branch.
16401 (KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth
16404 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16408 Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
16409 for the sake of non-WebKit clients.
16412 (JSGarbageCollect):
16413 * API/JSContextRef.cpp:
16414 (JSGlobalContextCreate):
16415 These are the JavaScriptCore API bottlenecks. There are a few other JSStringRef
16416 and JSClassRef functions that can be called earlier, but they do not do anything that
16417 requires initializeThreading.
16419 * kjs/InitializeThreading.cpp:
16420 (KJS::doInitializeThreading):
16421 (KJS::initializeThreading):
16422 On Darwin, make the initialization happen under pthread_once, since there is no guarantee
16423 that non-WebKit clients won't try to call this function re-entrantly.
16425 * kjs/InitializeThreading.h:
16427 Spell out initializeThreading contract.
16429 * wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
16430 Darwin, even if threading was initialized from a secondary thread.
16432 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
16434 Reviewed by Geoffrey Garen.
16436 https://bugs.webkit.org/show_bug.cgi?id=18826
16437 Make JavaScript heap per-thread
16439 * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
16440 (replaced "new T" with "new T()").
16442 * kjs/collector.h: Renamed Collector to Heap, made the heap per-thread. Removed support for
16443 multithreaded access to a heap.
16444 (KJS::CollectorBlock): Removed collectOnMainThreadOnly bitmap, added a reference to owner heap.
16445 (KJS::SmallCellCollectorBlock): Ditto.
16446 (KJS::Heap::markListSet): Moved from a static variable in List.cpp to a per-thread one here.
16447 (KJS::Heap::heap): Added a method to find which heap a JSValue is allocated in.
16449 * kjs/collector.cpp: Changed "const size_t" constants to #defines, to avoid a PIC branch
16450 (gcc was using one to access a constant used in std::max(), because it takes a reference,
16451 even though std::max() itself was inlined).
16452 (KJS::Heap::threadHeap): JS heap is now per-thread.
16453 (KJS::Heap::Heap): Zero-initialize the heap.
16454 (KJS::allocateBlock): Added NEVER_INLINE, because this function uses a PIC branch, so
16455 inlining it in Heap::heapAllocate() is bad for performance, now that the latter doesn't
16456 use any global data.
16457 (KJS::Heap::heapAllocate): Initialize Block::heap.
16458 (KJS::Heap::markCurrentThreadConservatively): Moved into markStackObjectsConservatively(),
16459 as GC only works with a current thread's heap now.
16460 (KJS::Heap::sweep): Removed collectOnMainThreadOnly checks.
16461 (KJS::Heap::collect): Ditto.
16465 (KJS::JSLock::JSLock):
16466 Removed registerThread(), as the heap no longer cares.
16468 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
16469 variables in Heap and JSGlobalObject.
16471 * kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
16472 per-thread heap, and an accessor for it.
16474 * kjs/JSGlobalObject.h: Made JSGlobalObject linked list per-thread.
16475 * kjs/JSGlobalObject.cpp:
16476 (KJS::JSGlobalObject::~JSGlobalObject): Fixed a bug in linked list handling. It only worked
16477 right if the removed object was the head one!
16478 (KJS::JSGlobalObject::head): Return a per-thread list head.
16479 (KJS::JSGlobalObject::init): Store a reference to per-thread heap.
16480 (KJS::JSGlobalObject::reset): Pass ExecState to functions that need it.
16481 (KJS::JSGlobalObject::tearOffActivation): Ditto.
16482 (KJS::JSGlobalObject::operator new): JSGlobalObject allocation cannot use an ExecState,
16483 so it needs a custom operator new that directly accesses per-thread heap.
16486 (KJS::List::List): Replaced m_isInMarkSet boolean with an actual pointer to the set, since it
16487 is no longer a single static object.
16488 (KJS::List::~List): Ditto.
16490 (KJS::List::markSet): Removed, this is now stored in Heap.
16491 (KJS::List::markProtectedLists): Take a reference to the list.
16492 (KJS::List::expandAndAppend): Ask the current thread heap for a mark set reference.
16496 (KJS::gcUnprotect):
16497 Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
16500 * kjs/property_map.h: Removed unused SavedProperty class.
16502 * JavaScriptCore.exp:
16504 (JSGarbageCollect):
16505 * API/JSCallbackObjectFunctions.h:
16506 (KJS::::staticFunctionGetter):
16507 * API/JSClassRef.cpp:
16508 (OpaqueJSClass::prototype):
16509 * API/JSObjectRef.cpp:
16511 (JSObjectMakeFunctionWithCallback):
16512 (JSObjectMakeConstructor):
16513 (JSObjectMakeFunction):
16514 * API/JSValueRef.cpp:
16515 (JSValueMakeNumber):
16516 (JSValueMakeString):
16517 * kjs/array_instance.cpp:
16518 (KJS::ArrayInstance::ArrayInstance):
16519 (KJS::ArrayInstance::lengthGetter):
16520 * kjs/array_object.cpp:
16521 (KJS::arrayProtoFuncToString):
16522 (KJS::arrayProtoFuncToLocaleString):
16523 (KJS::arrayProtoFuncJoin):
16524 (KJS::arrayProtoFuncConcat):
16525 (KJS::arrayProtoFuncPop):
16526 (KJS::arrayProtoFuncPush):
16527 (KJS::arrayProtoFuncShift):
16528 (KJS::arrayProtoFuncSlice):
16529 (KJS::arrayProtoFuncSplice):
16530 (KJS::arrayProtoFuncUnShift):
16531 (KJS::arrayProtoFuncFilter):
16532 (KJS::arrayProtoFuncMap):
16533 (KJS::arrayProtoFuncEvery):
16534 (KJS::arrayProtoFuncForEach):
16535 (KJS::arrayProtoFuncSome):
16536 (KJS::arrayProtoFuncIndexOf):
16537 (KJS::arrayProtoFuncLastIndexOf):
16538 (KJS::ArrayObjectImp::ArrayObjectImp):
16539 (KJS::ArrayObjectImp::construct):
16540 * kjs/bool_object.cpp:
16541 (KJS::BooleanPrototype::BooleanPrototype):
16542 (KJS::booleanProtoFuncToString):
16543 (KJS::BooleanObjectImp::BooleanObjectImp):
16544 (KJS::BooleanObjectImp::construct):
16545 * kjs/date_object.cpp:
16546 (KJS::formatLocaleDate):
16547 (KJS::DatePrototype::DatePrototype):
16548 (KJS::DateObjectImp::DateObjectImp):
16549 (KJS::DateObjectImp::construct):
16550 (KJS::DateObjectImp::callAsFunction):
16551 (KJS::DateObjectFuncImp::DateObjectFuncImp):
16552 (KJS::DateObjectFuncImp::callAsFunction):
16553 (KJS::dateProtoFuncToString):
16554 (KJS::dateProtoFuncToUTCString):
16555 (KJS::dateProtoFuncToDateString):
16556 (KJS::dateProtoFuncToTimeString):
16557 (KJS::dateProtoFuncToLocaleString):
16558 (KJS::dateProtoFuncToLocaleDateString):
16559 (KJS::dateProtoFuncToLocaleTimeString):
16560 (KJS::dateProtoFuncValueOf):
16561 (KJS::dateProtoFuncGetTime):
16562 (KJS::dateProtoFuncGetFullYear):
16563 (KJS::dateProtoFuncGetUTCFullYear):
16564 (KJS::dateProtoFuncToGMTString):
16565 (KJS::dateProtoFuncGetMonth):
16566 (KJS::dateProtoFuncGetUTCMonth):
16567 (KJS::dateProtoFuncGetDate):
16568 (KJS::dateProtoFuncGetUTCDate):
16569 (KJS::dateProtoFuncGetDay):
16570 (KJS::dateProtoFuncGetUTCDay):
16571 (KJS::dateProtoFuncGetHours):
16572 (KJS::dateProtoFuncGetUTCHours):
16573 (KJS::dateProtoFuncGetMinutes):
16574 (KJS::dateProtoFuncGetUTCMinutes):
16575 (KJS::dateProtoFuncGetSeconds):
16576 (KJS::dateProtoFuncGetUTCSeconds):
16577 (KJS::dateProtoFuncGetMilliSeconds):
16578 (KJS::dateProtoFuncGetUTCMilliseconds):
16579 (KJS::dateProtoFuncGetTimezoneOffset):
16580 (KJS::dateProtoFuncSetTime):
16581 (KJS::setNewValueFromTimeArgs):
16582 (KJS::setNewValueFromDateArgs):
16583 (KJS::dateProtoFuncSetYear):
16584 (KJS::dateProtoFuncGetYear):
16585 * kjs/error_object.cpp:
16586 (KJS::ErrorPrototype::ErrorPrototype):
16587 (KJS::errorProtoFuncToString):
16588 (KJS::ErrorObjectImp::ErrorObjectImp):
16589 (KJS::ErrorObjectImp::construct):
16590 (KJS::NativeErrorPrototype::NativeErrorPrototype):
16591 (KJS::NativeErrorImp::NativeErrorImp):
16592 (KJS::NativeErrorImp::construct):
16593 * kjs/function.cpp:
16594 (KJS::FunctionImp::lengthGetter):
16595 (KJS::FunctionImp::construct):
16596 (KJS::Arguments::Arguments):
16597 (KJS::ActivationImp::createArgumentsObject):
16600 (KJS::globalFuncParseInt):
16601 (KJS::globalFuncParseFloat):
16602 (KJS::globalFuncEscape):
16603 (KJS::globalFuncUnescape):
16604 (KJS::PrototypeFunction::PrototypeFunction):
16605 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
16606 * kjs/function_object.cpp:
16607 (KJS::FunctionPrototype::FunctionPrototype):
16608 (KJS::functionProtoFuncToString):
16609 (KJS::FunctionObjectImp::FunctionObjectImp):
16610 (KJS::FunctionObjectImp::construct):
16611 * kjs/internal.cpp:
16612 (KJS::StringImp::toObject):
16614 (KJS::StringImp::StringImp):
16615 (KJS::NumberImp::operator new):
16617 (KJS::staticFunctionGetter):
16618 (KJS::cacheGlobalObject):
16619 * kjs/math_object.cpp:
16620 (KJS::MathObjectImp::getValueProperty):
16621 (KJS::mathProtoFuncAbs):
16622 (KJS::mathProtoFuncACos):
16623 (KJS::mathProtoFuncASin):
16624 (KJS::mathProtoFuncATan):
16625 (KJS::mathProtoFuncATan2):
16626 (KJS::mathProtoFuncCeil):
16627 (KJS::mathProtoFuncCos):
16628 (KJS::mathProtoFuncExp):
16629 (KJS::mathProtoFuncFloor):
16630 (KJS::mathProtoFuncLog):
16631 (KJS::mathProtoFuncMax):
16632 (KJS::mathProtoFuncMin):
16633 (KJS::mathProtoFuncPow):
16634 (KJS::mathProtoFuncRandom):
16635 (KJS::mathProtoFuncRound):
16636 (KJS::mathProtoFuncSin):
16637 (KJS::mathProtoFuncSqrt):
16638 (KJS::mathProtoFuncTan):
16640 (KJS::Node::handleException):
16641 (KJS::NumberNode::evaluate):
16642 (KJS::StringNode::evaluate):
16643 (KJS::ArrayNode::evaluate):
16644 (KJS::PostIncResolveNode::evaluate):
16645 (KJS::PostIncLocalVarNode::evaluate):
16646 (KJS::PostDecResolveNode::evaluate):
16647 (KJS::PostDecLocalVarNode::evaluate):
16648 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
16649 (KJS::PostIncBracketNode::evaluate):
16650 (KJS::PostDecBracketNode::evaluate):
16651 (KJS::PostIncDotNode::evaluate):
16652 (KJS::PostDecDotNode::evaluate):
16653 (KJS::typeStringForValue):
16654 (KJS::LocalVarTypeOfNode::evaluate):
16655 (KJS::TypeOfResolveNode::evaluate):
16656 (KJS::TypeOfValueNode::evaluate):
16657 (KJS::PreIncLocalVarNode::evaluate):
16658 (KJS::PreIncResolveNode::evaluate):
16659 (KJS::PreDecLocalVarNode::evaluate):
16660 (KJS::PreDecResolveNode::evaluate):
16661 (KJS::PreIncConstNode::evaluate):
16662 (KJS::PreDecConstNode::evaluate):
16663 (KJS::PostIncConstNode::evaluate):
16664 (KJS::PostDecConstNode::evaluate):
16665 (KJS::PreIncBracketNode::evaluate):
16666 (KJS::PreDecBracketNode::evaluate):
16667 (KJS::PreIncDotNode::evaluate):
16668 (KJS::PreDecDotNode::evaluate):
16669 (KJS::NegateNode::evaluate):
16670 (KJS::BitwiseNotNode::evaluate):
16671 (KJS::MultNode::evaluate):
16672 (KJS::DivNode::evaluate):
16673 (KJS::ModNode::evaluate):
16674 (KJS::addSlowCase):
16676 (KJS::AddNumbersNode::evaluate):
16677 (KJS::AddStringsNode::evaluate):
16678 (KJS::AddStringLeftNode::evaluate):
16679 (KJS::AddStringRightNode::evaluate):
16680 (KJS::SubNode::evaluate):
16681 (KJS::LeftShiftNode::evaluate):
16682 (KJS::RightShiftNode::evaluate):
16683 (KJS::UnsignedRightShiftNode::evaluate):
16684 (KJS::BitXOrNode::evaluate):
16685 (KJS::BitOrNode::evaluate):
16686 (KJS::valueForReadModifyAssignment):
16687 (KJS::ForInNode::execute):
16688 (KJS::TryNode::execute):
16689 (KJS::FuncDeclNode::makeFunction):
16690 (KJS::FuncExprNode::evaluate):
16691 * kjs/number_object.cpp:
16692 (KJS::NumberPrototype::NumberPrototype):
16693 (KJS::numberProtoFuncToString):
16694 (KJS::numberProtoFuncToLocaleString):
16695 (KJS::numberProtoFuncToFixed):
16696 (KJS::numberProtoFuncToExponential):
16697 (KJS::numberProtoFuncToPrecision):
16698 (KJS::NumberObjectImp::NumberObjectImp):
16699 (KJS::NumberObjectImp::getValueProperty):
16700 (KJS::NumberObjectImp::construct):
16701 (KJS::NumberObjectImp::callAsFunction):
16703 (KJS::JSObject::defineGetter):
16704 (KJS::JSObject::defineSetter):
16705 (KJS::JSObject::putDirect):
16706 (KJS::Error::create):
16708 * kjs/object_object.cpp:
16709 (KJS::ObjectPrototype::ObjectPrototype):
16710 (KJS::objectProtoFuncToLocaleString):
16711 (KJS::objectProtoFuncToString):
16712 (KJS::ObjectObjectImp::ObjectObjectImp):
16713 (KJS::ObjectObjectImp::construct):
16714 * kjs/regexp_object.cpp:
16715 (KJS::RegExpPrototype::RegExpPrototype):
16716 (KJS::regExpProtoFuncToString):
16717 (KJS::RegExpImp::getValueProperty):
16718 (KJS::RegExpObjectImp::RegExpObjectImp):
16719 (KJS::RegExpObjectImp::arrayOfMatches):
16720 (KJS::RegExpObjectImp::getBackref):
16721 (KJS::RegExpObjectImp::getLastParen):
16722 (KJS::RegExpObjectImp::getLeftContext):
16723 (KJS::RegExpObjectImp::getRightContext):
16724 (KJS::RegExpObjectImp::getValueProperty):
16725 (KJS::RegExpObjectImp::createRegExpImp):
16726 * kjs/regexp_object.h:
16727 * kjs/string_object.cpp:
16728 (KJS::StringInstance::StringInstance):
16729 (KJS::StringInstance::lengthGetter):
16730 (KJS::StringInstance::indexGetter):
16731 (KJS::stringInstanceNumericPropertyGetter):
16732 (KJS::StringPrototype::StringPrototype):
16734 (KJS::stringProtoFuncCharAt):
16735 (KJS::stringProtoFuncCharCodeAt):
16736 (KJS::stringProtoFuncConcat):
16737 (KJS::stringProtoFuncIndexOf):
16738 (KJS::stringProtoFuncLastIndexOf):
16739 (KJS::stringProtoFuncMatch):
16740 (KJS::stringProtoFuncSearch):
16741 (KJS::stringProtoFuncReplace):
16742 (KJS::stringProtoFuncSlice):
16743 (KJS::stringProtoFuncSplit):
16744 (KJS::stringProtoFuncSubstr):
16745 (KJS::stringProtoFuncSubstring):
16746 (KJS::stringProtoFuncToLowerCase):
16747 (KJS::stringProtoFuncToUpperCase):
16748 (KJS::stringProtoFuncToLocaleLowerCase):
16749 (KJS::stringProtoFuncToLocaleUpperCase):
16750 (KJS::stringProtoFuncLocaleCompare):
16751 (KJS::stringProtoFuncBig):
16752 (KJS::stringProtoFuncSmall):
16753 (KJS::stringProtoFuncBlink):
16754 (KJS::stringProtoFuncBold):
16755 (KJS::stringProtoFuncFixed):
16756 (KJS::stringProtoFuncItalics):
16757 (KJS::stringProtoFuncStrike):
16758 (KJS::stringProtoFuncSub):
16759 (KJS::stringProtoFuncSup):
16760 (KJS::stringProtoFuncFontcolor):
16761 (KJS::stringProtoFuncFontsize):
16762 (KJS::stringProtoFuncAnchor):
16763 (KJS::stringProtoFuncLink):
16764 (KJS::StringObjectImp::StringObjectImp):
16765 (KJS::StringObjectImp::construct):
16766 (KJS::StringObjectImp::callAsFunction):
16767 (KJS::StringObjectFuncImp::StringObjectFuncImp):
16768 (KJS::StringObjectFuncImp::callAsFunction):
16769 * kjs/string_object.h:
16770 (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
16772 (GlobalObject::GlobalObject):
16775 (functionReadline):
16779 (KJS::JSCell::operator new):
16781 (KJS::jsOwnedString):
16782 (KJS::jsNumberCell):
16786 (KJS::jsNumberFromAnd):
16787 (KJS::JSCell::marked):
16788 (KJS::JSCell::mark):
16789 (KJS::JSValue::toJSNumber):
16790 Removed collectOnMainThreadOnly, as this is the only way to collect now. Replaced calls to
16791 static Collector methods with calls to per-thread Heap ones.
16793 2008-05-02 Dan Bernstein <mitz@apple.com>
16795 Reviewed by Maciej Stachowiak.
16799 * wtf/StrHash.h: Added header guards and removed #include "config.h".
16801 2008-05-01 Ada Chan <adachan@apple.com>
16803 #include <wtf/StrHash.h> in identifier.cpp.
16805 Reviewed by Maciej.
16807 * kjs/identifier.cpp:
16809 2008-05-01 Steve Falkenburg <sfalken@apple.com>
16813 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
16815 2008-05-01 Sam Weinig <sam@webkit.org>
16819 * JavaScriptCore.xcodeproj/project.pbxproj:
16821 2008-05-01 Kevin McCullough <kmccullough@apple.com>
16825 <rdar://problem/5770054> JavaScript profiler (10928)
16826 - Fix "sample" output so that it can be imported into Instruments
16827 - Also keep track of number of times a function is profiled.
16829 * JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed
16830 to be pulled out of identifier.cpp so that it could be used by the
16831 profiler and identifiers.
16832 * kjs/identifier.cpp: Ditto.
16833 * profiler/FunctionCallProfile.cpp:
16834 (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style
16835 printing should show microseconds.
16836 (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing
16837 now counts the number of times a function is in the stack tree and does
16838 not print microseconds since that does not make sense for a sampler.
16839 * profiler/FunctionCallProfile.h: Keep track of number of times a
16840 function is profiled.
16841 (KJS::FunctionCallProfile::numberOfCalls):
16842 * profiler/Profiler.cpp:
16843 (KJS::functionNameCountPairComparator): Comparator for sort function in
16844 printDataSampleStyle.
16845 (KJS::Profiler::printDataSampleStyle): Print the number of times that a
16846 function is listed in the stack tree in order of most times listed.
16847 * wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is
16848 a more standard way to copy a HashSet to a Vector. I added on variant
16849 that takes a pair as the Vector's type and so the HashCountedSet simply
16850 fills in that pair with its internal pair, and another variant that
16851 takes a Vector of the type of the HashCountedSet and only fills in the
16852 Vector with the first element of the pair.
16853 (WTF::copyToVector):
16854 * wtf/StrHash.h: Added.
16857 2008-04-29 David Kilzer <ddkilzer@apple.com>
16859 BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
16861 * wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
16862 PLATFORM(MAC) and PLATFORM(WIN). Changed default to 0 for other
16865 2008-04-29 Greg Bolsinga <bolsinga@apple.com>
16869 Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
16873 2008-04-29 Kevin McCullough <kmccullough@apple.com>
16877 -<rdar://problem/5770054> JavaScript profiler (10928)
16880 * profiler/FunctionCallProfile.cpp:
16881 (KJS::FunctionCallProfile::FunctionCallProfile):
16882 (KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex
16883 of 0 was causing the assert to be hit.
16884 (KJS::FunctionCallProfile::stopProfiling):
16885 (KJS::FunctionCallProfile::endAndRecordCall):
16886 * profiler/FunctionCallProfile.h:
16888 2008-04-29 Simon Hausmann <hausmann@webkit.org>
16890 Qt/Windows build fix. The externally declared hash tables are actually
16891 declared const and the const is mangled in the symbol name, so when
16892 importing they also need to be marked const.
16894 When compiling without MULTIPLE_THREADS use a const HashTable&
16895 instead of a HashTable& in ThreadClassInfoHashTables to avoid
16896 initializing the latter with a const reference.
16898 * kjs/JSGlobalObject.cpp:
16900 2008-04-28 Alexey Proskuryakov <ap@webkit.org>
16904 * kjs/ExecState.h: For whatever reason, MSVC couldn't generate a default constructor for
16905 a struct that had a "const List" member. Removing the const qulifier makes the problem go away.
16907 2008-04-28 Alexey Proskuryakov <ap@webkit.org>
16911 Fix run-webkit-tests --threading
16912 and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
16913 Proxy server issue in Sunday's Nightly
16915 Changed ClassInfo objects for built-in objects to hold a getter function returning
16916 a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
16917 and these are the only ones that need to be shared.
16920 (KJS::Lexer::Lexer):
16921 (KJS::Lexer::~Lexer):
16923 Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
16926 (KJS::JSObject::deleteProperty):
16927 (KJS::JSObject::findPropertyHashEntry):
16928 (KJS::JSObject::propertyIsEnumerable):
16929 (KJS::JSObject::getPropertyAttributes):
16930 (KJS::JSObject::getPropertyNames):
16932 (KJS::ClassInfo::propHashTable):
16933 Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
16934 static table is not used.
16936 * kjs/JSGlobalObject.cpp:
16937 (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
16938 HashTables for built-in classes. The old static structs are copied to create per-thread
16940 (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
16941 (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
16942 Also, construct globalExec.
16943 (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
16944 (KJS::JSGlobalObject::mark): Ditto.
16945 (KJS::JSGlobalObject::globalExec): Ditto.
16946 * kjs/JSGlobalObject.h:
16947 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
16948 be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
16949 trying to access half-initialized JSGlobalObject to make its own copy of these table
16950 references, and failed.
16951 (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
16952 (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
16954 * kjs/ExecState.cpp:
16955 (KJS::ExecState::ExecState):
16957 (KJS::ExecState::propertyNames):
16958 (KJS::ExecState::emptyList):
16959 (KJS::ExecState::arrayTable):
16960 (KJS::ExecState::dateTable):
16961 (KJS::ExecState::mathTable):
16962 (KJS::ExecState::numberTable):
16963 (KJS::ExecState::RegExpImpTable):
16964 (KJS::ExecState::RegExpObjectImpTable):
16965 (KJS::ExecState::stringTable):
16966 * kjs/ExecStateInlines.h:
16967 (KJS::ExecState::ExecState):
16968 Each ExecState holds its own reference to per-thread data, for even faster access. Moved
16969 m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
16970 and take less space on the stack.
16972 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
16973 added to JSGlobalObject.
16975 * API/JSCallbackConstructor.cpp:
16976 * API/JSCallbackFunction.cpp:
16977 * API/JSCallbackObject.cpp:
16978 * JavaScriptCore.exp:
16979 * kjs/JSVariableObject.cpp:
16980 (KJS::JSVariableObject::getPropertyAttributes):
16981 * kjs/JSVariableObject.h:
16982 * kjs/array_instance.cpp:
16983 * kjs/array_object.cpp:
16984 (KJS::ArrayPrototype::getOwnPropertySlot):
16985 * kjs/bool_object.cpp:
16986 * kjs/create_hash_table:
16987 * kjs/date_object.cpp:
16988 (KJS::DatePrototype::getOwnPropertySlot):
16989 (KJS::DateObjectImp::DateObjectImp):
16990 * kjs/error_object.cpp:
16991 * kjs/function.cpp:
16992 * kjs/function_object.cpp:
16993 (KJS::FunctionPrototype::FunctionPrototype):
16994 * kjs/internal.cpp:
16996 * kjs/math_object.cpp:
16997 (KJS::MathObjectImp::getOwnPropertySlot):
16998 * kjs/number_object.cpp:
16999 (KJS::NumberObjectImp::getOwnPropertySlot):
17000 * kjs/object_object.cpp:
17001 (KJS::ObjectPrototype::ObjectPrototype):
17002 * kjs/regexp_object.cpp:
17003 (KJS::RegExpPrototype::RegExpPrototype):
17004 (KJS::RegExpImp::getOwnPropertySlot):
17005 (KJS::RegExpImp::put):
17006 (KJS::RegExpObjectImp::getOwnPropertySlot):
17007 (KJS::RegExpObjectImp::put):
17008 * kjs/string_object.cpp:
17009 (KJS::StringPrototype::getOwnPropertySlot):
17010 Adjust for the above changes.
17012 2008-04-28 Darin Adler <darin@apple.com>
17016 - make sure RefPtr's default hash doesn't ref/deref when computing the hash
17017 - remove remnants of the hash table storage type optimization
17019 * wtf/HashFunctions.h: Used "using" to get the hash and equal functions
17020 from PtrHash<P*> into PtrHash<RefPtr<P>>.
17022 * wtf/HashMap.h: Replaced uses of PairBaseHashTraits with PairHashTraits.
17023 Eliminated storage-related typedefs. Removed constructor, destructor,
17024 copy constructor, and destructor since the compiler-generated ones are
17025 fine. Removed refAll and derefAll. Took out unnnecessary typecasts.
17026 Removed use of RefCounter.
17028 * wtf/HashSet.h: Eliminated storage-related typedefs. Removed constructor,
17029 destructor, copy constructor, and destructor since the compiler-generated
17030 ones are fine. Removed refAll and derefAll. Removed unneeded template
17031 arguents from HashSetTranslatorAdapter. Eliminated unneeded HashSetTranslator
17034 * wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
17035 RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
17038 * wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
17039 and HashKeyStorageTraits.
17041 * wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
17042 the corresponding changes to RefPtrHashMapRawKeyTranslator.
17044 2008-04-28 Darin Adler <darin@apple.com>
17048 - fix assertion hit every time you view www.apple.com
17050 * kjs/PropertyNameArray.cpp:
17051 (KJS::PropertyNameArray::add): Changed assertion to allow null and empty strings.
17052 Now to find out why we have a property named "" and if that's a bug!
17054 2008-04-27 Mark Rowe <mrowe@apple.com>
17056 Reviewed by Maciej Stachowiak.
17058 Fix crash inside PtrHash::hash when loading a page.
17060 * wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
17062 2008-04-27 Darin Adler <darin@apple.com>
17064 Reviewed by Maciej.
17066 - fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
17067 GCC 4.2 due to pointer aliasing warnings
17069 Fix this by removing the HashTable optimizations that allowed us to share a back end
17070 implementation between hash tables with integers, pointers, RefPtr, and String objects
17071 as keys. The way it worked was incompatible with strict aliasing.
17073 This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
17074 slowing down Safari startup times.
17076 This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
17078 - speed up array put slightly by moving a branch (was already done for get)
17080 - speed up symbol table access by adding a function named inlineGet to HashMap
17081 and using that in symbolTableGet/Put
17083 - speed up PropertyNameArray creation by reducing the amount of reference count
17084 churn and uniqueness checking when adding names and not doing any allocation at
17085 all when building small arrays
17087 - speed up conversion of strings to floating point numbers by eliminating the
17088 malloc/free of the buffer for the ASCII copy of the string; a way to make
17089 things even faster would be to change strtod to take a UTF-16 string
17091 Note that there is considerable unused complexity now in HashSet/Map/Table to support
17092 "storage types", which is no longer used. Will do in a separate patch.
17094 * API/JSCallbackObjectFunctions.h:
17095 (KJS::JSCallbackObject<Base>::getPropertyNames): Removed explicit cast to Identifier to
17096 take advantage of the new PropertyNameArray::add overload and avoid reference count churn.
17097 * API/JSObjectRef.cpp:
17098 (JSPropertyNameAccumulatorAddName): Ditto.
17099 * JavaScriptCore.exp: Updated PropertyNameArray::add entry point name.
17101 * kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
17102 definition (see below).
17103 (KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
17105 * kjs/JSVariableObject.h:
17106 (KJS::JSVariableObject::symbolTableGet): Use inlineGet for speed. Also changed to do
17107 early exit instead of nesting the body inside an if.
17108 (KJS::JSVariableObject::symbolTablePut): Ditto.
17110 * kjs/PropertyNameArray.cpp:
17111 (KJS::PropertyNameArray::add): Changed implementation to take a raw pointer instead of
17112 a reference to an identifier. Do uniqueness checking by searching the vector when the
17113 vector is short, only building the set once the vector is large enough.
17115 * kjs/PropertyNameArray.h: Added an overload of add for a raw pointer, and made the old
17116 add function call that one. Added an addKnownUnique function for use when the new
17117 name is known to be different from any other in the array. Changed the vector to have
17118 an inline capacity of 20.
17120 * kjs/SymbolTable.h: Changed IdentifierRepHash to inherit from the default hash for
17121 a RefPtr so we don't have to define so much. Added an overload of the hash function for
17122 a raw pointer as required by the new RefPtrHashMap. Got rid of the now-unneeded
17123 IdentifierRepHashTraits -- the default traits now work fine. Added a definition of
17124 empthValueIsZero to SymbolTableIndexHashTraits; not having it was incorrect, but harmless.
17126 * kjs/array_instance.cpp:
17127 (KJS::ArrayInstance::put): Move the maxArrayIndex check inside the branch that checks
17128 the index against the length, as done in the get function.
17130 * kjs/function.cpp:
17131 (KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
17133 * kjs/internal.cpp: Removed printInfo debugging function, a client of cstring.
17134 If we need a debugging function we can easily make a better one and we haven't
17135 used this one in a long time.
17136 * kjs/internal.h: Ditto.
17139 (KJS::JSObject::getPropertyNames): Removed explicit cast to Identifier.
17140 * kjs/property_map.cpp:
17141 (KJS::PropertyMap::getEnumerablePropertyNames): Ditto. Also added a special case for
17142 the case where the propertyNames array is empty -- in that case we know we're adding
17143 a set of names that are non-overlapping so we can use addKnownUnique.
17145 (KJS::UString::getCString): Replaces cstring. Puts the C string into a CStringBuffer,
17146 which is a char Vector with an inline capacity. Also returns a boolean to indicate if
17147 the converion was lossy, which eliminates the need for a separate is8Bit call.
17148 (KJS::UString::toDouble): Changed to call getCString instead of cstring.
17149 * kjs/ustring.h: Ditto.
17151 * wtf/HashFunctions.h: Overload the hash and equal functions for RefPtr's default
17152 hash to take raw pointers. This works with the changes to RefPtrHashMap to avoid
17153 introducing refcount churn.
17155 * wtf/HashMap.h: Removed special code to convert the deleted value to the empty value
17156 when writing a new value into the map. This is now handled elsewhere.
17157 (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
17158 HashTable::lookup; it's slightly more efficient to do this check inside lookup.
17161 (WTF::HashTable::isDeletedBucket): Changed to use isDeletedValue instead of using
17162 deletedValue and the equality operator.
17163 (WTF::HashTable::deleteBucket): Changed to use constructDeletedValue instead of
17164 using deletedValue and the assignment operator.
17165 (WTF::HashTable::checkKey): Added. Factors out the check for values that are empty
17166 or deleted keys that's used in various functions below.
17167 (WTF::HashTable::lookup): Changed to use checkKey, check for a 0 table, and also
17168 made public for use by RefPtrHashMap.
17169 (WTF::HashTable::lookupForWriting): Changed to use checkKey.
17170 (WTF::HashTable::fullLookupForWriting): Changed to use checkKey.
17171 (WTF::HashTable::add): Changed to use checkKey, and call initializeBucket on a
17172 deleted bucket before putting a new entry into it.
17173 (WTF::HashTable::addPassingHashCode): Ditto.
17174 (WTF::HashTable::deallocateTable): Check isDeletedBucket before calling ~ValueType.
17176 * wtf/HashTraits.h: Got ridd of all the HashTraits specialization for the integer
17177 types, since GeneicHashTraitsBase already deals with integers separately. Put the
17178 deleted value support into GenericHashTraitsBase. Changed FloatHashTraits to
17179 inherit from GenericHashTraits, and define construct/isDeletedValue rather than
17180 deletedValue. Removed the ref and deref functions from RefPtr's HashTraits, and
17181 defined construct/isDeletedValue. Eliminated DeletedValueAssigner. Changed
17182 PairHashTraits to define construct/isDeletedValue, and also merged
17183 PairBaseHashTraits in with PairHashTraits. Got rid of all specialization of
17184 HashKeyStorageTraits. We'll remove that, and the needsRef data member, later.
17186 * wtf/RefPtr.h: Added HashTableDeletedValueType, an enum type with a single value,
17187 HashTableDeletedValue. Used that type to make a new constructor to construct
17188 deleted values and also added an isHashTableDeletedValue function.
17190 * wtf/RefPtrHashMap.h: Added RefPtrHashMapRawKeyTranslator and used it to implement
17191 the raw pointer functions. This is a way to continue to avoid refcount thrash. We
17192 can't use the old way because it depended on the underlying map using a non-RefPtr
17194 (WTF::HashMap::find): Use find with RefPtrHashMapRawKeyTranslator.
17195 (WTF::HashMap::contains): Use contains with RefPtrHashMapRawKeyTranslator.
17196 (WTF::HashMap::inlineAdd): Use add with RefPtrHashMapRawKeyTranslator.
17197 (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
17198 HashTable::lookup; it's slightly more efficient to do this check inside lookup.
17199 (WTF::HashMap::inlineGet): Added. Just like get, but marked inline for use in the
17202 2008-04-25 Sam Weinig <sam@webkit.org>
17204 Rubber-stamped by Mark Rowe.
17206 Remove SavedBuiltins and SavedProperties classes and the methods used to
17207 save data to them. The CachedPage now stores a the JSGlobalObject in full.
17209 * JavaScriptCore.exp:
17210 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17211 * JavaScriptCore.xcodeproj/project.pbxproj:
17212 * kjs/JSGlobalObject.cpp:
17213 * kjs/JSGlobalObject.h:
17214 * kjs/JSVariableObject.cpp:
17215 * kjs/JSVariableObject.h:
17216 (KJS::JSVariableObject::localStorage):
17217 * kjs/SavedBuiltins.h: Removed.
17219 * kjs/property_map.cpp:
17220 * kjs/property_map.h:
17222 2008-04-25 Mark Rowe <mrowe@apple.com>
17224 Rubber-stamped by Sam Weinig.
17226 Add some content to an empty ICU header file to prevent verification errors.
17228 * icu/unicode/utf_old.h:
17230 2008-04-25 David Kilzer <ddkilzer@apple.com>
17232 <rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
17234 Patch by George Dicker and Michael Kahl. Reviewed by Darin.
17236 When -[NSObject(WebScriptDebugDelegate) webView:willLeaveCallFrame:sourceId:line:forWebFrame:]
17237 is invoked, the first line number of the function is returned instead of the last
17238 line number. This regressed in r28458.
17241 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
17242 when calling Debugger::returnEvent().
17244 2008-04-25 Darin Adler <darin@apple.com>
17246 Done with Stephanie Lewis.
17248 * JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
17249 adding -fno-strict-aliasing to CollatorICU.cpp.
17251 2008-04-24 Sam Weinig <sam@webkit.org>
17253 Reviewed by Geoffrey Garen.
17255 Add a #define to easily enable collecting on every allocation to aid
17258 * kjs/collector.cpp:
17259 (KJS::Collector::heapAllocate):
17261 2008-04-24 Kevin McCullough <kmccullough@apple.com>
17263 Reviewed by Adam and Sam.
17265 -<rdar://problem/5770054> JavaScript profiler (10928)
17266 -Only profile the page group that starts profiling to avoid profiling
17267 tools that shouldn't be profiled unless explicitly requested to.
17269 * JavaScriptCore.exp: Export new signature.
17270 * kjs/JSGlobalObject.cpp: Add unique identifiers to the JSGlobalObject.
17271 (KJS::JSGlobalObject::init):
17272 * kjs/JSGlobalObject.h: Ditto.
17273 (KJS::JSGlobalObject::setPageGroupIdentifier):
17274 (KJS::JSGlobalObject::pageGroupIdentifier):
17275 * profiler/Profiler.cpp: Check the identifier of the page group of the
17276 lexical global exec state and only profile if it matches the given page
17278 (KJS::Profiler::startProfiling):
17279 (KJS::Profiler::willExecute):
17280 (KJS::Profiler::didExecute):
17281 * profiler/Profiler.h: Ditto.
17282 (KJS::Profiler::Profiler):
17284 2008-04-24 Julien Chaffraix <jchaffraix@webkit.org>
17288 Bug 15940: Implement threading API for Qt
17289 https://bugs.webkit.org/show_bug.cgi?id=15940
17291 Original patch by Justin Haygood, tweaked by me.
17293 * JavaScriptCore.pri:
17294 * wtf/ThreadingQt.cpp: Added.
17295 (WTF::threadMapMutex):
17297 (WTF::establishIdentifierForThread):
17298 (WTF::clearThreadForIdentifier):
17299 (WTF::threadForIdentifier):
17300 (WTF::initializeThreading):
17301 (WTF::ThreadPrivate::getReturnValue):
17302 (WTF::ThreadPrivate::ThreadPrivate):
17303 (WTF::ThreadPrivate::run):
17304 (WTF::createThread):
17305 (WTF::waitForThreadCompletion): return !res to return
17306 0 on success (to match the pthreads implementation).
17307 (WTF::detachThread):
17308 (WTF::identifierByQthreadHandle):
17309 (WTF::currentThread):
17310 (WTF::Mutex::Mutex):
17311 (WTF::Mutex::~Mutex):
17312 (WTF::Mutex::lock):
17313 (WTF::Mutex::tryLock):
17314 (WTF::Mutex::unlock):
17315 (WTF::ThreadCondition::ThreadCondition):
17316 (WTF::ThreadCondition::~ThreadCondition):
17317 (WTF::ThreadCondition::wait):
17318 (WTF::ThreadCondition::timedWait):
17319 (WTF::ThreadCondition::signal):
17321 2008-04-22 Darin Adler <darin@apple.com>
17323 Reviewed by Anders.
17325 - simplify use of HashTraits to prepare for some upcoming hash table changes
17327 * kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
17328 and specialize only the empty value.
17330 2008-04-23 Holger Hans Peter Freyther <zecke@selfish.org>
17334 Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
17339 2008-04-21 Kevin McCullough <kmccullough@apple.com>
17343 <rdar://problem/5770054> JavaScript profiler (10928)
17344 - When stop profiling is called we need to stop the timers on all the
17345 functions that are still running.
17347 * profiler/FunctionCallProfile.cpp:
17348 (KJS::FunctionCallProfile::didExecute):
17349 (KJS::FunctionCallProfile::stopProfiling):
17350 * profiler/FunctionCallProfile.h:
17351 * profiler/Profiler.cpp:
17352 (KJS::Profiler::stopProfiling):
17354 2008-04-21 Alexey Proskuryakov <ap@webkit.org>
17358 Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
17360 * kjs/InitializeThreading.cpp:
17361 (KJS::initializeThreading):
17363 2008-04-21 Adam Roben <aroben@apple.com>
17367 Reviewed by Alexey Proskuryakov.
17370 (KJS::UString::cost): Disable a warning about assigning a 32-bit
17371 size_t into a 31-bit size_t.
17373 2008-04-21 Simon Hausmann <hausmann@webkit.org>
17377 Made convertValueToQVariant accessible from within WebKit/qt/Api
17379 * bindings/qt/qt_runtime.h:
17381 2008-04-21 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
17385 Build fix for Qt 4.3
17387 * When building WebCore/internal make sure the QT_[BEGIN,END]_NAMESPACE is
17388 always defined. Do this by adding defines to the compiler line
17389 * For users of our API this is not feasible. Every public header file should
17390 include qwebkitglobal.h. Define the QT_BEGIN_NAMESPACE and QT_END_NAMESPACE
17391 when we are building everything < 4.4.0 and don't have them defined.
17395 2008-04-19 Matt Lilek <webkit@mattlilek.com>
17397 Not reviewed, Windows build fix - copy the profiler headers in all
17398 configurations, not just Debug_Internal.
17400 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17402 2008-04-19 Mike Hommey <glandium@debian.org>
17404 Reviewed by Alp Toker.
17406 Don't build testkjs with rpath.
17410 2008-04-18 Kevin Ollivier <kevino@theolliviers.com>
17412 wx build fixes. Rename LocalStorage.h to LocalStorageEntry.h
17413 to avoid header detection issues between WebCore/storage/LocalStorage.h
17414 and it, and add $(PROFILER_SOURCES) to the wx JSCore build.
17416 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
17417 * JavaScriptCore.xcodeproj/project.pbxproj:
17420 * kjs/JSVariableObject.h:
17421 * kjs/LocalStorage.h: Removed.
17422 * kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
17425 2008-04-18 Jan Michael Alonzo <jmalonzo@unpluggable.com>
17427 Reviewed by Alp Toker.
17429 http://bugs.webkit.org/show_bug.cgi?id=16620
17430 [GTK] Autotools make dist and make check support
17436 2008-04-18 Jon Honeycutt <jhoneycutt@apple.com>
17438 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
17441 2008-04-11 Mark Rowe <mrowe@apple.com>
17443 Rubber-stamped by Antti Koivisto.
17445 Silence GCC 4.3 warnings by removing extraneous consts.
17450 2008-04-18 Kevin McCullough <kmccullough@apple.com>
17454 -<rdar://problem/5770054> JavaScript profiler (10928)
17455 - Use Deque instead of Vector since the profiler uses prepend a lot
17456 and deque is faster at that.
17458 * profiler/FunctionCallProfile.h:
17459 (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
17462 (WTF::deleteAllValues):
17464 2008-04-18 Kevin McCullough <kmccullough@apple.com>
17466 Reviewed by Sam and Adam.
17468 -<rdar://problem/5770054> JavaScript profiler (10928)
17469 - Cleaned up the header file and made some functions static, added
17470 a new, sane, printing function, and fixed a few minor bugs.
17472 * JavaScriptCore.exp:
17473 * JavaScriptCore.xcodeproj/project.pbxproj:
17474 * profiler/FunctionCallProfile.cpp:
17475 (KJS::FunctionCallProfile::didExecute): Removed assertion that time is
17476 > 0 because at ms resolution that may not be true and only cross-
17477 platform way to get time differences is in ms.
17478 (KJS::FunctionCallProfile::printDataInspectorStyle): Added a new
17479 printing function for dumping data in a sane style.
17480 (KJS::FunctionCallProfile::printDataSampleStyle): Fixed a bug where we
17481 displayed too much precision when printing our floats. Also added logic
17482 to make sure we don't display 0 because that doesn't make sense for a
17484 * profiler/FunctionCallProfile.h:
17485 * profiler/Profiler.cpp: Moved functions that could be static into the
17486 implementation, and chaned the ASSERTs to early returns. I did this
17487 because console.profile() is a JS function and so was being profiled
17488 but asserting because the profiler had not been started! In the future
17489 I would like to put the ASSERTs back and not profile the calls to
17490 console.profile() and console.profileEnd().
17491 (KJS::Profiler::willExecute):
17492 (KJS::Profiler::didExecute):
17493 (KJS::getStackNames): Fixed a bug where the wrong ExecState was being
17495 (KJS::getFunctionName):
17496 (KJS::Profiler::printDataInspectorStyle):
17497 * profiler/Profiler.h:
17499 2008-04-18 Alexey Proskuryakov <ap@webkit.org>
17503 Fix leaks during plugin tests (which actually excercise background JS), and potential
17504 PAC brokenness that was not reported, but very likely.
17506 The leaks shadowed a bigger problem with Identifier destruction. Identifier::remove involves
17507 an IdentifierTable lookup, which is now a per-thread instance. Since garbage collection can
17508 currently happen on a different thread than allocation, a wrong table was used.
17510 No measurable change on SunSpider total, ~1% variation on individual tests.
17513 (KJS::UString::Rep::create):
17514 (KJS::UString::Rep::destroy):
17516 Replaced isIdentifier with a pointer to IdentifierTable, so that destruction can be done
17517 correctly. Took one bit from reportedCost, to avoid making UString::Rep larger (performance
17518 effect was measurable on SunSpider).
17520 * kjs/identifier.cpp:
17521 (KJS::IdentifierTable::IdentifierTable):
17522 (KJS::IdentifierTable::~IdentifierTable):
17523 (KJS::IdentifierTable::add):
17524 (KJS::IdentifierTable::remove):
17525 Make IdentifierTable a real class. Its destructor needs to zero out outstanding references,
17526 because some identifiers may briefly outlive it during thread destruction, and we don't want
17527 them to use their stale pointers.
17529 (KJS::LiteralIdentifierTable):
17530 (KJS::Identifier::add):
17531 Now that LiteralIdentifierTable is per-thread and can be destroyed not just during application
17532 shutdown, it is not appropriate to simply bump refcount for strings that get there; changed
17533 the table to hold RefPtrs.
17535 (KJS::CStringTranslator::translate):
17536 (KJS::UCharBufferTranslator::translate):
17537 (KJS::Identifier::addSlowCase):
17538 (KJS::Identifier::remove):
17539 * kjs/identifier.h:
17540 (KJS::Identifier::add):
17541 Use and update UString::Rep::identifierTable as appropriate. Updating it is now done in
17542 IdentifierTable::add, not in translators.
17544 2008-04-18 Alexey Proskuryakov <ap@webkit.org>
17548 Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
17550 No change on SunSpider, CelticKane or iBench JavaScript. It is probable that in some cases,
17551 merge sort is still faster, but more investigation is needed to determine a new cutoff.
17552 Or possibly, it would be better to do what FIXME says (change to tree sort).
17554 Also, made arguments a local variable - not sure why it was a member of
17555 CompareWithCompareFunctionArguments.
17557 * kjs/array_instance.cpp:
17558 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
17559 (KJS::CompareWithCompareFunctionArguments::operator()):
17560 (KJS::ArrayInstance::sort):
17562 2008-04-18 Simon Hausmann <hausmann@webkit.org>
17564 Build fix for gcc 4.3. Include stdio.h for printf.
17566 * profiler/FunctionCallProfile.cpp:
17567 * profiler/Profiler.cpp:
17569 2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
17573 * wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
17575 2008-04-17 Alexey Proskuryakov <ap@webkit.org>
17577 Reviewed by Maciej.
17579 Thread static data destructors are not guaranteed to be called in any particular order;
17580 turn ThreadSpecific into a phoenix-style singleton to avoid accessing freed memory when
17581 deleted objects are interdependent (e.g. CommonIdentifiers and internal identifier tables).
17583 No change on SunSpider.
17585 * wtf/ThreadSpecific.h:
17586 (WTF::ThreadSpecific::Data::Data):
17591 2008-04-15 Srinivas Rao. M Hamse <msrinirao@gmail.com>
17593 Reviewed by Maciej Stachowiak.
17595 - gcc 3.x build fix
17597 * kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
17599 2008-04-16 Brady Eidson <beidson@apple.com>
17601 Reviewed by Sam Weinig
17603 Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
17606 (WTF::ThreadSafeShared::ThreadSafeShared):
17608 2008-04-16 Sam Weinig <sam@webkit.org>
17610 Reviewed by Geoffrey Garen.
17612 - To keep the behavior of the WebKit and JavaScriptCore API's the same,
17613 we need to hide the fact that the global object and the window object
17614 are no longer the same thing, and the the global object now changes on
17615 navigations. To do this, only the wrapper should ever be exposed. This
17616 fixes the two remaining spots where the internal global object is exposed,
17617 the windowScriptObject returned from [WebFrame windowObject] and the object
17618 return by calling JSContextGetGlobalObject on [WebFrame globalContext].
17620 * API/JSContextRef.cpp:
17621 (JSContextGetGlobalObject):
17622 This is a bit of a hack, this returns the "this" representation of the globalObject
17623 which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
17625 * API/JSObjectRef.cpp:
17626 (JSObjectSetProperty):
17627 Call the new putWithAttributes method instead of relying on lower-level calls.
17628 This is needed so that the window wrapper can forward the calls.
17630 * JavaScriptCore.exp:
17631 * kjs/Activation.h:
17632 * kjs/JSGlobalObject.cpp:
17633 (KJS::JSGlobalObject::putWithAttributes):
17634 * kjs/JSGlobalObject.h:
17635 * kjs/JSVariableObject.h:
17636 (KJS::JSVariableObject::symbolTablePutWithAttributes):
17637 * kjs/function.cpp:
17638 (KJS::ActivationImp::putWithAttributes):
17640 (KJS::ConstDeclNode::handleSlowCase):
17641 (KJS::ConstDeclNode::evaluateSingle):
17642 (KJS::EvalNode::processDeclarations):
17644 (KJS::JSObject::putWithAttributes):
17646 Rename initializeVariable to putWithAttributes and move it down to JSObject so it
17647 can be used for JSObjectSetProperty.
17649 2008-04-16 Kevin McCullough <kmccullough@apple.com>
17651 Reviewed by Sam and Geoff.
17653 -<rdar://problem/5770054> JavaScript profiler (10928)
17654 Inital profiler prototype
17656 * GNUmakefile.am: Added new files to project
17657 * JavaScriptCore.pri: Ditto
17658 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
17659 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto
17660 * JavaScriptCoreSources.bkl: Ditto
17661 * kjs/config.h: Put compiling flag in here.
17662 * kjs/function.cpp: Instrument calling the function eval().
17664 * kjs/interpreter.cpp: Instrument evaluating global scopes.
17665 (KJS::Interpreter::evaluate):
17666 * kjs/object.cpp: Instrument JS function calls.
17667 (KJS::JSObject::call):
17669 * profiler/FunctionCallProfile.cpp: Added.
17670 (KJS::FunctionCallProfile::FunctionCallProfile):
17671 (KJS::FunctionCallProfile::~FunctionCallProfile):
17672 (KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer.
17673 (KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer.
17674 (KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile.
17675 (KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one.
17676 (KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
17677 * profiler/FunctionCallProfile.h: Added.
17678 (KJS::FunctionCallProfile::FunctionCallProfile):
17679 (KJS::FunctionCallProfile::~FunctionCallProfile):
17680 (KJS::FunctionCallProfile::functionName):
17681 (KJS::FunctionCallProfile::microSecs):
17682 * profiler/Profiler.cpp: Added.
17683 (KJS::Profiler::profiler):
17684 (KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns)
17685 (KJS::Profiler::startProfiling): Don't start collecting profiling information until the user starts the profiler. Also don't clear old prfiled data until the profiler is restarted.
17686 (KJS::Profiler::stopProfiling): Stop collecting profile information.
17687 (KJS::Profiler::willExecute): Same as above.
17688 (KJS::Profiler::didExecute): Same as above.
17689 (KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it.
17690 (KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack.
17691 (KJS::Profiler::getFunctionName): Get the function name from the given parameter.
17692 (KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
17693 (KJS::Profiler::debugLog):
17694 * profiler/Profiler.h: Added.
17695 (KJS::Profiler::Profiler):
17697 2008-04-16 Sam Weinig <sam@webkit.org>
17699 Reviewed by Darin Adler.
17701 - Remove kjs_ prefix from strtod, dtoa, and freedtoa and put it
17702 in the KJS namespace.
17703 - Make strtod, dtoa, and freedtoa c++ functions instead of extern "C".
17704 - Remove mode switching from dtoa. ~2% improvement on test 26.
17705 - Removes all unnecessary #defines from dtoa code.
17707 * JavaScriptCore.exp:
17717 * kjs/function.cpp:
17721 * kjs/number_object.cpp:
17722 (KJS::integer_part_noexp):
17723 (KJS::numberProtoFuncToExponential):
17725 (KJS::UString::from):
17726 (KJS::UString::toDouble):
17728 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17732 Get rid of static execForCompareByStringForQSort in array_instance.cpp.
17734 No change on SunSpider, CelticKane or iBench JavaScript.
17736 * kjs/array_instance.cpp:
17737 (KJS::ArraySortComparator::ArraySortComparator):
17738 (KJS::ArraySortComparator::operator()):
17739 (KJS::ArrayInstance::sort):
17740 Switch slow case to std::sort, so that ExecState can be passed in a comparator.
17742 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17744 Reviewed by Adam Roben.
17748 * kjs/CommonIdentifiers.cpp:
17749 * kjs/CommonIdentifiers.h:
17752 * kjs/identifier.cpp:
17754 * wtf/ThreadSpecific.h:
17756 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17760 * kjs/date_object.cpp:
17761 * kjs/date_object.h:
17762 Don't include DateMath.h from date_object.h, as the latter is used from WebCore, while
17763 where the former is not available.
17765 2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
17767 Unreviewed build fix for MSVC. It does not want to have
17768 WTF in the KJS namespace.
17770 * kjs/CommonIdentifiers.h:
17772 2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
17774 Unreviewed build fix for gcc.
17776 ::msToGregorianDateTime is not known to it.
17778 * kjs/date_object.cpp:
17779 (KJS::DateInstance::msToGregorianDateTime):
17781 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17783 Reviewed by Oliver Hunt.
17785 Initialize threadMapMutex safely (as already done in ThreadingWin).
17787 * wtf/ThreadingGtk.cpp:
17788 (WTF::threadMapMutex):
17789 (WTF::initializeThreading):
17790 * wtf/ThreadingPthreads.cpp:
17791 (WTF::threadMapMutex):
17792 (WTF::initializeThreading):
17794 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17796 Reviewed by Adam Roben.
17798 Cache Gregorian date/time structure on DateInstance objects for 1.027x SunSpider speedup
17799 (1.65x on date-format-xparb, 1.13x on date-format-tofte).
17802 (KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
17803 Noncopyable, so it's not just operator=.
17805 * kjs/date_object.h: Added a per-object cache.
17807 * kjs/date_object.cpp:
17808 (KJS::DateInstance::DateInstance):
17809 (KJS::DateInstance::msToGregorianDateTime):
17810 (KJS::dateProtoFuncToString):
17811 (KJS::dateProtoFuncToUTCString):
17812 (KJS::dateProtoFuncToDateString):
17813 (KJS::dateProtoFuncToTimeString):
17814 (KJS::dateProtoFuncToLocaleString):
17815 (KJS::dateProtoFuncToLocaleDateString):
17816 (KJS::dateProtoFuncToLocaleTimeString):
17817 (KJS::dateProtoFuncGetFullYear):
17818 (KJS::dateProtoFuncGetUTCFullYear):
17819 (KJS::dateProtoFuncToGMTString):
17820 (KJS::dateProtoFuncGetMonth):
17821 (KJS::dateProtoFuncGetUTCMonth):
17822 (KJS::dateProtoFuncGetDate):
17823 (KJS::dateProtoFuncGetUTCDate):
17824 (KJS::dateProtoFuncGetDay):
17825 (KJS::dateProtoFuncGetUTCDay):
17826 (KJS::dateProtoFuncGetHours):
17827 (KJS::dateProtoFuncGetUTCHours):
17828 (KJS::dateProtoFuncGetMinutes):
17829 (KJS::dateProtoFuncGetUTCMinutes):
17830 (KJS::dateProtoFuncGetSeconds):
17831 (KJS::dateProtoFuncGetUTCSeconds):
17832 (KJS::dateProtoFuncGetTimezoneOffset):
17833 (KJS::setNewValueFromTimeArgs):
17834 (KJS::setNewValueFromDateArgs):
17835 (KJS::dateProtoFuncSetYear):
17836 (KJS::dateProtoFuncGetYear):
17837 Use the cache when converting.
17839 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
17843 Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
17845 SunSpider results were not conclusive, possibly up to 0.2% slowdown.
17847 * JavaScriptCore.xcodeproj/project.pbxproj:
17848 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
17849 Added ThreadSpecific.h
17851 * wtf/ThreadSpecific.h: Added.
17852 (WTF::::ThreadSpecific):
17853 (WTF::::~ThreadSpecific):
17859 Only implemented for platforms that use pthreads.
17861 * kjs/CommonIdentifiers.cpp:
17862 (KJS::CommonIdentifiers::shared):
17863 * kjs/CommonIdentifiers.h:
17864 * kjs/InitializeThreading.cpp:
17865 (KJS::initializeThreading):
17869 * kjs/identifier.cpp:
17870 (KJS::identifierTable):
17871 (KJS::literalIdentifierTable):
17872 (KJS::Identifier::initializeIdentifierThreading):
17873 * kjs/identifier.h:
17877 Make static instances per-thread.
17879 2008-04-15 Anders Carlsson <andersca@apple.com>
17883 Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
17885 * Configurations/JavaScriptCore.xcconfig:
17887 2008-04-15 Andre Poenitz <andre.poenitz@trolltech.com>
17891 Fix compilation with Qt namespaces
17893 Qt can be configured to have all of its classes inside a specified namespaces.
17894 This is for example used in plugin/component environments like Eclipse.
17896 This change makes it possible to let the Qt port compile against a namespaced
17897 Qt by the use of macros Qt provides to properly forward declare Qt classes in
17900 * wtf/unicode/qt4/UnicodeQt4.h:
17902 2008-04-14 Anders Carlsson <andersca@apple.com>
17906 Don't leak the prototype class.
17908 * API/JSClassRef.cpp:
17909 (OpaqueJSClass::create):
17911 2008-04-14 Steve Falkenburg <sfalken@apple.com>
17915 * wtf/ThreadingWin.cpp:
17917 2008-04-14 Alexey Proskuryakov <ap@webkit.org>
17919 Reviewed by Adam Roben.
17921 https://bugs.webkit.org/show_bug.cgi?id=18488
17922 FastMalloc doesn't release thread-specific data on Windows
17924 * wtf/ThreadingWin.cpp:
17925 (WTF::threadMapMutex): (WTF::initializeThreading): Call threadMapMutex once to initialize the static safely.
17926 (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): Added a structure to wrap thread entry point and arguments.
17927 (WTF::wtfThreadEntryPoint): Make sure to end all WTF threads with pthread_exit(), to give pthreads-win32 a chance to call
17928 destructors of thread-specific data.
17929 (WTF::createThread): Use _beginthreadex instead of CreateThread, because MSDN says so. Also removed a call to CreateEvent,
17930 for which I could see no reason at all.
17932 2008-04-14 Alexey Proskuryakov <ap@webkit.org>
17934 Touched a file to make JavaScriptCore.vcproj rebuild.
17936 * wtf/MathExtras.h:
17938 2008-04-14 Adam Roben <aroben@apple.com>
17942 Rubberstamped by Alexey Proskuryakov.
17944 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
17945 the "potentially uninitialized variable" warning for grammar.cpp, as
17946 it seems to be incorrect. yylval gets initialized by the lexer, but
17947 MSVC doesn't seem to understand this.
17949 2008-04-11 Antti Koivisto <antti@apple.com>
17951 Reviewed by Maciej.
17953 Add default hash for pairs of hashable types.
17955 * wtf/HashFunctions.h:
17956 (WTF::PairHash::hash):
17957 (WTF::PairHash::equal):
17960 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17964 Make DateMath.cpp thread safe.
17966 No measurable change on SunSpider (should be a very small speedup).
17968 * kjs/DateMath.cpp:
17969 (KJS::mimimumYearForDST): (KJS::equivalentYearForDST): Got rid of double caching of the
17970 same precomputed value.
17971 (KJS::calculateUTCOffset): (KJS::getUTCOffset): Factored actual UTC offset calculation code
17972 out of getUTCOffset(), and notification setup into initDateMath().
17974 (KJS::initDateMath): Added.
17977 * kjs/InitializeThreading.cpp:
17978 (KJS::initializeThreading):
17979 Added initDateMath().
17981 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17987 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
17989 Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
17998 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
18002 Generate a pure (re-entrant) parser with Bison.
18004 No change on SunSpider.
18007 (KJS::Parser::parse):
18013 Pass state as function arguments, instead of global data. Don't call lexer() as often as
18014 before, as this function is about to become slower due to thread-specific storage.
18016 * kjs/function.cpp:
18017 (KJS::isStrWhiteSpace): Don't call isSeparatorSpace() for 8-bit characters, as these are
18018 already taken care of. This is a small speedup, compensating for a small slowdown caused
18019 by switching Bison mode.
18021 2008-04-10 Alexey Proskuryakov <ap@webkit.org>
18025 https://bugs.webkit.org/show_bug.cgi?id=18402
18026 REGRESSION: visited element handling is incorrect in nested join/toString calls
18028 No change on SunSpider total, possibly a tiny improvement (about 0.1%).
18030 Test: fast/js/array-tostring-and-join.html
18032 * kjs/JSGlobalObject.h:
18033 (KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
18034 common to toString/toLocalizedString/join again.
18036 * kjs/array_object.cpp:
18037 (KJS::arrayProtoFuncToString):
18038 (KJS::arrayProtoFuncToLocaleString):
18039 (KJS::arrayProtoFuncJoin):
18040 Got rid of static variables. Replaced UString with Vector to avoid O(n^2) behavior and
18041 regain performance.
18046 (WTF::::reserveCapacity):
18049 Added null checks, so that Vector methods don't crash when out of memory. The caller should
18050 check that data pointer is not null before proceeding.
18052 2008-04-10 Mark Rowe <mrowe@apple.com>
18054 Reviewed by Maciej Stachowiak.
18056 Fix https://bugs.webkit.org/show_bug.cgi?id=18367 and the many dupes.
18057 Bug 18367: Crash during celtic kane js speed 2007 test
18059 GCC 4.2 on x86_64 Linux decided to reorder the local variables in markCurrentThreadConservatively's
18060 stack frame. This lead to the range of addresses the collector treated as stack to exclude the
18061 contents of volatile registers that markCurrentThreadConservatively forces onto the stack. This was
18062 leading to objects being prematurely collected if the only reference to them was via a register at
18063 the time a collection occurred.
18065 The fix for this is to move the calculation of the top of the stack into a NEVER_INLINE function
18066 that is called from markCurrentThreadConservatively. This forces the dummy variable we use for
18067 determining the top of stack to be in a different stack frame which prevents the compiler from
18068 reordering it relative to the registers that markCurrentThreadConservatively forces onto the stack.
18070 * kjs/collector.cpp:
18071 (KJS::Collector::markCurrentThreadConservativelyInternal):
18072 (KJS::Collector::markCurrentThreadConservatively):
18075 2008-04-10 Adam Roben <aroben@apple.com>
18077 VC++ Express build fix
18079 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
18080 that anyone who links against WTF.lib will get user32.lib
18083 2008-04-09 Adam Roben <aroben@apple.com>
18085 VC++ Express build fix
18087 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
18090 2008-04-09 Adam Roben <aroben@apple.com>
18094 * JavaScriptCore.exp: Export isMainThread.
18096 2008-04-09 Adam Roben <aroben@apple.com>
18100 * wtf/AlwaysInline.h: Make sure to #include Platform.h before using
18101 the macros it defines.
18103 2008-04-08 Mark Rowe <mrowe@apple.com>
18105 Export WTF::initializeThreading() from JavaScriptCore.
18107 * JavaScriptCore.exp:
18109 2008-04-04 Sam Weinig <sam@webkit.org>
18111 Reviewed by Geoffrey Garen.
18113 First step in implementing the "split window"
18115 - Add a GlobalThisValue to ExecState which should be used
18116 in places that used to implement the "use the global object
18117 as this if null" rule.
18118 - Factor out lookupGetter/lookupSetter into virtual methods
18119 on JSObject so that they can be forwarded.
18120 - Make defineGetter/defineSetter virtual methods for the same
18122 - Have PrototypeReflexiveFunction store the globalObject used
18123 to create it so that it can be used to get the correct thisObject
18126 * API/JSObjectRef.cpp:
18127 (JSObjectCallAsFunction):
18128 * JavaScriptCore.exp:
18129 * kjs/Activation.h:
18130 * kjs/ExecState.cpp:
18131 (KJS::ExecState::ExecState):
18132 (KJS::GlobalExecState::GlobalExecState):
18134 (KJS::ExecState::globalThisValue):
18135 * kjs/ExecStateInlines.h:
18136 (KJS::ExecState::ExecState):
18137 (KJS::FunctionExecState::FunctionExecState):
18138 * kjs/JSGlobalObject.cpp:
18139 (KJS::JSGlobalObject::reset):
18140 (KJS::JSGlobalObject::toGlobalObject):
18141 * kjs/JSGlobalObject.h:
18142 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
18143 (KJS::JSGlobalObject::JSGlobalObject):
18144 * kjs/array_instance.cpp:
18145 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
18146 (KJS::compareWithCompareFunctionForQSort):
18147 * kjs/array_object.cpp:
18148 (KJS::arrayProtoFuncSort):
18149 (KJS::arrayProtoFuncFilter):
18150 (KJS::arrayProtoFuncMap):
18151 (KJS::arrayProtoFuncEvery):
18152 (KJS::arrayProtoFuncForEach):
18153 (KJS::arrayProtoFuncSome):
18154 * kjs/function.cpp:
18155 (KJS::FunctionImp::callAsFunction):
18156 (KJS::ActivationImp::toThisObject):
18157 (KJS::globalFuncEval):
18158 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
18159 (KJS::PrototypeReflexiveFunction::mark):
18161 (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
18162 * kjs/function_object.cpp:
18163 (KJS::functionProtoFuncApply):
18164 (KJS::functionProtoFuncCall):
18166 (KJS::ExpressionNode::resolveAndCall):
18167 (KJS::FunctionCallValueNode::evaluate):
18168 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
18169 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
18170 (KJS::FunctionCallBracketNode::evaluate):
18171 (KJS::FunctionCallDotNode::inlineEvaluate):
18173 (KJS::JSObject::call):
18174 (KJS::JSObject::put):
18175 (KJS::tryGetAndCallProperty):
18176 (KJS::JSObject::lookupGetter):
18177 (KJS::JSObject::lookupSetter):
18178 (KJS::JSObject::toThisObject):
18179 (KJS::JSObject::toGlobalObject):
18180 (KJS::JSObject::fillGetterPropertySlot):
18182 * kjs/object_object.cpp:
18183 (KJS::objectProtoFuncLookupGetter):
18184 (KJS::objectProtoFuncLookupSetter):
18185 * kjs/string_object.cpp:
18188 2008-04-08 Brady Eidson <beidson@apple.com>
18190 Encourage Windows to rebuild - AGAIN...
18192 * kjs/DateMath.cpp:
18194 2008-04-08 Adam Roben <aroben@apple.com>
18198 * JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
18200 2008-04-08 Brady Eidson <beidson@apple.com>
18202 Rubberstamped by Adam Roben
18204 Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
18206 * kjs/DateMath.cpp:
18208 2008-04-08 Adam Roben <aroben@apple.com>
18210 Move callOnMainThread to WTF
18212 Reviewed by Alexey Proskuryakov.
18215 * JavaScriptCore.pri:
18216 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
18217 * JavaScriptCore.xcodeproj/project.pbxproj:
18218 * JavaScriptCoreSources.bkl:
18221 * wtf/MainThread.cpp:
18222 * wtf/MainThread.h:
18223 * wtf/gtk/MainThreadGtk.cpp:
18224 * wtf/mac/MainThreadMac.mm:
18225 * wtf/qt/MainThreadQt.cpp:
18226 * wtf/win/MainThreadWin.cpp:
18227 * wtf/wx/MainThreadWx.cpp:
18228 Moved here from WebCore/platform. Replaced all instances of "WebCore"
18231 * kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
18233 to the WTF namespace.
18234 * wtf/ThreadingWin.cpp:
18235 (WTF::initializeThreading): Call initializeMainThread.
18237 2008-04-07 Brady Eidson <beidson@apple.com>
18239 Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
18241 * Configurations/JavaScriptCore.xcconfig:
18243 2008-04-07 Adam Roben <aroben@apple.com>
18247 * wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
18249 2008-04-07 Adam Roben <aroben@apple.com>
18251 Add WTF::isMainThread
18253 Reviewed by Alexey Proskuryakov.
18255 * wtf/Threading.h: Declare the new function.
18256 * wtf/ThreadingGtk.cpp:
18257 (WTF::initializeThreading): Initialize the main thread identifier.
18258 (WTF::isMainThread): Added.
18259 * wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp.
18260 (WTF::initializeThreading):
18261 (WTF::isMainThread):
18262 * wtf/ThreadingPthreads.cpp: Ditto.
18263 (WTF::initializeThreading):
18264 (WTF::isMainThread):
18265 * wtf/ThreadingWin.cpp: Ditto.
18266 (WTF::initializeThreading):
18267 (WTF::isMainThread):
18269 2008-04-06 Alexey Proskuryakov <ap@webkit.org>
18273 Make UString thread-safe.
18275 No change on SunSpider total, although individual tests have changed a lot, up to 3%.
18277 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
18280 * kjs/identifier.cpp:
18281 (KJS::CStringTranslator::translate):
18282 (KJS::UCharBufferTranslator::translate):
18283 Use "true" for a boolean value instead of 1, because it's C++.
18286 (KJS::CString::adopt): Added a method to create from a char* buffer without copying.
18287 (KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
18288 necessary to hold JSLock when working with strings.
18289 (KJS::UString::Rep::deref): Ditto.
18290 (KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
18291 or null static string.
18294 (KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
18295 an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
18297 (KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
18298 (KJS::UString::Rep::create): Ditto.
18299 (KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
18300 as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
18301 apparently this functiton is hot enough for SunSpider to see an effect from this!
18302 (KJS::UString::null): Moved a star, added a comment.
18303 (KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
18304 (KJS::UString::ascii): Simplified statBuffer handling logic.
18305 (KJS::UString::toDouble): Use cstring() instead of ascii().
18307 2008-04-02 Mark Rowe <mrowe@apple.com>
18309 Reviewed by Oliver Hunt.
18311 Ensure that debug symbols are generated for x86_64 and ppc64 builds.
18313 * Configurations/Base.xcconfig:
18315 2008-04-01 Christian Dywan <christian@imendio.com>
18317 Build fix for GCC 4.3.
18319 * wtf/unicode/icu/CollatorICU.cpp: include string.h
18321 2008-04-01 Alexey Proskuryakov <ap@webkit.org>
18323 Rubber-stamped by Darin.
18325 Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
18326 compiler-provided emulation.
18328 1% speedup on Acid3 test 26.
18332 2008-04-01 Alexey Proskuryakov <ap@webkit.org>
18336 Make MathExtras.h thread safe.
18338 * kjs/math_object.cpp:
18339 (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
18343 * wtf/ThreadingGtk.cpp:
18344 (WTF::initializeThreading):
18345 * wtf/ThreadingNone.cpp:
18346 (WTF::initializeThreading):
18347 * wtf/ThreadingPthreads.cpp:
18348 (WTF::initializeThreading):
18349 * wtf/ThreadingWin.cpp:
18350 (WTF::initializeThreading):
18351 Call wtf_random_init(); made the function non-inline to avoid having to include too many
18352 headers in Threading.h.
18354 2008-03-31 Eric Seidel <eric@webkit.org>
18358 Make matching of regexps using ^ much faster
18359 http://bugs.webkit.org/show_bug.cgi?id=18086
18361 * pcre/pcre_compile.cpp:
18363 (branchNeedsLineStart):
18364 * pcre/pcre_exec.cpp:
18367 * pcre/pcre_internal.h:
18369 2008-03-29 Alexey Proskuryakov <ap@webkit.org>
18371 Reviewed by Oliver Hunt.
18373 <rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
18375 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): There is no guarantee that
18376 initializeThreading() is called only once; check that the mutex hasn't been already allocated.
18378 2008-03-29 Oliver Hunt <oliver@apple.com>
18382 Bug 17924: Crash in KJS::ConstDeclNode::evaluate with |with| and |const|
18383 <http://bugs.webkit.org/show_bug.cgi?id=17924>
18384 <rdar://problem/5806933>
18386 It turns out this is trivially avoidable if we just match firefox's
18387 semantics and ensure that an assignment in a const declaration always
18388 writes to the variable object.
18391 (KJS::ConstDeclNode::handleSlowCase):
18393 2008-03-28 Alexey Proskuryakov <ap@webkit.org>
18395 Reviewed by Sam Weinig.
18397 Fix a dtoa thread safety issue.
18399 WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
18400 compiled in for dtoa.
18402 This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
18403 his recent improvement.
18408 Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
18409 in the presence of locking (but somewhat slower in single-threaded case).
18410 (Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
18411 restructure the code to avoid significant performance implications).
18412 (Bigint::lshift): Rewrote to avoid an allocation, if possible.
18414 (Bigint::rv_alloc):
18415 (Bigint::kjs_freedtoa):
18416 (Bigint::kjs_dtoa):
18417 Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
18419 * kjs/InitializeThreading.cpp: Added.
18420 (KJS::initializeThreading):
18421 * kjs/InitializeThreading.h: Added.
18422 Initialize threading at KJS level, if enabled.
18424 * kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
18426 * kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
18428 * JavaScriptCore.exp: Export KJS::initializeThreading.
18431 * JavaScriptCore.exp:
18432 * JavaScriptCore.pri:
18433 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
18434 * JavaScriptCoreSources.bkl:
18435 * JavaScriptCore.xcodeproj/project.pbxproj:
18436 Added InitializeThreading.{h,cpp}.
18438 * wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
18439 to be called from KJS::initializeThreading, and having it in the global namespace is useless.
18441 2008-03-28 Brady Eidson <beidson@apple.com>
18445 Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
18447 * JavaScriptCore.exp:
18448 * JavaScriptCore.xcodeproj/project.pbxproj:
18450 2008-03-27 Darin Adler <darin@apple.com>
18452 Reviewed by Mark Rowe.
18454 <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
18455 compiled length calculated incorrectly.
18457 * pcre/pcre_compile.cpp:
18458 (multiplyWithOverflowCheck):
18459 (calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
18460 and bail with an error rather than returning incorrect results.
18462 2008-03-26 Mark Rowe <mrowe@apple.com>
18464 Rubber-stamped by Brady Eidson.
18466 Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
18468 * Configurations/JavaScriptCore.xcconfig:
18470 2008-03-26 Adam Roben <aroben@apple.com>
18472 Fix Bug 18060: Assertion failure (JSLock not held) beneath
18473 JSCallbackObject<Base>::toString
18475 <http://bugs.webkit.org/show_bug.cgi?id=18060>
18477 Reviewed by Geoff Garen.
18481 * API/JSCallbackObjectFunctions.h:
18482 (KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
18483 instance only be in scope while calling convertToType.
18488 (MyObject_convertToType): Implement type conversion to string.
18489 * API/testapi.js: Add a test for type conversion to string.
18491 2008-03-26 Adam Roben <aroben@apple.com>
18495 * kjs/array_instance.cpp: Touched this.
18496 * wtf/HashFunctions.h:
18497 (WTF::intHash): Added 8- and 16-bit versions of intHash.
18499 2008-03-26 Adam Roben <aroben@apple.com>
18501 Force JSC headers to be copied by touching a file
18503 * kjs/array_instance.cpp:
18504 (KJS::ArrayInstance::getPropertyNames):
18506 2008-03-26 Adam Roben <aroben@apple.com>
18508 Windows build fix after r31324
18510 Written with Darin.
18512 Added HashTable plumbing to support using wchar_t as a key type.
18514 * wtf/HashFunctions.h:
18515 * wtf/HashTraits.h:
18518 2008-03-26 Maciej Stachowiak <mjs@apple.com>
18522 - JSC part of fix for "SVG multichar glyph matching matches longest instead of first (affects Acid3 test 79)"
18523 http://bugs.webkit.org/show_bug.cgi?id=18118
18525 * wtf/HashFunctions.h:
18527 * wtf/HashTraits.h:
18530 2008-03-26 Alexey Proskuryakov <ap@webkit.org>
18534 Cache C string identifiers by address, not value, assuming that C strings can only
18537 1% speedup on Acid3 test 26.
18539 * kjs/identifier.cpp:
18540 (KJS::literalIdentifierTable):
18541 (KJS::Identifier::add):
18542 Added a new table to cache UString::Reps created from C strings by address. Elements are
18543 never removed from this cache, as only predefined identifiers can get there.
18545 * kjs/identifier.h:
18546 (KJS::Identifier::Identifier): Added a warning.
18548 2008-03-26 Alexey Proskuryakov <ap@webkit.org>
18550 Rubber-stamped by Maciej.
18552 An assertion was failing in function-toString-object-literals.html when parsing 1e-500.
18553 The condition existed before, and got uncovered by turning compiled-out dtoa checks into
18556 The assertion was verifying that the caller wasn't constructing a Bigint from 0.
18557 This might have had some reason behind it originally, but I couldn't find any,
18558 and this doesn't look like a reasonable requirement.
18560 * kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
18562 2008-03-25 Adam Roben <aroben@apple.com>
18564 Fix Bug 18077: Integrate testapi.c into the Windows build
18566 <http://bugs.webkit.org/show_bug.cgi?id=18077>
18568 Reviewed by Steve Falkenburg.
18570 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
18572 2008-03-25 Adam Roben <aroben@apple.com>
18574 Make testapi.c compile under MSVC
18576 Currently you must compile testapi.c as C++ code since MSVC does not
18577 support many C features that GCC does.
18579 Reviewed by Steve Falkenburg.
18582 (nan): Added an implementation of this for MSVC.
18583 (assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
18585 (assertEqualsAsCharactersPtr): Ditto.
18586 (print_callAsFunction): Ditto.
18587 (main): Ditto, and explicitly cast from UniChar* to JSChar*.
18589 2008-03-25 Adam Roben <aroben@apple.com>
18591 Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
18593 We can't remove the os-win32 directory yet because other ports (at
18594 least wx) are still relying on it.
18596 Reviewed by Steve Falkenburg.
18598 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
18599 - Made all the include paths match the one for the Debug
18600 configuration (these got out of sync in r30797)
18601 - Removed os-win32 from the include path
18602 - Removed os-win32 from the directories we copy to $WebKitOutputDir.
18603 - Removed stdint.h from the project
18604 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
18605 Delete the files that we may have previously copied from the os-win32
18608 2008-03-25 Alexey Proskuryakov <ap@webkit.org>
18612 * kjs/dtoa.cpp: Include stdint.h.
18614 2008-03-25 Alexey Proskuryakov <ap@webkit.org>
18616 Rubber-stamped by Darin.
18618 Cleanup dtoa.cpp style.
18629 (Bigint::pow5mult):
18640 (Bigint::kjs_strtod):
18642 (Bigint::rv_alloc):
18643 (Bigint::nrv_alloc):
18644 (Bigint::kjs_freedtoa):
18645 (Bigint::kjs_dtoa):
18648 2008-03-24 Darin Adler <darin@apple.com>
18652 - convert a JavaScript immediate number to a string more efficiently
18654 2% speedup of Acid3 test 26
18656 * kjs/JSImmediate.cpp:
18657 (KJS::JSImmediate::toString): Take advantage of the fact that all immediate
18658 numbers are integers, and use the faster UString function for formatting integers
18659 instead of the slower one that works for floating point. I think this is a leftover
18660 from when immediate numbers were floating point.
18662 2008-03-23 Sam Weinig <sam@webkit.org>
18664 Reviewed by Darin Adler.
18666 Fix http://bugs.webkit.org/show_bug.cgi?id=18048
18667 The "thisObject" parameter to JSEvaluateScript is not used properly
18669 Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
18673 (main): Add tests for setting the thisObject when calling JSEvaluateScript.
18675 * kjs/ExecState.cpp:
18676 (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment.
18678 2008-03-22 Jesse Ruderman <jruderman@gmail.com>
18680 Reviewed by Sam Weinig. Landed by eseidel.
18682 Make testkjs flush stdout after printing.
18684 * JavaScriptCore.xcodeproj/project.pbxproj:
18688 2008-03-21 Oliver Hunt <oliver@apple.com>
18690 Reviewed by Maciej.
18692 Optimise lookup of Math, undefined, NaN and Infinity
18694 Added a method to JSVariableObject to allow us to inject DontDelete properties
18695 into the symbol table and localStorage. This results in a 0.4% progression in
18696 SunSpider, with a 8% gain in math-partial-sums.
18698 * kjs/JSGlobalObject.cpp:
18699 (KJS::JSGlobalObject::reset):
18700 * kjs/JSVariableObject.h:
18701 (KJS::JSVariableObject::symbolTableInsert):
18703 2008-03-21 Oliver Hunt <oliver@apple.com>
18705 Reviewed by Geoff Garen.
18707 Global properties that use LocalStorage are not correctly listed as enumerable.
18709 The problem was caused by JSObject::getPropertyAttributes not being aware
18710 of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes
18711 virtual and override in JSVariableObject. This does not produce any performance
18714 * JavaScriptCore.exp:
18715 * kjs/JSVariableObject.cpp:
18716 (KJS::JSVariableObject::getPropertyNames):
18717 (KJS::JSVariableObject::getPropertyAttributes):
18718 * kjs/JSVariableObject.h:
18721 2008-03-21 Arkadiusz Miskiewicz <arekm@maven.pl>
18723 Webkit does not build on linux powerpc
18725 <http://bugs.webkit.org/show_bug.cgi?id=17019>
18727 Reviewed by David Kilzer.
18729 * wtf/TCSpinLock.h:
18730 (TCMalloc_SpinLock::Unlock):
18732 2008-03-21 Rodney Dawes <dobey@wayofthemonkey.com>
18734 Reviewed by Holger.
18736 http://bugs.webkit.org/show_bug.cgi?id=17981
18738 Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
18742 2008-03-21 Alexey Proskuryakov <ap@webkit.org>
18744 Reviewed by Oliver Hunt.
18746 Consolidate static identifier initializers within CommonIdentifiers.
18748 No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
18750 * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
18751 throughout the code.
18753 * kjs/date_object.cpp:
18754 (KJS::DateObjectImp::DateObjectImp):
18755 * kjs/function_object.cpp:
18756 (KJS::FunctionPrototype::FunctionPrototype):
18757 * kjs/object_object.cpp:
18758 (KJS::ObjectPrototype::ObjectPrototype):
18759 * kjs/regexp_object.cpp:
18760 (KJS::RegExpPrototype::RegExpPrototype):
18761 Use the values from CommonIdentifiers.
18763 * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
18766 (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
18768 * wtf/MathExtras.h:
18769 (wtf_atan2): Having local variables for numeric_limits constants is good for readability,
18770 but there is no reason to keep them static.
18772 * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
18774 2008-03-20 Oliver Hunt <oliver@apple.com>
18776 Reviewed by Maciej.
18778 Fix for leak introduced by inline ScopeChainNode use
18780 To avoid any extra branches when managing an inline ScopeChainNode
18781 in the ScopeChain the inline node gets inserted with a refcount of
18782 2. This meant than when the ScopeChain was destroyed the ScopeChainNodes
18783 above the inline node would be leaked.
18785 We resolve this by manually popping the inline node in the
18786 FunctionExecState destructor.
18788 * JavaScriptCore.xcodeproj/project.pbxproj:
18789 * kjs/ExecStateInlines.h:
18790 (KJS::FunctionExecState::~FunctionExecState):
18791 * kjs/scope_chain.h:
18792 (KJS::ScopeChain::popInlineScopeNode):
18794 2008-03-20 Mark Rowe <mrowe@apple.com>
18796 Reviewed by Sam Weinig.
18798 Ensure that the defines in FEATURE_DEFINES are sorted so that they will match the default settings of build-webkit.
18799 This will prevent the world from being rebuilt if you happen to switch between building in Xcode and with build-webkit on the
18802 * Configurations/JavaScriptCore.xcconfig:
18804 2008-03-20 David Krause <david.krause@gmail.com>
18806 Reviewed by David Kilzer.
18808 Fix http://bugs.webkit.org/show_bug.cgi?id=17923
18809 Bug 17923: ARM platform endian defines inaccurate
18812 Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
18813 for PLATFORM(MIDDLE_ENDIAN)
18815 2008-03-20 Maciej Stachowiak <mjs@apple.com>
18819 * JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
18821 2008-03-20 Maciej Stachowiak <mjs@apple.com>
18823 Reviewed by Oliver.
18825 - reduce function call overhead for 1.014x speedup on SunSpider
18827 I moved some functions from ExecState.cpp to ExecStateInline.h and
18828 from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
18829 inline; machine function call overhead for these was hurting JS
18830 funcion call overhead.
18832 * kjs/ExecState.cpp:
18833 * kjs/ExecStateInlines.h: Added.
18834 (KJS::ExecState::ExecState):
18835 (KJS::ExecState::~ExecState):
18836 (KJS::FunctionExecState::FunctionExecState):
18837 (KJS::FunctionExecState::~FunctionExecState):
18838 * kjs/JSGlobalObject.cpp:
18839 * kjs/JSGlobalObject.h:
18840 (KJS::JSGlobalObject::pushActivation):
18841 (KJS::JSGlobalObject::checkActivationCount):
18842 (KJS::JSGlobalObject::popActivation):
18843 * kjs/function.cpp:
18845 2008-03-19 Oliver Hunt <oliver@apple.com>
18847 Reviewed by Maciej.
18849 Avoid heap allocating the root scope chain node for eval and closure free functions
18851 Maciej suggested using an inline ScopeChainNode for functions that don't use eval
18852 or closures as they are unable to ever capture the scope chain. This gives us a 2.4%
18853 win in sunspider, a 15% win in controlflow-recursive, and big (>5%) wins in a number
18856 * kjs/ExecState.cpp:
18857 (KJS::ExecState::ExecState):
18859 * kjs/scope_chain.h:
18860 (KJS::ScopeChain::push):
18862 2008-03-19 Mark Rowe <mrowe@apple.com>
18864 Reviewed by Sam Weinig.
18868 * kjs/JSGlobalObject.cpp: Add missing #include.
18870 2008-03-19 Sam Weinig <sam@webkit.org>
18872 Reviewed by Anders Carlsson.
18874 Fix for <rdar://problem/5785694>
18875 Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
18877 Make the activeExecStates stack per JSGlobalObject instead of static to ensure
18880 * JavaScriptCore.exp:
18881 * kjs/ExecState.cpp:
18882 (KJS::InterpreterExecState::InterpreterExecState):
18883 (KJS::InterpreterExecState::~InterpreterExecState):
18884 (KJS::EvalExecState::EvalExecState):
18885 (KJS::EvalExecState::~EvalExecState):
18886 (KJS::FunctionExecState::FunctionExecState):
18887 (KJS::FunctionExecState::~FunctionExecState):
18889 * kjs/JSGlobalObject.cpp:
18890 (KJS::JSGlobalObject::mark):
18891 * kjs/JSGlobalObject.h:
18892 (KJS::JSGlobalObject::activeExecStates):
18893 * kjs/collector.cpp:
18894 (KJS::Collector::collect):
18895 (KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report
18896 the OutOfMemory condition to all the ExecStates in each.
18898 2008-03-19 Jasper Bryant-Greene <jasper@unix.geek.nz>
18900 Reviewed by Maciej Stachowiak.
18902 Fix http://bugs.webkit.org/show_bug.cgi?id=17941
18903 Bug 17941: C++-style comments in JavaScriptCore API
18906 Remove C++-style comments from public JavaScriptCore API, replacing
18907 with standard C90 block comments.
18909 2008-03-19 Mark Rowe <mrowe@apple.com>
18911 Reviewed by Oliver Hunt.
18913 Fix http://bugs.webkit.org/show_bug.cgi?id=17939
18914 Bug 17939: Crash decompiling "const a = 1, b;"
18916 * kjs/nodes2string.cpp:
18917 (KJS::ConstDeclNode::streamTo): Null-check the correct variable.
18919 2008-03-18 Oliver Hunt <oliver@apple.com>
18921 Reviewed by Mark Rowe.
18923 Bug 17929: Incorrect decompilation with |const|, comma
18924 http://bugs.webkit.org/show_bug.cgi?id=17929
18926 There were actually two bugs here. First we weren't correctly handling const
18927 nodes with multiple declarations. The second issue was caused by us not
18928 giving the correct precedence to the initialisers.
18930 * kjs/nodes2string.cpp:
18931 (KJS::ConstDeclNode::streamTo):
18933 2008-03-18 Darin Adler <darin@apple.com>
18935 Reviewed by Maciej.
18937 - Speed up JavaScript built-in properties by changing the
18938 hash table to take advantage of the identifier objects
18940 5% speedup for Acid3 test 26
18942 * JavaScriptCore.exp: Updated.
18943 * kjs/create_hash_table: Compute size of hash table large enough so that there
18944 are no collisions, but don't generate the hash table.
18945 * kjs/identifier.h: Made the add function that returns a PassRefPtr public.
18947 (KJS::Lexer::lex): Updated for change to HashTable interface.
18949 (KJS::HashTable::changeKeysToIdentifiers): Added. Finds the identifier for
18950 each property so the equality comparision can be done with pointer comparision.
18951 * kjs/lookup.h: Made the key be a union of char* with UString::Rep* so it can
18952 hold identifiers. Added a keysAreIdentifiers flag to the HashTable. Changed
18953 the Lookup functions to be member functions of HashTable instead.
18955 (KJS::JSObject::deleteProperty): Update for change to HashTable.
18956 (KJS::JSObject::findPropertyHashEntry): Ditto.
18957 (KJS::JSObject::getPropertyAttributes): Ditto.
18958 (KJS::JSObject::getPropertyNames): Ditto.
18960 2008-03-18 Mark Rowe <mrowe@apple.com>
18962 Reviewed by Oliver Hunt.
18964 Fix http://bugs.webkit.org/show_bug.cgi?id=17925 and http://bugs.webkit.org/show_bug.cgi?id=17927.
18965 - Bug 17925: Crash in KJS::JSObject::put after setting this.__proto__
18966 - Bug 17927: Hang after attempting to create circular __proto__
18969 (KJS::JSObject::put): Silently ignore attempts to set __proto__ to a non-object, non-null value.
18970 Return after setting the exception when an attempt to set a cyclic __proto__ is detected so that
18971 the cyclic value is not set.
18973 2008-03-18 Maciej Stachowiak <mjs@apple.com>
18975 Reviewed by Oliver.
18977 - inline ActivationImp::init for 0.8% SunSpider speedup
18979 * kjs/Activation.h:
18980 (KJS::ActivationImp::init): Moved here from function.cpp
18981 * kjs/function.cpp:
18983 2008-03-18 Simon Hausmann <hausmann@webkit.org>
18987 Including config.h like in the other .cpp files gets the #ifdeffery
18988 correct for rand_s.
18990 * kjs/JSWrapperObject.cpp:
18992 2008-03-17 Darin Adler <darin@apple.com>
18994 Reviewed by Maciej.
18996 JavaScriptCore changes to support a WebCore speedup.
18998 * JavaScriptCore.exp: Export the UString::Rep::computeHash function.
18999 * wtf/HashSet.h: Added a find and contains function that take a translator,
19000 like the add function.
19002 2008-03-18 Maciej Stachowiak <mjs@apple.com>
19004 Reviewed by Oliver.
19006 - a few micro-optimizations for 1.2% SunSpider speedup
19008 * kjs/function.cpp:
19009 (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
19012 (KJS::JSObject::put): When walking prototype chain, instead of
19013 checking isObject (a virtual call), compare to jsNull (compare to
19014 a constant) since null is the only non-object that can be in a
19017 2008-03-17 Oliver Hunt <oliver@apple.com>
19021 Optimise multi-scope function call resolution
19023 Refactor multiscope variable resolution and use to add
19024 optimised FunctionCallResolveNode subclasses.
19026 2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
19029 (KJS::getSymbolTableEntry):
19030 (KJS::ResolveNode::optimizeVariableAccess):
19031 (KJS::getNonLocalSymbol):
19032 (KJS::ExpressionNode::resolveAndCall):
19033 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
19034 (KJS::FunctionCallResolveNode::inlineEvaluate):
19035 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
19036 (KJS::ScopedVarFunctionCallNode::evaluate):
19037 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
19038 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
19039 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
19040 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
19041 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
19042 (KJS::NonLocalVarFunctionCallNode::evaluate):
19043 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
19044 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
19045 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
19046 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
19048 (KJS::ScopedVarFunctionCallNode::):
19049 (KJS::NonLocalVarFunctionCallNode::):
19051 2008-03-17 David Kilzer <ddkilzer@apple.com>
19053 Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
19057 See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
19059 * wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
19060 PLATFORM(MIDDLE_ENDIAN).
19062 2008-03-17 Oliver Hunt <oliver@apple.com>
19064 Reviewed by Geoff, Darin and Weinig.
19066 Add fast multi-level scope lookup
19068 Add logic and AST nodes to provide rapid variable resolution across
19069 static scope boundaries. This also adds logic that allows us to skip
19070 any static scopes that do not contain the variable to be resolved.
19072 This results in a ~2.5% speedup in SunSpider, and gives a 25-30% speedup
19073 in some simple and ad hoc closure and global variable access tests.
19075 * JavaScriptCore.exp:
19076 * kjs/Activation.h:
19077 * kjs/JSGlobalObject.cpp:
19078 * kjs/JSGlobalObject.h:
19079 * kjs/JSVariableObject.cpp:
19080 * kjs/JSVariableObject.h:
19081 * kjs/function.cpp:
19082 (KJS::ActivationImp::isDynamicScope):
19084 (KJS::ResolveNode::optimizeVariableAccess):
19085 (KJS::ScopedVarAccessNode::inlineEvaluate):
19086 (KJS::ScopedVarAccessNode::evaluate):
19087 (KJS::ScopedVarAccessNode::evaluateToNumber):
19088 (KJS::ScopedVarAccessNode::evaluateToBoolean):
19089 (KJS::ScopedVarAccessNode::evaluateToInt32):
19090 (KJS::ScopedVarAccessNode::evaluateToUInt32):
19091 (KJS::NonLocalVarAccessNode::inlineEvaluate):
19092 (KJS::NonLocalVarAccessNode::evaluate):
19093 (KJS::NonLocalVarAccessNode::evaluateToNumber):
19094 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
19095 (KJS::NonLocalVarAccessNode::evaluateToInt32):
19096 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
19097 (KJS::IfElseNode::optimizeVariableAccess):
19098 (KJS::ScopeNode::optimizeVariableAccess):
19100 (KJS::ScopedVarAccessNode::):
19101 (KJS::NonLocalVarAccessNode::):
19104 2008-03-16 weihongzeng <weihong.zeng@hotmail.com>
19106 Reviewed by Darin Adler.
19108 http://bugs.webkit.org/show_bug.cgi?id=15416
19109 Add support for mixed-endian processors
19111 * kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
19113 2008-03-16 Kevin Ollivier <kevino@theolliviers.com>
19115 Rubber stamped by Darin.
19117 Add set-webkit-configuration support for wx port, and centralize
19118 build dir location setting.
19120 http://bugs.webkit.org/show_bug.cgi?id=17790
19124 2008-03-14 Steve Falkenburg <sfalken@apple.com>
19128 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19130 2008-03-14 Oliver Hunt <oliver@apple.com>
19132 Reviewed by Maciej.
19134 Add logic to track whether a function uses a locally scoped eval or requires a closure
19136 Now that we limit eval we can track those uses of eval that operate
19137 in the local scope and functions that require a closure. We track
19138 this information during initial parsing to avoid yet another tree
19141 * JavaScriptCore.exp:
19144 (KJS::Parser::didFinishParsing):
19146 (KJS::Parser::parse):
19149 (KJS::ScopeNode::ScopeNode):
19150 (KJS::ProgramNode::ProgramNode):
19151 (KJS::ProgramNode::create):
19152 (KJS::EvalNode::EvalNode):
19153 (KJS::EvalNode::create):
19154 (KJS::FunctionBodyNode::FunctionBodyNode):
19155 (KJS::FunctionBodyNode::create):
19157 (KJS::ScopeNode::):
19158 (KJS::ScopeNode::usesEval):
19159 (KJS::ScopeNode::needsClosure):
19161 2008-03-14 Geoffrey Garen <ggaren@apple.com>
19163 Reviewed by Beth Dakin.
19165 Fixed another problem with Vector::shrinkCapacity.
19167 moveOverlapping isn't good enough for the case where the buffer hasn't
19168 changed, because it still destroys the contents of the buffer.
19171 (WTF::::shrinkCapacity): Changed to explicitly check whether the call
19172 to allocateBuffer produced a new buffer. If it didn't, there's no need
19175 2008-03-14 Geoffrey Garen <ggaren@apple.com>
19177 Reviewed by Beth Dakin.
19179 Fixed a few problems with Vector::shrinkCapacity that I noticed in testing.
19182 (WTF::VectorBufferBase::deallocateBuffer): Clear our m_buffer pointer
19183 when we deallocate m_buffer, in case we're not asked to reallocate a new
19184 buffer. (Otherwise, we would use a stale m_buffer if we were asked to
19185 perform any operations after shrinkCapacity was called.)
19187 (WTF::VectorBuffer::allocateBuffer): Made VectorBuffer with inline
19188 capacity aware that calls to allocateBuffer might be shrinks, rather
19189 than grows, so we shouldn't allocate a new buffer on the heap unless
19190 our inline buffer is too small.
19192 (WTF::::shrinkCapacity): Call resize() instead of just setting m_size,
19193 so destructors run. Call resize before reallocating the buffer to make
19194 sure that we still have access to the objects we need to destroy. Call
19195 moveOverlapping instead of move, since a call to allocateBuffer on an
19196 inline buffer may produce identical storage.
19198 2008-03-14 Alexey Proskuryakov <ap@webkit.org>
19202 Get rid of a localime() call on platforms that have better alternatives.
19204 * kjs/DateMath.h: Added getLocalTime();
19206 * kjs/DateMath.cpp:
19207 (KJS::getLocalTime):
19208 (KJS::getDSTOffsetSimple):
19209 Implementation moved from getDSTOffsetSimple().
19211 * kjs/date_object.cpp:
19212 (KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
19214 2008-03-14 David D. Kilzer <ddkilzer@apple.com>
19216 Unify concept of enabling the Mac Java bridge.
19218 Reviewed by Darin and Anders.
19220 * wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
19222 2008-03-13 Mark Mentovai <mark@moxienet.com>
19224 Reviewed by eseidel. Landed by eseidel.
19226 * wtf/FastMalloc.cpp: #include <wtf/HashSet.h> outside of any
19229 2008-03-13 Mark Mentovai <mark@moxienet.com>
19231 Reviewed by eseidel. Landed by eseidel.
19233 * pcre/pcre_exec.cpp: Fix misnamed variable, allowing -DDEBUG build
19235 * wtf/ThreadingPthreads.cpp: #include <sys/time.h> for gettimeofday
19238 2008-03-13 Steve Falkenburg <sfalken@apple.com>
19242 Disable PGO for normal release builds.
19243 Added work-in-progress Release_PGOInstrument/Release_PGOOptimize targets.
19245 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19247 2008-03-13 Beth Dakin <bdakin@apple.com>
19251 Adding new functionality to Vector. Currently all of the shrink and
19252 resize functions on Vector only shrink the size of the Vector, not
19253 the capacity. For the Vector to take up as little memory as
19254 possible, though, it is necessary to be able to shrink the capacity
19255 as well. So this patch adds that functionality.
19257 I need this for a speed up I am working on, and Geoff wants to use
19258 it in a speed up he is working on also, so he asked me to commit it
19262 (WTF::VectorBufferBase::allocateBuffer):
19263 (WTF::::shrinkCapacity):
19265 2008-03-13 Simon Hausmann <hausmann@webkit.org>
19267 Reviewed by Adam Roben.
19269 Attempt at fixing the Qt/Windows build bot. Quote using double-quotes
19270 instead of single quotes.
19274 2008-03-12 Steve Falkenburg <sfalken@apple.com>
19278 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19280 2008-03-12 Alp Toker <alp@atoker.com>
19282 Another autotools testkjs build fix attempt.
19286 2008-03-12 Alp Toker <alp@atoker.com>
19288 Attempt to fix the autotools testkjs build on systems with
19289 non-standard include paths.
19293 2008-03-11 Alexey Proskuryakov <ap@webkit.org>
19297 <rdar://problem/5787743> REGRESSION: Crash at WTF::Collator::CreateCollator() running fast/js/kde/StringObject.html on Windows
19299 * wtf/unicode/icu/CollatorICU.cpp:
19300 (WTF::Collator::createCollator): Check for null (== user default) m_locale before calling strcmp.
19302 2008-03-11 Steve Falkenburg <sfalken@apple.com>
19304 Disable LTCG/PGO for grammar.cpp and nodes.cpp.
19305 PGO on these files causes us to hang.
19307 Copy newer vsprops files from relative WebKitLibraries path to environment variable based path.
19309 Reviewed by Oliver.
19311 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19312 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
19314 2008-03-10 Darin Adler <darin@apple.com>
19316 - Windows build fix
19318 * kjs/function.cpp: (KJS::decode): Initialize variable.
19320 2008-03-10 Brent Fulgham <bfulgham@gmail.com>
19326 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
19327 Set the PATH to include Cygwin before running touch.
19329 2008-03-10 Eric Seidel <eric@webkit.org>
19331 Build fix for JSC on windows.
19333 * API/JSStringRefCF.cpp:
19334 (JSStringCreateWithCFString):
19335 * kjs/function.cpp:
19337 * kjs/nodes2string.cpp:
19338 (KJS::escapeStringForPrettyPrinting):
19340 2008-03-10 Eric Seidel <eric@webkit.org>
19342 No review, build fix only.
19344 Attempt to fix the windows build?
19346 * kjs/ustring.h: change unsigned short to UChar
19348 2008-03-10 Eric Seidel <eric@webkit.org>
19352 Remove KJS::UChar, use ::UChar instead
19353 http://bugs.webkit.org/show_bug.cgi?id=17017
19355 * API/JSStringRef.cpp:
19356 (JSStringCreateWithCharacters):
19357 (JSStringCreateWithUTF8CString):
19358 * API/JSStringRefCF.cpp:
19359 (JSStringCreateWithCFString):
19360 * JavaScriptCore.exp:
19362 * kjs/function.cpp:
19366 (KJS::globalFuncEscape):
19367 (KJS::globalFuncUnescape):
19368 * kjs/function_object.cpp:
19369 (KJS::FunctionObjectImp::construct):
19370 * kjs/identifier.cpp:
19371 (KJS::Identifier::equal):
19372 (KJS::CStringTranslator::translate):
19373 * kjs/interpreter.h:
19375 (KJS::Lexer::setCode):
19376 (KJS::Lexer::shift):
19378 (KJS::Lexer::convertUnicode):
19379 (KJS::Lexer::makeIdentifier):
19382 * kjs/nodes2string.cpp:
19383 (KJS::escapeStringForPrettyPrinting):
19384 (KJS::SourceStream::operator<<):
19386 (KJS::RegExp::RegExp):
19387 (KJS::RegExp::match):
19388 * kjs/string_object.cpp:
19389 (KJS::substituteBackreferences):
19390 (KJS::stringProtoFuncCharCodeAt):
19391 (KJS::stringProtoFuncToLowerCase):
19392 (KJS::stringProtoFuncToUpperCase):
19393 (KJS::stringProtoFuncToLocaleLowerCase):
19394 (KJS::stringProtoFuncToLocaleUpperCase):
19396 (KJS::UString::Rep::computeHash):
19397 (KJS::UString::UString):
19398 (KJS::UString::append):
19399 (KJS::UString::ascii):
19400 (KJS::UString::operator=):
19401 (KJS::UString::is8Bit):
19402 (KJS::UString::toStrictUInt32):
19403 (KJS::UString::find):
19407 (KJS::UString::UTF8String):
19411 2008-03-09 Steve Falkenburg <sfalken@apple.com>
19413 Stop Windows build if an error occurs in a prior project.
19415 Rubber stamped by Darin.
19417 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19418 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
19419 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19420 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
19422 2008-03-09 J¸rg Billeter <j@bitron.ch>
19424 Reviewed by Alp Toker.
19426 Conditionalise ICU for Unicode in the GTK+ port.
19430 2008-03-07 David D. Kilzer <ddkilzer@apple.com>
19432 Unify concept of enabling Netscape Plug-in API (NPAPI).
19436 * wtf/Platform.h: Define ENABLE_NETSCAPE_PLUGIN_API here.
19438 2008-03-07 Geoffrey Garen <ggaren@apple.com>
19440 Reviewed by Darin Adler.
19442 Fixed <rdar://problem/5689093> Stricter (ES4) eval semantics
19446 - "eval(s)" is treated as an operator that gives the ES3 eval behavior.
19447 ... but only if there is no overriding declaration of "eval" in scope.
19448 - All other invocations treat eval as a function that evaluates a
19449 script in the context of its "this" object.
19450 ... but if its "this" object is not the global object it was
19451 originally associated with, eval throws an exception.
19453 Because only expressions of the form "eval(s)" have access to local
19454 scope, the compiler can now statically determine whether a function
19455 needs local scope to be dynamic.
19457 * kjs/nodes.h: Added FunctionCallEvalNode. It works just like
19458 FuncationCallResolveNode, except it statically indicates that the node
19459 may execute eval in the ES3 way.
19461 * kjs/nodes2string.cpp:
19463 * tests/mozilla/expected.html: This patch happens to fix a Mozilla JS
19464 test, but it's a bit of a pyrrhic victory. The test intends to test
19465 Mozilla's generic API for calling eval on any object, but, in reality,
19466 we only support calling eval on the global object.
19468 2008-03-06 Steve Falkenburg <sfalken@apple.com>
19472 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
19474 2008-03-06 Steve Falkenburg <sfalken@apple.com>
19478 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19480 2008-03-06 Alp Toker <alp@atoker.com>
19482 Fix the build fix in r30845 to support out-of-tree builds.
19486 2008-03-06 Steve Falkenburg <sfalken@apple.com>
19490 * wtf/ThreadingWin.cpp:
19491 (WTF::ThreadCondition::timedWait):
19493 2008-03-06 Darin Adler <darin@apple.com>
19495 - another small step towards fixing the Qt build
19497 * JavaScriptCore.pri: Remove more references to the now-obsolete bindings directory.
19499 2008-03-06 Darin Adler <darin@apple.com>
19501 - a small step towards fixing the Qt build
19503 * JavaScriptCore.pri: Remove references to files no longer present in JavaScriptCore/bindings.
19505 2008-03-06 Brady Eidson <beidson@apple.com>
19509 * wtf/ThreadingGtk.cpp:
19510 (WTF::ThreadCondition::timedWait):
19512 2008-03-06 Alexey Proskuryakov <ap@webkit.org>
19516 * wtf/unicode/icu/CollatorICU.cpp:
19517 (WTF::Collator::userDefault): Put ICU workaround under both PLATFORM(DARWIN) and
19518 PLATFORM(CF) checks, so that each port can decide if it wants to use CF on Mac for it.
19520 2008-03-06 Brady Eidson <beidson@apple.com>
19524 Add a timedWait() method to ThreadCondition
19526 * JavaScriptCore.exp:
19530 * wtf/ThreadingGtk.cpp:
19531 (WTF::ThreadCondition::timedWait):
19533 * wtf/ThreadingNone.cpp:
19534 (WTF::ThreadCondition::timedWait):
19536 * wtf/ThreadingPthreads.cpp:
19537 (WTF::ThreadCondition::timedWait):
19539 * wtf/ThreadingWin.cpp:
19540 (WTF::ThreadCondition::timedWait): Needs implementation
19542 2008-03-06 Alexey Proskuryakov <ap@webkit.org>
19546 * jscore.bkl: Add the wtf/unicode directory.
19547 * wtf/unicode/CollatorDefault.cpp:
19548 (WTF::Collator::userDefault): Use a constructor that does exist.
19549 * wtf/unicode/icu/CollatorICU.cpp: Mac build fix for case-sensitive file systems.
19551 2008-03-06 Darin Adler <darin@apple.com>
19553 - try to fix the Qt build
19555 * JavaScriptCore.pri: Add the wtf/unicode directory.
19557 2008-03-06 Darin Adler <darin@apple.com>
19559 - try to fix the GTK build
19561 * GNUmakefile.am: Add a -I for the wtf/unicode directory.
19563 2008-03-06 Darin Adler <darin@apple.com>
19565 - try to fix the Mac build
19567 * icu/unicode/parseerr.h: Copied from ../WebCore/icu/unicode/parseerr.h.
19568 * icu/unicode/ucol.h: Copied from ../WebCore/icu/unicode/ucol.h.
19569 * icu/unicode/uloc.h: Copied from ../WebCore/icu/unicode/uloc.h.
19570 * icu/unicode/unorm.h: Copied from ../WebCore/icu/unicode/unorm.h.
19571 * icu/unicode/uset.h: Copied from ../WebCore/icu/unicode/uset.h.
19573 2008-03-06 Alexey Proskuryakov <ap@webkit.org>
19577 <rdar://problem/5687269> Need to create a Collator abstraction for WebCore and JavaScriptCore
19580 (WTF::initializeThreading):
19581 * wtf/ThreadingGtk.cpp:
19582 (WTF::initializeThreading):
19583 * wtf/ThreadingNone.cpp:
19584 * wtf/ThreadingPthreads.cpp:
19585 * wtf/ThreadingWin.cpp:
19586 Added AtomicallyInitializedStatic.
19588 * kjs/string_object.cpp: (KJS::localeCompare): Changed to use Collator.
19591 * JavaScriptCore.exp:
19592 * JavaScriptCore.pri:
19593 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
19594 * JavaScriptCore.xcodeproj/project.pbxproj:
19595 * JavaScriptCoreSources.bkl:
19596 Added new fiiles to projects.
19598 * wtf/unicode/Collator.h: Added.
19600 * wtf/unicode/CollatorDefault.cpp: Added.
19601 (WTF::Collator::Collator):
19602 (WTF::Collator::~Collator):
19603 (WTF::Collator::setOrderLowerFirst):
19604 (WTF::Collator::collate):
19605 * wtf/unicode/icu/CollatorICU.cpp: Added.
19606 (WTF::cachedCollatorMutex):
19607 (WTF::Collator::Collator):
19608 (WTF::Collator::~Collator):
19609 (WTF::Collator::setOrderLowerFirst):
19610 (WTF::Collator::collate):
19611 (WTF::Collator::createCollator):
19612 (WTF::Collator::releaseCollator):
19614 2008-03-05 Kevin Ollivier <kevino@theolliviers.com>
19616 Fix the wx build after the bindings move.
19618 * JavaScriptCoreSources.bkl:
19621 2008-03-05 Alp Toker <alp@atoker.com>
19623 GTK+ build fix for breakage introduced in r30800.
19625 Track moved bridge sources from JavaScriptCore to WebCore.
19629 2008-03-05 Brent Fulgham <bfulgham@gmail.com>
19631 Reviewed by Adam Roben.
19633 Remove definition of WTF_USE_SAFARI_THEME from wtf/Platform.h
19634 because the PLATFORM(CG) flag is not set until config.h has
19635 already included this file.
19637 * wtf/Platform.h: Remove useless definition of WTF_USE_SAFARI_THEME
19639 2008-03-05 Brady Eidson <beidson@apple.com>
19641 Reviewed by Alexey and Mark Rowe
19643 Fix for <rdar://problem/5778247> - Reproducible crash on storage/execute-sql-args.html
19645 DatabaseThread::unscheduleDatabaseTasks() manually filters through a MessageQueue,
19646 removing particular items for Databases that were shutting down.
19648 This filtering operation is not atomic, and therefore causes a race condition with the
19649 MessageQueue waking up and reading from the message queue.
19651 The end result was an attempt to dereference a null DatabaseTask. Timing-wise, this never
19652 seemed to happen in a debug build, otherwise an assertion would've caught it. Replacing that
19653 assertion with a crash in a release build is what revealed this bug.
19655 * wtf/MessageQueue.h:
19656 (WTF::::waitForMessage): Tweak the waiting logic to check the queue's empty state then go back
19657 to sleep if the queue was empty - checking m_killed each time it wakes up.
19659 2008-03-05 David D. Kilzer <ddkilzer@apple.com>
19661 Remove unused header includes from interpreter.cpp.
19665 * kjs/interpreter.cpp: Remove unused header includes.
19667 2008-03-05 Anders Carlsson <andersca@apple.com>
19673 * bindings: Removed.
19675 2008-03-05 Anders Carlsson <andersca@apple.com>
19677 Don't build bindings/ anymore.
19679 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
19681 2008-03-05 Anders Carlsson <andersca@apple.com>
19685 Don't build JavaScriptCore/bindings.
19687 * JavaScriptCore.exp:
19688 Export a couple of new functions.
19690 * JavaScriptCore.xcodeproj/project.pbxproj:
19694 No need to define HAVE_JNI anymore.
19696 * kjs/interpreter.cpp:
19697 Remove unnecessary include.
19699 2008-03-05 David D. Kilzer <ddkilzer@apple.com>
19701 Allow override of default script file name using command-line argument.
19706 (main): Allow first command-line argument to override the default script
19707 file name of "minidom.js".
19709 (main): Allow first command-line argument to override the default script
19710 file name of "testapi.js".
19712 2008-03-04 Mark Rowe <mrowe@apple.com>
19716 * JavaScriptCore.exp: Add new symbol to exports file.
19718 2008-03-03 Oliver Hunt <oliver@apple.com>
19720 Reviewed by Anders.
19722 Make ForInNode check for the timeout interrupt
19725 (KJS::ForInNode::execute):
19727 2008-03-02 Brent Fulgham <bfulgham@gmail.com>
19729 Reviewed by Alp Toker.
19731 http://bugs.webkit.org/show_bug.cgi?id=17415
19732 GTK Build (using autotools) on Mac OS (DarwinPorts) Fails
19734 Add -lstdc++ to link flags for minidom program. This corrects
19735 a build error for the GTK+ on Mac OS.
19739 2008-03-01 Mark Rowe <mrowe@apple.com>
19741 Reviewed by Tim Hatcher.
19743 Update Xcode configuration to support building debug and release from the mysterious future.
19745 * Configurations/Base.xcconfig:
19746 * Configurations/DebugRelease.xcconfig:
19748 2008-02-29 Brent Fulgham <bfulgham@gmail.com>
19750 http://bugs.webkit.org/show_bug.cgi?id=17483
19751 Implement scrollbars on Windows (Cairo)
19753 Reviewed by Adam Roben.
19757 2008-02-29 Adam Roben <aroben@apple.com>
19759 Remove unused DebuggerImp::abort and DebuggerImp::aborted
19761 Reviewed by Tim and Sam.
19763 * kjs/function_object.cpp:
19764 (KJS::FunctionObjectImp::construct):
19766 (KJS::DebuggerImp::DebuggerImp):
19768 (KJS::Node::handleException):
19769 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
19771 2008-02-28 Eric Christopher <echristo@apple.com>
19773 Reviewed by Geoffrey Garen.
19775 ** TOTAL **: 1.005x as fast 2867.6ms +/- 0.4% 2853.2ms +/- 0.3% significant
19777 * kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
19778 the sake of branch prediction and code organization).
19780 2008-02-27 Alexey Proskuryakov <ap@webkit.org>
19782 Reviewed by Sam Weinig.
19784 http://bugs.webkit.org/show_bug.cgi?id=17030
19785 Small buffer overflow within initialization
19787 * kjs/date_object.cpp:
19788 (KJS::DateObjectFuncImp::callAsFunction):
19790 Remove unnecessary and incorrect memset() calls - GregorianDateTime can initialize itself.
19792 2008-02-25 Sam Weinig <sam@webkit.org>
19794 Reviewed by Dan Bernstein.
19796 - Add a variant of remove that takes a position and a length.
19799 (WTF::Vector::remove):
19801 2008-02-25 Mark Mentovai <mark@moxienet.com>
19803 Reviewed by Mark Rowe.
19805 Enable CollectorHeapIntrospector to build by itself, as well as in an AllInOneFile build.
19806 http://bugs.webkit.org/show_bug.cgi?id=17538
19808 * kjs/CollectorHeapIntrospector.cpp: Provide "using" declaration for
19809 WTF::RemoteMemoryReader.
19810 * kjs/collector.h: Move CollectorHeap declaration here...
19811 * kjs/collector.cpp: ... from here.
19813 2008-02-25 Darin Adler <darin@apple.com>
19817 * JavaScriptCore.exp: Sort the contents of this file.
19819 2008-02-25 Adam Roben <aroben@apple.com>
19824 (functionQuit): Don't add a return statement after exit(0) for MSVC.
19826 2008-02-24 Sam Weinig <sam@webkit.org>
19828 Reviewed by Mark Rowe.
19830 http://bugs.webkit.org/show_bug.cgi?id=17529
19831 Add support for reading from stdin from testkjs
19834 (GlobalObject::GlobalObject): Add readline function to global object.
19835 (functionReadline): Added. Reads characters from stdin until a '\n' or
19836 EOF is encountered. The input is returned as a String to the caller.
19838 2008-02-24 Sam Weinig <sam@webkit.org>
19840 Reviewed by Mark Rowe.
19842 http://bugs.webkit.org/show_bug.cgi?id=17528
19843 Give testkjs a bath
19845 * JavaScriptCore.exp:
19846 * JavaScriptCore.xcodeproj/project.pbxproj: Make the testkjs.cpp use 4 space indentation.
19848 (StopWatch::getElapsedMS):
19849 (GlobalObject::className):
19850 (GlobalObject::GlobalObject):
19851 Rename GlobalImp to GlobalObject and setup the global functions
19852 in the GlobalObject's constructor. Also, use static functions for
19853 the implementation so we can use the standard PrototypeFunction
19854 class and remove TestFunctionImp.
19855 (functionPrint): Move print() functionality here.
19856 (functionDebug): Move debug() functionality here.
19857 (functionGC): Move gc() functionality here.
19858 (functionVersion): Move version() functionality here.
19859 (functionRun): Move run() functionality here.
19860 (functionLoad): Move load() functionality here.
19861 (functionQuit): Move quit() functionality here.
19862 (prettyPrintScript): Fix indentation.
19863 (runWithScripts): Since all the functionality of createGlobalObject is
19864 now in the GlobalObject constructor, just call new here.
19865 (parseArguments): Fix indentation.
19867 (fillBufferWithContentsOfFile): Ditto.
19869 2008-02-24 Sam Weinig <sam@webkit.org>
19871 Reviewed by Oliver Hunt and Mark Rowe.
19873 http://bugs.webkit.org/show_bug.cgi?id=17505
19874 Add support for getting command line arguments in testkjs
19876 - This slightly changes the behavior of parsing arguments by requiring
19877 a '-f' before all files.
19880 (createGlobalObject): Add a global property called 'arguments' which
19881 contains an array with the parsed arguments as strings.
19882 (runWithScripts): Pass in the arguments vector so that it can be passed
19883 to the global object.
19884 (parseArguments): Change parsing rules to require a '-f' before any script
19885 file. After all '-f' and '-p' arguments have been parsed, the remaining
19886 are added to the arguments vector and exposed to the script. If there is a
19887 chance of ambiguity (the user wants to pass the string '-f' to the script),
19888 the string '--' can be used separate the options from the pass through
19892 2008-02-24 Dan Bernstein <mitz@apple.com>
19894 Reviewed by Darin Adler.
19896 - fix http://bugs.webkit.org/show_bug.cgi?id=17511
19897 REGRESSION: Reproducible crash in SegmentedSubstring::SegmentedSubstring(SegmentedSubstring const&)
19900 (WTF::::expandCapacityIfNeeded): Fixed the case where m_start and m_end
19901 are both zero but the buffer capacity is non-zero.
19902 (WTF::::prepend): Added validity checks.
19904 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
19906 Rubber stamped by Darin.
19908 Add separator '\' after libJavaScriptCore_la_LIBADD and cleanup
19909 whitespaces introduced in the previous commit.
19913 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
19915 * GNUmakefile.am: Add GLOBALDEPS for testkjs and minidom.
19917 2008-02-23 Darin Adler <darin@apple.com>
19919 Reviewed by Anders.
19921 - http://bugs.webkit.org/show_bug.cgi?id=17496
19922 make Deque use a circular array; add iterators
19924 * wtf/Deque.h: Wrote an all-new version of this class that uses a circular
19925 buffer. Growth policy is identical to vector. Added iterators.
19927 * wtf/Vector.h: Made two small refinements while using this to implement
19928 Deque: Made VectorBufferBase derive from Noncopyable, which would have
19929 saved me some debugging time if it had been there. Renamed Impl and
19930 m_impl to Buffer and m_buffer.
19932 2008-02-23 Darin Adler <darin@apple.com>
19934 Reviewed by Anders.
19936 - http://bugs.webkit.org/show_bug.cgi?id=17067
19937 eliminate attributes parameter from JSObject::put for speed/clarity
19939 * API/JSCallbackObject.h: Removed attribute arguments.
19940 * API/JSCallbackObjectFunctions.h:
19941 (KJS::JSCallbackObject<Base>::put): Ditto.
19942 * API/JSObjectRef.cpp:
19943 (JSObjectSetProperty): Use initializeVariable or putDirect when necessary
19944 to set attribute values.
19945 * JavaScriptCore.exp: Updated.
19946 * bindings/objc/objc_runtime.h: Removed attribute arguments.
19947 * bindings/objc/objc_runtime.mm:
19948 (ObjcFallbackObjectImp::put): Ditto.
19949 * bindings/runtime_array.cpp:
19950 (RuntimeArray::put): Ditto.
19951 * bindings/runtime_array.h: Ditto.
19952 * bindings/runtime_object.cpp:
19953 (RuntimeObjectImp::put): Ditto.
19954 * bindings/runtime_object.h: Ditto. Also removed canPut which was only
19955 called from one place in WebCore that can use hasProperty instead.
19957 * kjs/Activation.h: Removed attribute argument from put and added the new
19958 initializeVariable function that's used to put variables in variable objects.
19959 Also made isActivationObject a const member.
19961 * kjs/JSGlobalObject.cpp:
19962 (KJS::JSGlobalObject::put): Removed attribute argument.
19963 (KJS::JSGlobalObject::initializeVariable): Added. Used to give variables
19964 their initial values, which can include the read-only property.
19965 (KJS::JSGlobalObject::reset): Removed obsolete comments about flags.
19966 Removed Internal flag, which is no longer needed.
19967 * kjs/JSGlobalObject.h: More of the same.
19969 * kjs/JSVariableObject.h: Added pure virtual initializeVariable function.
19970 (KJS::JSVariableObject::symbolTablePut): Removed checkReadOnly flag; we always
19972 (KJS::JSVariableObject::symbolTableInitializeVariable): Added.
19974 * kjs/array_instance.cpp:
19975 (KJS::ArrayInstance::put): Removed attribute argument.
19976 * kjs/array_instance.h: Ditto.
19978 * kjs/function.cpp:
19979 (KJS::FunctionImp::put): Ditto.
19980 (KJS::Arguments::put): Ditto.
19981 (KJS::ActivationImp::put): Ditto.
19982 (KJS::ActivationImp::initializeVariable): Added.
19983 * kjs/function.h: Removed attribute arguments.
19985 * kjs/function_object.cpp:
19986 (KJS::FunctionObjectImp::construct): Removed Internal flag.
19989 (KJS::lookupPut): Removed attributes argument. Also changed to use putDirect
19990 instead of calling JSObject::put.
19991 (KJS::cacheGlobalObject): Ditto.
19994 (KJS::ConstDeclNode::handleSlowCase): Call initializeVariable to initialize
19996 (KJS::ConstDeclNode::evaluateSingle): Ditto.
19997 (KJS::TryNode::execute): Use putDirect to set up the new object.
19998 (KJS::FunctionBodyNode::processDeclarations): Removed Internal.
19999 (KJS::ProgramNode::processDeclarations): Ditto.
20000 (KJS::EvalNode::processDeclarations): Call initializeVariable to initialize
20001 the variables and functions.
20002 (KJS::FuncDeclNode::makeFunction): Removed Internal.
20003 (KJS::FuncExprNode::evaluate): Ditto.
20005 * kjs/object.cpp: Removed canPut, which was only being used in one code path,
20006 not the normal high speed one.
20007 (KJS::JSObject::put): Removed attribute argument. Moved the logic from
20008 canPut here, in the one code ath that was still using it.
20009 * kjs/object.h: Removed Internal attribute, ad canPut function. Removed the
20010 attributes argument to the put function. Made isActivationObject const.
20012 * kjs/regexp_object.cpp:
20013 (KJS::RegExpImp::put): Removed attributes argument.
20014 (KJS::RegExpImp::putValueProperty): Ditto.
20015 (KJS::RegExpObjectImp::put): Ditto.
20016 (KJS::RegExpObjectImp::putValueProperty): Ditto.
20017 * kjs/regexp_object.h: Ditto.
20019 * kjs/string_object.cpp:
20020 (KJS::StringInstance::put): Removed attributes argument.
20021 * kjs/string_object.h: Ditto.
20023 2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
20025 Not reviewed, Gtk build fix.
20029 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20031 Windows build fix - move ThreadCondition implementation from WebCore to WTF.
20033 * wtf/ThreadingWin.cpp:
20034 (WTF::ThreadCondition::ThreadCondition):
20035 (WTF::ThreadCondition::~ThreadCondition):
20036 (WTF::ThreadCondition::wait):
20037 (WTF::ThreadCondition::signal):
20038 (WTF::ThreadCondition::broadcast):
20040 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20042 Touch some files, hoping that Windows build bot will create JSC headers.
20044 * kjs/AllInOneFile.cpp:
20045 * kjs/array_instance.cpp:
20046 * wtf/HashTable.cpp:
20048 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20050 Qt/Wx build fix - this file was still in a wrong namespace, too.
20052 * wtf/ThreadingNone.cpp:
20054 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20056 More build fixing - fix mismatched braces.
20058 * JavaScriptCore.pri:
20060 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20062 Wx and Gtk build fixes.
20064 * JavaScriptCore.pri: Don't try to compile ThreadingPthreads.
20065 * wtf/ThreadingGtk.cpp: Use a correct namespace.
20067 2008-02-23 Alexey Proskuryakov <ap@webkit.org>
20071 Move basic threading support from WebCore to WTF.
20073 Added mutex protection to MessageQueue::killed() for paranoia sake.
20076 * JavaScriptCore.exp:
20077 * JavaScriptCore.pri:
20078 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
20079 * JavaScriptCore.xcodeproj/project.pbxproj:
20080 * JavaScriptCoreSources.bkl:
20081 * wtf/Locker.h: Copied from WebCore/platform/Locker.h.
20082 * wtf/MessageQueue.h: Copied from WebCore/platform/MessageQueue.h.
20084 * wtf/Threading.h: Copied from WebCore/platform/Threading.h.
20085 * wtf/ThreadingGtk.cpp: Copied from WebCore/platform/gtk/ThreadingGtk.cpp.
20086 (WebCore::createThread):
20087 * wtf/ThreadingNone.cpp: Copied from WebCore/platform/ThreadingNone.cpp.
20088 * wtf/ThreadingPthreads.cpp: Copied from WebCore/platform/pthreads/ThreadingPthreads.cpp.
20089 (WTF::createThread):
20090 * wtf/ThreadingWin.cpp: Copied from WebCore/platform/win/ThreadingWin.cpp.
20091 (WTF::createThread):
20092 (WTF::Mutex::Mutex):
20093 (WTF::Mutex::~Mutex):
20094 (WTF::Mutex::lock):
20095 (WTF::Mutex::tryLock):
20096 (WTF::Mutex::unlock):
20098 2008-02-22 Geoffrey Garen <ggaren@apple.com>
20100 Reviewed by Sam Weinig.
20102 Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
20104 I'm removing KJS_MEM_LIMIT for the following reasons:
20106 - We have a few reports of KJS_MEM_LIMIT breaking important web
20107 applications, like GMail and Google Reader. (For example, if you
20108 simply open 12 GMail tabs, tab #12 will hit the limit.)
20110 - Firefox has no discernable JS object count limit, so any limit, even
20111 a large one, is a potential compatibility problem.
20113 - KJS_MEM_LIMIT does not protect against malicious memory allocation,
20114 since there are many ways to maliciously allocate memory without
20115 increasing the JS object count.
20117 - KJS_MEM_LIMIT is already mostly broken, since it only aborts the
20118 script that breaches the limit, not any subsequent scripts.
20120 - We've never gotten bug reports about websites that would have
20121 benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
20122 KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
20125 - Any website that brings you anywhere close to crashing due to the
20126 number of live JS objects will almost certainly put up the "slow
20127 script" dialog at least 20 times beforehand.
20129 * kjs/collector.cpp:
20130 (KJS::Collector::collect):
20133 (KJS::TryNode::execute):
20135 2008-02-22 Oliver Hunt <oliver@apple.com>
20137 Reviewed by Alexey P.
20139 <rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
20141 Fix yet another case where we incorrectly relied on implicit double
20145 (KJS::PostDecLocalVarNode::evaluateToBoolean):
20147 2008-02-20 Michael Knaup <michael.knaup@mac.com>
20151 Fix for Bug 16753: date set methods with no args should result in NaN (Acid3 bug)
20152 The set values result in NaN now when called with no args, NaN or +/- inf values.
20153 The setYear, setFullYear and setUTCFullYear methods used on NaN dates work as
20154 descripted in the standard.
20156 * kjs/date_object.cpp:
20157 (KJS::fillStructuresUsingTimeArgs):
20158 (KJS::fillStructuresUsingDateArgs):
20159 (KJS::setNewValueFromTimeArgs):
20160 (KJS::setNewValueFromDateArgs):
20161 (KJS::dateProtoFuncSetYear):
20163 2008-02-19 Anders Carlsson <andersca@apple.com>
20167 Change OpaqueJSClass and RootObject to start with a ref count of 1.
20169 * API/JSClassRef.cpp:
20170 (OpaqueJSClass::OpaqueJSClass):
20171 (OpaqueJSClass::createNoAutomaticPrototype):
20172 (OpaqueJSClass::create):
20173 * API/JSClassRef.h:
20174 * API/JSObjectRef.cpp:
20176 * bindings/runtime_root.cpp:
20177 (KJS::Bindings::RootObject::create):
20178 (KJS::Bindings::RootObject::RootObject):
20180 2008-02-19 Darin Adler <darin@apple.com>
20182 Rubber stamped by Anders.
20184 - removed explicit initialization to 1 for RefCounted; that's now the default
20187 (KJS::RegExp::RegExp): Removed RefCounted initializer.
20189 2008-02-19 Darin Adler <darin@apple.com>
20191 Reviewed by Anders.
20193 - next step for http://bugs.webkit.org/show_bug.cgi?id=17257
20194 start ref counts at 1 instead of 0 for speed
20196 * wtf/RefCounted.h:
20197 (WTF::RefCounted::RefCounted): Have refcounts default to 1. This allows us to start
20198 removing the explicit initialization of RefCounted from classes and eventually we
20199 can remove the ability to have the initial count of 0 entirely.
20201 2008-02-18 Samuel Weinig <sam@webkit.org>
20203 Reviewed by Geoff Garen.
20205 Fix for http://bugs.webkit.org/show_bug.cgi?id=17419
20206 Remove CompatMode from JavaScriptCore as it is never set to anything other than NativeMode
20208 * kjs/JSGlobalObject.cpp:
20209 (KJS::JSGlobalObject::init):
20210 * kjs/JSGlobalObject.h:
20211 (KJS::JSGlobalObject::setDebugger):
20212 * kjs/date_object.cpp:
20213 (KJS::dateProtoFuncGetYear):
20215 2008-02-18 Darin Adler <darin@apple.com>
20219 * wtf/ASCIICType.h:
20220 (WTF::toASCIIHexValue): Added.
20222 2008-02-17 Darin Adler <darin@apple.com>
20224 * wtf/ListHashSet.h: (WTF::swap): Removed stray return statement.
20226 2008-02-15 Adam Roben <aroben@apple.com>
20228 Make JavaScriptCore's FEATURE_DEFINES match WebCore's
20232 * Configurations/JavaScriptCore.xcconfig:
20234 2008-02-14 Stephanie Lewis <slewis@apple.com>
20238 Update order files.
20240 * JavaScriptCore.order:
20242 2008-02-14 Geoffrey Garen <ggaren@apple.com>
20244 Reviewed by Sam Weinig.
20246 Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
20247 Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
20249 Don't reset the "activations" stack in JSGlobalObject::reset, since we
20250 might be executing a script during the call to reset, and the script
20251 needs to safely run to completion.
20253 Instead, initialize the "activations" stack when the global object is
20254 created, and subsequently rely on pushing and popping during normal
20255 execution to maintain the stack's state.
20257 * kjs/JSGlobalObject.cpp:
20258 (KJS::JSGlobalObject::init):
20259 (KJS::JSGlobalObject::reset):
20261 2008-02-13 Bernhard Rosenkraenzer <bero@arklinux.org>
20265 - http://bugs.webkit.org/show_bug.cgi?id=17339
20266 JavaScriptCore does not build with gcc 4.3
20268 * kjs/interpreter.cpp: Add include of <unistd.h>, since that's where
20269 getpid() comes from.
20271 2008-02-13 Oliver Hunt <oliver@apple.com>
20273 Reviewed by Alexey P.
20275 <rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
20277 When converting numeric values to booleans we need to account for NaN
20280 (KJS::MultNode::evaluateToBoolean):
20281 (KJS::ModNode::evaluateToBoolean):
20283 2008-02-08 Samuel Weinig <sam@webkit.org>
20285 Reviewed by Brady Eidson.
20287 <rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
20289 - Tweak the statements in isASCIISpace to account for the statistical distribution of
20292 .4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
20294 * wtf/ASCIICType.h:
20295 (WTF::isASCIISpace):
20297 2008-02-11 Sam Weinig <sam@webkit.org>
20299 Reviewed by Anders Carlsson.
20302 <rdar://problem/5735497> Match Firefox's cross-domain model more accurately by return the built-in version of functions even if they have been overridden
20303 <rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
20305 - Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
20308 * JavaScriptCore.exp:
20309 * kjs/object_object.cpp:
20310 * kjs/object_object.h:
20312 2008-02-10 Darin Adler <darin@apple.com>
20314 Rubber stamped by Eric.
20317 (KJS::ExecState::takeException): Added.
20319 2008-02-10 Darin Adler <darin@apple.com>
20323 - http://bugs.webkit.org/show_bug.cgi?id=17256
20324 eliminate default ref. count of 0 in RefCounted class
20326 * wtf/RefCounted.h:
20327 (WTF::RefCounted::RefCounted): Remove default of 0.
20329 2008-02-10 Darin Adler <darin@apple.com>
20333 - http://bugs.webkit.org/show_bug.cgi?id=17256
20334 Make clients of RefCounted explicitly set the count to 0.
20336 * API/JSClassRef.cpp:
20337 (OpaqueJSClass::OpaqueJSClass):
20338 * bindings/runtime_root.cpp:
20339 (KJS::Bindings::RootObject::RootObject):
20341 2008-02-09 Darin Adler <darin@apple.com>
20345 - http://bugs.webkit.org/show_bug.cgi?id=17256
20346 Change RegExp to start its ref count at 1, not 0
20348 We'll want to do this to every RefCounted class, one at a time.
20351 (KJS::RegExpNode::RegExpNode): Use RegExp::create instead of new RegExp.
20353 (KJS::RegExp::RegExp): Marked inline, set initial ref count to 1.
20354 (KJS::RegExp::create): Added. Calls new RegExp then adopts the initial ref.
20355 * kjs/regexp.h: Reformatted. Made the constructors private. Added static
20356 create functions that return objects already wrapped in PassRefPtr.
20357 * kjs/regexp_object.cpp:
20358 (KJS::regExpProtoFuncCompile): Use RegExp::create instead of new RegExp.
20359 (KJS::RegExpObjectImp::construct): Ditto.
20360 * kjs/string_object.cpp:
20361 (KJS::stringProtoFuncMatch): Ditto.
20362 (KJS::stringProtoFuncSearch): Ditto.
20364 2008-02-08 Oliver Hunt <oliver@apple.com>
20366 Reviewed by Maciej.
20368 <rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
20369 https://bugs.webkit.org/show_bug.cgi?id=17214
20371 Make a subclass of CommaNode to provide the correct precedence for each expression in
20372 a variable declaration list.
20376 (KJS::VarDeclCommaNode::):
20378 2008-02-08 Darin Adler <darin@apple.com>
20380 Reviewed by Oliver.
20382 - fix http://bugs.webkit.org/show_bug.cgi?id=17247
20383 Labelled continue/break can fail in some cases
20385 Test: fast/js/continue-break-multiple-labels.html
20388 (KJS::StatementNode::pushLabel): Made this virtual.
20389 (KJS::LabelNode::pushLabel): Forward pushLabel calls to the statement inside.
20391 2008-02-08 Darin Adler <darin@apple.com>
20395 - fix http://bugs.webkit.org/show_bug.cgi?id=15003
20396 Function.prototype.constructor should not be DontDelete/ReadOnly (Acid3 bug)
20398 Test: fast/js/constructor-attributes.html
20400 * kjs/JSGlobalObject.cpp:
20401 (KJS::JSGlobalObject::reset): Remove unwanted attributes from "constructor".
20402 * kjs/function_object.cpp:
20403 (KJS::FunctionObjectImp::construct): Ditto.
20405 (KJS::FuncDeclNode::makeFunction): Ditto.
20406 (KJS::FuncExprNode::evaluate): Ditto.
20408 2008-02-06 Geoffrey Garen <ggaren@apple.com>
20410 Reviewed by Oliver Hunt.
20412 Added an ASSERT to catch refCount underflow, since it caused a leak in
20415 * wtf/RefCounted.h:
20416 (WTF::RefCounted::deref):
20418 2008-02-06 Geoffrey Garen <ggaren@apple.com>
20420 Reviewed by Darin Adler.
20422 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
20423 slower due to r28884 (global variable symbol table optimization)
20425 Tweaked RefCounted::deref() to be a little more efficient.
20427 1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
20429 * wtf/RefCounted.h:
20430 (WTF::RefCounted::deref): Don't modify m_refCount if we're just going
20431 to delete the object anyway. Also, use a simple == test, which might be
20432 faster than <= on some hardware.
20434 2008-02-06 Darin Adler <darin@apple.com>
20438 - fix http://bugs.webkit.org/show_bug.cgi?id=17094
20439 Array.prototype functions create length properties with DontEnum/DontDelete
20441 Test results match Gecko with very few obscure exceptions that seem to be
20444 Test: fast/js/array-functions-non-arrays.html
20446 * kjs/array_object.cpp:
20447 (KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
20449 (KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
20450 which is not needed for real arrays, but is needed for non-arrays.
20451 (KJS::arrayProtoFuncPush): Ditto.
20452 (KJS::arrayProtoFuncShift): Ditto.
20453 (KJS::arrayProtoFuncSlice): Ditto.
20454 (KJS::arrayProtoFuncSort): Removed incorrect call to set length when
20455 the array has no elements.
20456 (KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
20458 (KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
20459 make behavior match the specification in that case.
20461 (KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
20464 2008-02-06 Darin Adler <darin@apple.com>
20468 - replace calls to put to set up properties with calls to putDirect, to
20469 prepare for a future change where put won't take attributes any more,
20470 and for a slight performance boost
20472 * API/JSObjectRef.cpp:
20473 (JSObjectMakeConstructor): Use putDirect instead of put.
20474 * kjs/CommonIdentifiers.h: Removed lastIndex.
20475 * kjs/JSGlobalObject.cpp:
20476 (KJS::JSGlobalObject::reset): Use putDirect instead of put.
20477 * kjs/array_object.cpp:
20478 (KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
20479 (KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
20480 * kjs/error_object.cpp:
20481 (KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
20482 * kjs/function.cpp:
20483 (KJS::Arguments::Arguments): Use putDirect instead of put.
20484 (KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
20485 * kjs/function_object.cpp:
20486 (KJS::FunctionObjectImp::construct): Use putDirect instead of put.
20488 (KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
20489 (KJS::FuncExprNode::evaluate): Use putDirect instead of put.
20490 * kjs/regexp_object.cpp:
20491 (KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
20492 (KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
20493 calling get and put.
20494 * kjs/regexp_object.h:
20495 (KJS::RegExpImp::setLastIndex): Added.
20496 * kjs/string_object.cpp:
20497 (KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
20499 2008-02-05 Sam Weinig <sam@webkit.org>
20501 Reviewed by Anders Carlsson.
20503 Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
20504 NodeList (and other DOM lists) items are not enumeratable using for..in
20506 * JavaScriptCore.exp:
20508 2008-02-05 Mark Rowe <mrowe@apple.com>
20510 Reviewed by Oliver Hunt.
20512 Update versioning to support the mysterious future.
20514 * Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
20516 2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
20518 Reviewed by Oliver Hunt.
20520 Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
20521 Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
20522 Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
20524 <http://bugs.webkit.org/show_bug.cgi?id=16889>
20525 <rdar://problem/5696255>
20527 <http://bugs.webkit.org/show_bug.cgi?id=17015>
20529 <http://bugs.webkit.org/show_bug.cgi?id=17164>
20530 <rdar://problem/5720947>
20532 The ActivationImp tear-off (r29425) introduced a problem with ReadModify
20533 nodes that first resolve a slot, call valueForReadModifyNode(), and then
20534 store a value in the previously resolved slot. Since valueForReadModifyNode()
20535 may cause a tear-off, the slot needs to be resolved again, but this was
20536 not happening with the existing code.
20539 (KJS::ReadModifyLocalVarNode::evaluate):
20540 (KJS::ReadModifyResolveNode::evaluate):
20542 2008-02-04 Cameron McCormack <cam@mcc.id.au>
20544 Reviewed by Geoff Garen.
20546 Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
20549 (JSNode_appendChild):
20550 (JSNode_removeChild):
20551 (JSNode_replaceChild):
20552 (JSNode_getNodeType):
20553 (JSNode_getFirstChild):
20554 * API/JSNodeList.c:
20555 (JSNodeList_length):
20556 * API/JSObjectRef.h:
20558 2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
20560 Reviewed by Alp Toker and Mark Rowe.
20562 Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
20563 Bug 17175: Use of C++ compiler flags in CFLAGS
20565 * GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
20567 2008-02-04 Alp Toker <alp@atoker.com>
20569 Rubber-stamped by Mark Rowe.
20571 Remove all trailing whitespace in the GTK+ port and related
20576 2008-02-02 Darin Adler <darin@apple.com>
20578 Reviewed by Geoff Garen.
20580 PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
20581 slower due to r28884 (global variable symbol table optimization)
20583 Geoff's theory is that the slowdown was due to copying hash tables when
20584 putting things into the back/forward cache. If that's true, then this
20585 should fix the problem.
20587 (According to Geoff's measurements, in a PLT that exaggerates the
20588 importance of symbol table saving during cached page creation, this
20589 patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
20591 * JavaScriptCore.exp: Updated.
20593 * kjs/JSVariableObject.cpp:
20594 (KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
20595 which has been revised to avoid initializing each SavedProperty twice when building
20596 the array. Store the property names too, so we don't have to store the symbol table
20597 separately. Do this by iterating the symbol table instead of the local storage vector.
20598 (KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
20599 well as the local storage vector.
20601 * kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
20602 save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
20603 that takes a const reference to a SavedProperties object.
20605 * kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
20606 other declarations of attributes elsewhere.
20608 * kjs/property_map.cpp:
20609 (KJS::SavedProperties::SavedProperties): Updated for data member name change.
20610 (KJS::PropertyMap::save): Updated for data member name change and to use the new
20611 inline init function instead of setting the fields directly. This allows us to
20612 skip initializing the SavedProperty objects when first allocating the array, and
20613 just do it when we're actually setting up the individual elements.
20614 (KJS::PropertyMap::restore): Updated for SavedProperty changes.
20616 * kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
20617 it does not get initialized at construction time to avoid initializing twice when
20618 creating an array of SavedProperty. Removed the m_ prefixes from the members of
20619 the SavedProperties struct. Generally we use m_ for class members and not struct.
20621 2008-02-02 Tony Chang <idealisms@gmail.com>
20623 Reviewed by darin. Landed by eseidel.
20625 Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
20628 * wtf/FastMalloc.cpp:
20629 * wtf/TCSpinLock.h:
20631 2008-01-28 Sam Weinig <sam@webkit.org>
20633 Rubber-stamped by Darin Adler.
20635 - Fix whitespace in nodes.h/cpp and nodes2string.cpp.
20637 (NOTE: Specific changed functions elided for space and clarity)
20640 * kjs/nodes2string.cpp:
20642 2008-01-27 Sam Weinig <sam@webkit.org>
20644 Reviewed by Oliver Hunt.
20646 Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
20647 nodes.h/cpp has been rolling around in the mud - lets hose it down
20649 - Rename member variables to use the m_ prefix.
20651 (NOTE: Specific changed functions elided for space and clarity)
20655 * kjs/nodes2string.cpp:
20657 2008-01-27 Darin Adler <darin@apple.com>
20659 Reviewed by Oliver.
20661 - fix <rdar://problem/5657450> REGRESSION: const is broken
20663 Test: fast/js/const.html
20665 SunSpider said this was 0.3% slower. And I saw some Shark samples in
20666 JSGlobalObject::put -- not a lot but a few. We may be able to regain the
20667 speed, but for now we will take that small hit for correctness sake.
20669 * kjs/JSGlobalObject.cpp:
20670 (KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
20671 instead of passing attributes.
20673 * kjs/JSVariableObject.h:
20674 (KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
20675 here, since we only set attributes when creating a property. Added the code
20676 to check read-only here, since we need that to implement const!
20678 * kjs/function.cpp:
20679 (KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
20680 instead of passing attributes.
20683 (KJS::isConstant): Added.
20684 (KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
20685 if optimizing for a local variable and the variable is constant.
20686 (KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
20687 (KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
20688 (KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
20689 (KJS::PreIncConstNode::evaluate): Return the value + 1.
20690 (KJS::PreDecConstNode::evaluate): Return the value - 1.
20691 (KJS::PostIncConstNode::evaluate): Return the value converted to a number.
20692 (KJS::PostDecConstNode::evaluate): Ditto.
20693 (KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
20694 if optimizing for a local variable and the variable is constant.
20695 (KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
20696 (KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
20697 node optimizeVariableAccess functions, since that's where we need to look to
20698 figure out if a variable is constant.
20699 (KJS::FunctionBodyNode::processDeclarations): Moved the call to
20700 optimizeVariableAccess until after localStorage is set up.
20701 (KJS::ProgramNode::processDeclarations): Ditto.
20703 * kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
20704 as flag masks, so a value of 0 will not work for IsConstant. Changed the
20705 first parameter to optimizeVariableAccess to be a const reference to a symbol
20706 table and added a const reference to local storage. Added classes for const
20707 versions of local variable access: PostIncConstNode, PostDecConstNode,
20708 PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
20711 (KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
20712 expression to match the form used at the two other call sites.
20714 2008-01-27 Darin Adler <darin@apple.com>
20716 Reviewed by Oliver.
20718 - fix http://bugs.webkit.org/show_bug.cgi?id=16498
20719 ''.constructor.toString() gives [function]
20721 Test: fast/js/function-names.html
20723 * kjs/array_object.cpp:
20724 (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
20725 * kjs/bool_object.cpp:
20726 (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
20727 * kjs/date_object.cpp:
20728 (KJS::DateObjectImp::DateObjectImp): Ditto.
20729 * kjs/error_object.cpp:
20730 (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
20731 (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
20732 (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
20733 (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
20735 * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
20736 NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
20737 * kjs/function.h: Removed unneeded constructor for internal functions without names.
20738 We want to avoid those!
20739 * kjs/function_object.cpp:
20740 (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
20741 that have no names. There's no reason to do that.
20742 (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
20744 * kjs/internal.cpp: Removed the unused constructor.
20745 * kjs/number_object.cpp:
20746 (KJS::fractionalPartToString): Marked static for internal linkage.
20747 (KJS::exponentialPartToString): Ditto.
20748 (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
20749 (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
20751 (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
20752 * kjs/object_object.cpp:
20753 (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
20754 * kjs/regexp_object.cpp:
20755 (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
20756 * kjs/string_object.cpp:
20757 (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
20760 2008-01-26 Darin Adler <darin@apple.com>
20762 Reviewed by Oliver.
20764 - fix http://bugs.webkit.org/show_bug.cgi?id=17027
20765 Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
20767 Test: fast/js/function-toString-parentheses.html
20769 The problem here was that a NumberNode with a negative number in it had the wrong
20770 precedence. It's not a primary expression, it's a unary operator with a primary
20771 expression after it.
20773 Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
20774 fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
20775 The reason we handle numbers before dot nodes specially is that the dot is a
20776 legal character in a number. The same is not true of a bracket. Eventually we
20777 could get smarter, and only add the parentheses when there is actual ambiguity.
20778 There is none if the string form of the number already has a dot in it, or if
20779 it's a number with a alphabetic name like infinity or NAN.
20781 * kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
20782 (KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
20783 they serialize as a unary operator, not a primary expression.
20784 * kjs/nodes2string.cpp:
20785 (KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
20786 parens; one set is enough.
20787 (KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
20788 operator precedence suffices.
20789 (KJS::NewExprNode::streamTo): Ditto.
20791 2008-01-26 Oliver Hunt <oliver@apple.com>
20793 Reviewed by Maciej and Darin.
20795 Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
20796 Function.toString does not parenthesise numbers for the bracket accessor
20798 It turns out that logic was there for all of the dot accessor nodes to make numbers be
20799 parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
20800 I renamed the enum type to reflect the fact that it is now used for both dot and bracket
20803 * kjs/nodes2string.cpp:
20804 (KJS::bracketNodeStreamTo):
20805 (KJS::BracketAccessorNode::streamTo):
20807 2008-01-26 Oliver Hunt <oliver@apple.com>
20811 Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
20813 Don't quote getter and setter names during output, as that is simply wrong.
20815 * kjs/nodes2string.cpp:
20816 (KJS::PropertyNode::streamTo):
20818 2008-01-26 Darin Adler <darin@apple.com>
20820 Reviewed by Eric Seidel.
20822 - http://bugs.webkit.org/show_bug.cgi?id=16860
20823 a bit of cleanup after the Activation optimization
20825 * JavaScriptCore.exp: Export the GlobalExecState constructor instead of
20826 the global flavor of the ExecState constructor. It'd probably be cleaner
20827 to not export either one, but JSGlobalObject inlines the code that
20828 constructs the ExecState. If we changed that, we could remove this export.
20830 * JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
20831 put the new source files into the kjs group rather than at the top level.
20833 * kjs/ExecState.cpp:
20834 (KJS::ExecState::ExecState): Marked inline and updated for data member
20835 name changes. This is now only for use for the derived classes. Also removed
20836 code that sets the unused m_savedExec data member for the global case. That
20837 data member is only used for the other two types.
20838 (KJS::ExecState::~ExecState): Marked inline and removed all the code.
20839 The derived class destructors now inclde the appropriate code.
20840 (KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
20841 an empty scope chain. The bottom function already returns 0 for that case,
20842 so the general case code handles it fine. Also changed to use data members
20843 directly rather than calling functions.
20844 (KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
20846 (KJS::GlobalExecState::~GlobalExecState): Added.
20847 (KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
20848 manipulate activeExecStates here since we don't want to have to check for the
20849 special case of globalExec.
20850 (KJS::InterpreterExecState::~InterpreterExecState): Added.
20851 (KJS::EvalExecState::EvalExecState): Added.
20852 (KJS::EvalExecState::~EvalExecState): Added.
20853 (KJS::FunctionExecState::FunctionExecState): Added.
20854 (KJS::FunctionExecState::~FunctionExecState): Added.
20856 * kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
20857 Made ExecState inherit from Noncopyable. Reformatted some comments and
20858 made them a bit more brief. Rearranged declarations a little bit and removed
20859 unused savedExec function. Changed seenLabels function to return a reference
20860 rather than a pointer. Made constructors and destructor protected, and also
20861 did the same with all data members. Renamed m_thisVal to m_thisValue and
20862 ls to m_labelStack. Added three new derived classes for each of the
20863 types of ExecState. The primary goal here was to remove a branch from the
20864 code in the destructor, but it's also clearer than overloading the arguments
20865 to the ExecState constructor.
20867 * kjs/JSGlobalObject.cpp:
20868 (KJS::getCurrentTime): Fixed formatting.
20869 (KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
20870 the expression clearer -- other similar sites didn't have these parentheses,
20871 even the one a couple lines earlier that sets stackEntry.
20872 (KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
20873 (I think I mentioned this during patch review) and used an early exit so that
20874 the entire contents of the function aren't nested inside an if statement.
20875 Also removed the check of codeType, instead checking Activation for 0.
20876 For now, I kept the codeType check, but inside an assertion.
20878 * kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
20879 * kjs/function.cpp:
20880 (KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
20881 (KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
20882 * kjs/interpreter.cpp:
20883 (KJS::Interpreter::evaluate): Changed type to GlobalExecState.
20886 (KJS::ContinueNode::execute): Changed code since seenLabels() returns a
20887 reference now instead of a pointer.
20888 (KJS::BreakNode::execute): Ditto.
20889 (KJS::LabelNode::execute): Ditto.
20891 2008-01-26 Sam Weinig <sam@webkit.org>
20893 Reviewed by Mark Rowe.
20895 Cleanup node2string a little.
20896 - Remove some unnecessary branching.
20897 - Factor out bracket and dot streaming into static inline functions.
20900 * kjs/nodes2string.cpp:
20901 (KJS::bracketNodeStreamTo):
20902 (KJS::dotNodeStreamTo):
20903 (KJS::FunctionCallBracketNode::streamTo):
20904 (KJS::FunctionCallDotNode::streamTo):
20905 (KJS::PostIncBracketNode::streamTo):
20906 (KJS::PostDecBracketNode::streamTo):
20907 (KJS::PostIncDotNode::streamTo):
20908 (KJS::PostDecDotNode::streamTo):
20909 (KJS::DeleteBracketNode::streamTo):
20910 (KJS::DeleteDotNode::streamTo):
20911 (KJS::PreIncBracketNode::streamTo):
20912 (KJS::PreDecBracketNode::streamTo):
20913 (KJS::PreIncDotNode::streamTo):
20914 (KJS::PreDecDotNode::streamTo):
20915 (KJS::ReadModifyBracketNode::streamTo):
20916 (KJS::AssignBracketNode::streamTo):
20917 (KJS::ReadModifyDotNode::streamTo):
20918 (KJS::AssignDotNode::streamTo):
20919 (KJS::WhileNode::streamTo):
20921 2008-01-26 Mark Rowe <mrowe@apple.com>
20923 Reviewed by Darin Adler.
20925 Fix http://bugs.webkit.org/show_bug.cgi?id=17001
20926 Bug 17001: Build error with Gtk port on Mac OS X
20928 If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
20929 These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
20930 the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
20933 * bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
20935 2008-01-26 Darin Adler <darin@apple.com>
20937 Reviewed by Oliver.
20939 - fix http://bugs.webkit.org/show_bug.cgi?id=17013
20940 JSC can't round trip certain for-loops
20942 Test: fast/js/toString-for-var-decl.html
20944 * kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
20945 for loops without injecting the word "true" into them (nice, but not
20946 the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
20947 only when there is an expression, since it's common for the actual
20948 variable declaration to be moved by the parser.
20950 * kjs/nodes2string.cpp:
20951 (KJS::PlaceholderTrueNode::streamTo): Added. Empty.
20953 2008-01-25 Oliver Hunt <oliver@apple.com>
20955 Reviewed by Maciej.
20957 Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
20959 Add logic to ensure that object literals and function expressions get
20960 parentheses when necessary.
20963 * kjs/nodes2string.cpp:
20964 (KJS::SourceStream::operator<<):
20966 2008-01-24 Steve Falkenburg <sfalken@apple.com>
20970 * JavaScriptCore.vcproj/JavaScriptCore.sln:
20972 2008-01-24 Steve Falkenburg <sfalken@apple.com>
20976 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
20978 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
20982 Fix QDateTime to JS Date conversion.
20983 Several conversion errors (some UTC related, some month
20984 offset related) and the conversion distance for Date
20985 to DateTime conversion weights were fixed (it should never
20986 be better to convert a JS Number into a Date rather than
20989 * bindings/qt/qt_runtime.cpp:
20990 (KJS::Bindings::convertValueToQVariant):
20991 (KJS::Bindings::convertQVariantToValue):
20993 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
20997 Add support for calling QObjects.
20998 Add support for invokeDefaultMethod (via a call to
20999 a specific slot), and also allow using it as a
21000 constructor, like QtScript.
21003 * bindings/qt/qt_class.cpp:
21004 (KJS::Bindings::QtClass::fallbackObject):
21005 * bindings/qt/qt_instance.cpp:
21006 (KJS::Bindings::QtRuntimeObjectImp::construct):
21007 (KJS::Bindings::QtInstance::QtInstance):
21008 (KJS::Bindings::QtInstance::~QtInstance):
21009 (KJS::Bindings::QtInstance::implementsCall):
21010 (KJS::Bindings::QtInstance::invokeDefaultMethod):
21011 * bindings/qt/qt_instance.h:
21012 * bindings/qt/qt_runtime.cpp:
21013 (KJS::Bindings::findMethodIndex):
21014 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
21015 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
21016 * bindings/qt/qt_runtime.h:
21018 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
21022 Code style cleanups.
21023 Add spaces before/after braces in inline function.
21025 * bindings/qt/qt_instance.h:
21027 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
21031 Code style cleanups.
21032 Remove spaces and unneeded declared parameter names.
21034 * bindings/qt/qt_instance.cpp:
21035 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
21037 2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
21041 Clear stale RuntimeObjectImps.
21042 Since other objects can have refs to the QtInstance,
21043 we can't rely on the QtInstance being deleted when the
21044 RuntimeObjectImp is invalidate or deleted. This
21045 could result in a stale JSObject being returned for
21048 * bindings/qt/qt_instance.cpp:
21049 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
21050 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
21051 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
21052 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
21053 (KJS::Bindings::QtInstance::getRuntimeObject):
21054 * bindings/runtime.cpp:
21055 (KJS::Bindings::Instance::createRuntimeObject):
21056 * bindings/runtime.h:
21058 2008-01-23 Alp Toker <alp@atoker.com>
21060 Rubber-stamped by Mark Rowe.
21062 Remove whitespace after -I in automake include lists.
21066 2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
21068 Reviewed by Lars Knoll <lars@trolltech.com>.
21070 Reworked the JavaScriptCore Qt bindings:
21072 * Add initial support for string and variant arrays, as well
21073 as sub QObjects in the JS bindings.
21075 * Don't expose fields marked as not scriptable by moc.
21077 * Add support for dynamic properties and accessing named
21078 QObject children of an object (like QtScript and older
21080 * Add support for custom toString methods.
21082 * Fine tune some bindings to be closer to QtScript.
21083 Make void functions return undefined, and empty/
21084 null QStrings return a zero length string.
21086 * Create framework for allowing more direct method calls.
21087 Since RuntimeMethod doesn't allow us to add additional
21088 methods/properties to a function, add these classes.
21089 Start prototyping object.signal.connect(...).
21091 * Add signal support to the Qt bindings.
21092 Allow connecting to signals (object.signal.connect(slot)),
21093 disconnecting, and emitting signals. Currently chooses
21094 the first signal that matches the name, so this will need
21097 * Add property names, and resolve signals closer to use.
21098 Enumerating properties now returns some of the Qt properties
21099 and signals. Slots and methods aren't quite present. Also,
21100 resolve signal connections etc. closer to the time of use, so
21101 we can do more dynamic resolution based on argument type etc.
21102 Still picks the first one with the same name, at the moment.
21104 * Make signature comparison code consistent.
21105 Use the same code for checking meta signatures in
21106 the method and fallback getters, and avoid a
21107 QByteArray construction when we can.
21109 * Fix minor memory leak, and handle pointers better.
21110 Delete the private object in the dtors, and use RefPtrs
21111 for holding Instances etc.
21113 * Handle method lookup better.
21114 Allow invocation time method lookup based on the arguments,
21115 which is closer to QtScript behaviour. Also, cache the
21116 method lists and delete them in the QtClass dtor (stops
21119 * Improve JS to Qt data type conversions.
21120 Add some support for Date & RegExp JS objects,
21121 and provide some metrics on the quality of the
21124 * A couple of fixes for autotest failures.
21125 Better support for converting lists, read/write only
21126 QMetaProperty support, modified slot search order...)
21128 * bindings/qt/qt_class.cpp:
21129 (KJS::Bindings::QtClass::QtClass):
21130 (KJS::Bindings::QtClass::~QtClass):
21131 (KJS::Bindings::QtClass::name):
21132 (KJS::Bindings::QtClass::fallbackObject):
21133 (KJS::Bindings::QtClass::methodsNamed):
21134 (KJS::Bindings::QtClass::fieldNamed):
21135 * bindings/qt/qt_class.h:
21136 * bindings/qt/qt_instance.cpp:
21137 (KJS::Bindings::QtInstance::QtInstance):
21138 (KJS::Bindings::QtInstance::~QtInstance):
21139 (KJS::Bindings::QtInstance::getRuntimeObject):
21140 (KJS::Bindings::QtInstance::getClass):
21141 (KJS::Bindings::QtInstance::implementsCall):
21142 (KJS::Bindings::QtInstance::getPropertyNames):
21143 (KJS::Bindings::QtInstance::invokeMethod):
21144 (KJS::Bindings::QtInstance::invokeDefaultMethod):
21145 (KJS::Bindings::QtInstance::stringValue):
21146 (KJS::Bindings::QtInstance::booleanValue):
21147 (KJS::Bindings::QtInstance::valueOf):
21148 (KJS::Bindings::QtField::name):
21149 (KJS::Bindings::QtField::valueFromInstance):
21150 (KJS::Bindings::QtField::setValueToInstance):
21151 * bindings/qt/qt_instance.h:
21152 (KJS::Bindings::QtInstance::getBindingLanguage):
21153 (KJS::Bindings::QtInstance::getObject):
21154 * bindings/qt/qt_runtime.cpp:
21155 (KJS::Bindings::QWKNoDebug::QWKNoDebug):
21156 (KJS::Bindings::QWKNoDebug::~QWKNoDebug):
21157 (KJS::Bindings::QWKNoDebug::operator<<):
21159 (KJS::Bindings::valueRealType):
21160 (KJS::Bindings::convertValueToQVariant):
21161 (KJS::Bindings::convertQVariantToValue):
21162 (KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
21163 (KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
21164 (KJS::Bindings::QtRuntimeMethod::codeType):
21165 (KJS::Bindings::QtRuntimeMethod::execute):
21166 (KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
21167 (KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
21168 (KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
21169 (KJS::Bindings::QtMethodMatchType::):
21170 (KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
21171 (KJS::Bindings::QtMethodMatchType::kind):
21172 (KJS::Bindings::QtMethodMatchType::isValid):
21173 (KJS::Bindings::QtMethodMatchType::isVariant):
21174 (KJS::Bindings::QtMethodMatchType::isMetaType):
21175 (KJS::Bindings::QtMethodMatchType::isUnresolved):
21176 (KJS::Bindings::QtMethodMatchType::isMetaEnum):
21177 (KJS::Bindings::QtMethodMatchType::enumeratorIndex):
21178 (KJS::Bindings::QtMethodMatchType::variant):
21179 (KJS::Bindings::QtMethodMatchType::metaType):
21180 (KJS::Bindings::QtMethodMatchType::metaEnum):
21181 (KJS::Bindings::QtMethodMatchType::unresolved):
21182 (KJS::Bindings::QtMethodMatchType::typeId):
21183 (KJS::Bindings::QtMethodMatchType::name):
21184 (KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
21185 (KJS::Bindings::QtMethodMatchData::isValid):
21186 (KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
21187 (KJS::Bindings::indexOfMetaEnum):
21188 (KJS::Bindings::findMethodIndex):
21189 (KJS::Bindings::findSignalIndex):
21190 (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
21191 (KJS::Bindings::QtRuntimeMetaMethod::mark):
21192 (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
21193 (KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
21194 (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
21195 (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
21196 (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
21197 (KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
21198 (KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
21199 (KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
21200 (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
21201 (KJS::Bindings::QtConnectionObject::QtConnectionObject):
21202 (KJS::Bindings::QtConnectionObject::~QtConnectionObject):
21203 (KJS::Bindings::QtConnectionObject::metaObject):
21204 (KJS::Bindings::QtConnectionObject::qt_metacast):
21205 (KJS::Bindings::QtConnectionObject::qt_metacall):
21206 (KJS::Bindings::QtConnectionObject::execute):
21207 (KJS::Bindings::QtConnectionObject::match):
21208 (KJS::Bindings::::QtArray):
21209 (KJS::Bindings::::~QtArray):
21210 (KJS::Bindings::::rootObject):
21211 (KJS::Bindings::::setValueAt):
21212 (KJS::Bindings::::valueAt):
21213 * bindings/qt/qt_runtime.h:
21214 (KJS::Bindings::QtField::):
21215 (KJS::Bindings::QtField::QtField):
21216 (KJS::Bindings::QtField::fieldType):
21217 (KJS::Bindings::QtMethod::QtMethod):
21218 (KJS::Bindings::QtMethod::name):
21219 (KJS::Bindings::QtMethod::numParameters):
21220 (KJS::Bindings::QtArray::getLength):
21221 (KJS::Bindings::QtRuntimeMethod::d_func):
21222 (KJS::Bindings::QtRuntimeMetaMethod::d_func):
21223 (KJS::Bindings::QtRuntimeConnectionMethod::d_func):
21225 * bindings/runtime.cpp:
21226 (KJS::Bindings::Instance::createBindingForLanguageInstance):
21227 (KJS::Bindings::Instance::createRuntimeObject):
21228 (KJS::Bindings::Instance::reallyCreateRuntimeObject):
21229 * bindings/runtime.h:
21231 2008-01-22 Anders Carlsson <andersca@apple.com>
21233 Reviewed by Darin and Adam.
21235 <rdar://problem/5688975>
21236 div element on microsoft site has wrong left offset.
21238 Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
21239 (and is what the Silverlight plug-in expects).
21241 * bindings/NP_jsobject.cpp:
21242 (_NPN_GetProperty):
21244 2008-01-21 Geoffrey Garen <ggaren@apple.com>
21246 Reviewed by Maciej Stachowiak.
21248 Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
21249 REGRESSION: Amazon.com crash (ActivationImp)
21251 (and a bunch of other crashes)
21253 Plus, a .7% SunSpider speedup to boot.
21255 Replaced the buggy currentExec and savedExec mechanisms with an
21256 explicit ExecState stack.
21258 * kjs/collector.cpp:
21259 (KJS::Collector::collect): Explicitly mark the ExecState stack.
21261 (KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
21262 behavior: We no longer throw an exception in any global ExecStates,
21263 since global ExecStates are more like pseudo-ExecStates, and aren't
21264 used for script execution. (It's unclear what would happen if you left
21265 an exception waiting around in a global ExecState, but it probably
21268 2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
21270 Reviewed by Alp Toker.
21272 http://bugs.webkit.org/show_bug.cgi?id=16955
21273 Get errors when cross-compile webkit-gtk
21275 * GNUmakefile.am: removed ICU_CFLAGS
21277 2008-01-18 Kevin McCullough <kmccullough@apple.com>
21283 2008-01-18 Kevin McCullough <kmccullough@apple.com>
21289 (KJS::UString::cost):
21291 2008-01-18 Kevin McCullough <kmccullough@apple.com>
21295 - Correctly report cost of appended strings to trigger GC.
21298 (KJS::UString::Rep::create):
21299 (KJS::UString::UString): Don't create unnecssary objects.
21300 (KJS::UString::cost): Report cost if necessary but also keep track of
21304 2008-01-18 Simon Hausmann <hausmann@webkit.org>
21306 Reviewed by Holger.
21308 Fix return type conversions from Qt slots to JS values.
21310 This also fixes fast/dom/open-and-close-by-DOM.html, which called
21311 layoutTestController.windowCount().
21313 When constructing the QVariant that holds the return type we cannot
21314 use the QVarian(Type) constuctor as that will create a null variant.
21315 We have to use the QVariant(Type, void *) constructor instead, just
21316 like in QMetaObject::read() for example.
21319 * bindings/qt/qt_instance.cpp:
21320 (KJS::Bindings::QtInstance::getRuntimeObject):
21322 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
21324 Reviewed by Simon Hausmann <hausmann@webkit.org>.
21326 Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
21329 * kjs/collector.cpp:
21330 (KJS::Collector::heapAllocate):
21332 2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
21334 Reviewed by Simon Hausmann <hausmann@webkit.org>.
21336 Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
21341 2008-01-17 Antti Koivisto <antti@apple.com>
21345 * kjs/regexp_object.cpp:
21346 (KJS::regExpProtoFuncToString):
21348 2008-01-16 Sam Weinig <sam@webkit.org>
21352 Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
21353 Convert remaining JS function objects to use the new PrototypeFunction class
21355 - Moves Boolean, Function, RegExp, Number, Object and Global functions to their
21356 own static function implementations so that they can be used with the
21357 PrototypeFunction class. SunSpider says this is 1.003x as fast.
21359 * kjs/JSGlobalObject.cpp:
21360 (KJS::JSGlobalObject::reset):
21361 * kjs/array_object.h:
21362 * kjs/bool_object.cpp:
21363 (KJS::BooleanInstance::BooleanInstance):
21364 (KJS::BooleanPrototype::BooleanPrototype):
21365 (KJS::booleanProtoFuncToString):
21366 (KJS::booleanProtoFuncValueOf):
21367 (KJS::BooleanObjectImp::BooleanObjectImp):
21368 (KJS::BooleanObjectImp::implementsConstruct):
21369 (KJS::BooleanObjectImp::construct):
21370 (KJS::BooleanObjectImp::callAsFunction):
21371 * kjs/bool_object.h:
21372 (KJS::BooleanInstance::classInfo):
21373 * kjs/error_object.cpp:
21374 (KJS::ErrorPrototype::ErrorPrototype):
21375 (KJS::errorProtoFuncToString):
21376 * kjs/error_object.h:
21377 * kjs/function.cpp:
21378 (KJS::globalFuncEval):
21379 (KJS::globalFuncParseInt):
21380 (KJS::globalFuncParseFloat):
21381 (KJS::globalFuncIsNaN):
21382 (KJS::globalFuncIsFinite):
21383 (KJS::globalFuncDecodeURI):
21384 (KJS::globalFuncDecodeURIComponent):
21385 (KJS::globalFuncEncodeURI):
21386 (KJS::globalFuncEncodeURIComponent):
21387 (KJS::globalFuncEscape):
21388 (KJS::globalFuncUnEscape):
21389 (KJS::globalFuncKJSPrint):
21390 (KJS::PrototypeFunction::PrototypeFunction):
21392 * kjs/function_object.cpp:
21393 (KJS::FunctionPrototype::FunctionPrototype):
21394 (KJS::functionProtoFuncToString):
21395 (KJS::functionProtoFuncApply):
21396 (KJS::functionProtoFuncCall):
21397 * kjs/function_object.h:
21398 * kjs/number_object.cpp:
21399 (KJS::NumberPrototype::NumberPrototype):
21400 (KJS::numberProtoFuncToString):
21401 (KJS::numberProtoFuncToLocaleString):
21402 (KJS::numberProtoFuncValueOf):
21403 (KJS::numberProtoFuncToFixed):
21404 (KJS::numberProtoFuncToExponential):
21405 (KJS::numberProtoFuncToPrecision):
21406 * kjs/number_object.h:
21407 (KJS::NumberInstance::classInfo):
21408 (KJS::NumberObjectImp::classInfo):
21409 (KJS::NumberObjectImp::):
21410 * kjs/object_object.cpp:
21411 (KJS::ObjectPrototype::ObjectPrototype):
21412 (KJS::objectProtoFuncValueOf):
21413 (KJS::objectProtoFuncHasOwnProperty):
21414 (KJS::objectProtoFuncIsPrototypeOf):
21415 (KJS::objectProtoFuncDefineGetter):
21416 (KJS::objectProtoFuncDefineSetter):
21417 (KJS::objectProtoFuncLookupGetter):
21418 (KJS::objectProtoFuncLookupSetter):
21419 (KJS::objectProtoFuncPropertyIsEnumerable):
21420 (KJS::objectProtoFuncToLocaleString):
21421 (KJS::objectProtoFuncToString):
21422 * kjs/object_object.h:
21423 * kjs/regexp_object.cpp:
21424 (KJS::RegExpPrototype::RegExpPrototype):
21425 (KJS::regExpProtoFuncTest):
21426 (KJS::regExpProtoFuncExec):
21427 (KJS::regExpProtoFuncCompile):
21428 (KJS::regExpProtoFuncToString):
21429 * kjs/regexp_object.h:
21431 2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21433 Reviewed by Maciej & Darin.
21435 Fixes Bug 16868: Gmail crash
21436 and Bug 16871: Crash when loading apple.com/startpage
21438 <http://bugs.webkit.org/show_bug.cgi?id=16868>
21439 <rdar://problem/5686108>
21441 <http://bugs.webkit.org/show_bug.cgi?id=16871>
21442 <rdar://problem/5686670>
21444 Adds ActivationImp tear-off for cross-window eval() and fixes an
21445 existing garbage collection issue exposed by the ActivationImp tear-off
21446 patch (r29425) that can occur when an ExecState's m_callingExec is
21447 different than its m_savedExec.
21449 * kjs/ExecState.cpp:
21450 (KJS::ExecState::mark):
21451 * kjs/function.cpp:
21452 (KJS::GlobalFuncImp::callAsFunction):
21454 2008-01-16 Sam Weinig <sam@webkit.org>
21456 Reviewed by Oliver.
21458 Clean up MathObjectImp, it needed a little scrubbing.
21460 * kjs/math_object.cpp:
21461 (KJS::MathObjectImp::MathObjectImp):
21462 (KJS::MathObjectImp::getOwnPropertySlot):
21463 (KJS::MathObjectImp::getValueProperty):
21464 (KJS::mathProtoFuncACos):
21465 (KJS::mathProtoFuncASin):
21466 (KJS::mathProtoFuncATan):
21467 (KJS::mathProtoFuncATan2):
21468 (KJS::mathProtoFuncCos):
21469 (KJS::mathProtoFuncExp):
21470 (KJS::mathProtoFuncLog):
21471 (KJS::mathProtoFuncSin):
21472 (KJS::mathProtoFuncSqrt):
21473 (KJS::mathProtoFuncTan):
21474 * kjs/math_object.h:
21475 (KJS::MathObjectImp::classInfo):
21476 (KJS::MathObjectImp::):
21478 2008-01-16 Sam Weinig <sam@webkit.org>
21480 Reviewed by Geoffrey Garen.
21482 Rename Lexer variable bol to atLineStart.
21485 (KJS::Lexer::Lexer):
21486 (KJS::Lexer::setCode):
21487 (KJS::Lexer::nextLine):
21491 2008-01-16 Sam Weinig <sam@webkit.org>
21493 Reviewed by Geoffrey Garen and Anders Carlsson.
21495 Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
21496 and we have many features that are not included in the ECMA spec.
21499 (KJS::Lexer::Lexer):
21500 (KJS::Lexer::setCode):
21501 (KJS::Lexer::nextLine):
21504 * kjs/string_object.cpp:
21505 * kjs/string_object.h:
21507 2008-01-15 Sam Weinig <sam@webkit.org>
21509 Reviewed by Geoffrey Garen.
21511 Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
21513 - This changes the way JS functions that use Lookup tables are handled. Instead of using
21514 one class per function, which allowed specialization of the virtual callAsFunction
21515 method, we now use one class, PrototypeFunction, which takes a pointer to a static
21516 function to use as the implementation. This significantly decreases the binary size
21517 of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
21518 speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
21519 wiggle room from the original 1% speedup) and keeps the functions implementations in separate
21520 functions to help with optimizations.
21522 * JavaScriptCore.exp:
21523 * JavaScriptCore.xcodeproj/project.pbxproj:
21524 * kjs/array_object.cpp:
21525 (KJS::arrayProtoFuncToString):
21526 (KJS::arrayProtoFuncToLocaleString):
21527 (KJS::arrayProtoFuncJoin):
21528 (KJS::arrayProtoFuncConcat):
21529 (KJS::arrayProtoFuncPop):
21530 (KJS::arrayProtoFuncPush):
21531 (KJS::arrayProtoFuncReverse):
21532 (KJS::arrayProtoFuncShift):
21533 (KJS::arrayProtoFuncSlice):
21534 (KJS::arrayProtoFuncSort):
21535 (KJS::arrayProtoFuncSplice):
21536 (KJS::arrayProtoFuncUnShift):
21537 (KJS::arrayProtoFuncFilter):
21538 (KJS::arrayProtoFuncMap):
21539 (KJS::arrayProtoFuncEvery):
21540 (KJS::arrayProtoFuncForEach):
21541 (KJS::arrayProtoFuncSome):
21542 (KJS::arrayProtoFuncIndexOf):
21543 (KJS::arrayProtoFuncLastIndexOf):
21544 * kjs/array_object.h:
21545 * kjs/date_object.cpp:
21546 (KJS::DatePrototype::getOwnPropertySlot):
21547 (KJS::dateProtoFuncToString):
21548 (KJS::dateProtoFuncToUTCString):
21549 (KJS::dateProtoFuncToDateString):
21550 (KJS::dateProtoFuncToTimeString):
21551 (KJS::dateProtoFuncToLocaleString):
21552 (KJS::dateProtoFuncToLocaleDateString):
21553 (KJS::dateProtoFuncToLocaleTimeString):
21554 (KJS::dateProtoFuncValueOf):
21555 (KJS::dateProtoFuncGetTime):
21556 (KJS::dateProtoFuncGetFullYear):
21557 (KJS::dateProtoFuncGetUTCFullYear):
21558 (KJS::dateProtoFuncToGMTString):
21559 (KJS::dateProtoFuncGetMonth):
21560 (KJS::dateProtoFuncGetUTCMonth):
21561 (KJS::dateProtoFuncGetDate):
21562 (KJS::dateProtoFuncGetUTCDate):
21563 (KJS::dateProtoFuncGetDay):
21564 (KJS::dateProtoFuncGetUTCDay):
21565 (KJS::dateProtoFuncGetHours):
21566 (KJS::dateProtoFuncGetUTCHours):
21567 (KJS::dateProtoFuncGetMinutes):
21568 (KJS::dateProtoFuncGetUTCMinutes):
21569 (KJS::dateProtoFuncGetSeconds):
21570 (KJS::dateProtoFuncGetUTCSeconds):
21571 (KJS::dateProtoFuncGetMilliSeconds):
21572 (KJS::dateProtoFuncGetUTCMilliseconds):
21573 (KJS::dateProtoFuncGetTimezoneOffset):
21574 (KJS::dateProtoFuncSetTime):
21575 (KJS::dateProtoFuncSetMilliSeconds):
21576 (KJS::dateProtoFuncSetUTCMilliseconds):
21577 (KJS::dateProtoFuncSetSeconds):
21578 (KJS::dateProtoFuncSetUTCSeconds):
21579 (KJS::dateProtoFuncSetMinutes):
21580 (KJS::dateProtoFuncSetUTCMinutes):
21581 (KJS::dateProtoFuncSetHours):
21582 (KJS::dateProtoFuncSetUTCHours):
21583 (KJS::dateProtoFuncSetDate):
21584 (KJS::dateProtoFuncSetUTCDate):
21585 (KJS::dateProtoFuncSetMonth):
21586 (KJS::dateProtoFuncSetUTCMonth):
21587 (KJS::dateProtoFuncSetFullYear):
21588 (KJS::dateProtoFuncSetUTCFullYear):
21589 (KJS::dateProtoFuncSetYear):
21590 (KJS::dateProtoFuncGetYear):
21591 * kjs/date_object.h:
21592 * kjs/function.cpp:
21593 (KJS::PrototypeFunction::PrototypeFunction):
21594 (KJS::PrototypeFunction::callAsFunction):
21597 (KJS::HashEntry::):
21598 (KJS::staticFunctionGetter):
21599 * kjs/math_object.cpp:
21600 (KJS::mathProtoFuncAbs):
21601 (KJS::mathProtoFuncACos):
21602 (KJS::mathProtoFuncASin):
21603 (KJS::mathProtoFuncATan):
21604 (KJS::mathProtoFuncATan2):
21605 (KJS::mathProtoFuncCeil):
21606 (KJS::mathProtoFuncCos):
21607 (KJS::mathProtoFuncExp):
21608 (KJS::mathProtoFuncFloor):
21609 (KJS::mathProtoFuncLog):
21610 (KJS::mathProtoFuncMax):
21611 (KJS::mathProtoFuncMin):
21612 (KJS::mathProtoFuncPow):
21613 (KJS::mathProtoFuncRandom):
21614 (KJS::mathProtoFuncRound):
21615 (KJS::mathProtoFuncSin):
21616 (KJS::mathProtoFuncSqrt):
21617 (KJS::mathProtoFuncTan):
21618 * kjs/math_object.h:
21619 * kjs/string_object.cpp:
21620 (KJS::stringProtoFuncToString):
21621 (KJS::stringProtoFuncValueOf):
21622 (KJS::stringProtoFuncCharAt):
21623 (KJS::stringProtoFuncCharCodeAt):
21624 (KJS::stringProtoFuncConcat):
21625 (KJS::stringProtoFuncIndexOf):
21626 (KJS::stringProtoFuncLastIndexOf):
21627 (KJS::stringProtoFuncMatch):
21628 (KJS::stringProtoFuncSearch):
21629 (KJS::stringProtoFuncReplace):
21630 (KJS::stringProtoFuncSlice):
21631 (KJS::stringProtoFuncSplit):
21632 (KJS::stringProtoFuncSubstr):
21633 (KJS::stringProtoFuncSubstring):
21634 (KJS::stringProtoFuncToLowerCase):
21635 (KJS::stringProtoFuncToUpperCase):
21636 (KJS::stringProtoFuncToLocaleLowerCase):
21637 (KJS::stringProtoFuncToLocaleUpperCase):
21638 (KJS::stringProtoFuncLocaleCompare):
21639 (KJS::stringProtoFuncBig):
21640 (KJS::stringProtoFuncSmall):
21641 (KJS::stringProtoFuncBlink):
21642 (KJS::stringProtoFuncBold):
21643 (KJS::stringProtoFuncFixed):
21644 (KJS::stringProtoFuncItalics):
21645 (KJS::stringProtoFuncStrike):
21646 (KJS::stringProtoFuncSub):
21647 (KJS::stringProtoFuncSup):
21648 (KJS::stringProtoFuncFontcolor):
21649 (KJS::stringProtoFuncFontsize):
21650 (KJS::stringProtoFuncAnchor):
21651 (KJS::stringProtoFuncLink):
21652 * kjs/string_object.h:
21654 2008-01-15 Geoffrey Garen <ggaren@apple.com>
21656 Reviewed by Adam Roben.
21658 Some tweaks to our headerdoc, suggested by David Gatwood on the docs
21662 * API/JSObjectRef.h:
21663 * API/JSStringRef.h:
21664 * API/JSValueRef.h:
21666 2008-01-15 Alp Toker <alp@atoker.com>
21668 Rubber-stamped by Anders.
21670 Make the HTTP backend configurable in the GTK+ port. curl is currently
21673 * wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
21675 2008-01-15 Sam Weinig <sam@webkit.org>
21677 Reviewed by Beth Dakin.
21679 Remove unneeded variable.
21681 * kjs/string_object.cpp:
21682 (KJS::StringProtoFuncSubstr::callAsFunction):
21684 2008-01-14 Steve Falkenburg <sfalken@apple.com>
21686 Use shared vsprops for most vcproj properties.
21690 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
21691 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
21692 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
21694 2008-01-14 Adam Roben <aroben@apple.com>
21696 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
21697 some headers that were missing from the vcproj so their contents will
21698 be included in Find in Files.
21700 2008-01-14 Adam Roben <aroben@apple.com>
21702 Fix Bug 16871: Crash when loading apple.com/startpage
21704 <http://bugs.webkit.org/show_bug.cgi?id=16871>
21705 <rdar://problem/5686670>
21707 Patch written by Darin, reviewed by me.
21709 * kjs/ExecState.cpp:
21710 (KJS::ExecState::mark): Call ActivationImp::markChildren if our
21711 m_activation is on the stack. This is what ScopeChain::mark also does,
21712 but apparently in some cases it's possible for an ExecState's
21713 ActivationImp to not be in any ScopeChain.
21715 2008-01-14 Kevin McCullough <kmccullough@apple.com>
21717 Reviewed by Oliver.
21719 -<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
21720 trying to view techreport.com comments
21721 - We need to set values in the map, because if they are already in the
21722 map they will not be reset when we use add().
21724 * kjs/array_instance.cpp:
21725 (KJS::ArrayInstance::put):
21727 2008-01-14 Darin Adler <darin@apple.com>
21731 - re-speed-up the page load test (my StringImpl change slowed it down)
21733 * wtf/RefCounted.h:
21734 (WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
21735 count other than 0. Eventually everyone will want to start with a 1. This is a
21736 staged change. For now, there's a default of 0, and you can specify 1. Later,
21737 there will be no default and everyone will have to specify. And then later, there
21738 will be a default of 1. Eventually, we can take away even the option of starting
21742 (WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
21743 overhead of first constructing something empty and then calling resize.
21744 (WTF::Vector::clear): Sped up the common case of calling clear on an empty
21745 vector by adding a check for that case.
21746 (WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
21747 in the case of vectors with no inline capacity (normal vectors) by leaving out
21748 the code to copy the inline buffer in that case.
21750 2008-01-14 Alexey Proskuryakov <ap@webkit.org>
21752 Reviewed by David Kilzer.
21754 http://bugs.webkit.org/show_bug.cgi?id=16787
21755 array.splice() with 1 element not working
21757 Test: fast/js/array-splice.html
21759 * kjs/array_object.cpp:
21760 (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
21761 some other edge cases.
21763 2008-01-13 Steve Falkenburg <sfalken@apple.com>
21765 Share common files across projects.
21767 Unify vsprops files
21768 Debug: common.vsprops, debug.vsprops
21769 Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
21770 Release: common.vsprops, release.vsprops
21772 Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
21773 debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
21775 Reviewed by Adam Roben.
21777 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
21778 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
21779 * JavaScriptCore.vcproj/debug.vsprops: Removed.
21780 * JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
21781 * JavaScriptCore.vcproj/release.vsprops: Removed.
21782 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
21784 2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
21786 Contributions and review by Adriaan de Groot,
21787 Simon Hausmann, Eric Seidel, and Darin Adler.
21789 - http://bugs.webkit.org/show_bug.cgi?id=16590
21790 Compilation fixes for Solaris.
21793 (KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
21794 for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
21796 (KJS::GregorianDateTime::operator tm): Ditto.
21798 * kjs/collector.cpp:
21799 (KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
21801 * wtf/MathExtras.h:
21802 (isfinite): Implement for Solaris.
21804 (signbit): Ditto. But this one is wrong, so I added a FIXME.
21806 * wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
21808 2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
21810 Reviewed by Anders Carlsson.
21812 Add binding language type to Instance.
21813 Allows runtime determination of the type of an
21814 Instance, to allow safe casting. Doesn't actually
21815 add any safe casting yet, though.
21817 Add a helper function to get an Instance from a JSObject*.
21818 Given an object and the expected binding language, see if
21819 the JSObject actually wraps an Instance of the given type
21820 and return it. Otherwise return 0.
21822 Move RuntimeObjectImp creations into Instance.
21823 Make the ctor protected, and Instance a friend class, so
21824 that all creation of RuntimeObjectImps goes through
21827 Remove copy ctor/assignment operator for QtInstance.
21828 Instance itself is Noncopyable, so QtInstance doesn't
21829 need to have these.
21831 Add caching for QtInstance and associated RuntimeObjectImps.
21832 Push any dealings with QtLanguage bindings into QtInstance,
21833 and cache them there, rather than in the Instance layer. Add
21834 a QtRuntimeObjectImp to help with caching.
21836 * JavaScriptCore.exp:
21837 * bindings/c/c_instance.h:
21838 * bindings/jni/jni_instance.h:
21839 * bindings/objc/objc_instance.h:
21840 * bindings/qt/qt_instance.cpp:
21841 (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
21842 (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
21843 (KJS::Bindings::QtRuntimeObjectImp::invalidate):
21844 (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
21845 (KJS::Bindings::QtInstance::QtInstance):
21846 (KJS::Bindings::QtInstance::~QtInstance):
21847 (KJS::Bindings::QtInstance::getQtInstance):
21848 (KJS::Bindings::QtInstance::getRuntimeObject):
21849 * bindings/qt/qt_instance.h:
21850 (KJS::Bindings::QtInstance::getBindingLanguage):
21851 * bindings/runtime.cpp:
21852 (KJS::Bindings::Instance::createBindingForLanguageInstance):
21853 (KJS::Bindings::Instance::createRuntimeObject):
21854 (KJS::Bindings::Instance::getInstance):
21855 * bindings/runtime.h:
21856 * bindings/runtime_object.h:
21857 (KJS::RuntimeObjectImp::getInternalInstance):
21859 2008-01-12 Alp Toker <alp@atoker.com>
21861 Reviewed by Mark Rowe.
21863 Hide non-public symbols in GTK+/autotools release builds.
21867 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21869 Reviewed by Mark Rowe.
21871 Fix http://bugs.webkit.org/show_bug.cgi?id=16852
21872 Fixes leaking of ActivationStackNode objects.
21874 * kjs/JSGlobalObject.cpp:
21875 (KJS::JSGlobalObject::deleteActivationStack):
21876 (KJS::JSGlobalObject::~JSGlobalObject):
21877 (KJS::JSGlobalObject::init):
21878 (KJS::JSGlobalObject::reset):
21879 * kjs/JSGlobalObject.h:
21881 2008-01-12 Darin Adler <darin@apple.com>
21883 - try to fix Qt Windows build
21885 * pcre/dftables: Remove reliance on the list form of Perl pipes.
21887 2008-01-12 Darin Adler <darin@apple.com>
21889 - try to fix Qt build
21891 * kjs/function.cpp: Added include of scope_chain_mark.h.
21892 * kjs/scope_chain_mark.h: Added multiple-include guards.
21894 2008-01-12 Mark Rowe <mrowe@apple.com>
21896 Another Windows build fix.
21898 * kjs/Activation.h:
21900 2008-01-12 Mark Rowe <mrowe@apple.com>
21902 Attempted Windows build fix. Use struct consistently when forward-declaring
21903 ActivationStackNode and StackActivation.
21905 * kjs/Activation.h:
21906 * kjs/JSGlobalObject.h:
21908 2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21910 Reviewed by Maciej.
21912 Fixes a problem with the ActivationImp tear-off patch (r29425) where
21913 some of the calls to JSGlobalObject::tearOffActivation() were using
21914 the wrong test to determine whether it should leave a relic behind.
21916 * kjs/function.cpp:
21917 (KJS::FunctionImp::argumentsGetter):
21918 (KJS::ActivationImp::getOwnPropertySlot):
21920 2008-01-11 Geoffrey Garen <ggaren@apple.com>
21922 Reviewed by Oliver Hunt.
21924 Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
21925 variable access (16644)
21927 This bug was caused by var declarations shadowing built-in properties of
21930 To match Firefox, we've decided that var declarations will never shadow
21931 built-in properties of the global object or its prototypes. We used to
21932 behave more like IE, which allows shadowing, but walking that line got
21933 us into trouble with websites that sent us down the Firefox codepath.
21935 * kjs/JSVariableObject.h:
21936 (KJS::JSVariableObject::symbolTableGet): New code to support calling
21937 hasProperty before the variable object is fully initialized (so you
21938 can call it during initialization).
21941 (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
21942 check when looking for duplicates, not getDirect, since it only checks
21943 the property map, and not hasOwnProperty, since it doesn't check
21945 (KJS::EvalNode::processDeclarations): ditto
21947 * kjs/property_slot.h:
21948 (KJS::PropertySlot::ungettableGetter): Best function name evar.
21950 2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
21952 Reviewed by Maciej.
21954 Optimized ActivationImp allocation, so that activation records are now
21955 first allocated on an explicitly managed stack and only heap allocated
21956 when necessary. Roughly a 5% improvement on SunSpider, and a larger
21957 improvement on benchmarks that use more function calls.
21959 * JavaScriptCore.xcodeproj/project.pbxproj:
21960 * kjs/Activation.h: Added.
21961 (KJS::ActivationImp::ActivationData::ActivationData):
21962 (KJS::ActivationImp::ActivationImp):
21963 (KJS::ActivationImp::classInfo):
21964 (KJS::ActivationImp::isActivationObject):
21965 (KJS::ActivationImp::isOnStack):
21966 (KJS::ActivationImp::d):
21967 (KJS::StackActivation::StackActivation):
21968 * kjs/ExecState.cpp:
21969 (KJS::ExecState::ExecState):
21970 (KJS::ExecState::~ExecState):
21972 (KJS::ExecState::replaceScopeChainTop):
21973 (KJS::ExecState::setActivationObject):
21974 (KJS::ExecState::setLocalStorage):
21975 * kjs/JSGlobalObject.cpp:
21976 (KJS::JSGlobalObject::reset):
21977 (KJS::JSGlobalObject::pushActivation):
21978 (KJS::JSGlobalObject::checkActivationCount):
21979 (KJS::JSGlobalObject::popActivationHelper):
21980 (KJS::JSGlobalObject::popActivation):
21981 (KJS::JSGlobalObject::tearOffActivation):
21982 * kjs/JSGlobalObject.h:
21983 * kjs/JSVariableObject.h:
21984 (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
21985 (KJS::JSVariableObject::JSVariableObject):
21986 * kjs/function.cpp:
21987 (KJS::FunctionImp::argumentsGetter):
21988 (KJS::ActivationImp::ActivationImp):
21989 (KJS::ActivationImp::~ActivationImp):
21990 (KJS::ActivationImp::init):
21991 (KJS::ActivationImp::getOwnPropertySlot):
21992 (KJS::ActivationImp::markHelper):
21993 (KJS::ActivationImp::mark):
21994 (KJS::ActivationImp::ActivationData::ActivationData):
21995 (KJS::GlobalFuncImp::callAsFunction):
21998 (KJS::PostIncResolveNode::evaluate):
21999 (KJS::PostDecResolveNode::evaluate):
22000 (KJS::PreIncResolveNode::evaluate):
22001 (KJS::PreDecResolveNode::evaluate):
22002 (KJS::ReadModifyResolveNode::evaluate):
22003 (KJS::AssignResolveNode::evaluate):
22004 (KJS::WithNode::execute):
22005 (KJS::TryNode::execute):
22006 (KJS::FunctionBodyNode::processDeclarations):
22007 (KJS::FuncExprNode::evaluate):
22009 * kjs/scope_chain.h:
22010 (KJS::ScopeChain::replace):
22011 * kjs/scope_chain_mark.h: Added.
22012 (KJS::ScopeChain::mark):
22014 2008-01-11 Simon Hausmann <hausmann@webkit.org>
22016 Reviewed by Mark Rowe.
22018 Fix the (clean) qmake build. For generating chartables.c we don't
22019 depend on a separate input source file anymore, the dftables perl
22020 script is enough. So use that instead as value for the .input
22021 variable, to ensure that qmake also generates a rule to call dftables.
22025 2008-01-10 Geoffrey Garen <ggaren@apple.com>
22027 Reviewed by John Sullivan.
22029 Fixed some world leak reports:
22030 * <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
22031 Interpreter after running cvs-base suite
22033 * <rdar://problem/5669423> PLT complains about world leak if browser
22034 window is open when PLT starts
22036 * kjs/collector.h: Added the ability to distinguish between global
22037 objects and GC-protected global objects, since we only consider the
22038 latter to be world leaks.
22039 * kjs/collector.cpp:
22041 2008-01-11 Mark Rowe <mrowe@apple.com>
22043 Silence qmake warning about ctgen lacking input.
22045 Rubber-stamped by Alp Toker.
22049 2008-01-10 David Kilzer <ddkilzer@apple.com>
22051 dftables should be rewritten as a script
22053 <http://bugs.webkit.org/show_bug.cgi?id=16818>
22054 <rdar://problem/5681463>
22058 Rewrote the dftables utility in Perl. Attempted to switch all
22059 build systems to call the script directly instead of building
22060 a binary first. Only the Xcode build was able to be tested.
22062 * DerivedSources.make: Added pcre directory to VPATH and changed
22063 to invoke dftables directly.
22064 * GNUmakefile.am: Removed build information and changed to invoke
22066 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
22068 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
22069 * JavaScriptCore.vcproj/dftables: Removed.
22070 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
22071 * JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
22072 * jscore.bkl: Removed dftables executable definition.
22073 * pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
22074 * pcre/dftables.cpp: Removed.
22075 * pcre/dftables.pro: Removed.
22076 * pcre/pcre.pri: Removed references to dftables.cpp and changed to
22077 invoke dftables directly.
22079 2008-01-10 Dan Bernstein <mitz@apple.com>
22081 Reviewed by Darin Adler.
22083 - fix http://bugs.webkit.org/show_bug.cgi?id=16782
22084 <rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
22086 The crash resulted from a native object (DumpRenderTree's
22087 EventSender) causing its wrapper to be invalidated (by clicking a
22088 link that replaced the document in the window) and consequently
22089 deallocated. The fix is to use RefPtrs to protect the native object
22090 from deletion by self-invalidation.
22092 * bindings/runtime_method.cpp:
22093 (RuntimeMethod::callAsFunction):
22094 * bindings/runtime_object.cpp:
22095 (RuntimeObjectImp::fallbackObjectGetter):
22096 (RuntimeObjectImp::fieldGetter):
22097 (RuntimeObjectImp::methodGetter):
22098 (RuntimeObjectImp::put):
22099 (RuntimeObjectImp::defaultValue):
22100 (RuntimeObjectImp::callAsFunction):
22102 2008-01-07 Mark Rowe <mrowe@apple.com>
22104 Reviewed by Maciej Stachowiak.
22106 Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
22110 * wtf/HashTraits.h:
22112 2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
22116 Enable SVG_FONTS by default.
22118 * Configurations/JavaScriptCore.xcconfig:
22120 2008-01-07 Darin Adler <darin@apple.com>
22122 Rubber stamped by David Kilzer.
22124 - get rid of empty fpconst.cpp
22126 * GNUmakefile.am: Remove fpconst.cpp.
22127 * JavaScriptCore.pri: Ditto.
22128 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
22129 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
22130 * JavaScriptCoreSources.bkl: Ditto.
22132 * kjs/fpconst.cpp: Removed.
22134 2008-01-07 Darin Adler <darin@apple.com>
22136 Reviewed by David Kilzer.
22138 - fix alignment problem with NaN and Inf globals
22140 * kjs/fpconst.cpp: Move the contents of this file from here back to
22141 value.cpp. The reason this was in a separate file is that the DARWIN
22142 version of this used a declaration of the globals with a different
22143 type to avoid creating "init routines". That's no longer necessary for
22144 DARWIN and was never necessary for the non-DARWIN code path.
22145 To make this patch easy to merge, I didn't actually delete this file
22146 yet. We'll do that in a separate changeset.
22148 * kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
22149 othrewise use the union trick from fpconst.cpp. I think it would be
22150 better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
22151 directly or std::numeric_limits<double>::quiet_nan() and
22152 std::numeric_limits<double>::infinity(). But when I tried that, it
22153 slowed down SunSpider. Someone else could do that cleanup if they
22154 could do it without slowing down the engine.
22156 2008-01-07 Adam Roben <aroben@apple.com>
22160 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
22161 JavaScript.h to the project.
22162 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
22163 Copy JavaScript.h to WEBKITOUTPUTDIR.
22165 2008-01-07 Timothy Hatcher <timothy@apple.com>
22173 * API/JSNodeList.c:
22174 * API/JSNodeList.h:
22175 * API/JavaScript.h:
22176 * API/JavaScriptCore.h:
22178 * JavaScriptCore.xcodeproj/project.pbxproj:
22180 2008-01-07 Alp Toker <alp@atoker.com>
22184 http://bugs.webkit.org/show_bug.cgi?id=16029
22185 JavaScriptCore.h is not suitable for platforms other than Mac OS X
22187 Introduce a new JavaScriptCore/JavaScript.h public API header. This
22188 should be used by all new portable code using the JavaScriptCore API.
22190 JavaScriptCore/JavaScriptCore.h will remain for compatibility with
22191 existing applications that depend on it including JSStringRefCF.h
22192 which isn't portable.
22194 Also add minidom to the GTK+/autotools build since we can now support
22195 it on all platforms.
22198 * API/JSNodeList.h:
22199 * API/JavaScript.h: Added.
22200 * API/JavaScriptCore.h:
22201 * ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
22203 * JavaScriptCore.xcodeproj/project.pbxproj:
22205 2008-01-06 Eric Seidel <eric@webkit.org>
22209 Abstract all DateObject.set* functions in preparation for fixing:
22210 http://bugs.webkit.org/show_bug.cgi?id=16753
22212 SunSpider had random changes here and there but was overall a wash.
22214 * kjs/date_object.cpp:
22215 (KJS::fillStructuresUsingTimeArgs):
22216 (KJS::setNewValueFromTimeArgs):
22217 (KJS::setNewValueFromDateArgs):
22218 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
22219 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
22220 (KJS::DateProtoFuncSetSeconds::callAsFunction):
22221 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
22222 (KJS::DateProtoFuncSetMinutes::callAsFunction):
22223 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
22224 (KJS::DateProtoFuncSetHours::callAsFunction):
22225 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
22226 (KJS::DateProtoFuncSetDate::callAsFunction):
22227 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
22228 (KJS::DateProtoFuncSetMonth::callAsFunction):
22229 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
22230 (KJS::DateProtoFuncSetFullYear::callAsFunction):
22231 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
22233 2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
22237 Add new helper function isArabicChar - SVG Fonts support needs it.
22239 * wtf/unicode/icu/UnicodeIcu.h:
22240 (WTF::Unicode::isArabicChar):
22241 * wtf/unicode/qt4/UnicodeQt4.h:
22242 (WTF::Unicode::isArabicChar):
22244 2008-01-06 Alp Toker <alp@atoker.com>
22246 Reviewed by Mark Rowe.
22248 Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
22249 build. (This is already done correctly in DerivedSources.make.) Issue
22250 noticed by Mikkel when building in Cygwin.
22252 Add a missing slash. This was a hack from the qmake build system that
22253 isn't necessary with autotools.
22257 2008-01-05 Darin Adler <darin@apple.com>
22259 * API/JSRetainPtr.h: One more file that needed the change below.
22261 2008-01-05 Darin Adler <darin@apple.com>
22263 * wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
22265 2008-01-05 Adam Roben <aroben@apple.com>
22269 Reviewed by Maciej.
22271 * wtf/RetainPtr.h: Use PtrType instead of T* because of the
22272 RemovePointer magic.
22274 2008-01-05 Darin Adler <darin@apple.com>
22276 Rubber stamped by Maciej Stachowiak.
22278 - cut down own PIC branches by using a pointer-to-member-data instead of a
22279 pointer-to-member-function in WTF smart pointers
22281 * wtf/OwnArrayPtr.h:
22283 * wtf/PassRefPtr.h:
22286 Use a pointer to the m_ptr member instead of the get member.
22287 The GCC compiler generates better code for this idiom.
22289 2008-01-05 Henry Mason <hmason@mac.com>
22291 Reviewed by Maciej Stachowiak.
22293 http://bugs.webkit.org/show_bug.cgi?id=16738
22294 Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
22296 Gives a 0.4% SunSpider boost and prettier code.
22298 * kjs/collector.cpp: Switched to cell offsets from byte offsets
22299 (KJS::Collector::heapAllocate):
22300 (KJS::Collector::sweep):
22302 2008-01-04 Mark Rowe <mrowe@apple.com>
22304 Reviewed by Maciej Stachowiak.
22306 Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
22307 Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
22308 was not allocated by any registered malloc zone on the system.
22310 * kjs/CollectorHeapIntrospector.h:
22311 * wtf/FastMalloc.cpp:
22313 2008-01-04 Alp Toker <alp@atoker.com>
22315 GTK+ autotools build fix. Terminate empty rules.
22319 2008-01-03 Simon Hausmann <hausmann@webkit.org>
22321 Reviewed by Mark Rowe.
22323 Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
22325 * pcre/pcre_exec.cpp:
22327 2008-01-03 Darin Adler <darin@apple.com>
22329 * tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
22330 case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
22331 that test to succeed.
22333 2008-01-02 Darin Adler <darin@apple.com>
22337 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
22338 JSCRE fails fails to match Acid3 regexp
22340 Test: fast/regex/early-acid3-86.html
22342 The problem was with the cutoff point between backreferences and octal
22343 escape sequences. We need to determine the cutoff point by counting the
22344 total number of capturing brackets, which requires an extra pass through
22345 the expression when compiling it.
22347 * pcre/pcre_compile.cpp:
22348 (CompileData::CompileData): Added numCapturingBrackets. Removed some
22350 (compileBranch): Use numCapturingBrackets when calling checkEscape.
22351 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
22352 checkEscape, and also store the bracket count at the end of the compile.
22353 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
22354 count the number of brackets and then a second time to calculate the length.
22356 2008-01-02 Darin Adler <darin@apple.com>
22360 - fix http://bugs.webkit.org/show_bug.cgi?id=16696
22361 JSCRE fails fails to match Acid3 regexp
22363 Test: fast/regex/early-acid3-86.html
22365 The problem was with the cutoff point between backreferences and octal
22366 escape sequences. We need to determine the cutoff point by counting the
22367 total number of capturing brackets, which requires an extra pass through
22368 the expression when compiling it.
22370 * pcre/pcre_compile.cpp:
22371 (CompileData::CompileData): Added numCapturingBrackets. Removed some
22373 (compileBranch): Use numCapturingBrackets when calling checkEscape.
22374 (calculateCompiledPatternLength): Use numCapturingBrackets when calling
22375 checkEscape, and also store the bracket count at the end of the compile.
22376 (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
22377 count the number of brackets and then a second time to calculate the length.
22379 2008-01-02 David Kilzer <ddkilzer@webkit.org>
22381 Reviewed and landed by Darin.
22384 (KJS::DoWhileNode::execute): Added a missing return.
22386 2008-01-02 Darin Adler <darin@apple.com>
22388 - try to fix Qt build
22390 * wtf/unicode/qt4/UnicodeQt4.h:
22391 (WTF::Unicode::foldCase): Add some missing const.
22393 2008-01-02 Alice Liu <alice.liu@apple.com>
22395 Reviewed by Sam Weinig.
22397 need to export ASCIICType.h for use in DRT
22399 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
22400 * wtf/ASCIICType.h:
22401 (WTF::isASCIIUpper):
22403 2008-01-02 Sam Weinig <sam@webkit.org>
22405 Reviewed by Beth Dakin.
22407 Cleanup error_object.h/cpp.
22409 * kjs/JSGlobalObject.cpp:
22410 (KJS::JSGlobalObject::reset):
22411 * kjs/error_object.cpp:
22412 (KJS::ErrorInstance::ErrorInstance):
22413 (KJS::ErrorPrototype::ErrorPrototype):
22414 (KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
22415 (KJS::ErrorProtoFuncToString::callAsFunction):
22416 (KJS::ErrorObjectImp::ErrorObjectImp):
22417 (KJS::ErrorObjectImp::implementsConstruct):
22418 (KJS::ErrorObjectImp::construct):
22419 (KJS::ErrorObjectImp::callAsFunction):
22420 (KJS::NativeErrorPrototype::NativeErrorPrototype):
22421 (KJS::NativeErrorImp::NativeErrorImp):
22422 (KJS::NativeErrorImp::implementsConstruct):
22423 (KJS::NativeErrorImp::construct):
22424 (KJS::NativeErrorImp::callAsFunction):
22425 (KJS::NativeErrorImp::mark):
22426 * kjs/error_object.h:
22427 (KJS::ErrorInstance::classInfo):
22428 (KJS::NativeErrorImp::classInfo):
22430 2008-01-02 Mark Rowe <mrowe@apple.com>
22432 Rubber-stamped by Alp Toker.
22434 * GNUmakefile.am: Add missing dependency on grammar.y.
22436 2008-01-01 Darin Adler <darin@apple.com>
22440 - fix for http://bugs.webkit.org/show_bug.cgi?id=16695
22441 JSC allows non-identifier codepoints in identifiers (affects Acid3)
22443 Test: fast/js/kde/parse.html
22446 (KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
22447 start of identifiers from ones inside identifiers. Rejected characters that don't pass
22448 the isIdentStart and isIdentPart tests.
22449 (KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
22451 * kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
22452 from \u escapes inside identifiers.
22454 2008-01-01 Darin Adler <darin@apple.com>
22456 - rolled scope chain optimization out; it was breaking the world
22458 2008-01-01 Darin Adler <darin@apple.com>
22462 - http://bugs.webkit.org/show_bug.cgi?id=16685
22463 eliminate List::empty() to cut down on PIC branches
22465 Also included one other speed-up -- remove the call to reserveCapacity from
22466 FunctionBodyNode::processDeclarations in all but the most unusual cases.
22468 Together these make SunSpider 1.016x as fast.
22470 * JavaScriptCore.exp: Updated.
22471 * kjs/ExecState.cpp:
22472 (KJS::globalEmptyList): Added. Called only when creating global ExecState
22474 (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
22475 for the three separate node types. Also went through each of the three and
22476 streamlined as much as possible, removing dead code. This prevents us from having
22477 to access the global in the function body version of the constructor.
22479 * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
22480 three that are specific to the different node types that can create new execution
22483 * kjs/array_object.cpp:
22484 (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
22486 (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
22487 (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
22488 (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
22489 (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
22490 * kjs/function.cpp:
22491 (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
22492 (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
22493 * kjs/function_object.cpp:
22494 (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
22496 * kjs/list.cpp: Removed List::empty.
22497 * kjs/list.h: Ditto.
22500 (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
22501 (KJS::ArrayNode::evaluate): Ditto.
22502 (KJS::ObjectLiteralNode::evaluate): Ditto.
22503 (KJS::PropertyListNode::evaluate): Ditto.
22504 (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
22505 before calling reserveCapacity, because it doesn't get inlined the local storage
22506 vector is almost always big enough -- saving the function call overhead is a big
22508 (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
22509 (KJS::FuncExprNode::evaluate): Ditto.
22511 (KJS::tryGetAndCallProperty): Ditto.
22512 * kjs/property_slot.cpp:
22513 (KJS::PropertySlot::functionGetter): Ditto.
22514 * kjs/string_object.cpp:
22515 (KJS::StringProtoFuncSplit::callAsFunction): Ditto.
22517 2008-01-01 Darin Adler <darin@apple.com>
22521 - fix http://bugs.webkit.org/show_bug.cgi?id=16648
22522 REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
22523 <rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
22525 Fixes 34 failing test cases in the fast/regex/test1.html test.
22527 Restored the stack which prevents infinite loops for brackets that match the empty
22528 string; it had been removed as an optimization.
22530 Unfortunately, restoring this stack causes the regular expression test in SunSpider
22531 to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
22532 a correct optimization to restore the speed!
22534 It's possible the original change was on the right track but just off by one.
22536 * pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
22537 (MatchStack::pushNewFrame): Add back the logic needed here.
22538 (startNewGroup): Ditto.
22541 2008-01-01 Darin Adler <darin@apple.com>
22545 - http://bugs.webkit.org/show_bug.cgi?id=16683
22546 speed up function calls by making ScopeChain::push cheaper
22548 This gives a 1.019x speedup on SunSpider.
22550 After doing this, I realized this probably will be obsolete when the optimization
22551 to avoid creating an activation object is done. When we do that one we should check
22552 if rolling this out will speed things up, since this does add overhead at the time
22553 you copy the scope chain.
22555 * kjs/object.h: Removed the ScopeChain::release function. It was
22556 marked inline, and called in exactly one place, so moved it there.
22557 No idea why it was in this header file!
22559 * kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
22560 function that takes another ScopeChain. It was unused. I think we used
22561 it over in WebCore at one point, but not any more.
22563 * kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
22564 a class, got rid of its constructor so we can have one that's uninitialized,
22565 and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
22566 mutable so it can be changed in the moveToHeap function. Changed the copy
22567 constructor and assignment operator to call moveToHeap, since the top node
22568 can't be shared when it's embedded in another ScopeChain object. Updated
22569 functions as needed to handle the case where the first object isn't on the
22570 heap or to add casts for cases where it's guaranteed to be. Changed the push
22571 function to always put the new node into the ScopeChain object; it will get
22572 put onto the heap when needed later.
22574 2008-01-01 Geoffrey Garen <ggaren@apple.com>
22576 Reviewed by Darin Adler.
22578 Fixed slight logic error in reserveCapacity, where we would reallocate
22579 the storage buffer unnecessarily.
22582 (WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
22583 equal to capacity().
22585 2008-01-01 Darin Adler <darin@apple.com>
22587 Reviewed by Oliver.
22589 - http://bugs.webkit.org/show_bug.cgi?id=16684
22590 eliminate debugger overhead from function body execution
22592 Speeds SunSpider up 1.003x. That's a small amount, but measurable.
22594 * JavaScriptCore.exp: Updated.
22596 (KJS::Parser::parse): Create the node with a static member function named create() instead
22597 of using new explicitly.
22599 * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
22602 (KJS::ProgramNode::create): Added. Calls new.
22603 (KJS::EvalNode::create): Ditto.
22604 (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
22605 when a debugger is present.
22606 (KJS::FunctionBodyNode::execute): Removed debugger hooks.
22607 (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
22608 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
22609 then the debugger again.
22611 * kjs/nodes.h: Added create functions, made the constructors private and protected.
22613 2007-12-30 Eric Seidel <eric@webkit.org>
22617 More small cleanup to array_object.cpp
22619 * kjs/array_object.cpp:
22620 (KJS::ArrayProtoFuncToString::callAsFunction):
22621 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
22622 (KJS::ArrayProtoFuncJoin::callAsFunction):
22623 (KJS::ArrayProtoFuncConcat::callAsFunction):
22624 (KJS::ArrayProtoFuncReverse::callAsFunction):
22625 (KJS::ArrayProtoFuncShift::callAsFunction):
22626 (KJS::ArrayProtoFuncSlice::callAsFunction):
22627 (KJS::ArrayProtoFuncSort::callAsFunction):
22628 (KJS::ArrayProtoFuncSplice::callAsFunction):
22629 (KJS::ArrayProtoFuncUnShift::callAsFunction):
22630 (KJS::ArrayProtoFuncFilter::callAsFunction):
22631 (KJS::ArrayProtoFuncMap::callAsFunction):
22632 (KJS::ArrayProtoFuncEvery::callAsFunction):
22634 2007-12-30 Eric Seidel <eric@webkit.org>
22638 Apply wkstyle to array_object.cpp
22640 * kjs/array_object.cpp:
22641 (KJS::ArrayPrototype::ArrayPrototype):
22642 (KJS::ArrayPrototype::getOwnPropertySlot):
22643 (KJS::ArrayProtoFuncConcat::callAsFunction):
22644 (KJS::ArrayProtoFuncPop::callAsFunction):
22645 (KJS::ArrayProtoFuncReverse::callAsFunction):
22646 (KJS::ArrayProtoFuncShift::callAsFunction):
22647 (KJS::ArrayProtoFuncSlice::callAsFunction):
22648 (KJS::ArrayProtoFuncSort::callAsFunction):
22649 (KJS::ArrayProtoFuncSplice::callAsFunction):
22650 (KJS::ArrayProtoFuncUnShift::callAsFunction):
22651 (KJS::ArrayProtoFuncFilter::callAsFunction):
22652 (KJS::ArrayProtoFuncMap::callAsFunction):
22653 (KJS::ArrayProtoFuncEvery::callAsFunction):
22654 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
22655 (KJS::ArrayObjectImp::ArrayObjectImp):
22656 (KJS::ArrayObjectImp::implementsConstruct):
22657 (KJS::ArrayObjectImp::construct):
22658 (KJS::ArrayObjectImp::callAsFunction):
22660 2007-12-30 Eric Seidel <eric@webkit.org>
22664 Remove maxInt/minInt, replacing with std:max/min<int>()
22666 * kjs/array_object.cpp:
22667 (KJS::ArrayProtoFuncSplice::callAsFunction):
22668 * kjs/operations.cpp:
22669 * kjs/operations.h:
22671 2007-12-30 Eric Seidel <eric@webkit.org>
22675 Update Number.toString to properly throw exceptions.
22676 Cleanup code in Number.toString implementation.
22678 * kjs/number_object.cpp:
22679 (KJS::numberToString):
22681 (KJS::Error::create): Remove bogus debug lines.
22683 2007-12-28 Eric Seidel <eric@webkit.org>
22685 Reviewed by Oliver.
22687 ASSERT when debugging via Drosera due to missed var lookup optimization.
22688 http://bugs.webkit.org/show_bug.cgi?id=16634
22690 No test case possible.
22693 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
22696 2007-12-28 Eric Seidel <eric@webkit.org>
22698 Reviewed by Oliver.
22700 Fix (-0).toFixed() and re-factor a little
22701 Fix (-0).toExponential() and printing of trailing 0s in toExponential
22702 Fix toPrecision(nan) handling
22703 http://bugs.webkit.org/show_bug.cgi?id=16640
22705 * kjs/number_object.cpp:
22706 (KJS::numberToFixed):
22707 (KJS::fractionalPartToString):
22708 (KJS::numberToExponential):
22709 (KJS::numberToPrecision):
22711 2007-12-28 Eric Seidel <eric@webkit.org>
22715 More changes to make number code readable
22717 * kjs/number_object.cpp:
22718 (KJS::integer_part_noexp):
22719 (KJS::numberToFixed):
22720 (KJS::numberToExponential):
22722 2007-12-28 Eric Seidel <eric@webkit.org>
22726 More small cleanups to toPrecision
22728 * kjs/number_object.cpp:
22729 (KJS::numberToPrecision):
22731 2007-12-28 Eric Seidel <eric@webkit.org>
22735 More small attempts to make number code readable
22737 * kjs/number_object.cpp:
22738 (KJS::exponentialPartToString):
22739 (KJS::numberToExponential):
22740 (KJS::numberToPrecision):
22742 2007-12-28 Eric Seidel <eric@webkit.org>
22746 Break out callAsFunction implementations into static functions
22748 * kjs/number_object.cpp:
22749 (KJS::numberToString):
22750 (KJS::numberToFixed):
22751 (KJS::numberToExponential):
22752 (KJS::numberToPrecision):
22753 (KJS::NumberProtoFunc::callAsFunction):
22755 2007-12-28 Eric Seidel <eric@webkit.org>
22759 Apply wkstyle/astyle and fix placement of *
22761 * kjs/number_object.cpp:
22762 (KJS::NumberInstance::NumberInstance):
22763 (KJS::NumberPrototype::NumberPrototype):
22764 (KJS::NumberProtoFunc::NumberProtoFunc):
22765 (KJS::integer_part_noexp):
22767 (KJS::NumberProtoFunc::callAsFunction):
22768 (KJS::NumberObjectImp::NumberObjectImp):
22769 (KJS::NumberObjectImp::getOwnPropertySlot):
22770 (KJS::NumberObjectImp::getValueProperty):
22771 (KJS::NumberObjectImp::implementsConstruct):
22772 (KJS::NumberObjectImp::construct):
22773 (KJS::NumberObjectImp::callAsFunction):
22775 (KJS::JSObject::put):
22777 2007-12-27 Eric Seidel <eric@webkit.org>
22781 ASSERT in JavaScriptCore while viewing WICD test case
22782 http://bugs.webkit.org/show_bug.cgi?id=16626
22785 (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
22787 2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
22789 Reviewed by Alp Toker.
22791 http://bugs.webkit.org/show_bug.cgi?id=16390
22792 Use autotools or GNU make as the build system for the GTK port
22794 * GNUmakefile.am: Added.
22796 2007-12-25 Maciej Stachowiak <mjs@apple.com>
22798 Reviewed by Oliver.
22800 - Remove unnecessary redundant check from property setting
22801 http://bugs.webkit.org/show_bug.cgi?id=16602
22803 1.3% speedup on SunSpider.
22806 (KJS::JSObject::put): Don't do canPut check when not needed; let
22807 the PropertyMap handle it.
22808 (KJS::JSObject::canPut): Don't check the static property
22809 table. lookupPut does that already.
22811 2007-12-24 Alp Toker <alp@atoker.com>
22813 Fix builds that don't use AllInOneFile.cpp following breakage
22814 introduced in r28973.
22818 2007-12-24 Maciej Stachowiak <mjs@apple.com>
22822 - Optimize variable declarations
22823 http://bugs.webkit.org/show_bug.cgi?id=16585
22825 3.5% speedup on SunSpider.
22827 var statements now result in either assignments or empty statements.
22829 This allows a couple of optimization opportunities:
22830 - No need to branch at runtime to check if there is an initializer
22831 - EmptyStatementNodes can be removed entirely (also done in this patch)
22832 - Assignment expressions get properly optimized for local variables
22834 This patch also includes some code cleanup:
22835 - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
22836 thus it is renamed appropriately
22837 - AssignExprNode is gone
22839 * JavaScriptCore.exp:
22843 (KJS::SourceElements::append):
22844 (KJS::ConstDeclNode::ConstDeclNode):
22845 (KJS::ConstDeclNode::optimizeVariableAccess):
22846 (KJS::ConstDeclNode::handleSlowCase):
22847 (KJS::ConstDeclNode::evaluateSingle):
22848 (KJS::ConstDeclNode::evaluate):
22849 (KJS::ConstStatementNode::optimizeVariableAccess):
22850 (KJS::ConstStatementNode::execute):
22851 (KJS::VarStatementNode::optimizeVariableAccess):
22852 (KJS::VarStatementNode::execute):
22853 (KJS::ForInNode::ForInNode):
22854 (KJS::ForInNode::optimizeVariableAccess):
22855 (KJS::ForInNode::execute):
22856 (KJS::FunctionBodyNode::initializeSymbolTable):
22857 (KJS::ProgramNode::initializeSymbolTable):
22858 (KJS::FunctionBodyNode::processDeclarations):
22859 (KJS::ProgramNode::processDeclarations):
22860 (KJS::EvalNode::processDeclarations):
22862 (KJS::DeclarationStacks::):
22863 (KJS::StatementNode::):
22864 (KJS::ConstDeclNode::):
22865 (KJS::ConstStatementNode::):
22866 (KJS::EmptyStatementNode::):
22867 (KJS::VarStatementNode::):
22869 * kjs/nodes2string.cpp:
22870 (KJS::ConstDeclNode::streamTo):
22871 (KJS::ConstStatementNode::streamTo):
22872 (KJS::ScopeNode::streamTo):
22873 (KJS::VarStatementNode::streamTo):
22874 (KJS::ForNode::streamTo):
22875 (KJS::ForInNode::streamTo):
22877 2007-12-21 Mark Rowe <mrowe@apple.com>
22879 Reviewed by Oliver Hunt.
22881 * JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
22882 being generated in JavaScriptCore.framework.
22884 2007-12-21 Darin Adler <darin@apple.com>
22886 Requested by Maciej.
22888 * kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
22889 KJS_NO_INLINE. We don't want to have two, and we figured it was better
22890 to keep the one that's in WTF.
22892 2007-12-21 Darin Adler <darin@apple.com>
22896 - http://bugs.webkit.org/show_bug.cgi?id=16561
22897 remove debugger overhead from non-debugged JavaScript execution
22899 1.022x as fast on SunSpider.
22901 * JavaScriptCore.exp: Updated.
22903 * kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
22904 since that more accurately describes the role of this object, which
22905 is a reference-counted wrapper for a Vector.
22908 (KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
22909 and use plain assignment instead of set.
22910 * kjs/Parser.h: Changed parameter type of didFinishParsing to a
22911 SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
22912 of an OwnPtr as well.
22914 * kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
22915 That's now handed inside the constructors for various node types, since we now
22916 use vector swapping instead.
22919 (KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
22920 and we want exception handling out of the normal code flow.
22921 (KJS::SourceElements::append): Moved here from the header. This now handles
22922 creating a BreakpointCheckStatement for each statement in the debugger case.
22923 That way we can get breakpoint handling without having it in every execute function.
22924 (KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
22925 (KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
22926 in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
22927 (KJS::BreakpointCheckStatement::streamTo): Added.
22928 (KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
22930 (KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
22931 (KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
22932 Changed code to use release since the class now contains a vector rather than
22934 (KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
22935 rather than a vector pointer.
22936 (KJS::BlockNode::execute): Ditto.
22937 (KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
22938 (KJS::IfNode::execute): Ditto.
22939 (KJS::IfElseNode::execute): Ditto.
22940 (KJS::DoWhileNode::execute): Ditto.
22941 (KJS::WhileNode::execute): Ditto.
22942 (KJS::ContinueNode::execute): Ditto.
22943 (KJS::BreakNode::execute): Ditto.
22944 (KJS::ReturnNode::execute): Ditto.
22945 (KJS::WithNode::execute): Ditto.
22946 (KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
22947 rather than a vector pointer.
22948 (KJS::CaseClauseNode::executeStatements): Ditto.
22949 (KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
22950 (KJS::ThrowNode::execute): Ditto.
22951 (KJS::TryNode::execute): Ditto.
22952 (KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
22953 (KJS::ProgramNode::ProgramNode): Ditto.
22954 (KJS::EvalNode::EvalNode): Ditto.
22955 (KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
22956 (KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
22957 rather than a vector pointer.
22959 * kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
22960 Renamed SourceElementsStub to SourceElements and made it derive from
22961 ParserRefCounted rather than from Node, hold a vector rather than a pointer to
22962 a vector, and changed the release function to swap with another vector rather
22963 than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
22964 vectors instead of pointers to vectors. Added BreakpointCheckStatement.
22966 * kjs/nodes2string.cpp:
22967 (KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
22969 (KJS::BlockNode::streamTo): Ditto.
22970 (KJS::CaseClauseNode::streamTo): Ditto.
22972 * wtf/AlwaysInline.h: Added NEVER_INLINE.
22973 * wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
22974 ones in OwnPtr and auto_ptr.
22975 * wtf/RefPtr.h: Ditto.
22977 2007-12-21 Darin Adler <darin@apple.com>
22979 - fix broken regression tests
22981 The broken tests were fast/js/do-while-expression-value.html and
22982 fast/js/while-expression-value.html.
22984 * kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
22985 an old version of my patch for bug 16471.
22986 (KJS::statementListExecute): The logic here was backwards. Have to set the value
22987 even for non-normal execution results.
22989 2007-12-20 Alexey Proskuryakov <ap@webkit.org>
22993 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
22996 2007-12-20 Eric Seidel <eric@webkit.org>
23000 Split IfNode into IfNode and IfElseNode for speedup.
23001 http://bugs.webkit.org/show_bug.cgi?id=16470
23003 SunSpider claims this is 1.003x as fast as before.
23004 (This required running with --runs 15 to get consistent enough results to tell!)
23008 (KJS::IfNode::optimizeVariableAccess):
23009 (KJS::IfNode::execute):
23010 (KJS::IfNode::getDeclarations):
23011 (KJS::IfElseNode::optimizeVariableAccess):
23012 (KJS::IfElseNode::execute):
23013 (KJS::IfElseNode::getDeclarations):
23016 (KJS::IfElseNode::):
23017 * kjs/nodes2string.cpp:
23018 (KJS::IfNode::streamTo):
23019 (KJS::IfElseNode::streamTo):
23021 2007-12-20 Darin Adler <darin@apple.com>
23026 (WTF::operator==): Added.
23027 (WTF::operator!=): Added.
23029 2007-12-20 Geoffrey Garen <ggaren@apple.com>
23031 Reviewed by Oliver Hunt.
23033 AST optimization: Avoid NULL-checking ForNode's child nodes.
23035 0.6% speedup on SunSpider.
23037 This is a proof of concept patch that demonstrates how to optimize
23038 grammar productions with optional components, like
23040 for (optional; optional; optional) {
23044 The parser emits NULL for an optional component that is not present.
23046 Instead of checking for a NULL child at execution time, a node that
23047 expects an optional component to be present more often than not checks
23048 for a NULL child at construction time, and substitutes a viable
23049 alternative node in its place.
23051 (We'd like the parser to start emitting NULL a lot more once we teach
23052 it to emit NULL for certain no-op productions like EmptyStatement and
23053 VariableStatement, so, as a foundation, it's important for nodes with
23054 NULL optional components to be fast.)
23057 (KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
23058 moved didFinishParsing into the .cpp file because adding a branch while
23059 it was in the header file caused a substantial and inexplicable
23060 performance regression. (Did I mention that GCC is crazy?)
23065 (KJS::BlockNode::BlockNode): Check for NULL SourceElements.
23066 (KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
23067 (KJS::ForNode::execute): No need to check for NULL here.
23069 (KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
23070 because it's semantically harmless, and it evaluates to boolean in an
23073 2007-12-20 Oliver Hunt <oliver@apple.com>
23077 Slight logic reordering in JSImmediate::from(double)
23079 This gives a 0.6% improvement in SunSpider.
23081 * kjs/JSImmediate.h:
23082 (KJS::JSImmediate::from):
23084 2007-12-20 Eric Seidel <eric@webkit.org>
23088 Fix major Array regression introduced by 28899.
23090 SunSpider claims this is at least 1.37x as fast as pre-regression. :)
23092 * kjs/array_instance.cpp: make Arrays fast again!
23094 2007-12-20 Eric Seidel <eric@webkit.org>
23096 Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
23098 Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
23099 http://bugs.webkit.org/show_bug.cgi?id=16537
23101 Make msToYear human-readable
23102 Make msToDayInMonth slightly more readable and avoid recalculating msToYear
23103 Remove use of isInLeapYear to avoid calling msToYear
23104 Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
23105 Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
23107 * kjs/DateMath.cpp:
23108 (KJS::daysFrom1970ToYear):
23110 (KJS::monthFromDayInYear):
23112 (KJS::dayInMonthFromDayInYear):
23113 (KJS::dateToDayInYear):
23114 (KJS::getDSTOffsetSimple):
23115 (KJS::getDSTOffset):
23116 (KJS::gregorianDateTimeToMS):
23117 (KJS::msToGregorianDateTime):
23119 2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
23121 Reviewed by Darin Adler.
23123 Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
23124 Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
23125 This is for building with X11, as some type and enum names conflict
23126 with #define names in X11 headers.
23127 http://bugs.webkit.org/show_bug.cgi?id=15669
23129 * JavaScriptCore.xcodeproj/project.pbxproj:
23130 * bindings/NP_jsobject.h:
23131 * bindings/npapi.h:
23132 * bindings/npruntime.cpp:
23133 * bindings/npruntime_impl.h:
23134 * bindings/npruntime_priv.h:
23135 * bindings/npruntime_internal.h:
23136 * bindings/testbindings.cpp:
23137 * bindings/c/c_class.h:
23138 * bindings/c/c_runtime.h:
23139 * bindings/c/c_utility.h:
23141 2007-12-20 Darin Adler <darin@apple.com>
23143 - re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
23144 Completions need to be smaller (or not exist at all)
23146 Same patch as last time with the test failures problem fixed.
23148 * kjs/function.cpp:
23149 (KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
23150 type from newExec to see if the execute raised an exception.
23152 2007-12-20 Darin Adler <darin@apple.com>
23154 - roll out that last change -- it was causing test failures;
23155 I'll check it back in after fixing them
23157 2007-12-20 Darin Adler <darin@apple.com>
23161 - http://bugs.webkit.org/show_bug.cgi?id=16471
23162 Completions need to be smaller (or not exist at all)
23164 SuSpider shows 2.4% speedup.
23166 Stop using completions in the execution engine.
23167 Instead, the completion type and label target are both
23168 stored in the ExecState.
23170 * API/JSContextRef.cpp: Removed unneeded include of "completion.h".
23171 * bindings/runtime_method.cpp: Removed unused execute function.
23172 * bindings/runtime_method.h: Ditto.
23174 * kjs/ExecState.h: Added completionType, breakOrContinueTarget,
23175 setCompletionType, setNormalCompletion, setBreakCompletion,
23176 setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
23177 setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
23179 * kjs/completion.h: Removed constructor and getter for target
23180 for break and continue from Completion. This class is now only
23181 used for the public API to Interpreter and such.
23183 * kjs/date_object.h: Removed unused execute function.
23185 * kjs/function.cpp:
23186 (KJS::FunctionImp::callAsFunction): Removed some unneeded
23187 exception processing. Updated to call the new execute function
23188 and to get the completion type from the ExecState. Merged in
23189 the execute function, which repeated some of the same logic and
23190 was called only from here.
23191 (KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
23192 * kjs/function.h: Removed execute.
23194 * kjs/interpreter.cpp:
23195 (KJS::Interpreter::evaluate): Added code to convert the result of
23196 execut into a Completion.
23199 (KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
23200 Now sets the completion type in the ExecState.
23201 (KJS::Node::rethrowException): Now sets the completion type in the
23203 (KJS::StatementNode::hitStatement): Now sets the completion type in
23205 (KJS::VarStatementNode::execute): Updated to put completion type in
23206 the ExecState instead of a Completion object.
23207 (KJS::statementListExecute): Ditto. Also changed the for loop to use
23208 indices instead of iterators.
23209 (KJS::BlockNode::execute): Updated return type.
23210 (KJS::EmptyStatementNode::execute): Updated to put completion type in
23211 the ExecState instead of a Completion object.
23212 (KJS::ExprStatementNode::execute): Ditto.
23213 (KJS::IfNode::execute): Ditto.
23214 (KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
23215 to make the normal case a little faster and moved the end outside the
23216 loop so that "break" can do a break.
23217 (KJS::WhileNode::execute): Ditto.
23218 (KJS::ForNode::execute): Ditto.
23219 (KJS::ForInNode::execute): Ditto.
23220 (KJS::ContinueNode::execute): Updated to put completion type in
23221 the ExecState instead of a Completion object.
23222 (KJS::BreakNode::execute): Ditto.
23223 (KJS::ReturnNode::execute): Ditto.
23224 (KJS::WithNode::execute): Ditto.
23225 (KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
23226 execute in its name to reflect the fact that it's a member of the same
23227 family of functions.
23228 (KJS::CaseBlockNode::executeBlock): Ditto.
23229 (KJS::SwitchNode::execute): Ditto.
23230 (KJS::LabelNode::execute): Ditto.
23231 (KJS::ThrowNode::execute): Ditto.
23232 (KJS::TryNode::execute): Ditto.
23233 (KJS::ProgramNode::execute): Ditto.
23234 (KJS::EvalNode::execute): Ditto.
23235 (KJS::FunctionBodyNode::execute): Ditto.
23236 (KJS::FuncDeclNode::execute): Ditto.
23238 * kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
23239 hitStatement protected, changed return value of execute to a JSValue,
23240 renamed evalStatements to executeStatements, and evalBlock to executeBlock.
23242 * kjs/number_object.h: Removed unused execute function.
23244 2007-12-20 Geoffrey Garen <ggaren@apple.com>
23246 Added Radar number.
23249 (KJS::ProgramNode::processDeclarations):
23251 2007-12-20 Geoffrey Garen <ggaren@apple.com>
23253 Linux build fix: config.h has to come first.
23255 * kjs/error_object.cpp:
23257 2007-12-19 Geoffrey Garen <ggaren@apple.com>
23259 Reviewed by Oliver Hunt.
23261 Optimized global access to global variables, using a symbol table.
23263 SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
23264 and a whopping 33.1% speedup on bitops-bitwise-and.
23266 * API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
23267 calls to Base::, since JSObject is not always our base class. This
23268 was always a bug, but the bug is even more apparent after some of my
23271 (KJS::::staticFunctionGetter): Replaced use of getDirect with call to
23272 getOwnPropertySlot. Global declarations are no longer stored in the
23273 property map, so a call to getDirect is insufficient for finding
23274 override properties.
23277 * API/testapi.js: Added test for the getDirect change mentioned above.
23279 * kjs/ExecState.cpp:
23280 * kjs/ExecState.h: Dialed back the optimization to store a direct
23281 pointer to the localStorage buffer. One ExecState can grow the global
23282 object's localStorage without another ExecState's knowledge, so
23283 ExecState can't store a direct pointer to the localStorage buffer
23284 unless/until we invent a way to update all the relevant ExecStates.
23286 * kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
23288 (KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
23289 too. Also, clear the property map here, removing the need for a
23292 * kjs/JSVariableObject.cpp:
23293 * kjs/JSVariableObject.h: Added support for saving localStorage and the
23294 symbol table to the back/forward cache, and restoring them.
23296 * kjs/function.cpp:
23297 (KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
23298 because it's an EvalNode, not a ProgramNode.
23301 (KJS::cacheGlobalObject): Replaced put with faster putDirect, since
23302 that's how the rest of lookup.h works. putDirect is safe here because
23303 cacheGlobalObject is only used for objects whose names are not valid
23306 * kjs/nodes.cpp: The good stuff!
23308 (KJS::EvalNode::processDeclarations): Replaced hasProperty with
23309 the new hasOwnProperty, which is slightly faster.
23311 * kjs/object.h: Nixed clearProperties because clear() does this job now.
23313 * kjs/property_map.cpp:
23314 * kjs/property_map.h: More back/forward cache support.
23317 (WTF::::grow): Added fast non-branching grow function. I used it in
23318 an earlier version of this patch, even though it's not used anymore.
23320 2007-12-09 Mark Rowe <mrowe@apple.com>
23322 Reviewed by Oliver Hunt.
23324 Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
23325 declaration in grammar.h is able to declare members of that type.
23327 * kjs/NodeInfo.h: Added.
23328 (KJS::createNodeInfo):
23329 (KJS::mergeDeclarationLists):
23330 (KJS::appendToVarDeclarationList):
23334 2007-12-19 Oliver Hunt <oliver@apple.com>
23336 Make appendToVarDeclarationList static
23342 2007-12-18 Oliver Hunt <oliver@apple.com>
23344 Remove dead code due to removal of post-parse declaration discovery.
23348 Due to the removal of the declaration discovery pass after parsing we
23349 no longer need any of the logic used for that discovery.
23353 (KJS::VarDeclNode::VarDeclNode):
23354 (KJS::BlockNode::BlockNode):
23355 (KJS::ForInNode::ForInNode):
23356 (KJS::CaseBlockNode::CaseBlockNode):
23358 (KJS::VarStatementNode::):
23360 (KJS::DoWhileNode::):
23361 (KJS::WhileNode::):
23363 (KJS::LabelNode::):
23365 (KJS::FuncDeclNode::):
23366 (KJS::CaseClauseNode::):
23367 (KJS::ClauseListNode::):
23368 (KJS::SwitchNode::):
23370 2007-12-18 Oliver Hunt <oliver@apple.com>
23372 Replace post-parse pass to find declarations with logic in the parser itself
23376 Instead of finding declarations in a pass following the initial parsing of
23377 a program, we incorporate the logic directly into the parser. This lays
23378 the groundwork for further optimisations (such as improving performance in
23379 declaration expressions -- var x = y; -- to match that of standard assignment)
23380 in addition to providing a 0.4% performance improvement in SunSpider.
23382 * JavaScriptCore.exp:
23384 (KJS::Parser::parse):
23386 (KJS::Parser::didFinishParsing):
23387 (KJS::Parser::parse):
23390 (KJS::ParserTracked::ParserTracked):
23391 (KJS::ParserTracked::~ParserTracked):
23392 (KJS::ParserTracked::ref):
23393 (KJS::ParserTracked::deref):
23394 (KJS::ParserTracked::refcount):
23395 (KJS::ParserTracked::clearNewTrackedObjects):
23397 (KJS::ScopeNode::ScopeNode):
23398 (KJS::ProgramNode::ProgramNode):
23399 (KJS::EvalNode::EvalNode):
23400 (KJS::FunctionBodyNode::FunctionBodyNode):
23401 (KJS::FunctionBodyNode::initializeSymbolTable):
23402 (KJS::FunctionBodyNode::processDeclarations):
23404 (KJS::ParserTracked::):
23406 (KJS::ScopeNode::):
23408 2007-12-18 Xan Lopez <xan@gnome.org>
23412 Fix http://bugs.webkit.org/show_bug.cgi?id=14521
23413 Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
23415 * wtf/TCSpinLock.h:
23416 (TCMalloc_SpinLock::Unlock):
23418 Use less strict memory operand constraint on inline asm generation.
23419 PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
23421 Patch by David Kilzer <ddkilzer@webkit.org>
23423 2007-12-18 Mark Rowe <mrowe@apple.com>
23425 Rubber-stamped by Maciej Stachowiak.
23427 Remove outdated and non-functioning project files for the Apollo port.
23429 * JavaScriptCore.apolloproj: Removed.
23431 2007-12-18 Darin Adler <darin@apple.com>
23433 - fix Windows build
23435 * pcre/pcre_exec.cpp:
23436 (jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
23437 deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
23439 2007-12-18 Darin Adler <darin@apple.com>
23443 - fix http://bugs.webkit.org/show_bug.cgi?id=16458
23444 REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
23445 <rdar://problem/5636067>
23447 Test: fast/regex/slow.html
23449 Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
23450 http://bugs.webkit.org/show_bug.cgi?id=16503
23452 * pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
23453 * pcre/pcre_exec.cpp:
23454 (match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
23455 limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
23456 since they are just true and false (1 and 0).
23457 (jsRegExpExecute): More of the MATCH_MATCH change.
23459 2007-12-17 Darin Adler <darin@apple.com>
23461 - speculative build fix for non-gcc platforms
23463 * pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
23465 2007-12-16 Mark Rowe <mrowe@apple.com>
23467 Speculative build fix for non-Mac platforms.
23469 * pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
23471 2007-12-16 Darin Adler <darin@apple.com>
23473 Reviewed by Maciej.
23475 - http://bugs.webkit.org/show_bug.cgi?id=16438
23476 - removed some more unused code
23477 - changed quite a few more names to WebKit-style
23478 - moved more things out of pcre_internal.h
23479 - changed some indentation to WebKit-style
23480 - improved design of the functions for reading and writing
23481 2-byte values from the opcode stream (in pcre_internal.h)
23483 * pcre/dftables.cpp:
23484 (main): Added the kjs prefix a normal way in lieu of using macros.
23486 * pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
23487 (errorText): Name changes, fewer typedefs.
23488 (checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
23489 (isCountedRepeat): Name change.
23490 (readRepeatCounts): Name change.
23491 (firstSignificantOpcode): Got rid of the use of OP_lengths, which is
23492 very lightly used here. Hard-coded the length of OP_BRANUMBER.
23493 (firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
23494 use the advanceToEndOfBracket function.
23495 (getOthercaseRange): Name changes.
23496 (encodeUTF8): Ditto.
23497 (compileBranch): Name changes. Removed unused after_manual_callout and
23498 the code to handle it. Removed code to handle OP_ONCE since we never
23499 emit this opcode. Changed to use advanceToEndOfBracket in more places.
23500 (compileBracket): Name changes.
23501 (branchIsAnchored): Removed code to handle OP_ONCE since we never emit
23503 (bracketIsAnchored): Name changes.
23504 (branchNeedsLineStart): More fo the same.
23505 (bracketNeedsLineStart): Ditto.
23506 (branchFindFirstAssertedCharacter): Removed OP_ONCE code.
23507 (bracketFindFirstAssertedCharacter): More of the same.
23508 (calculateCompiledPatternLengthAndFlags): Ditto.
23509 (returnError): Name changes.
23510 (jsRegExpCompile): Ditto.
23512 * pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
23513 (matchRef): Updated names.
23514 Improved macros to use the do { } while(0) idiom so they expand to single
23515 statements rather than to blocks or multiple statements. And refeactored
23516 the recursive match macros.
23517 (MatchStack::pushNewFrame): Name changes.
23518 (getUTF8CharAndIncrementLength): Name changes.
23519 (match): Name changes. Removed the ONCE opcode.
23520 (jsRegExpExecute): Name changes.
23522 * pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
23523 quite a few comments. Removed the macros that add kjs prefixes to the
23524 functions with external linkage; instead renamed the functions. Removed
23525 the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
23526 dead and not-all-working code for LINK_SIZE values other than 2, although
23527 we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
23528 (put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
23529 (get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
23530 (put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
23531 (putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
23532 addition, since a comma is really no better than a plus sign. Added an
23533 assertion to catch out of range values and changed the parameter type to
23534 int rather than unsigned.
23535 (getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
23536 (putLinkValue): New function that most former callers of the
23537 putOpcodeValueAtOffset function can use; asserts the value that is
23538 being stored is non-zero and then calls putLinkValueAllowZero.
23539 (getLinkValue): Ditto.
23540 (putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
23541 caller was using an offset, which makes sense given the advancing behavior.
23542 (putLinkValueAllowZeroAndAdvance): Ditto.
23543 (isBracketOpcode): Added. For use in an assertion.
23544 (advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
23545 and removed comments about how it's not well designed. This function takes
23546 a pointer to the beginning of a bracket and advances to the end of the
23549 * pcre/pcre_tables.cpp: Updated names.
23550 * pcre/pcre_ucp_searchfuncs.cpp:
23551 (kjs_pcre_ucp_othercase): Ditto.
23552 * pcre/pcre_xclass.cpp:
23553 (getUTF8CharAndAdvancePointer): Ditto.
23554 (kjs_pcre_xclass): Ditto.
23555 * pcre/ucpinternal.h: Ditto.
23557 * wtf/ASCIICType.h:
23558 (WTF::isASCIIAlpha): Added an int overload, like the one we already have for
23560 (WTF::isASCIIAlphanumeric): Ditto.
23561 (WTF::isASCIIHexDigit): Ditto.
23562 (WTF::isASCIILower): Ditto.
23563 (WTF::isASCIISpace): Ditto.
23564 (WTF::toASCIILower): Ditto.
23565 (WTF::toASCIIUpper): Ditto.
23567 2007-12-16 Darin Adler <darin@apple.com>
23569 Reviewed by Maciej.
23571 - fix http://bugs.webkit.org/show_bug.cgi?id=16459
23572 REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
23573 <rdar://problem/5646361>
23575 The problem was that \B was not handled properly in character classes.
23577 Test: fast/js/regexp-overflow.html
23579 * pcre/pcre_compile.cpp:
23580 (check_escape): Added handling of ESC_b and ESC_B in character classes here.
23581 Allows us to get rid of the handling of \b in character classes from all the
23582 call sites that handle it separately and to handle \B properly as well.
23583 (compileBranch): Remove the ESC_b handling, since it's not needed any more.
23584 (calculateCompiledPatternLengthAndFlags): Ditto.
23586 2007-12-16 Mark Rowe <mrowe@apple.com>
23588 Reviewed by Maciej Stachowiak.
23590 Fix http://bugs.webkit.org/show_bug.cgi?id=16448
23591 Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
23593 * kjs/array_instance.cpp:
23594 (KJS::compareByStringPairForQSort):
23595 (KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
23596 results. This avoids calling toString twice per comparison, but requires a temporary buffer
23597 so we only use this approach in cases where the array being sorted is not too large.
23599 2007-12-16 Geoffrey Garen <ggaren@apple.com>
23601 Reviewed by Darin Adler and Maciej Stachowiak.
23603 More refactoring to support global variable optimization.
23605 Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
23606 UString::Rep*. With globals, the symbol table can outlast the
23607 declaration node for any given symbol, so the symbol table needs to ref
23610 In support, specialized HashMaps with RefPtr keys to allow lookup
23611 via raw pointer, avoiding refcount churn.
23613 SunSpider reports a .6% speedup (prolly just noise).
23615 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
23616 * JavaScriptCore.xcodeproj/project.pbxproj: ditto
23618 * kjs/JSVariableObject.cpp:
23619 (KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
23621 * kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
23622 static Rep* for null, which helps compute the deletedValue() trait.
23624 * wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
23626 * wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
23627 of find(), contains(), get(), set(), add(), remove(), and take() that take
23628 raw pointers as keys.
23630 2007-12-16 Alexey Proskuryakov <ap@webkit.org>
23634 http://bugs.webkit.org/show_bug.cgi?id=16162
23635 Problems with float parsing on Linux (locale-dependent parsing was used).
23637 * kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
23638 * kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
23640 2007-12-14 Alp Toker <alp@atoker.com>
23642 Reviewed by Mark Rowe.
23644 Enable the AllInOneFile.cpp optimization for the GTK+ port.
23646 * JavaScriptCore.pri:
23648 2007-12-14 Mark Rowe <mrowe@apple.com>
23650 Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
23652 * wtf/FastMalloc.cpp:
23653 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
23655 2007-12-14 Mark Rowe <mrowe@apple.com>
23657 Reviewed by Maciej Stachowiak.
23659 Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
23660 currently untested on other platforms.
23662 * wtf/TCSystemAlloc.cpp:
23663 (TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
23664 through into another mechanism if multiple are supported.
23666 2007-12-14 Alp Toker <alp@atoker.com>
23668 Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
23670 Include UnusedParam.h.
23672 * wtf/TCSystemAlloc.cpp:
23674 2007-12-14 Oliver Hunt <oliver@apple.com>
23676 Reviewed by Stephanie.
23678 Fix build on windows
23680 * wtf/FastMalloc.cpp:
23681 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
23683 2007-12-14 Dan Bernstein <mitz@apple.com>
23685 - try again to fix the Windows build
23687 * wtf/TCSystemAlloc.cpp:
23688 (TCMalloc_SystemRelease):
23690 2007-12-14 Dan Bernstein <mitz@apple.com>
23692 - try to fix the Windows build
23694 * wtf/TCSystemAlloc.cpp:
23695 (TCMalloc_SystemRelease):
23697 2007-12-14 Mark Rowe <mrowe@apple.com>
23699 Reviewed by Maciej and Oliver.
23701 Add final changes to make TCMalloc release memory to the system.
23702 This results in a 0.4% regression against ToT, but this is offset
23703 against the gains made by the original TCMalloc r38 merge - in fact
23704 we retain around 0.3-0.4% progression overall.
23706 * wtf/FastMalloc.cpp:
23707 (WTF::InitSizeClasses):
23708 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
23709 * wtf/TCSystemAlloc.cpp:
23710 (TCMalloc_SystemRelease):
23712 2007-12-14 Darin Adler <darin@apple.com>
23716 - removed unnecessary includes of "Vector.h"
23719 (WTF::copyKeysToVector): Make the type of the vector be a template parameter.
23720 This allows copying keys into a vector of a base class or one with an inline capacity.
23721 (WTF::copyValuesToVector): Ditto.
23723 (WTF::copyToVector): Ditto.
23725 2007-12-14 Anders Carlsson <andersca@apple.com>
23727 Reviewed by Darin and Geoff.
23729 <rdar://problem/5619295>
23730 REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
23732 Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
23734 The way this used to work was that each NPObject that wrapped a JSObject would have a root object
23735 corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
23736 doing security checks).
23738 This would prevent a plug-in from accessing a frame's window object if it's security origin was different
23739 (some parts of the window, such as the location object, can be accessed from frames with different security
23740 origins, and those checks are being done in WebCore).
23742 Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
23743 Window JSObject being garbage collected and the NPObject pointing to freed memory.
23745 How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
23746 for a plug-in will have the root object of the containing frame of that plug-in.
23748 * bindings/NP_jsobject.cpp:
23750 Don't free the origin root object.
23752 (_NPN_CreateScriptObject):
23753 Remove the origin root object parameter.
23755 (_NPN_InvokeDefault):
23758 (_NPN_GetProperty):
23759 (_NPN_SetProperty):
23760 (_NPN_RemoveProperty):
23761 (_NPN_HasProperty):
23764 Get rid of all security checks.
23766 * bindings/NP_jsobject.h:
23767 Remove originRootObject from the JavaScriptObject struct.
23769 * bindings/c/c_utility.cpp:
23770 (KJS::Bindings::convertValueToNPVariant):
23771 Always use the root object from the ExecState.
23773 2007-12-13 Steve Falkenburg <sfalken@apple.com>
23775 Move source file generation into its own vcproj to fix build dependencies.
23779 * JavaScriptCore.vcproj/JavaScriptCore.sln:
23780 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
23781 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
23782 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
23783 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
23785 2007-12-13 Alp Toker <alp@atoker.com>
23787 http://bugs.webkit.org/show_bug.cgi?id=16406
23788 [Gtk] JavaScriptCore needs -lpthread
23790 Build fix for Debian and any other platforms that don't implicitly
23793 Link to pthread on non-Windows platforms until this dependency is
23796 2007-12-11 Geoffrey Garen <ggaren@apple.com>
23798 Reviewed by Sam Weinig.
23800 Build fix: Note some variables that are used only for ASSERTs.
23804 (globalObject_initialize):
23805 (testInitializeFinalize):
23807 2007-12-11 Geoffrey Garen <ggaren@apple.com>
23809 Reviewed by Darin Adler.
23811 Fixed: All JS tests crash on Windows.
23813 NDEBUG wasn't defined when compiling testkjs in release builds, so the
23814 HashTable definition in HashTable.h included an extra data member.
23816 The solution was to add NDEBUG to the release testkjs configuration on
23819 For giggles, I also added other missing #defines to testkjs on Windows.
23821 * Configurations/Base.xcconfig:
23822 * Configurations/JavaScriptCore.xcconfig:
23823 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
23824 * JavaScriptCore.xcodeproj/project.pbxproj:
23828 2007-12-11 Geoffrey Garen <ggaren@apple.com>
23830 Reviewed by Darin Adler.
23832 Removed bogus ASSERT.
23834 ASSERT should only be used when we know that a code path will not be
23835 taken. This code path is taken often during the jsFunFuzz test.
23837 * pcre/pcre_exec.cpp:
23840 2007-12-11 Darin Adler <darin@apple.com>
23842 * wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
23844 2007-12-10 Darin Adler <darin@apple.com>
23846 Reviewed by Sam Weinig.
23848 - fix http://bugs.webkit.org/show_bug.cgi?id=16379
23849 REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
23850 fast/dom/xmlhttprequest-html-response-encoding.html
23851 and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
23852 find_firstassertedchar
23854 Test: fast/js/regexp-find-first-asserted.html
23856 * pcre/pcre_compile.cpp:
23857 (compileBracket): Take out unnecessary initialization of out parameters.
23858 (branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
23860 (bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
23861 options parameter -- the caller can handle the options.
23862 (jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
23863 the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
23864 passing in the options.
23866 2007-12-10 Geoffrey Garen <ggaren@apple.com>
23868 Reviewed by Sam Weinig.
23882 FunctionBodyNode ProgramNode EvalNode
23884 in preparation for specializing each class more while optimizing global
23887 Also removed some cruft from the FunctionBodyNode interface to simplify
23890 SunSpider says this patch is a .8% speedup, which seems reasonable,
23891 since it eliminates a few branches and adds KJS_FAST_CALL in a few
23894 Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
23895 mileage may vary...)
23897 2007-12-10 Geoffrey Garen <ggaren@apple.com>
23901 Mac build fix: added some exported symbols, now that Parser::parse is
23902 defined in the header.
23904 * JavaScriptCore.exp:
23906 2007-12-10 Sam Weinig <sam@webkit.org>
23910 Template methods need to be in the header.
23912 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
23915 (KJS::Parser::parse):
23917 2007-12-10 Geoffrey Garen <ggaren@apple.com>
23919 Reviewed by Sam Weinig.
23921 Merged different implementations of Parser::parse into a single,
23922 templatized implementation, in preparation for adding yet another
23923 implementation for "eval" code.
23925 JS and layout tests pass.
23927 2007-12-10 Timothy Hatcher <timothy@apple.com>
23929 Reviewed by Mark Rowe
23931 <rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
23933 * Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
23934 so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
23936 2007-12-10 Mark Rowe <mrowe@apple.com>
23940 * kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
23942 2007-12-10 Darin Adler <darin@apple.com>
23944 Reviewed by Mark Rowe.
23946 - fix http://bugs.webkit.org/show_bug.cgi?id=16375
23947 REGRESSION: Safari crashes on quit
23949 Probably a debug-only issue.
23952 (KJS::parser): Create the parser and never destroy it by using a pointer instead
23953 of a global object.
23955 2007-12-09 Darin Adler <darin@apple.com>
23957 Reviewed by Sam Weinig.
23959 - fix http://bugs.webkit.org/show_bug.cgi?id=16369
23960 REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
23962 * pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
23963 (branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
23964 branch and the other on an anchor. The old function would only work on a bracket.
23965 Also removed unneeded parameters; the anchored check does not require the bracket
23966 map or the options any more because we have a reduced set of features.
23967 (bracketIsAnchored): Ditto.
23968 (branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
23969 both a better name. This is the function that was returning the wrong value. The failure
23970 was beacuse the old function would only work on a bracket.
23971 (bracketNeedsLineStart): Ditto.
23972 (jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
23973 functions based on whether we compiled an outer bracket. Also removed inaccurate comments
23974 and unneeded parameters.
23976 - other small changes
23978 * pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
23979 the recursion limit, then running out of memory, and finally an unexpected internal error.
23981 * pcre/pcre_exec.cpp: Fixed indentation.
23982 (jsRegExpExecute): Corrected an inaccurate comment.
23984 2007-12-09 Darin Adler <darin@apple.com>
23986 Reviewed by Maciej.
23988 - fix http://bugs.webkit.org/show_bug.cgi?id=16370
23989 REGRESSION (r28540): source URL and line number no longer set for outer function/programs
23991 Test: fast/js/exception-linenums-in-html-1.html
23992 Test: fast/js/exception-linenums-in-html-2.html
23993 Test: fast/js/exception-linenums.html
23995 By the time the ProgramNode was constructed, the source URL was empty.
23998 (KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
23999 handled here instead of in the lexer; it needs to still be set when we create the
24000 program node. Call setLoc to set the first and last line number.
24001 (KJS::Parser::parseFunctionBody): Ditto, but for the body.
24002 (KJS::Parser::parse): Removed the sourceURL argument.
24004 * kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
24005 parameter to didFinishParsing, since the bison grammar knows the last line number
24006 and we otherwise do not know it. Removed the sourceURL parameter from parse, since
24007 that's now handled at a higher level.
24009 * kjs/grammar.y: Pass the last line number to didFinishParsing.
24012 (KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
24013 (KJS::Lexer::clear): Ditto.
24014 * kjs/lexer.h: More of the same.
24017 (KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
24018 than from the lexer. Removed unneeded call to setLoc, since the line numbers already
24019 both default to -1.
24021 2007-12-08 Oliver Hunt <oliver@apple.com>
24025 Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
24027 Fixes <rdar://problem/5620249> Must disable SVG animation
24028 <rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
24030 Minor config changes.
24032 * Configurations/JavaScriptCore.xcconfig:
24033 * JavaScriptCore.xcodeproj/project.pbxproj:
24035 2007-12-07 Sam Weinig <sam@webkit.org>
24039 - Rename isSafeScript to allowsAccessFrom.
24041 * bindings/NP_jsobject.cpp:
24043 * kjs/JSGlobalObject.h:
24044 (KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
24047 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24049 Reviewed by Sam Weinig.
24051 Refactored variable access optimization: Removed the assumption that
24052 the FunctionBodyNode holds the symbol table.
24054 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24056 Build fix: added #include.
24060 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24062 Build fix: added #include.
24064 * kjs/interpreter.cpp:
24066 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24068 Build fix: added #include.
24072 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24074 Build fix: added #include.
24076 * kjs/function_object.cpp:
24078 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24080 Reviewed by Sam Weinig.
24082 Fixed crash seen running layout tests.
24084 Reverted a change I made earlier today. Added a comment to try to
24085 discourage myself from making this mistake a third time.
24087 * kjs/function.cpp:
24088 (KJS::ActivationImp::mark):
24090 (KJS::ActivationImp::ActivationImpData::ActivationImpData):
24092 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24094 Reviewed by Sam Weinig.
24096 Refactored parsing of global code: Removed the assumption that
24097 ProgramNode inherits from FunctionBodyNode from the parser.
24100 (KJS::Parser::parseProgram):
24101 (KJS::Parser::parseFunctionBody):
24102 (KJS::Parser::parse):
24104 (KJS::Parser::didFinishParsing):
24105 * kjs/function.cpp:
24109 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24111 Build fix: added JSVariableObject.cpp to the .pri file.
24113 * JavaScriptCore.pri:
24115 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24117 Build fix: added #include.
24119 * kjs/function.cpp:
24121 2007-12-07 Steve Falkenburg <sfalken@apple.com>
24123 Re-named our B&I flag from BUILDBOT to PRODUCTION.
24125 Reviewed by Sam Weinig.
24127 * JavaScriptCore.vcproj/JavaScriptCore.make:
24128 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
24130 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24132 Build fix: removed stray name qualification.
24135 (KJS::ActivationImp::ActivationImp):
24137 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24139 Build fix: moved functions with qualified names outside of class
24142 * kjs/JSVariableObject.h:
24143 (KJS::JSVariableObject::symbolTableGet):
24144 (KJS::JSVariableObject::symbolTablePut):
24146 2007-12-07 Geoffrey Garen <ggaren@apple.com>
24148 Reviewed by Sam Weinig.
24150 Next step in refactoring JSGlobalObject: Added JSVariableObject class,
24151 and factored symbol-table-related code into it. (JSGlobalObject doesn't
24152 use the symbol table code yet, though.)
24154 Layout and JS tests, and testapi, pass. SunSpider reports no regression.
24156 2007-12-07 Darin Adler <darin@apple.com>
24160 - fix http://bugs.webkit.org/show_bug.cgi?id=16185
24161 jsRegExpCompile should not add implicit non-capturing bracket
24163 While this does not make SunSpider faster, it will make many regular
24164 expressions a bit faster.
24166 * pcre/pcre_compile.cpp: Moved CompileData struct in here from the
24167 header since it's private to this file.
24168 (compile_branch): Updated for function name change.
24169 (compile_bracket): Renamed from compile_regex, since, for one thing,
24170 this does not compile an entire regular expression.
24171 (calculateCompiledPatternLengthAndFlags): Removed unused item_count
24172 local variable. Renamed CompileData to cd instead of compile_block
24173 to be consistent with other functions. Added code to set the
24174 needOuterBracket flag if there's at least one "|" at the outer level.
24175 (jsRegExpCompile): Renamed CompileData to cd instead of compile_block
24176 to be consistent with other functions. Removed unneeded "size" field
24177 from the compiled regular expression. If no outer bracket is needed,
24178 then use compile_branch to compile the regular expression.
24180 * pcre/pcre_internal.h: Removed the CompileData struct, which is now
24181 private to pcre_compile.cpp. Removed the size member from JSRegExp.
24183 2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
24185 MSVC7 build fix due to a compiler bug with placement new and/or
24186 templates and casting.
24188 Reviewed by Darin Adler.
24193 2007-12-06 Darin Adler <darin@apple.com>
24195 Reviewed by Eric Seidel.
24197 - fix http://bugs.webkit.org/show_bug.cgi?id=16321
24198 new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
24199 <rdar://problem/5632992>
24201 Test: fast/js/regexp-oveflow.html
24203 * pcre/pcre_compile.cpp:
24204 (calculateCompiledPatternLengthAndFlags): In the case where a single character
24205 character class is optimized to not use a character class at all, the preflight
24206 code was not setting the lastitemlength variable.
24208 2007-12-05 Mark Rowe <mrowe@apple.com>
24210 Qt Windows build fix. Include the time-related headers in the correct place.
24212 * kjs/JSGlobalObject.cpp:
24213 * kjs/interpreter.cpp:
24215 2007-12-05 Darin Adler <darin@apple.com>
24217 Not reviewed; just undoing a previous commit.
24219 - remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
24220 <rdar://problem/5625221> Crash opening www.news.com (CNet)
24222 The real bug was the backwards ?: in the compile function, which Geoff just
24223 fixed. Rolling out the incorrect earlier fix.
24225 * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
24226 the unneeded preflight change. The regression test proves this is still working
24227 fine, so the bug remains fixed.
24229 2007-12-01 Mark Rowe <mrowe@apple.com>
24231 Build fix. Include headers before trying to use the things that they declare.
24233 * kjs/JSImmediate.cpp:
24236 * kjs/object_object.cpp:
24237 * kjs/regexp_object.cpp:
24238 * kjs/string_object.cpp:
24240 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24242 Build fix: added some #includes.
24244 * kjs/JSImmediate.cpp:
24246 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24248 Build fix: added some #includes.
24250 * kjs/JSGlobalObject.cpp:
24251 * kjs/JSImmediate.cpp:
24253 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24255 Build fix: Fixed #include spelling.
24257 * kjs/debugger.cpp:
24259 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24261 Build fix: added #include.
24263 * kjs/debugger.cpp:
24265 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24267 Build fix: added a forward declaration.
24271 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24273 Build fix: added an #include.
24275 * kjs/error_object.cpp:
24277 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24279 Build fix: added an #include.
24281 * kjs/bool_object.cpp:
24283 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24285 Reviewed by Darin Adler.
24287 Third step in refactoring JSGlobalObject: Moved data members and
24288 functions accessing data members from Interpreter to JSGlobalObject.
24289 Changed Interpreter member functions to static functions.
24291 This resolves a bug in global object bootstrapping, where the global
24292 ExecState could be used when uninitialized.
24294 This is a big change, but it's mostly code motion and renaming.
24296 Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
24297 a .7% regression, but Shark sees no difference related to this patch,
24298 and SunSpider reported a .7% speedup from an earlier step in this
24299 refactoring, so I think it's fair to call that a wash.
24301 2007-12-05 Geoffrey Garen <ggaren@apple.com>
24303 Reviewed by Darin Adler. (Or vice versa.)
24305 Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
24306 ASSERT, but the bug wasn't new.)
24308 * pcre/pcre_compile.cpp:
24309 (compile_branch): The ?: operator here was backwards, causing us to
24310 execute the loop too many times, adding stray KET opcodes to the
24311 compiled regular expression.
24313 2007-12-05 Kevin McCullough <kmccullough@apple.com>
24317 - Wait until local variable data is fully constructed before notifying the debugger of entering
24318 or leaving a call frame.
24320 * kjs/function.cpp:
24321 (KJS::FunctionImp::callAsFunction):
24323 (KJS::FunctionBodyNode::execute):
24325 2007-12-05 Mark Rowe <mrowe@apple.com>
24327 Reviewed by Oliver.
24329 Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
24331 * wtf/FastMalloc.cpp:
24333 (WTF::getPageHeap):
24335 2007-12-05 Mark Rowe <mrowe@apple.com>
24339 Fix testkjs in 64-bit.
24341 When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
24342 implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
24343 it will fail and trigger a call to abort.
24345 * wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
24346 * wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
24348 2007-12-04 Oliver Hunt <oliver@apple.com>
24352 * wtf/TCSystemAlloc.cpp:
24354 2007-12-03 Oliver Hunt <oliver@apple.com>
24356 Reviewed by Mark Rowe and Geoff Garen.
24360 It also result in a performance progression between 0.5% and
24361 0.9% depending on the test, however most if not all of this
24362 gain will be consumed by the overhead involved in the later
24363 change to release memory to the system.
24365 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
24366 * JavaScriptCore.xcodeproj/project.pbxproj:
24367 * wtf/FastMalloc.cpp:
24368 (WTF::KernelSupportsTLS):
24369 (WTF::CheckIfKernelSupportsTLS):
24373 (WTF::SLL_SetNext):
24376 (WTF::SLL_PopRange):
24377 (WTF::SLL_PushRange):
24380 (WTF::ByteSizeForClass):
24381 (WTF::NumMoveSize):
24382 (WTF::InitSizeClasses):
24383 (WTF::AllocationSize):
24384 (WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
24385 (WTF::TCMalloc_PageHeap::CacheSizeClass):
24386 (WTF::TCMalloc_PageHeap::init):
24387 (WTF::TCMalloc_PageHeap::New):
24388 (WTF::TCMalloc_PageHeap::AllocLarge):
24389 (WTF::TCMalloc_PageHeap::Carve):
24390 (WTF::TCMalloc_PageHeap::Delete):
24391 (WTF::TCMalloc_PageHeap::IncrementalScavenge):
24393 (WTF::TCMalloc_PageHeap::Dump):
24394 (WTF::TCMalloc_PageHeap::GrowHeap):
24395 (WTF::TCMalloc_PageHeap::Check):
24396 (WTF::ReleaseFreeList):
24397 (WTF::TCMalloc_PageHeap::ReleaseFreePages):
24398 (WTF::TCMalloc_ThreadCache_FreeList::Push):
24399 (WTF::TCMalloc_ThreadCache_FreeList::PushRange):
24400 (WTF::TCMalloc_ThreadCache_FreeList::PopRange):
24401 (WTF::TCMalloc_ThreadCache_FreeList::Pop):
24402 (WTF::TCMalloc_Central_FreeList::length):
24403 (WTF::TCMalloc_Central_FreeList::tc_length):
24404 (WTF::TCMalloc_Central_FreeList::Init):
24405 (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
24406 (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
24407 (WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
24408 (WTF::TCMalloc_Central_FreeList::ShrinkCache):
24409 (WTF::TCMalloc_Central_FreeList::InsertRange):
24410 (WTF::TCMalloc_Central_FreeList::RemoveRange):
24411 (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
24412 (WTF::TCMalloc_Central_FreeList::Populate):
24413 (WTF::TCMalloc_ThreadCache::Init):
24414 (WTF::TCMalloc_ThreadCache::Cleanup):
24415 (WTF::TCMalloc_ThreadCache::Allocate):
24416 (WTF::TCMalloc_ThreadCache::Deallocate):
24417 (WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
24418 (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
24419 (WTF::TCMalloc_ThreadCache::Scavenge):
24420 (WTF::TCMalloc_ThreadCache::PickNextSample):
24421 (WTF::TCMalloc_ThreadCache::NewHeap):
24422 (WTF::TCMalloc_ThreadCache::GetThreadHeap):
24423 (WTF::TCMalloc_ThreadCache::GetCache):
24424 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
24425 (WTF::TCMalloc_ThreadCache::InitTSD):
24426 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
24427 (WTF::TCMallocStats::ExtractStats):
24428 (WTF::TCMallocStats::DumpStats):
24429 (WTF::TCMallocStats::DumpStackTraces):
24430 (WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
24431 (WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
24432 (WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
24433 (WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
24434 (WTF::TCMallocStats::DoSampledAllocation):
24435 (WTF::TCMallocStats::CheckCachedSizeClass):
24436 (WTF::TCMallocStats::CheckedMallocResult):
24437 (WTF::TCMallocStats::SpanToMallocResult):
24438 (WTF::TCMallocStats::do_malloc):
24439 (WTF::TCMallocStats::do_free):
24440 (WTF::TCMallocStats::do_memalign):
24441 (WTF::TCMallocStats::do_malloc_stats):
24442 (WTF::TCMallocStats::do_mallopt):
24443 (WTF::TCMallocStats::do_mallinfo):
24444 (WTF::TCMallocStats::realloc):
24445 (WTF::TCMallocStats::cpp_alloc):
24446 (WTF::TCMallocStats::operator new):
24447 (WTF::TCMallocStats::):
24448 (WTF::TCMallocStats::operator new[]):
24449 (WTF::TCMallocStats::malloc_stats):
24450 (WTF::TCMallocStats::mallopt):
24451 (WTF::TCMallocStats::mallinfo):
24452 * wtf/TCPackedCache.h: Added.
24453 (PackedCache::PackedCache):
24454 (PackedCache::Put):
24455 (PackedCache::Has):
24456 (PackedCache::GetOrDefault):
24457 (PackedCache::Clear):
24458 (PackedCache::EntryToValue):
24459 (PackedCache::EntryToUpper):
24460 (PackedCache::KeyToUpper):
24461 (PackedCache::UpperToPartialKey):
24462 (PackedCache::Hash):
24463 (PackedCache::KeyMatch):
24465 (TCMalloc_PageMap2::PreallocateMoreMemory):
24466 * wtf/TCSystemAlloc.cpp:
24467 (TCMalloc_SystemRelease):
24468 * wtf/TCSystemAlloc.h:
24470 2007-12-04 Anders Carlsson <andersca@apple.com>
24474 Make isSafeScript const.
24476 * kjs/JSGlobalObject.h:
24477 (KJS::JSGlobalObject::isSafeScript):
24479 2007-12-04 Darin Adler <darin@apple.com>
24483 - fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
24484 <rdar://problem/5625221> Crash opening www.news.com (CNet)
24486 Test: fast/js/regexp-overflow.html
24488 * pcre/pcre_compile.cpp:
24489 (calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
24490 was generated in the compile code but not taken into account here.
24492 2007-12-03 Darin Adler <darin@apple.com>
24496 - fix http://bugs.webkit.org/show_bug.cgi?id=15618
24497 <rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
24499 Test: fast/js/recursion-limit-equal.html
24501 * kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
24503 2007-12-03 Dan Bernstein <mitz@apple.com>
24505 - fix a copy-and-paste-o
24507 * bindings/npruntime.cpp:
24508 (_NPN_GetIntIdentifier):
24510 2007-12-03 Dan Bernstein <mitz@apple.com>
24512 Reviewed by Darin Adler.
24514 - fix an ASSERT when getIntIdentifier is called with 0 or -1
24516 * bindings/npruntime.cpp:
24517 (_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
24518 they are the empty value and the deleted value. Instead, keep the
24519 identifiers for those two integers in a static array.
24521 2007-12-02 Darin Adler <darin@apple.com>
24525 - fix http://bugs.webkit.org/show_bug.cgi?id=15848
24526 <rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
24528 Test: fast/js/sparse-array.html
24530 * kjs/array_instance.cpp:
24531 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
24532 in hash map. Can't avoid the branch because we can't look for 0 in the hash.
24533 (KJS::ArrayInstance::deleteProperty): Ditto.
24535 2007-12-02 Geoffrey Garen <ggaren@apple.com>
24537 Build fix: added an #include.
24539 * kjs/collector.cpp:
24541 2007-12-02 Geoffrey Garen <ggaren@apple.com>
24543 Reviewed by Eric Seidel.
24545 Second step in refactoring JSGlobalObject: moved virtual functions from
24546 Interpreter to JSGlobalObject.
24548 Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
24551 2007-12-01 Alp Toker <alp@atoker.com>
24553 Reviewed by Adam Roben.
24555 http://bugs.webkit.org/show_bug.cgi?id=16228
24556 kJSClassDefinitionEmpty is not exported with JS_EXPORT
24558 Add JS_EXPORT to kJSClassDefinitionEmpty.
24560 Make the gcc compiler check take precedence over the WIN32||_WIN32
24561 check to ensure that symbols are exported on Windows when using gcc.
24563 Add a TODO referencing the bug about JS_EXPORT in the Win build
24564 (http://bugs.webkit.org/show_bug.cgi?id=16227)
24566 Don't define JS_EXPORT as 'extern' when the compiler is unknown since
24567 it would result in the incorrect expansion:
24569 extern extern const JSClassDefinition kJSClassDefinitionEmpty;
24571 (This was something we inherited from CFBase.h that doesn't make sense
24575 * API/JSObjectRef.h:
24577 2007-11-30 Geoffrey Garen <ggaren@apple.com>
24579 Reviewed by Beth Dakin.
24581 Reversed the ownership relationship between Interpreter and JSGlobalObject.
24582 Now, the JSGlobalObject owns the Interpreter, and top-level objects
24583 that need the two to persist just protect the JSGlobalObject from GC.
24585 Global object bootstrapping looks a little odd right now, but it will
24586 make much more sense soon, after further rounds of refactoring.
24588 * bindings/runtime_root.h: Made this class inherit from RefCounted,
24589 to avoid code duplication.
24591 * kjs/collector.cpp:
24592 (KJS::Collector::collect): No need to give special GC treatment to
24593 Interpreters, since we mark their global objects, which mark them.
24595 * kjs/interpreter.cpp:
24596 (KJS::Interpreter::mark): No need to mark our global object, since it
24598 * kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
24601 * kjs/testkjs.cpp: Modified to follow the new rules.
24602 (createGlobalObject):
24605 2007-11-30 Brent Fulgham <bfulgham@gmail.com>
24610 * pcre/pcre_compile.cpp:
24613 2007-11-30 Eric Seidel <eric@webkit.org>
24615 No review, build fix only.
24617 Fix uninitialized var warnings in release build.
24619 * JavaScriptCore.xcodeproj/project.pbxproj:
24620 * pcre/pcre_compile.cpp:
24623 2007-11-30 Darin Adler <darin@apple.com>
24625 Reviewed by Adam Roben.
24627 - fix http://bugs.webkit.org/show_bug.cgi?id=16207
24628 JavaScript regular expressions should match UTF-16 code units rather than characters
24630 SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
24632 Test: fast/js/regexp-non-bmp.html
24634 Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
24636 * pcre/pcre_compile.cpp:
24637 (compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
24638 them with simple pointer dereferences in some cases, and no code at all in others.
24639 (calculateCompiledPatternLengthAndFlags): Ditto.
24641 * pcre/pcre_exec.cpp:
24642 (match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
24643 Removed calls to the UTF-16 character accessor functions, replacing them with simple
24644 pointer dereferences in some cases, and no code at all in others. Also removed some
24645 explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
24646 in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
24647 end_subject in because it is already done outside the loop.
24650 * pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
24652 2007-11-30 Eric Seidel <eric@webkit.org>
24656 PCRE crashes under GuardMalloc
24657 http://bugs.webkit.org/show_bug.cgi?id=16127
24658 check against patternEnd to make sure we don't walk off the end of the string
24660 * pcre/pcre_compile.cpp:
24662 (calculateCompiledPatternLengthAndFlags):
24664 2007-11-30 Eric Seidel <eric@webkit.org>
24666 Reviewed by Maciej.
24668 Fix layout test regressions caused by r28186
24669 http://bugs.webkit.org/show_bug.cgi?id=16195
24670 change first_byte and req_byte back to shorts instead of chars
24671 (I think PCRE stuffs information in the high bits)
24673 * pcre/pcre_internal.h:
24675 2007-11-29 Oliver Hunt <oliver@apple.com>
24677 Reviewed by Maciej and Darin.
24679 Make the JS collector work with multiple threads
24681 Under heavy contention it was possible the GC to suspend other
24682 threads inside the pthread spinlock, which could lead to the GC
24683 thread blocking on the pthread spinlock itself.
24685 We now determine and store each thread's stack base when it is
24686 registered, thus removing the need for any calls to pthread_get_stackaddr_np
24687 that needed the pthread spinlock.
24689 * kjs/collector.cpp:
24690 (KJS::Collector::Thread::Thread):
24691 (KJS::Collector::registerThread):
24692 (KJS::Collector::markOtherThreadConservatively):
24694 2007-11-29 Adam Roben <aroben@apple.com>
24698 Removed some unreachable code (ironically, the code was some
24699 ASSERT_NOT_REACHED()s).
24701 * pcre/pcre_compile.cpp:
24703 * pcre/pcre_exec.cpp:
24706 2007-11-29 Eric Seidel <eric@webkit.org>
24708 Reviewed by Mark Rowe.
24710 Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151.
24712 * pcre/pcre_compile.cpp:
24715 2007-11-28 Mark Rowe <mrowe@apple.com>
24717 Gtk build fix. Rubber-stamped by Eric.
24719 * pcre/pcre_exec.cpp:
24720 (match): Add braces around the body of the case statement to prevent
24721 wanings about jumps across the initialization of a variable.
24723 2007-11-29 Eric Seidel <eric@webkit.org>
24725 Reviewed by Mark Rowe.
24727 Attempt to fix non-mac builds after PCRE cleanup.
24729 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
24730 * JavaScriptCoreSources.bkl:
24733 2007-11-28 Eric Seidel <eric@webkit.org>
24735 Reviewed by Maciej.
24737 Centralize code for subjectPtr adjustments using inlines, only ever check for a single
24738 trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char
24739 classes and garbled UTF16 strings.
24741 * pcre/pcre_exec.cpp:
24744 * pcre/pcre_internal.h:
24746 (movePtrToPreviousChar):
24747 (movePtrToNextChar):
24748 (movePtrToStartOfCurrentChar):
24750 2007-11-28 Eric Seidel <eric@webkit.org>
24752 Reviewed by Maciej.
24754 change getChar* functions to return result and push 'c' into local scopes for clarity
24756 * pcre/pcre_compile.cpp:
24758 (calculateCompiledPatternLengthAndFlags):
24759 * pcre/pcre_exec.cpp:
24761 * pcre/pcre_internal.h:
24763 (getCharAndAdvance):
24764 (getCharAndLength):
24765 (getCharAndAdvanceIfSurrogate):
24767 2007-11-28 Eric Seidel <eric@webkit.org>
24773 * pcre/pcre_exec.cpp:
24776 2007-11-26 Eric Seidel <eric@webkit.org>
24780 Further cleanups to calculateCompiledPatternLengthAndFlags
24782 * pcre/pcre_compile.cpp:
24783 (calculateCompiledPatternLengthAndFlags):
24784 * pcre/pcre_internal.h:
24786 2007-11-26 Eric Seidel <eric@webkit.org>
24790 Give consistent naming to the RegExp options/compile flags
24792 * pcre/pcre_compile.cpp:
24795 (find_firstassertedchar):
24796 (printCompiledRegExp):
24798 * pcre/pcre_exec.cpp:
24800 * pcre/pcre_internal.h:
24802 2007-11-26 Eric Seidel <eric@webkit.org>
24806 Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win.
24808 * pcre/pcre_exec.cpp:
24809 (tryFirstByteOptimization):
24810 (tryRequiredByteOptimization):
24812 * pcre/pcre_internal.h:
24814 2007-11-26 Eric Seidel <eric@webkit.org>
24816 Reviewed by Maciej.
24818 give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines
24820 * pcre/pcre_compile.cpp:
24823 (printCompiledRegExp):
24825 * pcre/pcre_exec.cpp:
24827 * pcre/pcre_internal.h:
24829 2007-11-26 Eric Seidel <eric@webkit.org>
24831 Reviewed by Oliver.
24833 Deprecate jsRegExpExecute's offset-vector fallback code
24835 * pcre/pcre_exec.cpp:
24838 2007-11-26 Eric Seidel <eric@webkit.org>
24840 Reviewed by Maciej.
24842 Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity
24844 * pcre/pcre_compile.cpp:
24845 (find_fixedlength):
24847 (canApplyFirstCharOptimization):
24848 * pcre/pcre_exec.cpp:
24850 * pcre/pcre_internal.h:
24852 2007-11-26 Eric Seidel <eric@webkit.org>
24854 Reviewed by Mitz & Maciej.
24856 Change _NC operators to use _IGNORING_CASE for clarity
24858 * pcre/pcre_compile.cpp:
24859 (find_fixedlength):
24861 (find_firstassertedchar):
24862 * pcre/pcre_exec.cpp:
24864 * pcre/pcre_internal.h:
24866 2007-11-26 Eric Seidel <eric@webkit.org>
24870 Remove branch from return
24872 * pcre/pcre_compile.cpp:
24874 * pcre/pcre_exec.cpp:
24877 2007-11-26 Eric Seidel <eric@webkit.org>
24879 Reviewed by Maciej.
24881 Add repeatInformationFromInstructionOffset inline
24883 * pcre/pcre_exec.cpp:
24884 (repeatInformationFromInstructionOffset):
24887 2007-11-26 Eric Seidel <eric@webkit.org>
24889 Reviewed by Maciej.
24891 Remove no longer used error code JSRegExpErrorMatchLimit
24894 (KJS::RegExp::match):
24896 * pcre/pcre_internal.h:
24898 2007-11-26 Eric Seidel <eric@webkit.org>
24902 Make i locally scoped for better code clarity
24904 * pcre/pcre_exec.cpp:
24907 2007-11-26 Eric Seidel <eric@webkit.org>
24909 Reviewed by Maciej.
24911 Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup.
24913 * pcre/pcre_compile.cpp:
24915 (calculateCompiledPatternLengthAndFlags):
24916 * pcre/pcre_exec.cpp:
24918 (MatchStack::pushNewFrame):
24919 (getUTF8CharAndIncrementLength):
24921 * pcre/pcre_internal.h:
24923 (getCharAndAdvance):
24924 (getCharAndLength):
24925 (getCharAndAdvanceIfSurrogate):
24926 * pcre/pcre_xclass.cpp:
24927 (getUTF8CharAndAdvancePointer):
24929 2007-11-26 Eric Seidel <eric@webkit.org>
24933 Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check
24935 * pcre/pcre_exec.cpp:
24936 (MatchStack::MatchStack):
24937 (MatchStack::popCurrentFrame):
24939 2007-11-25 Eric Seidel <eric@webkit.org>
24943 Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests
24945 * pcre/pcre_internal.h:
24947 2007-11-25 Eric Seidel <eric@webkit.org>
24949 Reviewed by Maciej.
24951 Remove match_is_group variable for another 5% speedup
24953 * pcre/pcre_compile.cpp:
24954 * pcre/pcre_exec.cpp:
24958 2007-11-28 Eric Seidel <eric@webkit.org>
24962 Abstract frame variables into locals and args
24964 * pcre/pcre_compile.cpp:
24966 * pcre/pcre_exec.cpp:
24968 * pcre/pcre_internal.h:
24970 2007-11-28 Eric Seidel <eric@webkit.org>
24974 Section off MatchData arguments into args struct
24976 * pcre/pcre_exec.cpp:
24977 (MatchStack::pushNewFrame):
24980 2007-11-24 Eric Seidel <eric@webkit.org>
24984 Remove redundant eptrblock struct
24986 * pcre/pcre_exec.cpp:
24987 (MatchStack::pushNewFrame):
24990 2007-11-24 Eric Seidel <eric@webkit.org>
24992 Reviewed by Maciej.
24994 Remove redundant match_call_count and move recursion check out of super-hot code path
24995 SunSpider says this is at least an 8% speedup for regexp.
24997 * pcre/pcre_exec.cpp:
24998 (MatchStack::MatchStack):
24999 (MatchStack::pushNewFrame):
25000 (MatchStack::popCurrentFrame):
25001 (MatchStack::popAllFrames):
25004 * pcre/pcre_internal.h:
25006 2007-11-24 Eric Seidel <eric@webkit.org>
25010 Get rid of GETCHAR* macros, replacing them with better named inlines
25012 * pcre/pcre_compile.cpp:
25014 (calculateCompiledPatternLengthAndFlags):
25015 * pcre/pcre_exec.cpp:
25017 * pcre/pcre_internal.h:
25018 (getCharAndAdvance):
25019 (getCharAndLength):
25020 (getCharAndAdvanceIfSurrogate):
25022 2007-11-24 Eric Seidel <eric@webkit.org>
25026 Further cleanup GET/PUT inlines
25028 * pcre/pcre_internal.h:
25029 (putOpcodeValueAtOffset):
25030 (getOpcodeValueAtOffset):
25031 (putOpcodeValueAtOffsetAndAdvance):
25032 (put2ByteOpcodeValueAtOffset):
25033 (get2ByteOpcodeValueAtOffset):
25034 (put2ByteOpcodeValueAtOffsetAndAdvance):
25036 2007-11-24 Eric Seidel <eric@webkit.org>
25040 Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches
25042 * pcre/pcre_compile.cpp:
25043 (firstSignificantOpCodeSkippingAssertions):
25044 (find_fixedlength):
25045 (complete_callout):
25049 (canApplyFirstCharOptimization):
25050 (find_firstassertedchar):
25051 * pcre/pcre_exec.cpp:
25053 * pcre/pcre_internal.h:
25054 (putOpcodeValueAtOffset):
25055 (getOpcodeValueAtOffset):
25056 (putOpcodeValueAtOffsetAndAdvance):
25057 (put2ByteOpcodeValueAtOffset):
25058 (get2ByteOpcodeValueAtOffset):
25059 (moveOpcodePtrPastAnyAlternateBranches):
25060 * pcre/pcre_ucp_searchfuncs.cpp:
25061 (_pcre_ucp_othercase):
25063 2007-11-24 Eric Seidel <eric@webkit.org>
25067 Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup
25069 * pcre/pcre_compile.cpp:
25072 * pcre/pcre_exec.cpp:
25075 * pcre/pcre_internal.h:
25078 (classBitmapForChar):
25082 (CompileData::CompileData):
25083 * pcre/pcre_xclass.cpp:
25086 2007-11-24 Eric Seidel <eric@webkit.org>
25090 cleanup _pcre_ucp_othercase
25092 * pcre/pcre_ucp_searchfuncs.cpp:
25093 (_pcre_ucp_othercase):
25095 2007-11-24 Eric Seidel <eric@webkit.org>
25097 Reviewed by Maciej.
25099 Use better variable names for case ignoring options
25101 * pcre/pcre_compile.cpp:
25103 (find_firstassertedchar):
25104 (printCompiledRegExp):
25106 * pcre/pcre_exec.cpp:
25110 * pcre/pcre_internal.h:
25112 2007-11-24 Eric Seidel <eric@webkit.org>
25116 split first_significant_code into two simpler functions
25118 * pcre/pcre_compile.cpp:
25119 (firstSignificantOpCode):
25120 (firstSignificantOpCodeSkippingAssertions):
25122 (canApplyFirstCharOptimization):
25123 (find_firstassertedchar):
25125 2007-11-24 Eric Seidel <eric@webkit.org>
25129 clean up is_counted_repeat
25131 * pcre/pcre_compile.cpp:
25132 (is_counted_repeat):
25134 2007-11-24 Eric Seidel <eric@webkit.org>
25138 clean up check_escape
25140 * pcre/pcre_compile.cpp:
25143 2007-11-24 Eric Seidel <eric@webkit.org>
25147 Reformat find_fixedlength
25149 * pcre/pcre_compile.cpp:
25150 (find_fixedlength):
25152 2007-11-24 Eric Seidel <eric@webkit.org>
25156 reformat is_anchored
25158 * pcre/pcre_compile.cpp:
25161 2007-11-24 Eric Seidel <eric@webkit.org>
25163 Reviewed by Maciej.
25165 Remove unused function could_be_empty_branch
25167 * pcre/pcre_compile.cpp:
25168 (first_significant_code):
25169 (find_fixedlength):
25171 (canApplyFirstCharOptimization):
25173 2007-11-24 Eric Seidel <eric@webkit.org>
25177 Pass around MatchData objects by reference
25179 * pcre/pcre_exec.cpp:
25185 2007-11-24 Eric Seidel <eric@webkit.org>
25189 give PCRE_STARTLINE a better name and rename match_data to MatchData
25191 * pcre/pcre_compile.cpp:
25193 (canApplyFirstCharOptimization):
25194 (find_firstassertedchar):
25195 (printCompiledRegExp):
25197 * pcre/pcre_exec.cpp:
25200 * pcre/pcre_internal.h:
25202 2007-11-24 Eric Seidel <eric@webkit.org>
25206 Clean up find_firstassertedchar
25208 * pcre/pcre_compile.cpp:
25209 (get_othercase_range):
25210 (find_firstassertedchar):
25211 (calculateCompiledPatternLengthAndFlags):
25213 2007-11-24 Eric Seidel <eric@webkit.org>
25215 Reviewed by Tim Hatcher.
25217 Pass around CompileData& instead of CompileData*
25219 * pcre/pcre_compile.cpp:
25223 2007-11-24 Eric Seidel <eric@webkit.org>
25227 Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData
25229 * JavaScriptCore.xcodeproj/project.pbxproj:
25230 * pcre/pcre_compile.cpp:
25232 (calculateCompiledPatternLengthAndFlags):
25234 * pcre/pcre_internal.h:
25235 * pcre/pcre_ord2utf8.cpp: Removed.
25237 2007-11-24 Eric Seidel <eric@webkit.org>
25241 removing more macros
25243 * pcre/pcre_compile.cpp:
25244 (could_be_empty_branch):
25246 (calculateCompiledPatternLengthAndFlags):
25247 * pcre/pcre_exec.cpp:
25250 * pcre/pcre_internal.h:
25251 * pcre/pcre_xclass.cpp:
25253 2007-11-24 Eric Seidel <eric@webkit.org>
25255 Reviewed by Maciej.
25257 clean up formating in compile_branch
25259 * pcre/pcre_compile.cpp:
25262 2007-11-24 Eric Seidel <eric@webkit.org>
25266 Fix spacing for read_repeat_counts
25268 * pcre/pcre_compile.cpp:
25269 (read_repeat_counts):
25271 2007-11-24 Eric Seidel <eric@webkit.org>
25275 Get rid of PCRE custom char types
25277 * pcre/pcre_compile.cpp:
25279 (complete_callout):
25282 (calculateCompiledPatternLengthAndFlags):
25284 * pcre/pcre_exec.cpp:
25288 * pcre/pcre_internal.h:
25290 2007-11-24 Eric Seidel <eric@webkit.org>
25294 reformat get_othercase_range
25296 * pcre/pcre_compile.cpp:
25297 (get_othercase_range):
25299 2007-11-24 Eric Seidel <eric@webkit.org>
25301 Reviewed by Maciej.
25303 Remove register keyword and more cleanup
25305 * pcre/pcre_compile.cpp:
25306 (find_fixedlength):
25310 (find_firstassertedchar):
25311 (calculateCompiledPatternLengthAndFlags):
25313 * pcre/pcre_exec.cpp:
25314 (MatchStack::canUseStackBufferForNextFrame):
25315 (MatchStack::allocateNextFrame):
25316 (MatchStack::pushNewFrame):
25317 (MatchStack::frameIsStackAllocated):
25318 (MatchStack::popCurrentFrame):
25319 (MatchStack::unrollAnyHeapAllocatedFrames):
25320 (getUTF8CharAndIncrementLength):
25323 * pcre/pcre_internal.h:
25325 (isLeadingSurrogate):
25326 (isTrailingSurrogate):
25327 (decodeSurrogatePair):
25329 * pcre/pcre_ord2utf8.cpp:
25331 * pcre/pcre_xclass.cpp:
25332 (getUTF8CharAndAdvancePointer):
25335 2007-11-24 Eric Seidel <eric@webkit.org>
25337 Reviewed by Maciej.
25339 Clean up jsRegExpExecute
25341 * pcre/pcre_compile.cpp:
25344 * pcre/pcre_exec.cpp:
25346 * pcre/pcre_internal.h:
25348 2007-11-29 Oliver Hunt <oliver@apple.com>
25352 Merging updated system alloc and spinlock code from r38 of TCMalloc.
25354 This is needed as a precursor to the merge of TCMalloc proper.
25356 * wtf/FastMalloc.cpp:
25357 (WTF::TCMalloc_PageHeap::GrowHeap):
25358 * wtf/TCSpinLock.h:
25359 (TCMalloc_SpinLock::TCMalloc_SpinLock):
25360 (TCMalloc_SpinLock::):
25361 (TCMalloc_SpinLock::Lock):
25362 (TCMalloc_SpinLock::Unlock):
25363 (TCMalloc_SpinLock::IsHeld):
25364 * wtf/TCSystemAlloc.cpp:
25369 (TCMalloc_SystemAlloc):
25370 * wtf/TCSystemAlloc.h:
25372 2007-11-28 Brady Eidson <beidson@apple.com>
25376 Add copyKeysToVector utility, mirroring copyValuesToVector
25377 Also change the copyValuesToVector implementation to be a little more attractive
25380 (WTF::copyKeysToVector):
25381 (WTF::copyValuesToVector):
25383 2007-11-27 Alp Toker <alp@atoker.com>
25385 Reviewed by Mark Rowe.
25387 Add a list of public JavaScriptCore headers for installation.
25389 This follows the convention used for the Qt and GTK+ header lists.
25391 * headers.pri: Added.
25393 2007-11-27 Alp Toker <alp@atoker.com>
25395 Prospective MSVC build fix.
25397 Roll back dllexport/dllimport support for now.
25401 2007-11-27 Alp Toker <alp@atoker.com>
25403 Reviewed by Maciej.
25405 http://bugs.webkit.org/show_bug.cgi?id=15569
25406 [gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF
25408 Introduce JS_EXPORT to mark symbols to be exported as public API.
25410 Export all public symbols in the JavaScriptCore C API.
25412 This matches conventions for exporting symbols set by the CF and CG
25416 * API/JSContextRef.h:
25417 * API/JSObjectRef.h:
25418 * API/JSStringRef.h:
25419 * API/JSStringRefBSTR.h:
25420 * API/JSStringRefCF.h:
25421 * API/JSValueRef.h:
25423 2007-11-27 Anders Carlsson <andersca@apple.com>
25427 Make PropertyNameArray and ScopeChain COMEnumVariant friendly.
25429 * kjs/PropertyNameArray.cpp:
25430 (KJS::PropertyNameArray::swap):
25431 Implement PropertyNameArray::swap.
25433 * kjs/PropertyNameArray.h:
25434 Add ValueType typedef. Replace PropertyNameArrayIterator with
25435 PropertyNameArray::const_iterator.
25438 (KJS::ForInNode::execute):
25439 * kjs/scope_chain.cpp:
25440 (KJS::ScopeChain::print):
25441 Update for changes to PropertyNameArray.
25443 * kjs/scope_chain.h:
25444 Add const_iterator and ValueType typedef.
25446 2007-11-27 Anders Carlsson <andersca@apple.com>
25450 Add a ValueType typedef.
25454 2007-11-26 Darin Adler <darin@apple.com>
25458 - fix http://bugs.webkit.org/show_bug.cgi?id=16096
25459 REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
25461 Test: fast/js/regexp-overflow.html
25463 * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
25464 Removed a stray "ptr++" that I added by accident when merging the
25465 changes between PCRE 6.4 and 6.5.
25467 2007-11-26 Geoffrey Garen <ggaren@apple.com>
25469 Reviewed by Kevin McCullough.
25471 Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not
25472 show variables (can't enumerate ActivationImp properties)
25474 Implemented a custom ActivationImp::getPropertyNames, since
25475 ActivationImp now uses a custom property storage mechanism for local
25478 * kjs/function.cpp:
25479 (KJS::ActivationImp::getPropertyNames):
25482 2007-11-26 Alp Toker <alp@atoker.com>
25484 GTK+/Qt/Wx build fix for breakage introduced in r28039.
25486 * ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
25488 2007-11-24 Laszlo Gombos <laszlo.gombos@gmail.com>
25490 Reviewed by Maciej Stachowiak.
25492 Fix minor compiler warning (GCC 4.1.3)
25494 * pcre/pcre_internal.h:
25495 * pcre/pcre_ucp_searchfuncs.cpp:
25496 (_pcre_ucp_othercase):
25498 2007-11-25 Mark Rowe <mrowe@apple.com>
25500 Reviewed by Dan Bernstein.
25502 Fix http://bugs.webkit.org/show_bug.cgi?id=16129
25503 Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
25505 * pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
25506 to our caller like they expect.
25508 2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
25510 MSVC7 build fix. (rand_s doesn't exist there)
25512 Reviewed by Adam Roben.
25515 * wtf/MathExtras.h:
25517 2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
25519 wx build fix. Move WX_PYTHON logic into project build settings,
25520 add WebKitLibraries dirs on Win, and explicitly include JSCore
25521 headers in testkjs rather than getting them from a template.
25522 (Include dir order of JSCore/WTF and ICU headers is important due
25523 to wtf/unicode/utf8.h.)
25527 2007-11-23 Simon Hausmann <hausmann@webkit.org>
25529 Reviewed by George Staikos <staikos@kde.org>.
25531 Fix make (dist)clean on Windows.
25533 OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
25536 * JavaScriptCore.pri:
25539 2007-11-22 Simon Hausmann <hausmann@kde.org>
25541 Reviewed by George.
25543 Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
25545 * JavaScriptCore.pri:
25548 2007-11-22 Simon Hausmann <hausmann@kde.org>
25550 Reviewed by George.
25552 Centralize the setup for all the extra compilers in a addExtraCompiler function.
25554 This allows adding a "generated_files" target that builds all generated files using "make generated_files".
25555 For the build inside Qt we do not generate actual rules for the extra compilers but instead
25556 do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
25558 * JavaScriptCore.pri:
25561 2007-11-20 Mark Rowe <mrowe@apple.com>
25563 Reviewed by Tim Hatcher.
25565 <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
25567 Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
25568 -Werror to succeed. At present they will crash when executed due to code that is not safe
25569 under strict aliasing (<rdar://problem/5536806>).
25571 * Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
25572 * kjs/date_object.cpp:
25573 (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
25575 (Bigint::): Tweak formatting to silence warnings.
25576 * pcre/pcre_exec.cpp:
25577 (match): Tweak formatting to silence warnings
25578 * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
25579 * wtf/Assertions.h: Ditto.
25581 2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
25583 wx port build fix (wx headers include ctype functions).
25587 2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
25589 Remove outdated and unused Windows port files.
25591 Reviewed by Adam Roben.
25593 * Makefile.vc: Removed.
25594 * README-Win32.txt: Removed.
25596 2007-11-18 Eric Seidel <eric@webkit.org>
25598 Reviewed by Oliver.
25600 * tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
25602 2007-11-17 Mark Rowe <mrowe@apple.com>
25604 Reviewed by Darin Adler.
25606 Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
25607 <rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
25608 http://bugs.webkit.org/show_bug.cgi?id=16033
25610 Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
25611 and constructors, and storing them on the global object. This allows JSClassRef's passed to
25612 JSGlobalContextCreate to be instantiated with the correct prototype.
25614 * API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
25615 * API/JSCallbackObject.h:
25616 * API/JSCallbackObjectFunctions.h:
25617 (KJS::::JSCallbackObject):
25619 * API/JSContextRef.cpp:
25620 (JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
25621 is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
25622 prevent any JSObjectInitializeCallback's being invoked before a global object is set.
25624 (globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
25625 (globalObject_get):
25626 (globalObject_set):
25628 * API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
25629 * JavaScriptCore.exp:
25630 * bindings/testbindings.cpp:
25631 (main): Update for changes in Interpreter method signatures.
25632 * bindings/testbindings.mm:
25634 * kjs/ExecState.cpp:
25635 (KJS::ExecState::ExecState):
25636 (KJS::ExecState::mark):
25637 (KJS::ExecState::setGlobalObject):
25638 * kjs/ExecState.h: Rename scope to m_scopeChain.
25639 * kjs/interpreter.cpp:
25640 (KJS::Interpreter::Interpreter):
25641 (KJS::Interpreter::init):
25642 (KJS::Interpreter::globalObject):
25643 (KJS::Interpreter::setGlobalObject):
25644 (KJS::Interpreter::resetGlobalObjectProperties):
25645 (KJS::Interpreter::createObjectsForGlobalObjectProperties):
25646 (KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
25647 cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
25648 call back into JavaScript from the initialization of the global object's members.
25649 * kjs/interpreter.h:
25651 (setupInterpreter): Update for changes in Interpreter method signatures.
25653 2007-11-17 Mark Rowe <mrowe@apple.com>
25655 Reviewed by Sam Weinig.
25657 Prevent testapi from reporting false leaks. Clear out local variables pointing at
25658 JSObjectRefs to allow their values to be collected.
25663 2007-11-17 Mark Rowe <mrowe@apple.com>
25665 Reviewed by Sam Weinig.
25667 Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
25672 2007-11-17 Alp Toker <alp@atoker.com>
25676 http://bugs.webkit.org/show_bug.cgi?id=16032
25677 JS minidom is not portable
25679 Use a plain UTF-8 string instead of a CFString.
25681 Print to stdout, not stderr like CFShow() would have done, since that
25682 behaviour seems unintentional.
25687 2007-11-17 Steve Falkenburg <sfalken@apple.com>
25691 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
25693 2007-11-16 Mark Rowe <mrowe@apple.com>
25698 (KJS::Lexer::record8):
25700 2007-11-16 Mark Rowe <mrowe@apple.com>
25704 Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
25705 SunSpider claims this is a 0.7% speedup.
25708 (KJS::Lexer::Lexer):
25710 (KJS::Lexer::record8):
25711 (KJS::Lexer::record16):
25712 (KJS::Lexer::scanRegExp):
25713 (KJS::Lexer::clear):
25714 (KJS::Lexer::makeIdentifier):
25715 (KJS::Lexer::makeUString):
25718 (KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
25721 2007-11-16 Adam Roben <aroben@apple.com>
25725 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
25726 and ignore the int -> bool conversion warning.
25728 2007-11-16 Alexey Proskuryakov <ap@webkit.org>
25730 Fix Windows debug build.
25731 Rubber-stamped by Eric
25733 * pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
25734 complain about unreachable code.
25736 2007-11-15 Mark Rowe <mrowe@apple.com>
25742 2007-11-15 Mark Rowe <mrowe@apple.com>
25744 Mac build and header search path sanity fix.
25746 Reviewed by Sam Weinig and Tim Hatcher.
25748 Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
25749 it in JavaScriptCore.xcconfig. This removes the need to override it on a
25750 per-target basis inside the .xcodeproj file.
25752 * Configurations/Base.xcconfig:
25753 * Configurations/JavaScriptCore.xcconfig:
25754 * JavaScriptCore.xcodeproj/project.pbxproj:
25756 2007-11-15 Mark Rowe <mrowe@apple.com>
25762 2007-11-15 Geoffrey Garen <ggaren@apple.com>
25764 Reviewed by Eric Seidel.
25766 Another round of grammar / parsing cleanup.
25768 1. Created distinct parser calls for parsing function bodies vs
25769 programs. This will help later with optimizing global variable access.
25771 2. Turned Parser into a singleton. Cleaned up Lexer's singleton
25774 3. Modified Lexer to free a little more memory when done lexing. (Added
25775 FIXMEs for similar issues that I didn't fix.)
25777 4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
25778 respecting the arguments passed to them. (No behavior change, but this
25779 problem could have caused serious problems for an unsuspecting user of
25782 5. Removed KJS_DEBUG_MEM because it was bit-rotted.
25784 6. Removed Parser::prettyPrint because the same work was simpler to do
25789 "Parser::accept" => "Parser::didFinishParsing"
25790 "Parser::sid" => "Parser::m_sourceID"
25791 "Lexer::doneParsing" => "Lexer::clear"
25792 "sid" => "sourceId"
25793 "lineno" => "lineNo"
25795 * JavaScriptCore.exp:
25797 (KJS::Parser::Parser):
25798 (KJS::Parser::parseProgram):
25799 (KJS::Parser::parseFunctionBody):
25800 (KJS::Parser::parse):
25801 (KJS::Parser::didFinishParsing):
25804 (KJS::Parser::sourceId):
25805 * kjs/function.cpp:
25806 (KJS::GlobalFuncImp::callAsFunction):
25807 * kjs/function_object.cpp:
25808 (FunctionObjectImp::construct):
25810 * kjs/interpreter.cpp:
25811 (KJS::Interpreter::checkSyntax):
25812 (KJS::Interpreter::evaluate):
25813 * kjs/interpreter.h:
25817 (KJS::Lexer::Lexer):
25818 (KJS::Lexer::~Lexer):
25819 (KJS::Lexer::scanRegExp):
25820 (KJS::Lexer::doneParsing):
25821 (KJS::Lexer::makeIdentifier):
25822 (KJS::Lexer::makeUString):
25824 (KJS::Lexer::pattern):
25825 (KJS::Lexer::flags):
25826 (KJS::Lexer::sawError):
25829 (KJS::FunctionBodyNode::FunctionBodyNode):
25832 (prettyPrintScript):
25837 2007-11-15 Oliver Hunt <oliver@apple.com>
25841 <rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
25843 Add a stub node to maintain the Vector of SourceElements until assignment.
25847 (KJS::SourceElementsStub::SourceElementsStub):
25848 (KJS::SourceElementsStub::append):
25849 (KJS::SourceElementsStub::release):
25850 (KJS::SourceElementsStub::):
25851 (KJS::SourceElementsStub::precedence):
25853 2007-11-15 Eric Seidel <eric@webkit.org>
25857 Abstract most of RMATCH into MatchStack functions.
25859 SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
25861 * pcre/pcre_exec.cpp:
25862 (MatchStack::canUseStackBufferForNextFrame):
25863 (MatchStack::allocateNextFrame):
25864 (MatchStack::pushNewFrame):
25865 (MatchStack::frameIsStackAllocated):
25866 (MatchStack::popCurrentFrame):
25867 (MatchStack::unrollAnyHeapAllocatedFrames):
25870 2007-11-15 Eric Seidel <eric@webkit.org>
25874 Remove RETURN_ERROR, add MatchStack
25876 * pcre/pcre_exec.cpp:
25877 (MatchStack::MatchStack):
25878 (MatchStack::unrollAnyHeapAllocatedFrames):
25882 2007-11-15 Eric Seidel <eric@webkit.org>
25886 Clean up match function to match WebKit style
25888 * JavaScriptCore.xcodeproj/project.pbxproj:
25889 * pcre/pcre_exec.cpp:
25892 2007-11-15 Steve Falkenburg <sfalken@apple.com>
25896 * JavaScriptCore.vcproj/JavaScriptCore.make:
25898 2007-11-14 Alexey Proskuryakov <ap@webkit.org>
25902 http://bugs.webkit.org/show_bug.cgi?id=15982
25903 Improve JSString UTF-8 decoding
25905 * API/JSStringRef.cpp:
25906 (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
25908 * wtf/unicode/UTF8.cpp:
25909 (WTF::Unicode::convertUTF16ToUTF8):
25910 (WTF::Unicode::convertUTF8ToUTF16):
25911 * wtf/unicode/UTF8.h:
25912 Made these function names start with a lower case letter.
25914 * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
25916 * bindings/c/c_utility.cpp:
25917 (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
25918 from convertUTF8ToUTF16 in wtf/unicode.
25919 (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
25920 (KJS::Bindings::identifierFromNPIdentifier): Ditto.
25921 * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
25923 2007-11-14 Sam Weinig <sam@webkit.org>
25925 Rubber-stamped by Anders.
25927 Fix the Xcode project file after it was messed up in r27402.
25929 * JavaScriptCore.xcodeproj/project.pbxproj:
25931 2007-11-14 Eric Seidel <eric@webkit.org>
25933 Reviewed by Oliver.
25935 More PCRE style cleanup.
25937 * pcre/pcre_compile.cpp:
25940 2007-11-14 Adam Roben <aroben@apple.com>
25942 Clean up the bison conflict checking script
25946 * DerivedSources.make:
25948 2007-11-14 Eric Seidel <eric@webkit.org>
25952 Another round of PCRE cleanups: inlines
25954 SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
25956 * pcre/pcre_compile.cpp:
25958 * pcre/pcre_exec.cpp:
25961 * pcre/pcre_internal.h:
25968 2007-11-14 Eric Seidel <eric@webkit.org>
25972 Give PCRE a (small) bath.
25973 Fix some formating and break things off into separate functions
25974 http://bugs.webkit.org/show_bug.cgi?id=15993
25976 * pcre/pcre_compile.cpp:
25977 (calculateCompiledPatternLengthAndFlags):
25978 (printCompiledRegExp):
25981 * pcre/pcre_internal.h:
25982 (compile_data::compile_data):
25984 2007-11-14 Geoffrey Garen <ggaren@apple.com>
25986 Reviewed by Eric Seidel.
25988 Cleaned up the JavaScript grammar a bit.
25990 1. Changed BlockNode to always hold a child vector (which may be empty),
25991 eliminating a few NULL-check branches in the common execution case.
25993 2. Changed the Block production to correctly report its starting and
25994 ending line numbers to the debugger. (It used to report its ending line
25995 as its starting line.) Also, removed duplicate line-reporting code
25996 inside the BlockNode constructor.
25998 3. Moved curly braces up from FunctionBody production into parent
25999 productions. (I had to move the line number reporting code, too, since
26000 it depends on the location of the curly braces.) This matches the ECMA
26001 spec more closely, and makes some future changes I plan easier.
26003 4. Fixed statementList* convenience functions to deal appropriately with
26006 SunSpider reports a small and statistically insignificant speedup.
26010 (KJS::statementListPushFIFO):
26011 (KJS::statementListGetDeclarations):
26012 (KJS::statementListInitializeDeclarationStack):
26013 (KJS::statementListInitializeVariableAccessStack):
26014 (KJS::BlockNode::BlockNode):
26015 (KJS::BlockNode::optimizeVariableAccess):
26016 (KJS::BlockNode::getDeclarations):
26017 (KJS::BlockNode::execute):
26018 (KJS::FunctionBodyNode::initializeDeclarationStacks):
26019 (KJS::FunctionBodyNode::optimizeVariableAccess):
26021 2007-11-13 Anders Carlsson <andersca@apple.com>
26023 Add RefCounted.h (And remove Shared.h)
26025 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
26027 2007-11-13 Geoffrey Garen <ggaren@apple.com>
26033 2007-11-13 Geoffrey Garen <ggaren@apple.com>
26035 Reviewed by Anders Carlsson.
26037 Renamed Shared to RefCounted.
26039 * API/JSClassRef.h:
26040 * JavaScriptCore.xcodeproj/project.pbxproj:
26041 * kjs/interpreter.h:
26043 * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
26044 (WTF::RefCounted::RefCounted):
26045 * wtf/Shared.h: Removed.
26047 2007-11-13 Adam Roben <aroben@apple.com>
26053 * kjs/regexp.h: Added a missing #include.
26055 2007-11-13 Geoffrey Garen <ggaren@apple.com>
26057 Reviewed by Sam Weinig.
26059 Moved Shared.h into wtf so it could be used in more places. Deployed
26060 Shared in places where JSCore previously had hand-rolled ref-counting
26063 * API/JSClassRef.cpp:
26064 (OpaqueJSClass::OpaqueJSClass):
26065 * API/JSClassRef.h:
26066 * API/JSObjectRef.cpp:
26069 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
26070 * JavaScriptCore.xcodeproj/project.pbxproj:
26071 * kjs/interpreter.cpp:
26072 (KJS::Interpreter::init):
26073 * kjs/interpreter.h:
26075 (KJS::RegExp::RegExp):
26077 * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
26079 2007-11-13 Eric Seidel <eric@webkit.org>
26081 Reviewed by Maciej.
26083 Add an ASSERT to getTruncatedInt32 to enforce proper usage.
26084 Best part about this patch? It doesn't break the web!
26086 * kjs/JSImmediate.h:
26087 (KJS::JSImmediate::getTruncatedInt32):
26088 (KJS::JSImmediate::toDouble):
26089 (KJS::JSImmediate::getUInt32):
26091 2007-11-13 Alexey Proskuryakov <ap@webkit.org>
26095 * bindings/c/c_utility.cpp:
26096 (KJS::Bindings::convertUTF8ToUTF16):
26098 (KJS::UString::UTF8String):
26099 * wtf/unicode/UTF8.cpp:
26100 (WTF::Unicode::ConvertUTF8ToUTF16):
26102 2007-11-13 Darin Adler <darin@apple.com>
26106 - fix http://bugs.webkit.org/show_bug.cgi?id=11231
26107 RegExp bug when handling newline characters
26108 and a number of other differences between PCRE behvior
26109 and JavaScript regular expressions:
26111 + single-digit sequences like \4 should be treated as octal
26112 character constants, unless there is a sufficient number
26113 of brackets for them to be treated as backreferences
26115 + \8 turns into the character "8", not a binary zero character
26116 followed by "8" (same for 9)
26118 + only the first 3 digits should be considered part of an
26119 octal character constant (the old behavior was to decode
26120 an arbitrarily long sequence and then mask with 0xFF)
26122 + if \x is followed by anything other than two valid hex digits,
26123 then it should simply be treated a the letter "x"; that includes
26124 not supporting the \x{41} syntax
26126 + if \u is followed by anything less than four valid hex digits,
26127 then it should simply be treated a the letter "u"
26129 + an extra "+" should be a syntax error, rather than being treated
26130 as the "possessive quantifier"
26132 + if a "]" character appears immediately after a "[" character that
26133 starts a character class, then that's an empty character class,
26134 rather than being the start of a character class that includes a
26137 + a "$" should not match a terminating newline; we could have gotten
26138 PCRE to handle this the way we wanted by passing an appropriate option
26140 Test: fast/js/regexp-no-extensions.html
26142 * pcre/pcre_compile.cpp:
26143 (check_escape): Check backreferences against bracount to catch both
26144 overflows and things that should be treated as octal. Rewrite octal
26145 loop to not go on indefinitely. Rewrite both hex loops to match and
26146 remove \x{} support.
26147 (compile_branch): Restructure loops so that we don't special-case a "]"
26148 at the beginning of a character class. Remove code that treated "+" as
26149 the possessive quantifier.
26150 (jsRegExpCompile): Change the "]" handling here too.
26152 * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
26153 Changed DOLL to remove handling of "terminating newline", a Perl concept
26154 which we don't need.
26156 * tests/mozilla/expected.html: Two tests are fixed now:
26157 ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
26158 One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
26159 was due to a bug (we treated all 1-character numeric escapes as backreferences).
26160 The date tests also now both expect success -- whatever was making them fail
26161 before was probably due to the time being close to a DST shift; maybe we need
26162 to get rid of those tests.
26164 2007-11-13 Darin Adler <darin@apple.com>
26166 * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
26167 Remove too-strong assert that was firing constantly and preventing even basic
26168 web browsing from working in a debug build. This function is used in many
26169 cases where the immediate value is not a number; the assertion could perhaps
26170 be added back later with a bit of reorganization.
26172 2007-11-13 Alp Toker <alp@atoker.com>
26174 Build fix for breakage to non-Mac builds introduced in r27746.
26178 2007-11-13 Eric Seidel <eric@webkit.org>
26180 Reviewed by Maciej.
26182 Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
26184 * kjs/JSImmediate.h:
26186 (KJS::GreaterNode::inlineEvaluateToBoolean):
26187 (KJS::GreaterNode::evaluate):
26188 (KJS::LessEqNode::inlineEvaluateToBoolean):
26189 (KJS::LessEqNode::evaluate):
26190 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
26191 (KJS::GreaterEqNode::evaluate):
26192 (KJS::InNode::evaluateToBoolean):
26193 (KJS::EqualNode::inlineEvaluateToBoolean):
26194 (KJS::EqualNode::evaluate):
26195 (KJS::NotEqualNode::inlineEvaluateToBoolean):
26196 (KJS::NotEqualNode::evaluate):
26197 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
26198 (KJS::StrictEqualNode::evaluate):
26199 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
26200 (KJS::NotStrictEqualNode::evaluate):
26203 2007-11-12 Geoffrey Garen <ggaren@apple.com>
26205 Reviewed by Sam Weinig.
26207 Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
26208 base64 spends 1.1% of total time checking for special Infinity case
26210 Use a fast character test instead of calling strncmp.
26212 1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
26213 Sharks reports only .1%. Who are you going to believe? Huh?
26216 (KJS::UString::toDouble):
26218 2007-11-12 Eric Seidel <eric@webkit.org>
26220 Reviewed by Oliver.
26222 Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
26223 Fix a few missing evaluateToBoolean methods
26224 Deploy all evaluateTo* functions to more nodes to avoid slowdowns
26225 http://bugs.webkit.org/show_bug.cgi?id=15950
26227 SunSpider claims this is at least a 1.4% speedup.
26229 * kjs/JSImmediate.h:
26230 (KJS::JSImmediate::getTruncatedInt32):
26231 (KJS::JSImmediate::toDouble):
26232 (KJS::JSImmediate::getUInt32):
26234 (KJS::ExpressionNode::evaluateToNumber):
26235 (KJS::ExpressionNode::evaluateToInt32):
26236 (KJS::ExpressionNode::evaluateToUInt32):
26237 (KJS::NumberNode::evaluateToInt32):
26238 (KJS::NumberNode::evaluateToUInt32):
26239 (KJS::ImmediateNumberNode::evaluateToInt32):
26240 (KJS::ImmediateNumberNode::evaluateToUInt32):
26241 (KJS::ResolveNode::evaluate):
26242 (KJS::ResolveNode::evaluateToNumber):
26243 (KJS::ResolveNode::evaluateToBoolean):
26244 (KJS::ResolveNode::evaluateToInt32):
26245 (KJS::ResolveNode::evaluateToUInt32):
26246 (KJS::LocalVarAccessNode::evaluateToInt32):
26247 (KJS::LocalVarAccessNode::evaluateToUInt32):
26248 (KJS::BracketAccessorNode::evaluateToNumber):
26249 (KJS::BracketAccessorNode::evaluateToBoolean):
26250 (KJS::BracketAccessorNode::evaluateToInt32):
26251 (KJS::BracketAccessorNode::evaluateToUInt32):
26252 (KJS::DotAccessorNode::inlineEvaluate):
26253 (KJS::DotAccessorNode::evaluate):
26254 (KJS::DotAccessorNode::evaluateToNumber):
26255 (KJS::DotAccessorNode::evaluateToBoolean):
26256 (KJS::DotAccessorNode::evaluateToInt32):
26257 (KJS::DotAccessorNode::evaluateToUInt32):
26258 (KJS::NewExprNode::inlineEvaluate):
26259 (KJS::NewExprNode::evaluate):
26260 (KJS::NewExprNode::evaluateToNumber):
26261 (KJS::NewExprNode::evaluateToBoolean):
26262 (KJS::NewExprNode::evaluateToInt32):
26263 (KJS::NewExprNode::evaluateToUInt32):
26264 (KJS::FunctionCallResolveNode::inlineEvaluate):
26265 (KJS::FunctionCallResolveNode::evaluate):
26266 (KJS::FunctionCallResolveNode::evaluateToNumber):
26267 (KJS::FunctionCallResolveNode::evaluateToBoolean):
26268 (KJS::FunctionCallResolveNode::evaluateToInt32):
26269 (KJS::FunctionCallResolveNode::evaluateToUInt32):
26270 (KJS::LocalVarFunctionCallNode::evaluate):
26271 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
26272 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
26273 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
26274 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
26275 (KJS::FunctionCallDotNode::evaluate):
26276 (KJS::FunctionCallDotNode::evaluateToNumber):
26277 (KJS::FunctionCallDotNode::evaluateToBoolean):
26278 (KJS::FunctionCallDotNode::evaluateToInt32):
26279 (KJS::FunctionCallDotNode::evaluateToUInt32):
26280 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
26281 (KJS::PostDecLocalVarNode::evaluateToNumber):
26282 (KJS::PostDecLocalVarNode::evaluateToBoolean):
26283 (KJS::PostDecLocalVarNode::evaluateToInt32):
26284 (KJS::PostDecLocalVarNode::evaluateToUInt32):
26285 (KJS::typeStringForValue):
26286 (KJS::UnaryPlusNode::evaluate):
26287 (KJS::UnaryPlusNode::evaluateToBoolean):
26288 (KJS::UnaryPlusNode::evaluateToNumber):
26289 (KJS::UnaryPlusNode::evaluateToInt32):
26290 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
26291 (KJS::BitwiseNotNode::evaluate):
26292 (KJS::BitwiseNotNode::evaluateToNumber):
26293 (KJS::BitwiseNotNode::evaluateToBoolean):
26294 (KJS::BitwiseNotNode::evaluateToInt32):
26295 (KJS::MultNode::evaluateToBoolean):
26296 (KJS::MultNode::evaluateToInt32):
26297 (KJS::MultNode::evaluateToUInt32):
26298 (KJS::DivNode::evaluateToInt32):
26299 (KJS::DivNode::evaluateToUInt32):
26300 (KJS::ModNode::evaluateToBoolean):
26301 (KJS::ModNode::evaluateToInt32):
26302 (KJS::ModNode::evaluateToUInt32):
26303 (KJS::AddNode::evaluateToNumber):
26304 (KJS::AddNode::evaluateToInt32):
26305 (KJS::AddNode::evaluateToUInt32):
26306 (KJS::AddNumbersNode::evaluateToInt32):
26307 (KJS::AddNumbersNode::evaluateToUInt32):
26308 (KJS::SubNode::evaluateToInt32):
26309 (KJS::SubNode::evaluateToUInt32):
26310 (KJS::LeftShiftNode::inlineEvaluateToInt32):
26311 (KJS::LeftShiftNode::evaluate):
26312 (KJS::LeftShiftNode::evaluateToNumber):
26313 (KJS::LeftShiftNode::evaluateToInt32):
26314 (KJS::RightShiftNode::inlineEvaluateToInt32):
26315 (KJS::RightShiftNode::evaluate):
26316 (KJS::RightShiftNode::evaluateToNumber):
26317 (KJS::RightShiftNode::evaluateToInt32):
26318 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
26319 (KJS::UnsignedRightShiftNode::evaluate):
26320 (KJS::UnsignedRightShiftNode::evaluateToNumber):
26321 (KJS::UnsignedRightShiftNode::evaluateToInt32):
26322 (KJS::LessNode::inlineEvaluateToBoolean):
26323 (KJS::LessNode::evaluate):
26324 (KJS::LessNode::evaluateToBoolean):
26325 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
26326 (KJS::LessNumbersNode::evaluate):
26327 (KJS::LessNumbersNode::evaluateToBoolean):
26328 (KJS::LessStringsNode::inlineEvaluateToBoolean):
26329 (KJS::LessStringsNode::evaluate):
26330 (KJS::BitAndNode::evaluate):
26331 (KJS::BitAndNode::inlineEvaluateToInt32):
26332 (KJS::BitAndNode::evaluateToNumber):
26333 (KJS::BitAndNode::evaluateToBoolean):
26334 (KJS::BitAndNode::evaluateToInt32):
26335 (KJS::BitXOrNode::inlineEvaluateToInt32):
26336 (KJS::BitXOrNode::evaluate):
26337 (KJS::BitXOrNode::evaluateToNumber):
26338 (KJS::BitXOrNode::evaluateToBoolean):
26339 (KJS::BitXOrNode::evaluateToInt32):
26340 (KJS::BitOrNode::inlineEvaluateToInt32):
26341 (KJS::BitOrNode::evaluate):
26342 (KJS::BitOrNode::evaluateToNumber):
26343 (KJS::BitOrNode::evaluateToBoolean):
26344 (KJS::BitOrNode::evaluateToInt32):
26345 (KJS::ConditionalNode::evaluateToNumber):
26346 (KJS::ConditionalNode::evaluateToInt32):
26347 (KJS::ConditionalNode::evaluateToUInt32):
26348 (KJS::valueForReadModifyAssignment):
26349 (KJS::AssignExprNode::evaluate):
26350 (KJS::AssignExprNode::evaluateToBoolean):
26351 (KJS::AssignExprNode::evaluateToNumber):
26352 (KJS::AssignExprNode::evaluateToInt32):
26353 (KJS::VarDeclNode::handleSlowCase):
26355 (KJS::FunctionCallResolveNode::precedence):
26356 (KJS::AddNode::precedence):
26358 (KJS::LessNumbersNode::):
26359 (KJS::LessStringsNode::):
26361 (KJS::JSValue::toInt32SlowCase):
26362 (KJS::JSValue::toUInt32SlowCase):
26364 (KJS::JSValue::asCell):
26365 (KJS::JSValue::toInt32):
26366 (KJS::JSValue::toUInt32):
26368 2007-11-12 Alexey Proskuryakov <ap@webkit.org>
26372 http://bugs.webkit.org/show_bug.cgi?id=15953
26373 Add UTF-8 encoding/decoding to WTF
26375 * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
26376 * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
26377 parameter. Callers are not interested in getting decoding results in strict mode, so
26378 this allows for bailing out as soon as an error is seen.
26380 * kjs/function.cpp:
26381 (KJS::encode): Updated for new UString::UTF8String() signature.
26383 * API/JSStringRef.cpp:
26384 (JSStringCreateWithCharacters): Disambiguate UChar.
26385 (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
26386 * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
26388 * wtf/unicode/UTF8.cpp: Added.
26389 (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
26390 (WTF::Unicode::inlineUTF8SequenceLength):
26391 (WTF::Unicode::UTF8SequenceLength):
26392 (WTF::Unicode::decodeUTF8Sequence):
26394 (WTF::Unicode::ConvertUTF16ToUTF8):
26395 (WTF::Unicode::isLegalUTF8):
26396 (WTF::Unicode::ConvertUTF8ToUTF16):
26397 * wtf/unicode/UTF8.h: Added.
26399 Some code moved from ustring.h, some adapted from unicode.org sources.
26401 * JavaScriptCore.exp:
26402 * JavaScriptCore.pri:
26403 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
26404 * JavaScriptCore.xcodeproj/project.pbxproj:
26405 * JavaScriptCoreSources.bkl:
26408 2007-11-12 Josh Aas <joshmoz@gmail.com>
26412 - http://bugs.webkit.org/show_bug.cgi?id=15946
26413 add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
26415 * bindings/npapi.h:
26417 2007-11-12 Darin Adler <darin@apple.com>
26421 - http://bugs.webkit.org/show_bug.cgi?id=15951
26422 REGRESSION: assertion failure in regexp match() when running JS tests
26424 Test: fast/js/regexp-many-brackets.html
26426 * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
26427 the BRANUMBER opcode.
26429 2007-11-12 Darin Adler <darin@apple.com>
26433 - fix use of prefix and config.h, got rid of a few unneeded things in
26434 the PCRE code; no behavior changes
26436 * API/JSBase.cpp: Added include of config.h.
26437 * API/JSCallbackConstructor.cpp: Ditto.
26438 * API/JSCallbackFunction.cpp: Ditto.
26439 * API/JSCallbackObject.cpp: Ditto.
26440 * API/JSClassRef.cpp: Ditto.
26441 * API/JSContextRef.cpp: Ditto.
26442 * API/JSObjectRef.cpp: Ditto.
26443 * API/JSStringRef.cpp: Ditto.
26444 * API/JSValueRef.cpp: Ditto.
26446 * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
26447 Moved new/delete macros after includes, as they are in WebCore's prefix.
26448 Removed "config.h".
26450 * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
26451 function. This is needed for PCRE, but not helpful for our use. Also changed
26452 the tables to all be 128 entries long instead of 256, since only the first
26455 * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
26456 which was only being used to check hex digits. Changed all uses of TRUE and
26457 FALSE to use the C++ true and false instead.
26458 (check_escape): Just the TRUE/FALSE thing.
26459 (is_counted_repeat): Ditto.
26460 (could_be_empty_branch): Ditto.
26461 (get_othercase_range): Ditto.
26462 (compile_branch): Ditto.
26463 (compile_regex): Ditto.
26464 (is_anchored): Ditto.
26465 (is_startline): Ditto.
26466 (find_firstassertedchar): Ditto.
26467 (jsRegExpCompile): Ditto.
26469 * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
26470 FALSE to use the C++ true and false instead.
26471 (match_ref): Just the TRUE/FALSE thing.
26472 (match): Ditto. Removed some unneeded braces.
26473 (jsRegExpExecute): Just the TRUE/FALSE thing.
26475 * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
26476 of the file instead of the bottom, so they can be used. Also changed the table
26477 sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
26478 Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
26479 be a macro instead of a extern int.
26481 * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
26483 * pcre/pcre_tables.cpp: Made table sizes explicit.
26485 * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
26487 2007-11-12 Adam Roben <aroben@apple.com>
26491 * wtf/FastMalloc.h: Add missing using statement.
26493 2007-11-11 Oliver Hunt <oliver@apple.com>
26497 Add special fastZeroedMalloc function to replace a
26498 number of fastCalloc calls where one argument was 1.
26500 This results in a 0.4% progression in SunSpider, more
26501 than making up for the earlier regression caused by
26502 additional overflow checks.
26504 * JavaScriptCore.exp:
26505 * kjs/array_instance.cpp:
26506 * kjs/property_map.cpp:
26507 * wtf/FastMalloc.cpp:
26508 * wtf/FastMalloc.h:
26511 2007-11-11 Adam Roben <aroben@apple.com>
26513 Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
26515 The bug was due to a mismatch between HashMap::remove and
26516 HashTable::checkTableConsistency. HashMap::remove can delete the value
26517 stored in the HashTable (by derefing it), which is not normally
26518 allowed by HashTable. It's OK in this case because the value is about
26519 to be removed from the table, but HashTable wasn't aware of this.
26521 HashMap::remove now performs the consistency check itself before
26522 derefing the value.
26524 Darin noticed that the same bug would occur in HashSet, so I've fixed
26530 (WTF::HashMap::remove): Perform the HashTable consistency check
26531 manually before calling deref.
26533 (WTF::HashSet::remove): Ditto.
26534 * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
26535 and HashSet can call it.
26536 (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
26538 (WTF::HashTable::removeAndInvalidate): Added.
26539 (WTF::HashTable::remove):
26540 (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
26542 2007-11-11 Mark Rowe <mrowe@apple.com>
26544 Build fix. Use the correct filename case.
26548 2007-11-11 Geoffrey Garen <ggaren@apple.com>
26550 Reviewed by Sam Weinig.
26552 Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
26553 15% of string-validate-input.js is spent compiling the same regular expression
26555 Store a compiled representation of the regular expression in the AST.
26557 Only a .2% SunSpider speedup overall, but a 10.6% speedup on
26558 string-validate-input.js.
26561 (KJS::RegExpNode::evaluate):
26563 (KJS::RegExpNode::):
26564 * kjs/nodes2string.cpp:
26565 (KJS::RegExpNode::streamTo):
26567 (KJS::RegExp::flags):
26569 (KJS::RegExp::pattern):
26570 * kjs/regexp_object.cpp:
26571 (KJS::RegExpObjectImp::construct):
26572 (KJS::RegExpObjectImp::createRegExpImp):
26573 * kjs/regexp_object.h:
26575 2007-11-11 Oliver Hunt <oliver@apple.com>
26579 Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
26581 Unfortunately this is a very slight regression, but is unavoidable.
26583 * wtf/FastMalloc.cpp:
26585 2007-11-10 Eric Seidel <eric@webkit.org>
26589 Add simple type inferencing to the parser, and create custom
26590 AddNode and LessNode subclasses based on inferred types.
26591 http://bugs.webkit.org/show_bug.cgi?id=15884
26593 SunSpider claims this is at least a 0.5% speedup.
26595 * JavaScriptCore.exp:
26597 * kjs/internal.cpp:
26598 (KJS::NumberImp::getPrimitiveNumber):
26599 (KJS::GetterSetterImp::getPrimitiveNumber):
26605 (KJS::StringNode::evaluate):
26606 (KJS::StringNode::evaluateToNumber):
26607 (KJS::StringNode::evaluateToBoolean):
26608 (KJS::RegExpNode::evaluate):
26609 (KJS::UnaryPlusNode::optimizeVariableAccess):
26610 (KJS::AddNode::evaluate):
26611 (KJS::AddNode::evaluateToNumber):
26612 (KJS::AddNumbersNode::inlineEvaluateToNumber):
26613 (KJS::AddNumbersNode::evaluate):
26614 (KJS::AddNumbersNode::evaluateToNumber):
26615 (KJS::AddStringsNode::evaluate):
26616 (KJS::AddStringLeftNode::evaluate):
26617 (KJS::AddStringRightNode::evaluate):
26620 (KJS::LessNumbersNode::evaluate):
26621 (KJS::LessStringsNode::evaluate):
26623 (KJS::ExpressionNode::):
26624 (KJS::RegExpNode::):
26625 (KJS::RegExpNode::precedence):
26626 (KJS::TypeOfResolveNode::):
26627 (KJS::LocalVarTypeOfNode::):
26628 (KJS::UnaryPlusNode::):
26629 (KJS::UnaryPlusNode::precedence):
26631 (KJS::AddNode::precedence):
26632 (KJS::AddNumbersNode::):
26633 (KJS::AddStringLeftNode::):
26634 (KJS::AddStringRightNode::):
26635 (KJS::AddStringsNode::):
26637 (KJS::LessNode::precedence):
26638 (KJS::LessNumbersNode::):
26639 (KJS::LessStringsNode::):
26640 * kjs/nodes2string.cpp:
26641 (KJS::StringNode::streamTo):
26645 (KJS::JSValue::getPrimitiveNumber):
26647 2007-11-11 Darin Adler <darin@apple.com>
26649 - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
26651 * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
26652 Later we can break it into two files.
26654 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
26655 * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
26656 * pcre/dftables.pro: Take out now-unneeded include paths.
26657 * pcre/pcre_maketables.cpp: Use new instead of malloc.
26659 2007-11-11 Darin Adler <darin@apple.com>
26661 * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
26662 another include path.
26664 2007-11-11 Darin Adler <darin@apple.com>
26666 * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
26667 by adding another include path.
26669 2007-11-11 Darin Adler <darin@apple.com>
26673 - http://bugs.webkit.org/show_bug.cgi?id=15924
26674 next round of changes to JSRegExp (formerly PCRE)
26676 This is a combination of converting to C++, tweaking the API, and adding
26677 some additional optimizations.
26679 Future steps will involve getting rid of the use of UTF-8 completely
26680 (we'll use UTF-16 exclusively instead), eliminating more source files,
26681 and some more speed-ups.
26683 SunSpider says the current round is an 0.9% speed-up overall, and a
26684 5.3% speed-up for regexp.
26686 * JavaScriptCore.exp: Updated for new entry points.
26688 * JavaScriptCore.pri:
26689 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
26690 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
26691 * JavaScriptCore.xcodeproj/project.pbxproj:
26692 * JavaScriptCoreSources.bkl:
26694 Updated for new source file names and ForwardingHeaders.
26697 (KJS::RegExp::RegExp): Changed to use the error message without calling
26698 strdup on it and to pass the new types and options.
26699 (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
26700 (KJS::RegExp::match): Pass the new types and options.
26701 * kjs/regexp.h: Update type of m_constructionError.
26703 * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
26704 the Google parts, and this isn't the PCRE library, per se.
26705 * pcre/COPYING: Ditto.
26707 * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
26708 (main): Removed unneeded ctype_digit.
26710 * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
26712 * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
26713 Moved a lot of private stuff used only within this file here from pcre_internal.h.
26714 Renumbered the error codes.
26715 (error_text): Use a single string with embedded nulls for the error text (I got
26716 this idea from newer versions of PCRE).
26717 (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
26718 uses with isASCIIDigit.
26719 (is_counted_repeat): Ditto.
26720 (read_repeat_counts): Ditto.
26721 (first_significant_code): Ditto.
26722 (find_fixedlength): Ditto.
26723 (could_be_empty_branch): Ditto.
26724 (compile_branch): Ditto. Also removed some code that handles changing options.
26725 JavaScript doesn't have any of the features that allow options to change.
26726 (compile_regex): Updated for change to options parameter.
26727 (is_anchored): Ditto.
26728 (find_firstassertedchar): Ditto.
26729 (jsRegExpCompile): Changed to take separate flags instead of an options int.
26730 Also changed to call new/delete instead of pcre_malloc/free.
26731 (jsRegExpFree): Ditto.
26733 * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
26734 Added a case that uses computed goto for the opcode loop, but did not turn it on.
26735 Changed the RMATCH macro to handle returns more efficiently by putting the where
26736 pointer in the new frame instead of the old one, allowing us to branch to the
26737 return with a single statement. Switched to new/delete from pcre_malloc/free.
26738 Changed many RRETURN callers to not set the return value since it's already
26739 set correctly. Replaced the rrc variable with an is_match variable. Values other
26740 than "match" and "no match" are now handled differently. This allows us to remove
26741 the code to check for those cases in various rules.
26742 (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
26743 continue statements, or break statements that break out of the outer case use
26744 a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
26745 (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
26746 start_match field from the match block.
26748 * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
26749 in here. Removed various unused types. Converted from JSRegExpChar to UChar.
26750 Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
26751 used in multiple places. Unfortunately we lose the comments for each opcode; we
26752 should find a place to put those back. Removed ctype_digit.
26754 * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
26755 (pcre_maketables): Got rid of the conditional code that allows this to be compiled
26756 in -- it's only used for dftables now (and soon may be obsolete entirely).
26757 Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
26758 loop. Removed ctype_digit.
26760 * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
26762 * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
26763 Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
26765 * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
26766 Updated for other file name changes.
26768 * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
26770 * pcre/ucpinternal.h: Updated header.
26772 * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
26774 * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
26775 & for this operation. Also added an overload that takes an int because that's
26776 useful for PCRE. Later we could optimize for int and overload other functions in
26777 this file; stuck to this simple one for now.
26779 * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
26780 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
26782 * pcre/LICENCE: Removed.
26783 * pcre/pcre-config.h: Removed.
26784 * wtf/FastMallocPCRE.cpp: Removed.
26786 * pcre/dftables.c: Renamed to cpp.
26787 * pcre/pcre_compile.c: Ditto.
26788 * pcre/pcre_exec.c: Ditto.
26789 * pcre/pcre_maketables.c: Ditto.
26790 * pcre/pcre_ord2utf8.c: Ditto.
26791 * pcre/pcre_tables.c: Ditto.
26792 * pcre/pcre_ucp_searchfuncs.c: Ditto.
26793 * pcre/pcre_xclass.c: Ditto.
26794 * pcre/ucptable.c: Ditto.
26796 2007-11-11 Eric Seidel <eric@webkit.org>
26798 Reviewed by Oliver.
26800 Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
26803 (KJS::ExpressionNode::evaluateToBoolean):
26804 (KJS::LessNode::evaluateToBoolean):
26805 (KJS::GreaterNode::evaluateToBoolean):
26806 (KJS::LessEqNode::evaluateToBoolean):
26807 (KJS::GreaterEqNode::evaluateToBoolean):
26808 (KJS::InstanceOfNode::evaluateToBoolean):
26809 (KJS::InNode::evaluateToBoolean):
26810 (KJS::EqualNode::evaluateToBoolean):
26811 (KJS::NotEqualNode::evaluateToBoolean):
26812 (KJS::StrictEqualNode::evaluateToBoolean):
26813 (KJS::NotStrictEqualNode::evaluateToBoolean):
26814 (KJS::LogicalAndNode::evaluateToBoolean):
26815 (KJS::LogicalOrNode::evaluateToBoolean):
26816 (KJS::ConditionalNode::evaluateToBoolean):
26818 2007-11-10 Darin Adler <darin@apple.com>
26822 - fix http://bugs.webkit.org/show_bug.cgi?id=15927
26823 REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
26824 and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
26826 Test: fast/js/delete-then-put.html
26828 * kjs/property_map.cpp:
26829 (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
26830 (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
26833 - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
26835 * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
26836 optimizeForUnnecessaryResult, since the result is used in some cases.
26838 2007-11-10 Adam Roben <aroben@apple.com>
26842 Roll out some changes that were (seemingly accidentally) checked in
26845 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
26847 2007-11-10 Darin Adler <darin@apple.com>
26851 - http://bugs.webkit.org/show_bug.cgi?id=15915
26852 add an evaluation path for booleans like the one we have for numbers
26854 Gives 1.1% on SunSpider.
26856 * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
26858 * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
26859 down from Node to ExpressionNode. Changed some classes to not inherit from
26860 ExpressionNode where not necessary, and removed unnneeded evaluate functions
26861 as well as evaluate functions that need not be virtual. Call the
26862 optimizeForUnnecessaryResult function on the start of a for loop too.
26864 (KJS::ExpressionNode::evaluateToBoolean): Added.
26865 (KJS::FalseNode::evaluate): Added.
26866 (KJS::TrueNode::evaluate): Added.
26867 (KJS::NumberNode::evaluateToBoolean): Added.
26868 (KJS::StringNode::evaluateToBoolean): Added.
26869 (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
26870 (KJS::BracketAccessorNode::evaluateToBoolean): Added.
26871 (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
26872 (KJS::LogicalNotNode::evaluateToBoolean): Added.
26873 (KJS::lessThan): Changed to return bool.
26874 (KJS::lessThanEq): Ditto.
26875 (KJS::LessNode::evaluate): Changed since lessThan returns bool.
26876 (KJS::LessNode::evaluateToBoolean): Added.
26877 (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
26878 (KJS::GreaterNode::evaluateToBoolean): Added.
26879 (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
26880 (KJS::LessEqNode::evaluateToBoolean): Added.
26881 (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
26882 (KJS::GreaterEqNode::evaluateToBoolean): Added.
26883 (KJS::InstanceOfNode::evaluateToBoolean): Added.
26884 (KJS::InNode::evaluateToBoolean): Added.
26885 (KJS::EqualNode::evaluateToBoolean): Added.
26886 (KJS::NotEqualNode::evaluateToBoolean): Added.
26887 (KJS::StrictEqualNode::evaluateToBoolean): Added.
26888 (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
26889 (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
26890 (KJS::IfNode::execute): Ditto.
26891 (KJS::DoWhileNode::execute): Ditto.
26892 (KJS::WhileNode::execute): Ditto.
26893 (KJS::ForNode::execute): Ditto.
26895 * kjs/nodes2string.cpp:
26896 (KJS::FalseNode::streamTo): Added.
26897 (KJS::TrueNode::streamTo): Added.
26899 2007-11-09 Adam Roben <aroben@apple.com>
26906 (KJS::jsNumber): Add some explicit casts.
26908 2007-11-08 Darin Adler <darin@apple.com>
26914 * kjs/property_map.cpp:
26916 2007-11-08 Darin Adler <darin@apple.com>
26918 - roll out accidentally-checked in changes
26920 * kjs/nodes.cpp: Back to previous version.
26921 * kjs/nodes.h: Ditto.
26922 * kjs/grammar.y: Ditto.
26924 2007-11-08 Darin Adler <darin@apple.com>
26926 Reviewed by Maciej.
26928 - http://bugs.webkit.org/show_bug.cgi?id=15912
26929 fasta spends a lot of time in qsort
26931 * kjs/property_map.cpp:
26932 (KJS::PropertyMap::getEnumerablePropertyNames):
26933 Use insertion sort instead of qsort for small sets of property names.
26934 We can probably do some even-better speedups of for/in, but this nets
26935 0.6% overall and 6.7% on fasta.
26937 2007-11-08 Darin Adler <darin@apple.com>
26939 Reviewed by Maciej.
26941 - http://bugs.webkit.org/show_bug.cgi?id=15906
26942 getting characters by indexing into a string is very slow
26944 This fixes one source of the slowness -- the conversion to an unused
26945 Identifier as we call the get function from the slot -- but doesn't
26946 fix others, such as the fact that we have to allocate a new UString::Rep
26947 for every single character.
26949 Speeds up string-base64 30%, and at least 0.5% overall.
26950 But does slow down access-fannkuch quite a bit. Might be worth
26951 revisiting in the future to see what we can do about that (although
26952 I did look at a profile for a while).
26954 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
26955 slots where we don't need to pass the identifier to the get function.
26956 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
26957 (KJS::PropertySlot::setCustomNumeric): Added.
26958 * kjs/string_object.cpp:
26959 (KJS::StringInstance::indexGetter): Changed to use substr() instead
26960 of constructing a wholly new UString each time.
26961 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
26962 takes advantage of setCustomNumeric to avoid creating an Identifier.
26963 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
26965 2007-11-08 Darin Adler <darin@apple.com>
26967 Reviewed by Oliver.
26969 - http://bugs.webkit.org/show_bug.cgi?id=15904
26970 more speed-ups possible by tightening up int version of JSImmediate
26972 1% improvement of SunSpider
26974 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
26975 (KJS::JSImmediate::from): Overload for most numeric types; many types can
26976 do fewer branches and checks.
26977 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
26978 (KJS::JSImmediate::getTruncatedInt32): Ditto.
26979 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
26980 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
26982 * kjs/grammar.y: Update since fromDouble is now just from.
26983 * kjs/nodes.h: Ditto.
26985 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
26987 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
26989 Bakefiles for building JavaScriptCore, needed by wx port.
26991 Reviewed by Mark Rowe.
26993 * JavaScriptCoreSources.bkl: Added.
26994 * jscore.bkl: Added.
26996 2007-11-08 Oliver Hunt <oliver@apple.com>
26998 Reviewed by Maciej.
27000 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
27002 The implementation of JSImmediate::areBothImmediateNumbers relies on
27003 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
27004 a unique result when both immediate values are numbers.
27006 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
27007 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
27011 2007-11-08 Darin Adler <darin@apple.com>
27015 * kjs/nodes.h: Add missing parameter name.
27017 2007-11-08 Eric Seidel <eric@webkit.org>
27021 Add ExpressionNode subclass of Node, use it.
27025 (KJS::ForInNode::ForInNode):
27027 (KJS::ExpressionNode::):
27029 (KJS::NullNode::precedence):
27030 (KJS::BooleanNode::):
27031 (KJS::BooleanNode::precedence):
27032 (KJS::RegExpNode::):
27033 (KJS::RegExpNode::precedence):
27035 (KJS::ThisNode::precedence):
27036 (KJS::ResolveNode::):
27037 (KJS::ElementNode::):
27038 (KJS::ArrayNode::):
27039 (KJS::PropertyNode::):
27040 (KJS::PropertyNode::precedence):
27041 (KJS::PropertyNode::name):
27042 (KJS::PropertyListNode::):
27043 (KJS::ObjectLiteralNode::):
27044 (KJS::ObjectLiteralNode::precedence):
27045 (KJS::BracketAccessorNode::):
27046 (KJS::DotAccessorNode::):
27047 (KJS::DotAccessorNode::precedence):
27048 (KJS::ArgumentListNode::):
27049 (KJS::ArgumentsNode::):
27050 (KJS::NewExprNode::):
27051 (KJS::NewExprNode::precedence):
27052 (KJS::FunctionCallValueNode::):
27053 (KJS::FunctionCallValueNode::precedence):
27054 (KJS::FunctionCallResolveNode::):
27055 (KJS::FunctionCallBracketNode::):
27056 (KJS::FunctionCallBracketNode::precedence):
27057 (KJS::FunctionCallDotNode::):
27058 (KJS::FunctionCallDotNode::precedence):
27059 (KJS::PrePostResolveNode::):
27060 (KJS::PostfixBracketNode::):
27061 (KJS::PostfixBracketNode::precedence):
27062 (KJS::PostIncBracketNode::):
27063 (KJS::PostIncBracketNode::isIncrement):
27064 (KJS::PostDecBracketNode::):
27065 (KJS::PostDecBracketNode::isIncrement):
27066 (KJS::PostfixDotNode::):
27067 (KJS::PostfixDotNode::precedence):
27068 (KJS::PostIncDotNode::):
27069 (KJS::PostIncDotNode::isIncrement):
27070 (KJS::PostDecDotNode::):
27071 (KJS::PostDecDotNode::isIncrement):
27072 (KJS::PostfixErrorNode::):
27073 (KJS::PostfixErrorNode::precedence):
27074 (KJS::DeleteResolveNode::):
27075 (KJS::DeleteBracketNode::):
27076 (KJS::DeleteBracketNode::precedence):
27077 (KJS::DeleteDotNode::):
27078 (KJS::DeleteDotNode::precedence):
27079 (KJS::DeleteValueNode::):
27080 (KJS::DeleteValueNode::precedence):
27082 (KJS::VoidNode::precedence):
27083 (KJS::TypeOfResolveNode::):
27084 (KJS::TypeOfValueNode::):
27085 (KJS::PrefixBracketNode::):
27086 (KJS::PrefixBracketNode::precedence):
27087 (KJS::PreIncBracketNode::):
27088 (KJS::PreIncBracketNode::isIncrement):
27089 (KJS::PreDecBracketNode::):
27090 (KJS::PreDecBracketNode::isIncrement):
27091 (KJS::PrefixDotNode::):
27092 (KJS::PrefixDotNode::precedence):
27093 (KJS::PreIncDotNode::):
27094 (KJS::PreIncDotNode::isIncrement):
27095 (KJS::PreDecDotNode::):
27096 (KJS::PreDecDotNode::isIncrement):
27097 (KJS::PrefixErrorNode::):
27098 (KJS::PrefixErrorNode::precedence):
27099 (KJS::UnaryPlusNode::):
27100 (KJS::UnaryPlusNode::precedence):
27101 (KJS::NegateNode::):
27102 (KJS::NegateNode::precedence):
27103 (KJS::BitwiseNotNode::):
27104 (KJS::BitwiseNotNode::precedence):
27105 (KJS::LogicalNotNode::):
27106 (KJS::LogicalNotNode::precedence):
27108 (KJS::AddNode::precedence):
27109 (KJS::LeftShiftNode::):
27110 (KJS::LeftShiftNode::precedence):
27111 (KJS::RightShiftNode::):
27112 (KJS::RightShiftNode::precedence):
27113 (KJS::UnsignedRightShiftNode::):
27114 (KJS::UnsignedRightShiftNode::precedence):
27116 (KJS::LessNode::precedence):
27117 (KJS::GreaterNode::):
27118 (KJS::GreaterNode::precedence):
27119 (KJS::LessEqNode::):
27120 (KJS::LessEqNode::precedence):
27121 (KJS::GreaterEqNode::):
27122 (KJS::GreaterEqNode::precedence):
27123 (KJS::InstanceOfNode::):
27124 (KJS::InstanceOfNode::precedence):
27126 (KJS::InNode::precedence):
27127 (KJS::EqualNode::):
27128 (KJS::EqualNode::precedence):
27129 (KJS::NotEqualNode::):
27130 (KJS::NotEqualNode::precedence):
27131 (KJS::StrictEqualNode::):
27132 (KJS::StrictEqualNode::precedence):
27133 (KJS::NotStrictEqualNode::):
27134 (KJS::NotStrictEqualNode::precedence):
27135 (KJS::BitAndNode::):
27136 (KJS::BitAndNode::precedence):
27137 (KJS::BitOrNode::):
27138 (KJS::BitOrNode::precedence):
27139 (KJS::BitXOrNode::):
27140 (KJS::BitXOrNode::precedence):
27141 (KJS::LogicalAndNode::):
27142 (KJS::LogicalAndNode::precedence):
27143 (KJS::LogicalOrNode::):
27144 (KJS::LogicalOrNode::precedence):
27145 (KJS::ConditionalNode::):
27146 (KJS::ConditionalNode::precedence):
27147 (KJS::ReadModifyResolveNode::):
27148 (KJS::ReadModifyResolveNode::precedence):
27149 (KJS::AssignResolveNode::):
27150 (KJS::AssignResolveNode::precedence):
27151 (KJS::ReadModifyBracketNode::):
27152 (KJS::ReadModifyBracketNode::precedence):
27153 (KJS::AssignBracketNode::):
27154 (KJS::AssignBracketNode::precedence):
27155 (KJS::AssignDotNode::):
27156 (KJS::AssignDotNode::precedence):
27157 (KJS::ReadModifyDotNode::):
27158 (KJS::ReadModifyDotNode::precedence):
27159 (KJS::AssignErrorNode::):
27160 (KJS::AssignErrorNode::precedence):
27161 (KJS::CommaNode::):
27162 (KJS::CommaNode::precedence):
27163 (KJS::AssignExprNode::):
27164 (KJS::AssignExprNode::precedence):
27165 (KJS::ExprStatementNode::):
27167 (KJS::DoWhileNode::):
27168 (KJS::WhileNode::):
27169 (KJS::ReturnNode::):
27171 (KJS::ThrowNode::):
27172 (KJS::ParameterNode::):
27173 (KJS::CaseClauseNode::):
27174 (KJS::CaseClauseNode::precedence):
27175 (KJS::ClauseListNode::):
27176 (KJS::SwitchNode::):
27178 2007-11-08 Oliver Hunt <oliver@apple.com>
27182 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
27184 This only improves bitwise-and performance, as the additional logic required
27185 for similar code paths on or, xor, and shifting requires additional operations
27186 and branches that negate (and in certain cases, regress) any advantage we might
27189 This improves performance on all bitop tests, the cryptography tests, as well as
27190 the string-base64 and string-unpack-code tests. No significant degradation on
27193 * kjs/JSImmediate.h:
27194 (KJS::JSImmediate::areBothImmediateNumbers):
27195 (KJS::JSImmediate::andImmediateNumbers):
27197 (KJS::BitAndNode::evaluate):
27199 (KJS::jsNumberFromAnd):
27201 2007-11-08 Adam Roben <aroben@apple.com>
27203 Stop using KJS inside of MathExtras.h
27207 * wtf/MathExtras.h: Removed an unused header, and a now-unused
27208 forward-declaration.
27209 (wtf_atan2): Use std::numeric_limits intead of KJS.
27211 2007-11-08 Sam Weinig <sam@webkit.org>
27215 * kjs/date_object.cpp:
27216 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
27217 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
27218 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
27220 2007-11-08 Mark Rowe <mrowe@apple.com>
27224 * kjs/lookup.h: Add missing include.
27226 2007-11-08 Sam Weinig <sam@webkit.org>
27230 Convert JavaScript internal function objects to use one class per
27231 function. This avoids a switch statement inside what used to be
27232 the shared function classes and will allow Shark to better analyze
27235 To make this switch, the value property of the HashEntry was changed
27236 to a union of an intptr_t (which is used to continue handle valueGetters)
27237 and function pointer which points to a static constructor for the
27238 individual new function objects.
27240 SunSpider claims this is a 1.0% speedup.
27242 * kjs/array_object.cpp:
27243 (KJS::ArrayPrototype::getOwnPropertySlot):
27244 (KJS::getProperty):
27245 (KJS::ArrayProtoFuncToString::callAsFunction):
27246 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
27247 (KJS::ArrayProtoFuncJoin::callAsFunction):
27248 (KJS::ArrayProtoFuncConcat::callAsFunction):
27249 (KJS::ArrayProtoFuncPop::callAsFunction):
27250 (KJS::ArrayProtoFuncPush::callAsFunction):
27251 (KJS::ArrayProtoFuncReverse::callAsFunction):
27252 (KJS::ArrayProtoFuncShift::callAsFunction):
27253 (KJS::ArrayProtoFuncSlice::callAsFunction):
27254 (KJS::ArrayProtoFuncSort::callAsFunction):
27255 (KJS::ArrayProtoFuncSplice::callAsFunction):
27256 (KJS::ArrayProtoFuncUnShift::callAsFunction):
27257 (KJS::ArrayProtoFuncFilter::callAsFunction):
27258 (KJS::ArrayProtoFuncMap::callAsFunction):
27259 (KJS::ArrayProtoFuncEvery::callAsFunction):
27260 (KJS::ArrayProtoFuncForEach::callAsFunction):
27261 (KJS::ArrayProtoFuncSome::callAsFunction):
27262 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
27263 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
27264 * kjs/array_object.h:
27265 (KJS::ArrayPrototype::classInfo):
27266 * kjs/create_hash_table:
27267 * kjs/date_object.cpp:
27268 (KJS::DatePrototype::getOwnPropertySlot):
27269 (KJS::DateProtoFuncToString::callAsFunction):
27270 (KJS::DateProtoFuncToUTCString::callAsFunction):
27271 (KJS::DateProtoFuncToDateString::callAsFunction):
27272 (KJS::DateProtoFuncToTimeString::callAsFunction):
27273 (KJS::DateProtoFuncToLocaleString::callAsFunction):
27274 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
27275 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
27276 (KJS::DateProtoFuncValueOf::callAsFunction):
27277 (KJS::DateProtoFuncGetTime::callAsFunction):
27278 (KJS::DateProtoFuncGetFullYear::callAsFunction):
27279 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
27280 (KJS::DateProtoFuncToGMTString::callAsFunction):
27281 (KJS::DateProtoFuncGetMonth::callAsFunction):
27282 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
27283 (KJS::DateProtoFuncGetDate::callAsFunction):
27284 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
27285 (KJS::DateProtoFuncGetDay::callAsFunction):
27286 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
27287 (KJS::DateProtoFuncGetHours::callAsFunction):
27288 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
27289 (KJS::DateProtoFuncGetMinutes::callAsFunction):
27290 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
27291 (KJS::DateProtoFuncGetSeconds::callAsFunction):
27292 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
27293 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
27294 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
27295 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
27296 (KJS::DateProtoFuncSetTime::callAsFunction):
27297 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
27298 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
27299 (KJS::DateProtoFuncSetSeconds::callAsFunction):
27300 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
27301 (KJS::DateProtoFuncSetMinutes::callAsFunction):
27302 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
27303 (KJS::DateProtoFuncSetHours::callAsFunction):
27304 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
27305 (KJS::DateProtoFuncSetDate::callAsFunction):
27306 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
27307 (KJS::DateProtoFuncSetMonth::callAsFunction):
27308 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
27309 (KJS::DateProtoFuncSetFullYear::callAsFunction):
27310 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
27311 (KJS::DateProtoFuncSetYear::callAsFunction):
27312 (KJS::DateProtoFuncGetYear::callAsFunction):
27313 * kjs/date_object.h:
27315 (KJS::Lookup::find):
27317 (KJS::HashEntry::):
27318 (KJS::staticFunctionGetter):
27319 (KJS::staticValueGetter):
27320 (KJS::getStaticPropertySlot):
27321 (KJS::getStaticFunctionSlot):
27323 * kjs/math_object.cpp:
27324 (KJS::MathObjectImp::getOwnPropertySlot):
27325 (KJS::MathProtoFuncAbs::callAsFunction):
27326 (KJS::MathProtoFuncACos::callAsFunction):
27327 (KJS::MathProtoFuncASin::callAsFunction):
27328 (KJS::MathProtoFuncATan::callAsFunction):
27329 (KJS::MathProtoFuncATan2::callAsFunction):
27330 (KJS::MathProtoFuncCeil::callAsFunction):
27331 (KJS::MathProtoFuncCos::callAsFunction):
27332 (KJS::MathProtoFuncExp::callAsFunction):
27333 (KJS::MathProtoFuncFloor::callAsFunction):
27334 (KJS::MathProtoFuncLog::callAsFunction):
27335 (KJS::MathProtoFuncMax::callAsFunction):
27336 (KJS::MathProtoFuncMin::callAsFunction):
27337 (KJS::MathProtoFuncPow::callAsFunction):
27338 (KJS::MathProtoFuncRandom::callAsFunction):
27339 (KJS::MathProtoFuncRound::callAsFunction):
27340 (KJS::MathProtoFuncSin::callAsFunction):
27341 (KJS::MathProtoFuncSqrt::callAsFunction):
27342 (KJS::MathProtoFuncTan::callAsFunction):
27343 * kjs/math_object.h:
27344 (KJS::MathObjectImp::classInfo):
27345 (KJS::MathObjectImp::):
27346 * kjs/string_object.cpp:
27347 (KJS::StringPrototype::getOwnPropertySlot):
27348 (KJS::StringProtoFuncToString::callAsFunction):
27349 (KJS::StringProtoFuncValueOf::callAsFunction):
27350 (KJS::StringProtoFuncCharAt::callAsFunction):
27351 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
27352 (KJS::StringProtoFuncConcat::callAsFunction):
27353 (KJS::StringProtoFuncIndexOf::callAsFunction):
27354 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
27355 (KJS::StringProtoFuncMatch::callAsFunction):
27356 (KJS::StringProtoFuncSearch::callAsFunction):
27357 (KJS::StringProtoFuncReplace::callAsFunction):
27358 (KJS::StringProtoFuncSlice::callAsFunction):
27359 (KJS::StringProtoFuncSplit::callAsFunction):
27360 (KJS::StringProtoFuncSubstr::callAsFunction):
27361 (KJS::StringProtoFuncSubstring::callAsFunction):
27362 (KJS::StringProtoFuncToLowerCase::callAsFunction):
27363 (KJS::StringProtoFuncToUpperCase::callAsFunction):
27364 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
27365 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
27366 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
27367 (KJS::StringProtoFuncBig::callAsFunction):
27368 (KJS::StringProtoFuncSmall::callAsFunction):
27369 (KJS::StringProtoFuncBlink::callAsFunction):
27370 (KJS::StringProtoFuncBold::callAsFunction):
27371 (KJS::StringProtoFuncFixed::callAsFunction):
27372 (KJS::StringProtoFuncItalics::callAsFunction):
27373 (KJS::StringProtoFuncStrike::callAsFunction):
27374 (KJS::StringProtoFuncSub::callAsFunction):
27375 (KJS::StringProtoFuncSup::callAsFunction):
27376 (KJS::StringProtoFuncFontcolor::callAsFunction):
27377 (KJS::StringProtoFuncFontsize::callAsFunction):
27378 (KJS::StringProtoFuncAnchor::callAsFunction):
27379 (KJS::StringProtoFuncLink::callAsFunction):
27380 * kjs/string_object.h:
27382 2007-11-08 Adam Roben <aroben@apple.com>
27386 Reviewed by Sam and Ada.
27388 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
27391 2007-11-08 Adam Roben <aroben@apple.com>
27393 Fix a precedence warning on Windows
27395 * kjs/JSImmediate.h:
27396 (KJS::JSImmediate::toBoolean):
27398 2007-11-08 Mark Rowe <mrowe@apple.com>
27400 Build fix for JavaScriptGlue.
27402 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
27404 2007-11-08 Darin Adler <darin@apple.com>
27406 - Windows build fix
27408 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
27410 2007-11-08 Oliver Hunt <oliver@apple.com>
27414 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
27416 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
27417 we should now have faster array access, faster immediate to double conversion, and the
27418 potential to further improve bitwise operators in future.
27420 This also removes the need for unions to avoid strict aliasing problems when extracting
27421 a value from immediates.
27423 * kjs/JSImmediate.h:
27424 (KJS::JSImmediate::trueImmediate):
27425 (KJS::JSImmediate::falseImmediate):
27426 (KJS::JSImmediate::undefinedImmediate):
27427 (KJS::JSImmediate::nullImmediate):
27428 (KJS::JSImmediate::toBoolean):
27432 2007-11-07 Eric Seidel <eric@webkit.org>
27434 Reviewed by Darin and Oliver.
27436 Add evaluateToNumber parallel evaluation tree to speed up number operations.
27437 Make ImmediateNumberNode a subclass of NumberNode.
27438 Share evaluate logic between evaluate and evaluateToNumber using inline functions
27439 There is still a lot of improvement to be made here.
27441 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
27442 Given the huge win that this prepares us for with simple type inferencing I see the small
27443 regression in base64 being worth the substantial overall improvement.
27447 (KJS::Node::evaluateToNumber):
27448 (KJS::NumberNode::evaluate):
27449 (KJS::NumberNode::evaluateToNumber):
27450 (KJS::StringNode::evaluateToNumber):
27451 (KJS::LocalVarAccessNode::inlineEvaluate):
27452 (KJS::LocalVarAccessNode::evaluate):
27453 (KJS::LocalVarAccessNode::evaluateToNumber):
27454 (KJS::BracketAccessorNode::inlineEvaluate):
27455 (KJS::BracketAccessorNode::evaluate):
27456 (KJS::BracketAccessorNode::evaluateToNumber):
27457 (KJS::NegateNode::evaluate):
27458 (KJS::NegateNode::evaluateToNumber):
27459 (KJS::MultNode::inlineEvaluateToNumber):
27460 (KJS::MultNode::evaluate):
27461 (KJS::MultNode::evaluateToNumber):
27462 (KJS::DivNode::inlineEvaluateToNumber):
27463 (KJS::DivNode::evaluate):
27464 (KJS::DivNode::evaluateToNumber):
27465 (KJS::ModNode::inlineEvaluateToNumber):
27466 (KJS::ModNode::evaluate):
27467 (KJS::ModNode::evaluateToNumber):
27468 (KJS::throwOutOfMemoryErrorToNumber):
27469 (KJS::addSlowCaseToNumber):
27471 (KJS::addToNumber):
27472 (KJS::AddNode::evaluateToNumber):
27473 (KJS::SubNode::inlineEvaluateToNumber):
27474 (KJS::SubNode::evaluate):
27475 (KJS::SubNode::evaluateToNumber):
27476 (KJS::valueForReadModifyAssignment):
27477 (KJS::ReadModifyLocalVarNode::evaluate):
27478 (KJS::ReadModifyResolveNode::evaluate):
27479 (KJS::ReadModifyDotNode::evaluate):
27480 (KJS::ReadModifyBracketNode::evaluate):
27483 (KJS::NumberNode::):
27484 (KJS::ImmediateNumberNode::):
27485 (KJS::AddNode::precedence):
27486 * kjs/nodes2string.cpp:
27487 (KJS::NumberNode::streamTo):
27489 2007-11-07 Mark Rowe <mrowe@apple.com>
27493 Fix up initialization after being mangled in r27572, and remove the
27494 ternary expression as extraCost will always be zero for the numeric
27497 * kjs/collector.cpp:
27498 (KJS::Collector::heapAllocate):
27500 2007-11-07 Mark Rowe <mrowe@apple.com>
27504 * kjs/regexp_object.cpp:
27506 2007-11-07 Geoffrey Garen <ggaren@apple.com>
27508 Reviewed by Beth Dakin.
27510 Eliminated a bogus (though compiled-out) branch in the collector.
27512 * kjs/collector.cpp:
27513 (KJS::Collector::heapAllocate):
27515 2007-11-06 Geoffrey Garen <ggaren@apple.com>
27517 Reviewed by Darin Adler.
27519 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
27520 5.8% of string-validate-input.js is spent creating RegExpImps
27522 Put RegExpImp properties into a static hashtable to avoid a slew of
27523 PropertyMap churn when creating a RegExpImp.
27525 Factored important bits of regular expression implementation out of
27526 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
27527 making RegExp a ref-counted class. (This will help later.)
27529 Removed PCRE_POSIX support because I didn't quite know how to test it
27530 and keep it working with these changes.
27532 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
27534 * kjs/regexp.h: A few interface changes:
27535 1. Renamed "subpatterns()" => "numSubpatterns()"
27536 2. Made flag enumeration private and replaced it with public getters for
27538 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
27539 4. Made RegExp take a string of flags instead of an int, eliminating
27540 duplicated flag parsing code elsewhere.
27542 * kjs/regexp_object.cpp:
27543 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
27544 - Fixed a bug where compile(undefined) would throw an exception.
27545 - Removed some now-redundant code.
27546 - Used RegExp sharing to eliminate an allocation and a bunch of
27547 PropertyMap thrash. (Not a big win since compile is a deprecated
27548 function. I mainly did this to test the plubming.)
27550 2007-11-07 Simon Hausmann <hausmann@kde.org>
27552 Reviewed by nobody, Qt/Windows build fix.
27554 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
27555 testkjs.pro, too, where it's included from.
27559 2007-11-07 Simon Hausmann <shausman@trolltech.com>
27563 Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
27565 * JavaScriptCore.pri:
27568 2007-11-07 Lars Knoll <lars@trolltech.com>
27574 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
27576 * wtf/unicode/qt4/UnicodeQt4.h:
27577 (WTF::Unicode::umemcasecmp):
27579 2007-11-06 Maciej Stachowiak <mjs@apple.com>
27583 - only collect when the heap is full, unless we have lots of extra cost garbage
27585 1.1% SunSpider speedup.
27587 This shouldn't hit memory use much since the extra space in those
27588 blocks hangs around either way.
27590 * kjs/collector.cpp:
27591 (KJS::Collector::heapAllocate):
27592 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
27595 2007-11-06 Oliver Hunt <oliver@apple.com>
27597 Reviewed by Maciej.
27599 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
27601 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
27602 'for (...; ...; ++<var>) ...'.
27605 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
27606 (KJS::PostIncLocalVarNode::evaluate):
27607 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
27608 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
27609 (KJS::PostDecLocalVarNode::evaluate):
27610 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
27612 (KJS::PrePostResolveNode::):
27613 (KJS::PostIncResolveNode::):
27614 (KJS::PostIncLocalVarNode::):
27615 (KJS::PostDecResolveNode::):
27616 (KJS::PostDecLocalVarNode::):
27617 (KJS::PreIncResolveNode::):
27618 (KJS::PreDecResolveNode::):
27619 (KJS::ForNode::ForNode):
27621 2007-11-06 Eric Seidel <eric@webkit.org>
27625 This fixes a regressed layout test for string + object
27627 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
27630 (KJS::add): remove erroneous "fast path" for string + *
27632 2007-11-06 Geoffrey Garen <ggaren@apple.com>
27634 Reviewed by Eric Seidel.
27636 Added toJSNumber, a fast path for converting a JSValue to a JS number,
27637 and deployed it in postfix expressions. In the fast case this
27638 eliminates a call to jsNumber.
27640 0.4% speedup on SunSpider.
27644 (KJS::PostIncResolveNode::evaluate):
27645 (KJS::PostIncLocalVarNode::evaluate):
27646 (KJS::PostDecResolveNode::evaluate):
27647 (KJS::PostDecLocalVarNode::evaluate):
27648 (KJS::PostIncBracketNode::evaluate):
27649 (KJS::PostDecBracketNode::evaluate):
27650 (KJS::PostIncDotNode::evaluate):
27651 (KJS::PostDecDotNode::evaluate):
27652 (KJS::UnaryPlusNode::evaluate):
27654 (KJS::JSValue::toJSNumber):
27656 2007-11-06 Darin Adler <darin@apple.com>
27658 Reviewed by Maciej.
27660 - http://bugs.webkit.org/show_bug.cgi?id=15846
27661 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
27663 There was a mistake in the algorithm used to find an empty slot in the property
27664 map entries vector; when we were putting in a new property value and not overwriting
27665 an existing deleted sentinel, we would enlarge the entries vector, but would not
27666 overwrite the stale data that's in the new part. It was easy to pin this down by
27667 turning on property map consistency checks -- I never would have landed with this
27668 bug if I had run the regression tests once with consistency checks on!
27670 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
27671 foundDeletedElement is false to always use the item at the end of the entries vector.
27672 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
27674 2007-11-06 Oliver Hunt <oliver@apple.com>
27678 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
27683 2007-11-06 Oliver Hunt <oliver@apple.com>
27687 Replace boolean comparisons in AddNode with mask
27688 comparisons for a 0.2% improvement in sunspider.
27690 * JavaScriptCore.xcodeproj/project.pbxproj:
27694 2007-11-06 Eric Seidel <eric@webkit.org>
27698 SunSpider claims this is a 1.1% speedup.
27701 (KJS::throwOutOfMemoryError): Added, non inline.
27702 (KJS::addSlowCase): renamed from add(), non inline.
27703 (KJS::add): add fast path for String + String, Number + Number and String + *
27705 2007-11-06 Eric Seidel <eric@webkit.org>
27709 Avoid more UString creation.
27711 SunSpider claims this is a 0.4% speedup.
27713 * kjs/regexp_object.cpp:
27714 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
27716 2007-11-05 Mark Rowe <mrowe@apple.com>
27720 * kjs/array_object.cpp:
27721 (KJS::ArrayProtoFunc::callAsFunction):
27723 2007-11-05 Adam Roben <aroben@apple.com>
27729 2007-11-05 Mark Rowe <mrowe@apple.com>
27731 Build fix. Add missing #include.
27733 * kjs/operations.cpp:
27735 2007-11-05 Eric Seidel <eric@webkit.org>
27739 Remove another call to toString(exec)
27741 SunSpider claims this is a 0.5% speedup.
27743 * kjs/operations.cpp:
27744 (KJS::equal): remove another toString
27746 2007-11-05 Eric Seidel <eric@webkit.org>
27748 * kjs/operations.cpp:
27749 (KJS::equal): correct broken change.
27751 2007-11-05 Eric Seidel <eric@webkit.org>
27755 Remove one more call to toString(exec).
27757 SunSpider claims this is a 0.7% speedup.
27759 * kjs/operations.cpp:
27760 (KJS::equal): remove a call to toString()
27762 2007-11-05 Mark Rowe <mrowe@apple.com>
27768 2007-11-05 Mark Rowe <mrowe@apple.com>
27774 2007-11-05 Geoffrey Garen <ggaren@apple.com>
27776 Touched a file to test my new HTTP access.
27778 * kjs/scope_chain.cpp:
27780 2007-11-05 Alp Toker <alp@atoker.com>
27782 Unreviewed build fix for qmake-based ports.
27784 Someone with a better understanding of qmake still needs to sort out
27785 the INCLUDEPATH/DEPENDPATH mess.
27787 * JavaScriptCore.pri:
27789 2007-11-05 Geoffrey Garen <ggaren@apple.com>
27791 Reviewed by Darin Adler.
27793 http://bugs.webkit.org/show_bug.cgi?id=15835
27795 Switched List implementation from a custom heap allocator to an inline
27796 Vector, for a disappointing .5% SunSpider speedup.
27798 Also renamed List::slice to List::getSlice because "get" is the
27799 conventional prefix for functions returning a value through an out
27802 * kjs/array_object.cpp:
27803 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
27804 calls and memory accesses.
27806 * kjs/bool_object.cpp:
27807 (BooleanObjectImp::construct): Removed questionable use of iterator.
27810 * kjs/list.h: New List class, implemented in terms of Vector. Two
27811 interesting differences:
27812 1. The inline capacity is 8, not 5. Many of the Lists constructed
27813 during a SunSpider run are larger than 5; almost none are larger
27816 2. The growth factor is 4, not 2. Since we can guarantee that Lists
27817 aren't long-lived, we can grow them more aggressively, to avoid
27820 * kjs/regexp_object.cpp:
27821 (RegExpObjectImp::construct): Removed redundant function calls.
27823 * kjs/string_object.cpp:
27824 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
27827 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
27829 2007-11-05 Mark Rowe <mrowe@apple.com>
27831 Reviewed by Alp Toker.
27833 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
27835 * JavaScriptCore.pri:
27838 2007-11-04 Darin Adler <darin@apple.com>
27840 Reviewed by Maciej.
27842 - http://bugs.webkit.org/show_bug.cgi?id=15826
27843 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
27845 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
27847 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
27849 * pcre/pcre_compile.c:
27850 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
27851 added OP_NOT since there was no reason it should not be in here.
27852 (could_be_empty_branch): Ditto.
27853 (compile_branch): Streamlined all the single-character cases; there was a bit of
27854 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
27855 But in particular, compile to those opcodes when the single character match is
27857 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
27859 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
27860 the matchframe, after I discovered that none of them needed to be saved and restored
27861 across recursive match calls. Also eliminated the ignored result field from the
27862 matchframe, since I discovered that rrc ("recursive result code") was already the
27863 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
27864 statement of the switch instead of doing them before the switch. This removes a
27865 branch from each iteration of the opcode interpreter, just as removal of "op"
27866 removed at least one store from each iteration. Last, but not least, add the
27867 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
27868 surrogate pair and the letter case can be handled efficiently.
27870 2007-11-04 Darin Adler <darin@apple.com>
27872 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
27874 2007-11-03 Darin Adler <darin@apple.com>
27876 - fix non-Mac builds; remove some more unused PCRE stuff
27878 * pcre/pcre_compile.c:
27879 (compile_branch): Removed branch chain and some unused ESC values.
27880 (compile_regex): Ditto.
27881 (jsRegExpCompile): Ditto.
27882 * pcre/pcre_exec.c:
27883 (match): Removed unused branch targets. Don't use macros any more.
27884 (jsRegExpExecute): More of the same.
27886 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
27887 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
27888 * pcre/pcre.pri: Ditto.
27890 * pcre/MERGING: Removed.
27891 * pcre/pcre_fullinfo.c: Removed.
27892 * pcre/pcre_get.c: Removed.
27893 * pcre/pcre_internal.h:
27894 * pcre/ucp.h: Removed.
27896 2007-11-03 Darin Adler <darin@apple.com>
27898 Reviewed by Maciej.
27900 - http://bugs.webkit.org/show_bug.cgi?id=15821
27901 remove unused PCRE features for speed
27903 A first step toward removing the PCRE features we don't use.
27904 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
27905 the SunSpider regular expression test.
27907 Replaced the public interface with one that doesn't use the
27908 name PCRE. Removed code we don't need for JavaScript and various
27909 configurations we don't use. This is in preparation for still
27910 more changes in the future. We'll probably switch to C++ and
27911 make some even more significant changes to the regexp engine
27912 to get some additional speed.
27914 There's probably additional unused stuff that I haven't
27917 This does mean that our PCRE is now a fork, but I think that's
27918 not really a big deal.
27920 * JavaScriptCore.exp: Remove the 5 old entry points and add
27921 the 3 new entry points for WebCore's direct use of the regular
27924 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
27925 its sense and now there's a USE(POSIX_REGEX) instead, which should
27926 probably not be set by anyone. Maybe later we'll just get rid of it
27931 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
27932 defines. Cut down on the number of functions used.
27933 (KJS::RegExp::~RegExp): Ditto.
27934 (KJS::RegExp::match): Ditto.
27936 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
27939 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
27940 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
27941 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
27942 and JAVASCRIPT. These are all no longer configurable in our copy
27945 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
27946 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
27947 the include of <stdlib.h>, and most of the constants and
27948 functions defined in this header. Changed the naming scheme to
27949 use a JSRegExp prefix rather than a pcre prefix. In the future,
27950 we'll probably change this to be a C++ header.
27952 * pcre/pcre_compile.c: Removed all unused code branches,
27953 including many whole functions and various byte codes.
27954 Kept changes outside of removal to a minimum.
27956 (first_significant_code):
27957 (find_fixedlength):
27959 (could_be_empty_branch):
27964 (find_firstassertedchar):
27965 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
27966 parameters around a bit.
27967 (jsRegExpFree): Added.
27969 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
27970 Also started tearing down the NO_RECURSE mechanism since it's
27971 now the default. In some cases there were things in the explicit
27972 frame that could be turned into plain old local variables and
27973 other small like optimizations.
27976 (match): Changed parameters quite a bit since it's now not used
27978 (jsRegExpExecute): Renamed from pcre_exec.
27980 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
27981 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
27982 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
27983 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
27984 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
27985 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
27987 * pcre/pcre_maketables.c: Changed to only compile in dftables.
27988 Also got rid of many of the tables that we don't use.
27990 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
27992 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
27993 _pcre_ucp_othercase.
27995 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
27996 for classes based on Unicode properties.
27998 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
27999 to eliminate this completely, but we need the regular expression
28000 code to be C++ first.
28002 * pcre/pcre_fullinfo.c:
28005 Files that are no longer needed. I didn't remove them with this
28006 check-in, because I didn't want to modify all the project files.
28008 2007-11-03 Maciej Stachowiak <mjs@apple.com>
28012 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
28014 It turns out that doing this check costs more than it saves.
28016 * kjs/JSImmediate.h:
28017 (KJS::JSImmediate::fromDouble):
28019 2007-11-03 Sam Weinig <sam@webkit.org>
28021 Reviewed by Oliver.
28023 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
28024 The variable had been kept around for binary compatibility, but since nothing
28025 else is there is no point in continuing to keep it around.
28027 * API/JSCallbackConstructor.cpp:
28028 * API/JSCallbackFunction.cpp:
28029 * API/JSCallbackObject.cpp:
28030 * bindings/objc/objc_runtime.mm:
28031 * bindings/runtime_array.cpp:
28032 * bindings/runtime_object.cpp:
28033 * kjs/array_instance.cpp:
28034 * kjs/array_object.cpp:
28035 * kjs/bool_object.cpp:
28036 * kjs/date_object.cpp:
28037 * kjs/error_object.cpp:
28038 * kjs/function.cpp:
28039 * kjs/internal.cpp:
28041 * kjs/math_object.cpp:
28042 * kjs/number_object.cpp:
28044 * kjs/regexp_object.cpp:
28045 * kjs/string_object.cpp:
28047 2007-11-03 Kevin McCullough <kmccullough@apple.com>
28049 - Updated testkjs results to make the build bots green until we
28050 can fix the tests that are failing. The new failures are in DST.
28052 * tests/mozilla/expected.html:
28054 2007-11-03 Maciej Stachowiak <mjs@apple.com>
28058 - don't print the var twice for ForInNodes with a var declaration
28060 * kjs/nodes2string.cpp:
28061 (KJS::ForInNode::streamTo):
28063 2007-11-03 Darin Adler <darin@apple.com>
28065 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
28066 C-incompatible declaration.
28068 2007-11-03 Mark Rowe <mrowe@apple.com>
28072 * kjs/nodes.cpp: Add missing include.
28074 2007-11-03 Darin Adler <darin@apple.com>
28076 Reviewed by Maciej.
28078 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
28079 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
28081 These changes cause us to match the JavaScript specification and pass the
28082 fast/js/kde/encode_decode_uri.html test.
28084 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
28085 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
28088 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
28090 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
28091 those might be illegal in some sense, they aren't supposed to get any special
28092 handling in the place where this function is currently used.
28093 (KJS::UString::UTF8String): Added the strictness.
28095 2007-11-03 Darin Adler <darin@apple.com>
28097 Reviewed by Maciej.
28099 - http://bugs.webkit.org/show_bug.cgi?id=15812
28100 some JavaScript tests (from the Mozilla test suite) are failing
28102 Two or three fixes get 7 more of the Mozilla tests passing.
28103 This gets us down from 61 failing tests to 54.
28105 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
28106 Made this inline and gave it a more specific type. Some day we should
28107 probably do that for all of these -- might even get a bit of a speed
28109 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
28110 inline in the header.
28112 * kjs/regexp_object.h:
28113 * kjs/regexp_object.cpp:
28114 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
28115 switch statement into the RegExpImp object, so they can be shared with
28116 RegExpImp::callAsFunction.
28117 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
28118 (KJS::RegExpImp::test): Added.
28119 (KJS::RegExpImp::exec): Added.
28120 (KJS::RegExpImp::implementsCall): Added.
28121 (KJS::RegExpImp::callAsFunction): Added.
28122 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
28123 lastInput to null rather than empty string -- we take advantage of the
28124 difference in RegExpImp::match.
28125 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
28126 just to get at a field like this.
28128 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
28129 the JavaScript specification. If there are not 4 hex digits after the \u,
28130 then it's processed as if it wasn't an escape sequence at all.
28132 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
28133 for JavaScript (4 specific Unicode values).
28134 * pcre/pcre_exec.c:
28135 (match): Changed all call sites to use IS_NEWLINE.
28136 (pcre_exec): Ditto.
28138 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
28140 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
28142 Sort files(...); sections of Xcode project files.
28144 Rubber-stamped by Darin.
28146 * JavaScriptCore.xcodeproj/project.pbxproj:
28148 2007-11-03 Maciej Stachowiak <mjs@apple.com>
28150 Reviewed by Oliver.
28152 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
28156 (KJS::VarDeclNode::optimizeVariableAccess):
28157 (KJS::VarDeclNode::getDeclarations):
28158 (KJS::VarDeclNode::handleSlowCase):
28159 (KJS::VarDeclNode::evaluateSingle):
28160 (KJS::VarDeclNode::evaluate):
28161 (KJS::VarStatementNode::execute):
28163 (KJS::VarDeclNode::):
28164 (KJS::VarStatementNode::):
28165 * kjs/nodes2string.cpp:
28166 (KJS::VarDeclNode::streamTo):
28168 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
28172 http://bugs.webkit.org/show_bug.cgi?id=15800
28173 REGRESSION (r27303): RegExp leaks
28175 * kjs/regexp_object.h:
28176 (KJS::RegExpImp::setRegExp):
28177 (KJS::RegExpImp::regExp):
28178 (KJS::RegExpImp::classInfo):
28179 * kjs/regexp_object.cpp:
28180 (RegExpImp::RegExpImp):
28181 (RegExpImp::~RegExpImp):
28182 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
28184 2007-11-02 Maciej Stachowiak <mjs@apple.com>
28186 Reviewed by Oliver.
28188 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
28192 (KJS::statementListPushFIFO):
28193 (KJS::statementListGetDeclarations):
28194 (KJS::statementListInitializeDeclarationStacks):
28195 (KJS::statementListInitializeVariableAccessStack):
28196 (KJS::statementListExecute):
28197 (KJS::BlockNode::BlockNode):
28198 (KJS::FunctionBodyNode::FunctionBodyNode):
28199 (KJS::ProgramNode::ProgramNode):
28201 (KJS::CaseClauseNode::):
28203 2007-11-02 Darin Adler <darin@apple.com>
28205 Reviewed by Maciej.
28207 - http://bugs.webkit.org/show_bug.cgi?id=15791
28208 change property map data structure for less memory use, better speed
28210 The property map now has an array of indices and a separate array of
28211 property map entries. This slightly slows down lookup because of a second
28212 memory acess, but makes property maps smaller and faster to iterate in
28213 functions like mark().
28215 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
28216 more than 10% slower. To fix that we'll need to optimize global variable lookup.
28218 * kjs/property_map.cpp:
28219 (KJS::PropertyMapEntry::PropertyMapEntry):
28220 (KJS::PropertyMapHashTable::entries):
28221 (KJS::PropertyMapHashTable::allocationSize):
28222 (KJS::SavedProperties::SavedProperties):
28223 (KJS::SavedProperties::~SavedProperties):
28224 (KJS::PropertyMap::checkConsistency):
28225 (KJS::PropertyMap::~PropertyMap):
28226 (KJS::PropertyMap::clear):
28227 (KJS::PropertyMap::get):
28228 (KJS::PropertyMap::getLocation):
28229 (KJS::PropertyMap::put):
28230 (KJS::PropertyMap::insert):
28231 (KJS::PropertyMap::createTable):
28232 (KJS::PropertyMap::rehash):
28233 (KJS::PropertyMap::remove):
28234 (KJS::PropertyMap::mark):
28235 (KJS::comparePropertyMapEntryIndices):
28236 (KJS::PropertyMap::containsGettersOrSetters):
28237 (KJS::PropertyMap::getEnumerablePropertyNames):
28238 (KJS::PropertyMap::save):
28239 (KJS::PropertyMap::restore):
28240 * kjs/property_map.h:
28242 2007-11-02 Darin Adler <darin@apple.com>
28244 Reviewed by Maciej.
28246 - http://bugs.webkit.org/show_bug.cgi?id=15807
28247 HashMap needs a take() function that combines get and remove
28249 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
28250 but still does only one hash table lookup.
28252 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
28253 a find followed by a remove.
28255 2007-11-02 David Carson <dacarson@gmail.com>
28259 Fix compiler warning "warning: suggest parentheses around && within ||"
28260 http://bugs.webkit.org/show_bug.cgi?id=15764
28262 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
28264 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28266 Reviewed by Maciej Stachowiak.
28268 In preparation for making List a simple stack-allocated Vector:
28270 Removed all instances of List copying and/or assignment, and made List
28271 inherit from Noncopyable.
28273 Functions that used to return a List by copy now take List& out
28276 Layout tests and JS tests pass.
28279 (KJS::List::slice): Replaced copyTail with a more generic slice
28280 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
28283 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28285 Reviewed by Maciej Stachowiak.
28287 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
28288 REGRESSION(r27344): Crash on load at finance.yahoo.com
28290 Reverted a small portion of my last check-in. (The speedup and the List
28291 removal are still there, though.)
28293 ActivationImp needs to hold a pointer to its function, and mark that
28294 pointer (rather than accessing its function through its ExecState, and
28295 counting on the active scope to mark its function) because a closure
28296 can cause an ActivationImp to outlive its ExecState along with any
28299 * kjs/ExecState.cpp:
28300 (KJS::ExecState::ExecState):
28301 * kjs/function.cpp:
28302 (KJS::FunctionImp::~FunctionImp):
28303 (KJS::ActivationImp::ActivationImp):
28305 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
28307 Also made HashTable a little more crash-happy in debug builds, so
28308 problems like this will show up earlier:
28311 (WTF::HashTable::~HashTable):
28313 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28315 Reviewed by Adam Roben.
28317 Addressed some of Darin's review comments.
28319 Used perl -p, which is the shorthand while(<>) {}.
28321 Made sure not to suppress bison's output.
28323 Added line to removed bison_out.txt, since this script removes other
28324 intermediate files, too.
28326 * DerivedSources.make:
28328 2007-11-01 Geoffrey Garen <ggaren@apple.com>
28330 Reviewed by Oliver Hunt.
28332 Removed List from ActivationImp, in preparation for making all lists
28337 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
28339 * kjs/ExecState.cpp:
28340 (KJS::ExecState::ExecState):
28341 (KJS::ExecState::~ExecState):
28342 * kjs/function.cpp:
28343 (KJS::ActivationImp::ActivationImp):
28344 (KJS::ActivationImp::createArgumentsObject):
28346 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
28348 2007-11-01 Adam Roben <aroben@apple.com>
28350 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
28352 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
28353 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
28355 It also gets rid of an MSVC warning that we previously had to silence.
28359 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
28360 back on the "overflow in constant arithmetic" warning.
28361 * kjs/number_object.cpp:
28362 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
28365 2007-10-31 Adam Roben <aroben@apple.com>
28371 2007-10-31 Maciej Stachowiak <mjs@apple.com>
28373 Reviewed by Oliver.
28375 - shave some cycles off of local storage access for a 1% SunSpider speedup
28377 Keep the LocalStorage pointer in the ExecState, instead of getting
28378 it from the ActivationImp all the time.
28380 * kjs/ExecState.cpp:
28381 (KJS::ExecState::updateLocalStorage):
28383 (KJS::ExecState::localStorage):
28385 (KJS::LocalVarAccessNode::evaluate):
28386 (KJS::LocalVarFunctionCallNode::evaluate):
28387 (KJS::PostIncLocalVarNode::evaluate):
28388 (KJS::PostDecLocalVarNode::evaluate):
28389 (KJS::LocalVarTypeOfNode::evaluate):
28390 (KJS::PreIncLocalVarNode::evaluate):
28391 (KJS::PreDecLocalVarNode::evaluate):
28392 (KJS::ReadModifyLocalVarNode::evaluate):
28393 (KJS::AssignLocalVarNode::evaluate):
28394 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
28396 2007-10-31 Adam Roben <aroben@apple.com>
28398 Fix a crash on launch due to a static initializer race
28400 We now use fast inline assembler spinlocks which can be statically
28401 initialized at compile time.
28403 As a side benefit, this speeds up SunSpider by 0.4%.
28405 Reviewed by Oliver.
28407 * wtf/FastMalloc.cpp:
28408 * wtf/TCSpinLock.h:
28409 (TCMalloc_SpinLock::Lock):
28410 (TCMalloc_SpinLock::Unlock):
28411 (TCMalloc_SlowLock):
28412 * wtf/TCSystemAlloc.cpp:
28414 2007-10-31 Kevin McCullough <kmccullough@apple.com>
28418 - Corrected spelling.
28420 * wtf/HashTraits.h:
28422 2007-10-31 Mark Rowe <mrowe@apple.com>
28424 Further Gtk build fixage.
28426 * kjs/regexp_object.cpp:
28428 2007-10-31 Mark Rowe <mrowe@apple.com>
28434 2007-10-31 Darin Adler <darin@apple.com>
28436 Reviewed by Maciej.
28438 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
28439 RegExp/RegExpObjectImp cause needless UString creation
28441 Speeds things up 0.4% according to SunSpider.
28443 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
28444 because this library doesn't use the real PCRE -- it uses its
28445 own PCRE that works on UTF-16.
28447 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
28448 Use Noncopyable. Change the return value of match.
28450 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
28451 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
28452 (KJS::RegExp::match): Change to return the position as an int and the
28453 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
28455 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
28456 require a result string.
28457 * kjs/regexp_object.cpp:
28458 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
28459 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
28460 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
28461 the main result with the backreferences; now it doesn't need to take
28462 a result parameter.
28463 (RegExpObjectImp::getBackref): Minor tweaks.
28464 (RegExpObjectImp::getLastParen): Ditto.
28465 (RegExpObjectImp::getLeftContext): Ditto.
28466 (RegExpObjectImp::getRightContext): Ditto.
28467 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
28468 getBackref(0) so we don't need a separate getLastMatch function.
28470 * kjs/string_object.cpp:
28471 (KJS::replace): Update to use new performMatch, including merging the
28472 matched string section with the other substrings.
28473 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
28474 new performMatch and match. Also change to use OwnArrayPtr.
28476 2007-10-31 Oliver Hunt <oliver@apple.com>
28478 * kjs/nodes.h: include OwnPtr.h
28480 2007-10-31 Oliver Hunt <oliver@apple.com>
28482 Reviewed by Maciej.
28484 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
28488 (KJS::statementListPushFIFO):
28489 (KJS::statementListGetDeclarations):
28490 (KJS::statementListInitializeDeclarationStacks):
28491 (KJS::statementListInitializeVariableAccessStack):
28492 (KJS::statementListExecute):
28493 (KJS::BlockNode::optimizeVariableAccess):
28494 (KJS::BlockNode::BlockNode):
28495 (KJS::BlockNode::getDeclarations):
28496 (KJS::BlockNode::execute):
28497 (KJS::CaseClauseNode::optimizeVariableAccess):
28498 (KJS::CaseClauseNode::getDeclarations):
28499 (KJS::CaseClauseNode::evalStatements):
28500 (KJS::FunctionBodyNode::initializeDeclarationStacks):
28501 (KJS::FunctionBodyNode::optimizeVariableAccess):
28503 * kjs/nodes2string.cpp:
28504 (KJS::statementListStreamTo):
28505 (KJS::BlockNode::streamTo):
28506 (KJS::CaseClauseNode::streamTo):
28508 2007-10-30 Mark Rowe <mrowe@apple.com>
28510 * kjs/property_map.cpp: Added a missing using directive to fix the build
28511 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
28513 2007-10-31 Maciej Stachowiak <mjs@apple.com>
28515 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
28518 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
28522 http://bugs.webkit.org/show_bug.cgi?id=11001
28523 WebKit doesn't support RegExp.compile method
28525 Test: fast/js/regexp-compile.html
28527 * kjs/regexp_object.cpp:
28528 (RegExpPrototype::RegExpPrototype):
28529 (RegExpProtoFunc::callAsFunction):
28530 * kjs/regexp_object.h:
28531 (KJS::RegExpProtoFunc::):
28532 Added RegExp.compile.
28534 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
28536 2007-10-31 Maciej Stachowiak <mjs@apple.com>
28538 Reviewed by Oliver.
28540 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
28542 Integer divide sucks. Fortunately, a bunch of shifts and XORs
28543 biased towards the high bits is sufficient to provide a good
28544 double hash. Besides the SunSpider win, I used the dump statistics
28545 mode for both to verify that collisions did not increase and that
28546 the longest collision chain is not any longer.
28548 * kjs/property_map.cpp:
28550 (KJS::PropertyMap::get):
28551 (KJS::PropertyMap::getLocation):
28552 (KJS::PropertyMap::put):
28553 (KJS::PropertyMap::insert):
28554 (KJS::PropertyMap::remove):
28555 (KJS::PropertyMap::checkConsistency):
28559 (WTF::::lookupForWriting):
28560 (WTF::::fullLookupForWriting):
28563 2007-10-30 Adam Roben <aroben@apple.com>
28565 * kjs/collector.h: Make HeapType public so it can be used for non-member
28566 things like the HeapConstants struct template. Fixes the build on Windows.
28568 2007-10-30 Adam Roben <aroben@apple.com>
28570 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
28572 Speeds up SunSpider by 0.4%.
28574 Reviewed by Steve and Maciej.
28576 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
28577 a warning during LTCG in release builds about double -> float
28579 * wtf/AlwaysInline.h:
28580 * wtf/FastMalloc.h:
28582 2007-10-30 Adam Roben <aroben@apple.com>
28584 Use GetCurrentThreadId instead of pthread_self in FastMalloc
28586 Speeds up SunSpider by 0.3%.
28590 * wtf/FastMalloc.cpp:
28591 (WTF::TCMalloc_ThreadCache::InitTSD):
28592 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
28594 2007-10-30 Adam Roben <aroben@apple.com>
28596 Switch to a Win32 critical section implementation of spinlocks
28598 Speeds up SunSpider by 0.4%.
28602 * wtf/FastMalloc.cpp:
28603 * wtf/TCSpinLock.h:
28604 (TCMalloc_SpinLock::TCMalloc_SpinLock):
28605 (TCMalloc_SpinLock::Init):
28606 (TCMalloc_SpinLock::Finalize):
28607 (TCMalloc_SpinLock::Lock):
28608 (TCMalloc_SpinLock::Unlock):
28609 * wtf/TCSystemAlloc.cpp:
28611 2007-10-30 Adam Roben <aroben@apple.com>
28613 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
28615 http://bugs.webkit.org/show_bug.cgi?id=15586
28617 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
28619 Use Win32 TLS functions instead of __declspec(thread), which breaks
28624 * wtf/FastMalloc.cpp:
28625 (WTF::getThreadHeap):
28626 (WTF::TCMalloc_ThreadCache::InitModule):
28628 2007-10-30 Maciej Stachowiak <mjs@apple.com>
28630 Reviewed by Oliver.
28632 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
28633 http://bugs.webkit.org/show_bug.cgi?id=15772
28635 We do this by using a single mark bit per two number cells, and
28638 Besides being an 0.5% win overall, this is a 7.1% win on morph.
28640 * kjs/collector.cpp:
28641 (KJS::Collector::heapAllocate):
28642 (KJS::Collector::markStackObjectsConservatively):
28643 (KJS::Collector::sweep):
28645 (KJS::SmallCollectorCell::):
28647 2007-10-30 Geoffrey Garen <ggaren@apple.com>
28649 Reviewed by Adam Roben, Sam Weinig.
28651 Made conflicts in grammar.y a persistent build failure.
28653 * DerivedSources.make:
28655 2007-10-30 Kevin McCullough <kmccullough@apple.com>
28657 Reviewed by Adam and Geoff.
28659 - Added a new cast so all the casts are in the same place.
28664 2007-10-30 Geoffrey Garen <ggaren@apple.com>
28666 Reviewed by Darin Adler.
28668 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
28670 JS tests, including
28672 ecma_2/Statements/dowhile-001.js
28673 ecma_2/Statements/dowhile-002.js
28674 ecma_2/Statements/dowhile-003.js
28675 ecma_2/Statements/dowhile-004.js
28676 ecma_2/Statements/dowhile-005.js
28677 ecma_2/Statements/dowhile-006.js
28678 ecma_2/Statements/dowhile-007.js
28679 js1_2/statements/do_while.js
28681 and layout tests, including
28683 do-while-expression-value.html
28684 do-while-semicolon.html
28685 do-while-without-semicolon.html
28689 * kjs/grammar.y: Use the explicit "error" production, as we do with other
28690 automatic semicolon insertions, to disambiguate "do { } while();" from
28691 "do { } while()" followed by ";" (the empty statement).
28693 2007-10-29 Oliver Hunt <oliver@apple.com>
28695 Reviewed by Maciej.
28697 Debranching remaining assignment nodes, and miscellaneous cleanup
28699 Split read-modify code paths out of AssignBracketNode and AssignDotNode
28700 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
28701 and ReadModifyResolveNode evaluate methods
28703 Leads to a 1% gain in SunSpider.
28707 (KJS::ReadModifyLocalVarNode::evaluate):
28708 (KJS::ReadModifyResolveNode::evaluate):
28709 (KJS::AssignDotNode::evaluate):
28710 (KJS::ReadModifyDotNode::optimizeVariableAccess):
28711 (KJS::ReadModifyDotNode::evaluate):
28712 (KJS::AssignBracketNode::evaluate):
28713 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
28714 (KJS::ReadModifyBracketNode::evaluate):
28716 (KJS::AssignBracketNode::):
28717 (KJS::AssignBracketNode::precedence):
28718 (KJS::AssignDotNode::):
28719 (KJS::AssignDotNode::precedence):
28720 * kjs/nodes2string.cpp:
28721 (KJS::ReadModifyBracketNode::streamTo):
28722 (KJS::AssignBracketNode::streamTo):
28723 (KJS::ReadModifyDotNode::streamTo):
28724 (KJS::AssignDotNode::streamTo):
28726 2007-10-29 Oliver Hunt <oliver@apple.com>
28728 Debranching various Node::evaluate implementations
28730 Reviewed by Maciej.
28732 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
28733 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
28735 Gains 1.6% on SunSpider
28737 * JavaScriptCore.xcodeproj/project.pbxproj:
28740 (KJS::PostIncResolveNode::optimizeVariableAccess):
28741 (KJS::PostIncResolveNode::evaluate):
28742 (KJS::PostIncLocalVarNode::evaluate):
28743 (KJS::PostDecResolveNode::optimizeVariableAccess):
28744 (KJS::PostDecResolveNode::evaluate):
28745 (KJS::PostDecLocalVarNode::evaluate):
28746 (KJS::PostIncBracketNode::evaluate):
28747 (KJS::PostDecBracketNode::evaluate):
28748 (KJS::PostIncDotNode::evaluate):
28749 (KJS::PostDecDotNode::evaluate):
28750 (KJS::PreIncResolveNode::optimizeVariableAccess):
28751 (KJS::PreIncLocalVarNode::evaluate):
28752 (KJS::PreIncResolveNode::evaluate):
28753 (KJS::PreDecResolveNode::optimizeVariableAccess):
28754 (KJS::PreDecLocalVarNode::evaluate):
28755 (KJS::PreDecResolveNode::evaluate):
28756 (KJS::PreIncBracketNode::evaluate):
28757 (KJS::PreDecBracketNode::evaluate):
28758 (KJS::PreIncDotNode::evaluate):
28759 (KJS::PreDecDotNode::evaluate):
28760 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
28761 (KJS::AssignResolveNode::optimizeVariableAccess):
28762 (KJS::AssignLocalVarNode::evaluate):
28763 (KJS::AssignResolveNode::evaluate):
28765 (KJS::PostDecResolveNode::):
28766 (KJS::PostDecResolveNode::precedence):
28767 (KJS::PostDecLocalVarNode::):
28768 (KJS::PostfixBracketNode::):
28769 (KJS::PostfixBracketNode::precedence):
28770 (KJS::PostIncBracketNode::):
28771 (KJS::PostIncBracketNode::isIncrement):
28772 (KJS::PostDecBracketNode::):
28773 (KJS::PostDecBracketNode::isIncrement):
28774 (KJS::PostfixDotNode::):
28775 (KJS::PostfixDotNode::precedence):
28776 (KJS::PostIncDotNode::):
28777 (KJS::PostIncDotNode::isIncrement):
28778 (KJS::PostDecDotNode::):
28779 (KJS::PreIncResolveNode::):
28780 (KJS::PreDecResolveNode::):
28781 (KJS::PreDecResolveNode::precedence):
28782 (KJS::PreDecLocalVarNode::):
28783 (KJS::PrefixBracketNode::):
28784 (KJS::PrefixBracketNode::precedence):
28785 (KJS::PreIncBracketNode::):
28786 (KJS::PreIncBracketNode::isIncrement):
28787 (KJS::PreDecBracketNode::):
28788 (KJS::PreDecBracketNode::isIncrement):
28789 (KJS::PrefixDotNode::):
28790 (KJS::PrefixDotNode::precedence):
28791 (KJS::PreIncDotNode::):
28792 (KJS::PreIncDotNode::isIncrement):
28793 (KJS::PreDecDotNode::):
28794 (KJS::ReadModifyResolveNode::):
28795 (KJS::ReadModifyLocalVarNode::):
28796 (KJS::AssignResolveNode::):
28797 (KJS::AssignResolveNode::precedence):
28798 * kjs/nodes2string.cpp:
28799 (KJS::PostIncResolveNode::streamTo):
28800 (KJS::PostDecResolveNode::streamTo):
28801 (KJS::PostfixBracketNode::streamTo):
28802 (KJS::PostfixDotNode::streamTo):
28803 (KJS::PreIncResolveNode::streamTo):
28804 (KJS::PreDecResolveNode::streamTo):
28805 (KJS::ReadModifyResolveNode::streamTo):
28806 (KJS::AssignResolveNode::streamTo):
28808 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28810 Not reviewed, build fix.
28812 - Include Vector.h in a way that actually works.
28814 * kjs/LocalStorage.h:
28816 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28818 Not reviewed, build fix.
28820 - Install LocalStorage.h as a private header.
28822 * JavaScriptCore.xcodeproj/project.pbxproj:
28824 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28828 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
28830 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
28831 * JavaScriptCore.xcodeproj/project.pbxproj:
28832 * kjs/LocalStorage.h: Added.
28833 (KJS::LocalStorageEntry::LocalStorageEntry):
28837 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
28839 2007-10-29 Geoffrey Garen <ggaren@apple.com>
28841 Reviewed by Oliver Hunt.
28843 Some small tweaks that I notice while reviewing Oliver's last patch.
28845 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
28847 No change in SunSpider because SunSpider doesn't take the code path that
28848 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
28851 (KJS::LocalVarPostfixNode::evaluate):
28852 (KJS::TypeOfResolveNode::optimizeVariableAccess):
28853 (KJS::LocalVarTypeOfNode::evaluate):
28854 (KJS::PrefixResolveNode::optimizeVariableAccess):
28855 (KJS::LocalVarPrefixNode::evaluate):
28856 (KJS::AssignResolveNode::optimizeVariableAccess):
28857 (KJS::LocalVarAssignNode::evaluate):
28859 (KJS::LocalVarTypeOfNode::):
28860 (KJS::PrefixResolveNode::):
28861 (KJS::LocalVarPrefixNode::):
28862 (KJS::AssignResolveNode::):
28863 (KJS::LocalVarAssignNode::):
28865 2007-10-29 Eric Seidel <eric@webkit.org>
28867 Reviewed by Maciej.
28869 SunSpider claims this was a 0.7% speedup.
28871 * kjs/string_object.cpp:
28872 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
28874 2007-10-29 Maciej Stachowiak <mjs@apple.com>
28878 - re-enable asserts for access to empty or deleted keys
28882 (WTF::::lookupForWriting):
28883 (WTF::::fullLookupForWriting):
28886 2007-10-29 Eric Seidel <eric@webkit.org>
28888 Build fix only, no review.
28890 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
28892 2007-10-29 Mark Rowe <mrowe@apple.com>
28894 Gtk build fix. Move struct declarations into nodes.h.
28899 2007-10-29 Eric Seidel <eric@webkit.org>
28903 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
28904 Make it a compile time error to use toString(ExecState) on a StringInstance
28906 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
28909 (KJS::StringImp::getLength):
28910 * kjs/string_object.cpp:
28911 (KJS::StringInstance::lengthGetter):
28912 (KJS::StringInstance::inlineGetOwnPropertySlot):
28913 (KJS::StringInstance::getOwnPropertySlot):
28914 * kjs/string_object.h:
28916 2007-10-28 Oliver Hunt <oliver@apple.com>
28920 Add nodes to allow Assignment, TypeOf, and prefix operators to
28921 make use of the new optimised local variable look up.
28923 5% gain on sunspider
28926 (KJS::TypeOfResolveNode::optimizeVariableAccess):
28927 (KJS::LocalTypeOfAccessNode::evaluate):
28928 (KJS::PrefixResolveNode::optimizeVariableAccess):
28929 (KJS::PrefixLocalAccessNode::evaluate):
28930 (KJS::AssignResolveNode::optimizeVariableAccess):
28931 (KJS::AssignLocalAccessNode::evaluate):
28933 (KJS::TypeOfResolveNode::):
28934 (KJS::TypeOfResolveNode::precedence):
28935 (KJS::LocalTypeOfAccessNode::):
28936 (KJS::PrefixResolveNode::):
28937 (KJS::PrefixResolveNode::precedence):
28938 (KJS::PrefixLocalAccessNode::):
28939 (KJS::AssignResolveNode::):
28940 (KJS::AssignLocalAccessNode::):
28942 2007-10-28 Maciej Stachowiak <mjs@apple.com>
28946 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
28947 http://bugs.webkit.org/show_bug.cgi?id=15748
28949 Not a significant speedup or slowdown on SunSpider.
28952 (KJS::clearNewNodes):
28956 (KJS::BlockNode::BlockNode):
28957 (KJS::CaseBlockNode::CaseBlockNode):
28958 (KJS::FunctionBodyNode::FunctionBodyNode):
28959 (KJS::SourceElementsNode::SourceElementsNode):
28960 (KJS::ProgramNode::ProgramNode):
28962 (KJS::ElementNode::):
28963 (KJS::ArrayNode::):
28964 (KJS::PropertyListNode::):
28965 (KJS::ObjectLiteralNode::):
28966 (KJS::ArgumentListNode::):
28967 (KJS::ArgumentsNode::):
28968 (KJS::VarDeclListNode::):
28969 (KJS::VarStatementNode::):
28971 (KJS::ParameterNode::):
28972 (KJS::FuncExprNode::):
28973 (KJS::FuncDeclNode::):
28974 (KJS::SourceElementsNode::):
28975 (KJS::CaseClauseNode::):
28976 (KJS::ClauseListNode::):
28978 2007-10-28 Mark Rowe <mrowe@apple.com>
28980 Disable assertions in a manner that doesn't break the Qt Windows build.
28984 (WTF::::lookupForWriting):
28985 (WTF::::fullLookupForWriting):
28987 2007-10-28 Geoffrey Garen <ggaren@apple.com>
28989 Temporarily disabling some ASSERTs I introduced in my last check-in
28990 because of http://bugs.webkit.org/show_bug.cgi?id=15747
28991 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
28995 (WTF::::lookupForWriting):
28996 (WTF::::fullLookupForWriting):
28999 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29001 Reviewed by Darin Adler.
29003 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
29004 #ifndef ASSERT_DISABLED is no good!
29006 Replaced with #if !ASSERT_DISABLED.
29010 (WTF::::lookupForWriting):
29011 (WTF::::fullLookupForWriting):
29014 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29016 Reviewed by Darin Adler.
29018 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
29019 to the AST transfom that replaces slow resolve nodes with fast local
29020 variable alternatives.
29022 2.5% speedup on SunSpider.
29024 Also added some missing copyright notices.
29027 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
29028 (KJS::FunctionCallResolveNode::evaluate):
29029 (KJS::LocalVarFunctionCallNode::evaluate):
29030 (KJS::PostfixResolveNode::optimizeVariableAccess):
29031 (KJS::PostfixResolveNode::evaluate):
29032 (KJS::LocalVarPostfixNode::evaluate):
29033 (KJS::DeleteResolveNode::optimizeVariableAccess):
29034 (KJS::DeleteResolveNode::evaluate):
29035 (KJS::LocalVarDeleteNode::evaluate):
29037 (KJS::FunctionCallResolveNode::):
29038 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
29039 (KJS::PostfixResolveNode::):
29040 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
29041 (KJS::DeleteResolveNode::):
29042 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
29044 2007-10-28 Eric Seidel <eric@webkit.org>
29048 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
29049 Add virtual keyword to a few virtual functions previously unmarked.
29052 (KJS::StringImp::type):
29053 (KJS::NumberImp::type):
29055 (KJS::UString::Rep::deref):
29057 2007-10-28 Darin Adler <darin@apple.com>
29059 - fix "broken everything" from the storage leak fix
29061 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
29062 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
29064 2007-10-28 Darin Adler <darin@apple.com>
29068 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
29070 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
29073 * API/JSNodeList.c:
29076 Fixed unused variables by using them or marked them with UNUSED_PARAM.
29078 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
29079 Removed parameter names to indicate they are unused.
29081 2007-10-28 Darin Adler <darin@apple.com>
29083 Reviewed by Maciej.
29085 - fix a storage leak where we ref the UString every time we replace
29086 a ResolveNode with a LocalVarAccessNode
29088 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
29089 that takes PlacementNewAdopt.
29091 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
29092 with PlacementNewAdopt instead of the old value of ident.
29094 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
29095 takes PlacementNewAdopt.
29097 2007-10-28 Darin Adler <darin@apple.com>
29099 - Windows build fix; get rid of unused parameter
29101 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
29102 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
29103 The assertions weren't all that helpful.
29105 2007-10-28 Mark Rowe <mrowe@apple.com>
29107 Gtk build fix. Add include of MathExtras.h.
29109 * kjs/string_object.cpp:
29111 2007-10-28 Mark Rowe <mrowe@apple.com>
29113 Reviewed by Maciej and Tim.
29115 Replace uses of isNaN and isInf with isnan and isinf, and
29116 remove isNaN and isInf.
29118 * kjs/config.h: Remove unused HAVE_'s.
29119 * kjs/date_object.cpp:
29120 (KJS::DateInstance::getTime):
29121 (KJS::DateInstance::getUTCTime):
29122 (KJS::DateProtoFunc::callAsFunction):
29123 (KJS::DateObjectImp::construct):
29124 (KJS::DateObjectFuncImp::callAsFunction):
29125 * kjs/function.cpp:
29126 (KJS::GlobalFuncImp::callAsFunction):
29127 * kjs/math_object.cpp:
29128 (MathFuncImp::callAsFunction):
29129 * kjs/nodes2string.cpp:
29130 (KJS::isParserRoundTripNumber):
29131 * kjs/number_object.cpp:
29132 (NumberProtoFunc::callAsFunction):
29133 * kjs/operations.cpp:
29134 * kjs/operations.h:
29135 * kjs/string_object.cpp:
29136 (KJS::StringProtoFunc::callAsFunction):
29138 (KJS::UString::from):
29140 (KJS::JSValue::toInteger):
29141 (KJS::JSValue::toInt32SlowCase):
29142 (KJS::JSValue::toUInt32SlowCase):
29144 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29146 Build fix: use the new-fangled missingSymbolMarker().
29149 (KJS::ResolveNode::optimizeVariableAccess):
29151 (KJS::LocalVarAccessNode::LocalVarAccessNode):
29153 2007-10-28 Geoffrey Garen <ggaren@apple.com>
29155 Reviewed by Maciej Stachowiak, Darin Adler.
29157 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
29160 AST transfom to replace slow resolve nodes with fast local variable
29161 alternatives that do direct memory access. Currently, only ResolveNode
29162 provides a fast local variable alternative. 6 others are soon to come.
29164 16.7% speedup on SunSpider.
29166 Most of this patch is just scaffolding to support iterating all the
29167 resolve nodes in the AST through optimizeResolveNodes(). In
29168 optimizeResolveNodes(), most classes just push their child nodes onto
29169 the processing stack, while ResolveNodes actually replace themselves in
29170 the tree with more optimized alternatives, if possible.
29172 Here are the interesting bits:
29174 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
29175 in Node and ResolveNode. This tag allows you to use placement new to
29176 swap out a base class Node in favor of a subclass copy that holds the
29177 same data. (Without this tag, default initialization would NULL out
29178 RefPtrs, change line numbers, etc.)
29181 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
29182 that the fast path is impossible, to make sure we didn't leave anything
29185 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
29186 transformation happens.
29188 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
29189 optimization happens.
29191 * kjs/function.h: Added symbolTable() accessor for, for the sake of
29194 2007-10-28 Mark Rowe <mrowe@apple.com>
29196 Reviewed by Maciej.
29198 Fix "AllInOneFile.o has a global initializer in it".
29200 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
29201 We can avoid this by moving it inside an inline function.
29203 * kjs/SymbolTable.h:
29204 (KJS::missingSymbolMarker):
29205 * kjs/function.cpp:
29206 (KJS::ActivationImp::getOwnPropertySlot):
29207 (KJS::ActivationImp::put):
29209 2007-10-28 Maciej Stachowiak <mjs@apple.com>
29213 - Added assertions to protect against adding empty or deleted keys to a HashTable
29216 (WTF::HashTable::lookup):
29217 (WTF::HashTable::lookupForWriting):
29218 (WTF::HashTable::fullLookupForWriting):
29219 (WTF::HashTable::add):
29221 2007-10-28 Darin Adler <darin@apple.com>
29225 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
29226 Use isNaN and isInf instead of isnan and isinf.
29228 2007-10-28 Darin Adler <darin@apple.com>
29230 Reviewed by Maciej.
29232 - http://bugs.webkit.org/show_bug.cgi?id=15735
29233 remove GroupNode to simplify AST and possibly get a modest speedup
29235 This patch removes 4 node types: GroupNode, PropertyNameNode,
29236 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
29238 To remove GroupNode, we add knowledge of precedence to the tree nodes,
29239 and use that when serializing to determine where parentheses are needed.
29240 This means we no longer have to represent parentheses in the tree.
29242 The precedence values are named after productions in the grammar from the
29243 JavaScript standard.
29245 SunSpider says this is an 0.4% speedup.
29248 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
29249 serialization, so I moved it to the file that takes care of that.
29251 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
29252 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
29253 by merging the PropertyName rule into the Property rule (which was easier
29254 than figuring out how to pass the Identifier from one node to another).
29255 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
29256 and FunctionCallParenDotNode.
29258 * kjs/nodes.h: Removed unused forward declarations and Operator values.
29259 Added Precedence enum, and precedence function to all nodes. Removed
29260 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
29261 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
29262 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
29264 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
29265 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
29266 of converting it from an Identifier to a jsString then back to a UString
29267 then into an Identifier again!
29269 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
29270 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
29271 single function with a switch. Added a precedence that you can stream in, to
29272 cause the next node serialized to add parentheses based on that precedence value.
29273 (KJS::operatorString): Moved to the top of the file.
29274 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
29275 workaround for snprintf, since StringExtras.h takes care of that.
29276 (KJS::operator<<): Made the char and char* versions faster by using UString's
29277 character append functions instead of constructing a UString. Added the logic
29278 to the Node* version to add parentheses if needed.
29279 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
29280 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
29281 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
29283 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
29284 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
29285 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
29286 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
29287 (KJS::FunctionCallBracketNode::streamTo): Ditto.
29288 (KJS::FunctionCallDotNode::streamTo): Ditto.
29289 (KJS::PostfixBracketNode::streamTo): Ditto.
29290 (KJS::PostfixDotNode::streamTo): Ditto.
29291 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
29292 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
29293 (KJS::DeleteDotNode::streamTo): Ditto.
29294 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
29295 (KJS::VoidNode::streamTo): Ditto.
29296 (KJS::TypeOfValueNode::streamTo): Ditto.
29297 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
29298 (KJS::PrefixDotNode::streamTo): Ditto.
29299 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
29300 (KJS::UnaryPlusNode::streamTo): Ditto.
29301 (KJS::NegateNode::streamTo): Ditto.
29302 (KJS::BitwiseNotNode::streamTo): Ditto.
29303 (KJS::LogicalNotNode::streamTo): Ditto.
29304 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
29305 (KJS::DivNode::streamTo): Ditto.
29306 (KJS::ModNode::streamTo): Ditto.
29307 (KJS::AddNode::streamTo): Ditto.
29308 (KJS::SubNode::streamTo): Ditto.
29309 (KJS::LeftShiftNode::streamTo): Ditto.
29310 (KJS::RightShiftNode::streamTo): Ditto.
29311 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
29312 (KJS::LessNode::streamTo): Ditto.
29313 (KJS::GreaterNode::streamTo): Ditto.
29314 (KJS::LessEqNode::streamTo): Ditto.
29315 (KJS::GreaterEqNode::streamTo): Ditto.
29316 (KJS::InstanceOfNode::streamTo): Ditto.
29317 (KJS::InNode::streamTo): Ditto.
29318 (KJS::EqualNode::streamTo): Ditto.
29319 (KJS::NotEqualNode::streamTo): Ditto.
29320 (KJS::StrictEqualNode::streamTo): Ditto.
29321 (KJS::NotStrictEqualNode::streamTo): Ditto.
29322 (KJS::BitAndNode::streamTo): Ditto.
29323 (KJS::BitXOrNode::streamTo): Ditto.
29324 (KJS::BitOrNode::streamTo): Ditto.
29325 (KJS::LogicalAndNode::streamTo): Ditto.
29326 (KJS::LogicalOrNode::streamTo): Ditto.
29327 (KJS::ConditionalNode::streamTo): Ditto.
29328 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
29329 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
29330 the bracket and PrecAssignment for the right side.
29331 (KJS::AssignDotNode::streamTo): Ditto.
29332 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
29333 and PrecAssignment for the right side.
29334 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
29335 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
29337 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
29339 Define wx port and set wx port USE options.
29341 Reviewed by Adam Roben.
29345 2007-10-28 Mark Rowe <mrowe@apple.com>
29347 We don't include "config.h" in headers.
29349 * bindings/jni/jni_instance.h:
29352 * wtf/TCSpinLock.h:
29354 2007-10-28 Maciej Stachowiak <mjs@apple.com>
29356 Rubber stamped by Mark.
29358 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
29360 * kjs/SymbolTable.h:
29361 (KJS::SymbolTableIndexHashTraits::emptyValue):
29362 * kjs/function.cpp:
29363 (KJS::ActivationImp::getOwnPropertySlot):
29364 (KJS::ActivationImp::put):
29366 2007-10-28 Maciej Stachowiak <mjs@apple.com>
29370 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
29372 * kjs/SymbolTable.h:
29373 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
29374 (KJS::IdentifierRepHash::equal): ditto
29375 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
29376 (KJS::SymbolTable): change to a typedef for a HashMap.
29377 * kjs/function.cpp:
29378 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
29379 (KJS::ActivationImp::deleteProperty): ditto
29380 (KJS::ActivationImp::put): ditto
29383 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
29384 you now have to store a UString::rep, not an identifier.
29386 2007-10-27 Maciej Stachowiak <mjs@apple.com>
29388 Reviewed by Oliver.
29390 - numerous HashTable performance improvements
29392 This does not quite add up to a measurable win on SunSpider, but it allows a
29393 follow-on > 3% improvement and probably helps WebCore too.
29395 I made the following improvements, among others:
29397 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
29398 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
29400 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
29401 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
29402 two for writing, and one folded directly into add() (these all were improvments).
29404 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
29406 - Made a special constructor for iterators that knows it points to
29407 a valid filled cell and so skips updating itself.
29409 - Reordered memory accesses in the various lookup functions for better code generation
29411 - Made simple translators avoid passing a hash code around
29413 - Other minor tweaks
29417 (WTF::HashTableConstIterator::HashTableConstIterator):
29418 (WTF::HashTableIterator::HashTableIterator):
29419 (WTF::IdentityHashTranslator::translate):
29420 (WTF::HashTable::end):
29421 (WTF::HashTable::lookup):
29422 (WTF::HashTable::lookupForWriting):
29423 (WTF::HashTable::makeKnownGoodIterator):
29424 (WTF::HashTable::makeKnownGoodConstIterator):
29426 (WTF::::lookupForWriting):
29427 (WTF::::fullLookupForWriting):
29429 (WTF::::addPassingHashCode):
29433 * kjs/identifier.cpp:
29435 * wtf/HashFunctions.h:
29443 * wtf/ListHashSet.h:
29444 (WTF::ListHashSetTranslator::translate):
29446 2007-10-27 Darin Adler <darin@apple.com>
29450 - fix ASCIICType.h for some Windows compiles
29452 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
29453 compiler/library that has the wchar_t that is just a typedef.
29455 2007-10-27 Kevin McCullough <kmccullough@apple.com>
29458 - Forgot to change the build step when I changed the filename.
29460 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29462 2007-10-27 Geoffrey Garen <ggaren@apple.com>
29464 Reviewed by Darin Adler.
29466 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
29468 http://bugs.webkit.org/show_bug.cgi?id=15718
29470 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
29471 hash value. Also changed O(n) strlen to O(1) check for empty string.
29472 (KJS::Identifier::add):
29474 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
29475 (KJS::UString::UString):
29476 (KJS::UString::operator=):
29478 2007-10-27 Darin Adler <darin@apple.com>
29482 - fix pow on Windows
29484 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
29485 a "pow" function that does not properly handle the case where arg1 is
29488 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
29489 specify "::pow" -- just "pow" is fine.
29491 2007-10-27 Darin Adler <darin@apple.com>
29493 Reviewed by Maciej.
29495 - http://bugs.webkit.org/show_bug.cgi?id=15711
29496 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
29498 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
29500 * kjs/object.h: Removed redundant includes.
29501 * kjs/value.h: Ditto.
29503 2007-10-27 Maciej Stachowiak <mjs@apple.com>
29507 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
29508 http://bugs.webkit.org/show_bug.cgi?id=15718
29510 * kjs/identifier.cpp:
29511 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
29512 now that we count on all Identifiers already having one.
29514 2007-10-27 Mark Rowe <mrowe@apple.com>
29518 * kjs/SymbolTable.h:
29520 2007-10-27 Mark Rowe <mrowe@apple.com>
29526 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29528 Rubber stamp by Adam.
29530 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
29531 files contain are functions that operate on BSTRs.
29533 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
29534 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
29535 * API/JSStringRefCOM.cpp: Removed.
29536 * API/JSStringRefCOM.h: Removed.
29537 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29539 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29543 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
29545 * API/JSStringRefCOM.cpp:
29546 (JSStringCreateWithBSTR):
29548 2007-10-26 Sam Weinig <sam@webkit.org>
29552 * kjs/SymbolTable.h: Add header gaurd.
29553 * kjs/nodes.h: #include "SymbolTable.h"
29555 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29557 Suggested by Anders Carlsson.
29561 * kjs/function.cpp:
29562 (KJS::ActivationImp::getOwnPropertySlot):
29564 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29566 Suggested by Darin Adler.
29568 Use computedHash(), which is safer than just directly accessing _hash.
29571 (KJS::Lookup::findEntry):
29572 (KJS::Lookup::find):
29574 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29576 Build fix: svn add SymbolTable.h
29578 * kjs/SymbolTable.h: Added.
29579 (KJS::SymbolTable::set):
29580 (KJS::SymbolTable::get):
29582 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29584 Build fix: export SymbolTable.h to WebCore.
29586 * JavaScriptCore.xcodeproj/project.pbxproj:
29588 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29590 Comment tweak suggested by Maciej.
29592 * kjs/function.cpp:
29593 (KJS::ActivationImp::getOwnPropertySlot):
29595 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29597 Reviewed by Maciej Stachowiak.
29599 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
29601 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
29602 hash value. Also, return immediately instead of branching to the end
29603 of the loop if the value is not found.
29604 (KJS::PropertyMap::get):
29605 (KJS::PropertyMap::getLocation):
29606 (KJS::PropertyMap::put):
29607 (KJS::PropertyMap::insert):
29608 (KJS::PropertyMap::remove):
29609 (KJS::PropertyMap::checkConsistency):
29612 (KJS::UString::Rep::computedHash): Special no branch accessor to the
29613 UString's hash value. Used when the caller knows that the hash value
29614 has already been computed. (For example, if the caller got the UString
29615 from an Identifier.)
29617 2007-10-26 Geoffrey Garen <ggaren@apple.com>
29619 Reviewed by Maciej Stachowiak.
29621 Switched ActivationImp to using a symbol table. For now, though, all
29622 clients take the slow path.
29624 Net .6% speedup on SunSpider.
29627 - ActivationImp now mallocs in its constructor
29628 - Local variable hits use an extra level of indirection to retrieve
29630 - Local variable misses do two lookups
29633 - Fast initialization of local variables upon function entry
29635 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
29637 * kjs/function.cpp:
29638 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
29639 data that won't fit in a JSCell.
29640 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
29642 (KJS::ActivationImp::getOwnPropertySlot): ditto
29643 (KJS::ActivationImp::deleteProperty): ditto
29644 (KJS::ActivationImp::put): ditto
29645 (KJS::ActivationImp::createArgumentsObject): ditto
29647 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
29648 our properties doesn't try to recursively mark us. (This caused a crash
29649 in earlier testing. Not sure why we haven't run into it before.)
29651 * kjs/nodes.cpp: Functions now build a symbol table the first time
29653 (KJS::VarDeclNode::evaluate):
29654 (KJS::FunctionBodyNode::FunctionBodyNode):
29655 (KJS::FunctionBodyNode::initializeSymbolTable):
29656 (KJS::FunctionBodyNode::processDeclarations):
29657 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
29658 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
29661 (KJS::FunctionBodyNode::symbolTable):
29663 * wtf/Forward.h: Added Vector.
29665 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29667 - Corrected function name mistake in this changelog.
29669 2007-10-26 Kevin McCullough <kmccullough@apple.com>
29670 Reviewed by Sam and Steve.
29672 - Added convenience methods for converting between BSTR and JSStringRefs
29674 * API/JSStringRefCOM.cpp: Added.
29675 (JSStringCreateWithBSTR):
29676 (JSStringCopyBSTR):
29677 * API/JSStringRefCOM.h: Added.
29678 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29680 2007-10-26 Mark Rowe <mrowe@apple.com>
29684 * kjs/collector.cpp:
29685 (KJS::Collector::collect):
29687 2007-10-26 Oliver Hunt <oliver@apple.com>
29689 Reviewed by Maciej.
29691 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
29693 * kjs/CollectorHeapIntrospector.cpp:
29694 (KJS::CollectorHeapIntrospector::init):
29695 (KJS::CollectorHeapIntrospector::enumerate):
29696 * kjs/CollectorHeapIntrospector.h:
29697 * kjs/collector.cpp:
29698 (KJS::Collector::recordExtraCost):
29699 (KJS::Collector::heapAllocate):
29700 (KJS::Collector::allocate):
29701 (KJS::Collector::allocateNumber):
29702 (KJS::Collector::registerThread):
29703 (KJS::Collector::markStackObjectsConservatively):
29704 (KJS::Collector::markMainThreadOnlyObjects):
29705 (KJS::Collector::sweep):
29706 (KJS::Collector::collect):
29709 (KJS::NumberImp::operator new):
29710 Force numbers to be allocated in the secondary heap.
29712 2007-10-26 Maciej Stachowiak <mjs@apple.com>
29714 Reviewed by Oliver.
29716 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
29719 (KJS::JSValue::getUInt32):
29720 (KJS::JSValue::getTruncatedInt32):
29721 (KJS::JSValue::toNumber):
29722 * wtf/PassRefPtr.h:
29723 (WTF::PassRefPtr::~PassRefPtr):
29725 (WTF::RefPtr::operator->):
29727 2007-10-26 Mark Rowe <mrowe@apple.com>
29733 2007-10-26 Maciej Stachowiak <mjs@apple.com>
29737 - Merge Context class fully into ExecState, since they are always created and used together.
29739 No measurable performance impact but this is a useful cleanup.
29741 * JavaScriptCore.pri:
29742 * kjs/ExecState.cpp:
29743 (KJS::ExecState::ExecState):
29744 (KJS::ExecState::~ExecState):
29745 (KJS::ExecState::mark):
29746 (KJS::ExecState::lexicalInterpreter):
29748 (KJS::ExecState::dynamicInterpreter):
29749 (KJS::ExecState::setException):
29750 (KJS::ExecState::clearException):
29751 (KJS::ExecState::exception):
29752 (KJS::ExecState::exceptionSlot):
29753 (KJS::ExecState::hadException):
29754 (KJS::ExecState::scopeChain):
29755 (KJS::ExecState::callingExecState):
29756 (KJS::ExecState::propertyNames):
29757 * kjs/collector.cpp:
29758 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
29759 * kjs/function.cpp:
29760 (KJS::FunctionImp::callAsFunction):
29761 (KJS::FunctionImp::argumentsGetter):
29762 (KJS::FunctionImp::callerGetter):
29763 (KJS::GlobalFuncImp::callAsFunction):
29764 * kjs/interpreter.cpp:
29765 (KJS::Interpreter::Interpreter):
29766 (KJS::Interpreter::init):
29767 (KJS::Interpreter::evaluate):
29768 (KJS::Interpreter::mark):
29769 * kjs/interpreter.h:
29770 (KJS::Interpreter::setCurrentExec):
29771 (KJS::Interpreter::currentExec):
29773 (KJS::currentSourceId):
29774 (KJS::currentSourceURL):
29775 (KJS::ThisNode::evaluate):
29776 (KJS::ResolveNode::evaluate):
29777 (KJS::FunctionCallResolveNode::evaluate):
29778 (KJS::PostfixResolveNode::evaluate):
29779 (KJS::DeleteResolveNode::evaluate):
29780 (KJS::TypeOfResolveNode::evaluate):
29781 (KJS::PrefixResolveNode::evaluate):
29782 (KJS::AssignResolveNode::evaluate):
29783 (KJS::VarDeclNode::evaluate):
29784 (KJS::DoWhileNode::execute):
29785 (KJS::WhileNode::execute):
29786 (KJS::ForNode::execute):
29787 (KJS::ForInNode::execute):
29788 (KJS::ContinueNode::execute):
29789 (KJS::BreakNode::execute):
29790 (KJS::ReturnNode::execute):
29791 (KJS::WithNode::execute):
29792 (KJS::SwitchNode::execute):
29793 (KJS::LabelNode::execute):
29794 (KJS::TryNode::execute):
29795 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
29796 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
29797 (KJS::FunctionBodyNode::processDeclarations):
29798 (KJS::FuncDeclNode::makeFunction):
29799 (KJS::FuncExprNode::evaluate):
29801 2007-10-26 Mark Rowe <mrowe@apple.com>
29805 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29807 2007-10-26 Mark Rowe <mrowe@apple.com>
29811 * JavaScriptCore.pri:
29812 * kjs/ExecState.cpp:
29814 2007-10-26 Maciej Stachowiak <mjs@apple.com>
29816 Reviewed by Oliver.
29818 - moved Context class into ExecState.{h,cpp} in preparation for merging
29819 ExecState and Context classes.
29821 * kjs/ExecState.h: Moved CodeType enum and Context class here in
29822 preparation for merging ExecState and Context.
29823 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
29824 (KJS::Context::Context):
29825 (KJS::Context::~Context):
29826 (KJS::Context::mark):
29827 * kjs/context.h: Removed.
29828 * kjs/Context.cpp: Removed.
29829 * kjs/function.h: Removed CodeType enum.
29830 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
29831 * kjs/internal.h: Removed LabelStack.
29832 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
29833 * kjs/collector.cpp: Fixed includes.
29834 * kjs/function.cpp: ditto
29835 * kjs/internal.cpp: ditto
29836 * kjs/interpreter.cpp: ditto
29837 * kjs/lookup.h: ditto
29838 * kjs/nodes.cpp: ditto
29840 2007-10-26 Mark Rowe <mrowe@apple.com>
29844 * kjs/string_object.cpp:
29845 (KJS::StringObjectFuncImp::callAsFunction):
29847 2007-10-25 Darin Adler <darin@apple.com>
29849 Reviewed by Maciej.
29851 - http://bugs.webkit.org/show_bug.cgi?id=15703
29852 fix numeric functions -- improve correctness and speed
29854 Gives about 1% gain on SunSpider.
29856 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
29857 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
29858 with both immediate and number values.
29859 (KJS::JSValue::toUInt32): Ditto.
29861 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
29862 differences. One is that it now correctly returns 0 for NaN, and another is that
29863 there's no special case for 0 or infinity, since the general case already handles
29865 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
29867 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
29868 truncation done by the typecast already does the necessary truncation that
29869 roundValue was doing.
29870 (KJS::JSValue::toUInt32SlowCase): Ditto.
29871 (KJS::JSValue::toUInt16): Removed.
29873 * kjs/internal.h: Removed roundValue.
29874 * kjs/internal.cpp: Ditto.
29876 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
29877 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
29879 * kjs/date_object.cpp:
29880 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
29881 toNumber as specified.
29882 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
29883 with a call to toNumber and timeClip as specified.
29884 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
29885 where the default behavior of toInt32 (returning 0) was already correct. Replaced
29886 call to roundValue with a call to toNumber as specified.
29887 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
29889 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
29890 cases for the pow function that the library already handles correctly.
29892 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
29893 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
29894 The real toInteger now returns 0 for NaN. Took out unneeded special case in
29895 ToFixed for undefined; was only needed because our toInteger was wrong. Same
29896 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
29898 * kjs/string_object.cpp:
29899 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
29900 cases for undefined that were only needed because toInteger was wrong. Same in
29901 IndexOf, and was able to remove some special cases. In LastIndexOf, used
29902 toIntegerPreserveNaN, but was able to remove some special cases there too.
29903 Changed Substr implementation to preserve correct behavior with the change
29904 to toInteger and match the specification. Also made sure we weren't converting
29905 an out of range double to an int.
29906 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
29907 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
29908 no reason to have toUInt16 as a second, less-optimized function that's only
29909 called at this one call site.
29911 * wtf/MathExtras.h: Added trunc function for Windows.
29913 2007-10-25 Geoffrey Garen <ggaren@apple.com>
29915 Reviewed by Maciej Stachowiak.
29917 Tweaked the inner hashtable lookup loop to remove a branch in the "not
29918 found" case. .5% speedup on SunSpider.
29920 * JavaScriptCore.xcodeproj/project.pbxproj:
29924 2007-10-25 Maciej Stachowiak <mjs@apple.com>
29926 Reviewed by Oliver.
29928 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
29931 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
29932 adding any value over toNumber() here.
29933 (KJS::valueForReadModifyAssignment): Ditto.
29934 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
29936 (KJS::lessThanEq): Ditto.
29937 * JavaScriptCore.exp: Export new functions as needed.
29939 (KJS::JSValue::toPrimitive): Fixed formatting.
29940 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
29941 to number and tells you whether a toPrimitive() conversion with a Number hint
29942 would have given a string.
29943 * kjs/internal.cpp:
29944 (KJS::StringImp::getPrimitiveNumber): Implemented.
29945 (KJS::NumberImp::getPrimitiveNumber): ditto
29946 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
29947 (KJS::StringImp::toPrimitive): Fixed formatting.
29948 (KJS::NumberImp::toPrimitive): ditto
29949 (KJS::GetterSetterImp::toPrimitive): ditto
29952 (KJS::JSObject::getPrimitiveNumber): Implemented.
29955 2007-10-25 Sam Weinig <sam@webkit.org>
29957 Reviewed by Adam Roben.
29959 Remove JSStringRefCFHack from windows as it is no longer needed.
29961 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
29963 2007-10-25 Geoffrey Garen <ggaren@apple.com>
29965 Reviewed by Oliver Hunt.
29967 Rolled out my last patch. It turns out that I needed 2 words, not 1,
29970 2007-10-25 Geoffrey Garen <ggaren@apple.com>
29972 Reviewed by Oliver Hunt.
29974 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
29975 Shrink the size of an activation object by 1 word
29977 This is in preparation for adding a symbol table to the activation
29980 The basic strategy here is to rely on the mutual exclusion between
29981 the arguments object pointer and the function pointer (you only need
29982 the latter in order to create the former), and store them in the same
29983 place. The LazyArgumentsObject class encapsulates this strategy.
29985 Also inlined the ArgumentsImp constructor, for good measure.
29987 SunSpider reports no regression. Regression tests pass.
29989 * JavaScriptCore.xcodeproj/project.pbxproj:
29991 (KJS::Context::~Context):
29992 * kjs/function.cpp:
29993 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
29994 (KJS::ActivationImp::LazyArgumentsObject::mark):
29995 (KJS::ActivationImp::argumentsGetter):
29996 (KJS::ActivationImp::mark):
29998 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
29999 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
30000 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
30001 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
30002 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
30003 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
30004 (KJS::ActivationImp::LazyArgumentsObject::function):
30005 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
30006 (KJS::ActivationImp::LazyArgumentsObject::):
30007 (KJS::ActivationImp::ActivationImp::ActivationImp):
30008 (KJS::ActivationImp::resetArguments):
30010 2007-10-25 Adam Roben <aroben@apple.com>
30012 Change JavaScriptCore.vcproj to use DerivedSources.make
30014 We were trying to emulate the logic of make in
30015 build-generated-files.sh, but we got it wrong. We now use a
30016 build-generated-files very much like the one that WebCore uses to
30019 We also now only have a Debug configuration of dftables which we build
30020 even when doing a Release build of JavaScriptCore. dftables also no
30021 longer has the "_debug" name suffix.
30023 Changes mostly made by Darin, reviewed by me.
30025 * DerivedSources.make: Add a variable to set the extension used for
30026 the dftables executable.
30027 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
30028 dftables in Release configurations.
30029 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
30030 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
30031 - Updated include path to point to the new location of the derived
30033 - Modified pre-build event to pass the right arguments to
30034 build-generated-files.sh and not call dftables directly.
30035 - Added the derived source files to the project.
30036 - Removed grammarWrapper.cpp, which isn't needed now that we're
30037 compiling grammar.cpp directly.
30038 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
30039 Slightly modified from the WebCore version.
30040 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
30041 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
30042 - Changed the output location to match Mac.
30043 - Removed the Release configuration.
30044 - Removed the _debug suffix.
30046 2007-10-25 Geoffrey Garen <ggaren@apple.com>
30048 Reviewed by Eric Seidel.
30050 Slightly elaborated the differences between declaration procesing in
30051 Function Code and Program Code.
30053 .3% speedup on SunSpider.
30056 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
30057 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
30058 minimum set of attributes instead of recomputing all the time. Also,
30059 ignore m_parameters, since programs don't have arguments.
30061 2007-10-25 Eric Seidel <eric@webkit.org>
30063 Reviewed by Maciej.
30065 More preparation work before adding long-running mode to testkjs.
30068 (TestFunctionImp::callAsFunction):
30069 (prettyPrintScript):
30073 (fillBufferWithContentsOfFile):
30075 2007-10-25 Eric Seidel <eric@webkit.org>
30077 Reviewed by Maciej.
30079 Bring testkjs code out of the dark ages in preparation for more
30080 radical improvements (like long-running testing support!)
30083 (TestFunctionImp::callAsFunction):
30084 (setupInterpreter):
30086 (fillBufferWithContentsOfFile):
30088 2007-10-25 Geoffrey Garen <ggaren@apple.com>
30090 Reviewed by Maciej Stachowiak.
30092 Make a fast path for declaration processing inside Function Code.
30094 Lifted declaration processing code up from individual declaration nodes
30095 and into processDeclarations.
30097 Broke out processDeclarations into two cases, depending on the type of
30098 code. This eliminates 2 branches, and facilitates more radical
30099 divergeance in the future.
30101 2.5% SunSpider speedup.
30103 * JavaScriptCore.xcodeproj/project.pbxproj:
30105 (KJS::FunctionBodyNode::initializeDeclarationStacks):
30106 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
30107 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
30108 (KJS::FunctionBodyNode::execute):
30109 (KJS::FuncDeclNode::makeFunction):
30112 2007-10-25 Maciej Stachowiak <mjs@apple.com>
30116 - add header includes needed on platforms that don't use AllInOneFile.cpp
30118 * API/JSCallbackObject.cpp:
30120 * kjs/ExecState.cpp:
30121 * kjs/array_instance.cpp:
30122 * kjs/function_object.cpp:
30123 * kjs/interpreter.cpp:
30126 2007-10-25 Eric Seidel <eric@webkit.org>
30130 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
30132 2007-10-25 Geoffrey Garen <ggaren@apple.com>
30134 Reviewed by Maciej Stachowiak.
30136 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
30137 Re-order declaration initialization to avoid calling hasProperty inside
30138 VarDeclNode::processDeclaration
30140 .7% speedup on SunSpider.
30143 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
30144 other processing of declared symbols, so the order of execution could
30148 (KJS::VarDeclNode::getDeclarations): Added special case for the
30149 "arguments" property name, explained in the comment.
30151 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
30152 in the case of function code, since we know the declared symbol
30153 management will resolve conflicts between symbols. Yay!
30155 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
30156 implementation of getDeclarations is non-trivial, we can't take a
30157 short-cut here any longer -- we need to put the VarDecl node on the
30158 stack so it gets processed normally.
30160 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
30161 processing to enforce mutual exclusion rules.
30164 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
30165 ExecState now, for fast access to the "arguments" property name.
30167 2007-10-24 Eric Seidel <eric@webkit.org>
30169 Reviewed by Maciej.
30171 Add a JSGlobalObject class and remove the InterpreterMap
30172 http://bugs.webkit.org/show_bug.cgi?id=15681
30174 This required making JSCallbackObject a template class to allow for
30175 JSGlobalObjects with JSCallbackObject functionality.
30177 SunSpider claims this was a 0.5% speedup.
30179 * API/JSCallbackObject.cpp:
30180 * API/JSCallbackObject.h:
30181 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
30182 (KJS::::JSCallbackObject):
30184 (KJS::::~JSCallbackObject):
30185 (KJS::::initializeIfNeeded):
30186 (KJS::::className):
30187 (KJS::::getOwnPropertySlot):
30189 (KJS::::deleteProperty):
30190 (KJS::::implementsConstruct):
30191 (KJS::::construct):
30192 (KJS::::implementsHasInstance):
30193 (KJS::::hasInstance):
30194 (KJS::::implementsCall):
30195 (KJS::::callAsFunction):
30196 (KJS::::getPropertyNames):
30199 (KJS::::setPrivate):
30200 (KJS::::getPrivate):
30202 (KJS::::cachedValueGetter):
30203 (KJS::::staticValueGetter):
30204 (KJS::::staticFunctionGetter):
30205 (KJS::::callbackGetter):
30206 * API/JSClassRef.cpp:
30207 (OpaqueJSClass::prototype):
30208 * API/JSContextRef.cpp:
30209 (JSGlobalContextCreate):
30210 * API/JSObjectRef.cpp:
30212 (JSObjectGetPrivate):
30213 (JSObjectSetPrivate):
30214 * API/JSValueRef.cpp:
30215 (JSValueIsObjectOfClass):
30216 * JavaScriptCore.exp:
30217 * JavaScriptCore.xcodeproj/project.pbxproj:
30218 * bindings/c/c_utility.cpp:
30219 (KJS::Bindings::convertValueToNPVariant):
30220 * bindings/jni/jni_jsobject.cpp:
30221 * bindings/objc/objc_utility.mm:
30222 (KJS::Bindings::convertValueToObjcValue):
30224 (KJS::Context::Context):
30225 * kjs/ExecState.cpp:
30226 (KJS::ExecState::lexicalInterpreter):
30227 * kjs/JSGlobalObject.h: Added.
30228 (KJS::JSGlobalObject::JSGlobalObject):
30229 (KJS::JSGlobalObject::isGlobalObject):
30230 (KJS::JSGlobalObject::interpreter):
30231 (KJS::JSGlobalObject::setInterpreter):
30232 * kjs/array_instance.cpp:
30234 * kjs/function.cpp:
30235 (KJS::FunctionImp::callAsFunction):
30236 (KJS::GlobalFuncImp::callAsFunction):
30237 * kjs/interpreter.cpp:
30238 (KJS::Interpreter::Interpreter):
30239 (KJS::Interpreter::init):
30240 (KJS::Interpreter::~Interpreter):
30241 (KJS::Interpreter::globalObject):
30242 (KJS::Interpreter::initGlobalObject):
30243 (KJS::Interpreter::evaluate):
30244 * kjs/interpreter.h:
30246 (KJS::cacheGlobalObject):
30248 (KJS::JSObject::isGlobalObject):
30251 2007-10-24 Eric Seidel <eric@webkit.org>
30253 Build fix for Gtk, no review.
30255 * kjs/collector.cpp: #include "context.h"
30257 2007-10-24 Eric Seidel <eric@webkit.org>
30259 Reviewed by Maciej.
30261 Stop checking isOutOfMemory after every allocation, instead let the collector
30262 notify all ExecStates if we ever hit this rare condition.
30264 SunSpider claims this was a 2.2% speedup.
30266 * kjs/collector.cpp:
30267 (KJS::Collector::collect):
30268 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
30271 (KJS::TryNode::execute):
30273 2007-10-24 Mark Rowe <mrowe@apple.com>
30277 * kjs/identifier.h: Remove extra qualification.
30279 2007-10-24 Geoffrey Garen <ggaren@apple.com>
30281 Reviewed by Sam Weinig.
30283 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
30286 * wtf/AlwaysInline.h:
30288 2007-10-24 Geoffrey Garen <ggaren@apple.com>
30290 Reviewed by Sam Weinig.
30292 Inlined the fast path for creating an Identifier from an Identifier.
30294 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
30295 speedup on certain individual tests. 65% of the Identifiers creating
30296 by SunSpider are already Identifiers.
30298 (The main reason I'm making this change is that it resolves a large
30299 regression in a patch I haven't checked in yet.)
30301 * JavaScriptCore.exp:
30302 * kjs/identifier.cpp:
30303 (KJS::Identifier::addSlowCase):
30304 * kjs/identifier.h:
30305 (KJS::Identifier::Identifier::add):
30307 2007-10-24 Lars Knoll <lars@trolltech.com>
30311 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.
30313 * bindings/qt/qt_instance.cpp:
30314 (KJS::Bindings::QtInstance::invokeMethod):
30315 * bindings/qt/qt_runtime.cpp:
30316 (KJS::Bindings::convertValueToQVariant):
30317 (KJS::Bindings::QtField::setValueToInstance):
30319 2007-10-24 Oliver Hunt <oliver@apple.com>
30323 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
30328 (KJS::LessNode::evaluate):
30329 (KJS::GreaterNode::evaluate):
30330 (KJS::LessEqNode::evaluate):
30331 (KJS::GreaterEqNode::evaluate):
30332 * kjs/operations.cpp:
30333 * kjs/operations.h:
30335 2007-10-24 Eric Seidel <eric@webkit.org>
30340 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
30342 2007-10-24 Darin Adler <darin@apple.com>
30346 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
30347 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
30349 2007-10-24 Darin Adler <darin@apple.com>
30351 Reviewed by Maciej.
30353 - separate out the code to create a hash table the first time from the code
30356 SunSpider claims this was a 0.7% speedup.
30358 * kjs/property_map.cpp:
30359 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
30360 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
30361 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
30363 * kjs/property_map.h: Added createTable.
30365 2007-10-24 Eric Seidel <eric@webkit.org>
30369 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
30370 which can be represented by JSImmediate.
30372 SunSpider claims this was a 0.6% speedup.
30376 (KJS::NumberNode::evaluate):
30377 (KJS::ImmediateNumberNode::evaluate):
30380 (KJS::ImmediateNumberNode::):
30381 * kjs/nodes2string.cpp:
30382 (ImmediateNumberNode::streamTo):
30384 2007-10-24 Darin Adler <darin@apple.com>
30386 Reviewed by Maciej.
30388 - http://bugs.webkit.org/show_bug.cgi?id=15657
30389 change static hash tables to use powers of two for speed
30391 Seems to give 0.7% SunSpider speedup.
30393 * kjs/create_hash_table: Updated to generate new format.
30395 (KJS::keysMatch): Took out unneeded typecast.
30396 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
30397 Replaced the modulus with a bit mask.
30398 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
30399 their hash -- saves a branch.
30400 (KJS::Lookup::find): Ditto.
30401 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
30403 2007-10-24 Maciej Stachowiak <mjs@apple.com>
30407 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
30410 (KJS::DoWhileNode::execute):
30411 (KJS::WhileNode::execute):
30412 (KJS::ForNode::execute):
30413 (KJS::ForInNode::execute):
30414 (KJS::SourceElementsNode::execute):
30416 2007-10-23 Darin Adler <darin@apple.com>
30418 Reviewed by Maciej.
30420 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
30421 Changed an && to an & for a 1% gain in SunSpider.
30423 2007-10-23 Oliver Hunt <oliver@apple.com>
30425 Reviewed by Maciej.
30427 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
30430 (KJS::MultNode::evaluate):
30431 (KJS::DivNode::evaluate):
30432 (KJS::ModNode::evaluate):
30435 (KJS::AddNode::evaluate):
30436 (KJS::SubNode::evaluate):
30437 (KJS::valueForReadModifyAssignment):
30438 * kjs/operations.cpp:
30439 * kjs/operations.h:
30441 2007-10-23 Oliver Hunt <oliver@apple.com>
30443 Reviewed by Maciej.
30445 Separating all of the simple (eg. non-read-modify-write) binary operators
30446 into separate classes in preparation for further JS optimisations.
30448 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
30451 * JavaScriptCore.xcodeproj/project.pbxproj:
30454 (KJS::MultNode::evaluate):
30455 (KJS::DivNode::evaluate):
30456 (KJS::ModNode::evaluate):
30457 (KJS::AddNode::evaluate):
30458 (KJS::SubNode::evaluate):
30459 (KJS::LeftShiftNode::evaluate):
30460 (KJS::RightShiftNode::evaluate):
30461 (KJS::UnsignedRightShiftNode::evaluate):
30462 (KJS::LessNode::evaluate):
30463 (KJS::GreaterNode::evaluate):
30464 (KJS::LessEqNode::evaluate):
30465 (KJS::GreaterEqNode::evaluate):
30466 (KJS::InstanceOfNode::evaluate):
30467 (KJS::InNode::evaluate):
30468 (KJS::EqualNode::evaluate):
30469 (KJS::NotEqualNode::evaluate):
30470 (KJS::StrictEqualNode::evaluate):
30471 (KJS::NotStrictEqualNode::evaluate):
30472 (KJS::BitAndNode::evaluate):
30473 (KJS::BitXOrNode::evaluate):
30474 (KJS::BitOrNode::evaluate):
30475 (KJS::LogicalAndNode::evaluate):
30476 (KJS::LogicalOrNode::evaluate):
30483 (KJS::LeftShiftNode::):
30484 (KJS::RightShiftNode::):
30485 (KJS::UnsignedRightShiftNode::):
30487 (KJS::GreaterNode::):
30488 (KJS::LessEqNode::):
30489 (KJS::GreaterEqNode::):
30490 (KJS::InstanceOfNode::):
30492 (KJS::EqualNode::):
30493 (KJS::NotEqualNode::):
30494 (KJS::StrictEqualNode::):
30495 (KJS::NotStrictEqualNode::):
30496 (KJS::BitAndNode::):
30497 (KJS::BitOrNode::):
30498 (KJS::BitXOrNode::):
30499 (KJS::LogicalAndNode::):
30500 (KJS::LogicalOrNode::):
30501 * kjs/nodes2string.cpp:
30502 (MultNode::streamTo):
30503 (DivNode::streamTo):
30504 (ModNode::streamTo):
30505 (AddNode::streamTo):
30506 (SubNode::streamTo):
30507 (LeftShiftNode::streamTo):
30508 (RightShiftNode::streamTo):
30509 (UnsignedRightShiftNode::streamTo):
30510 (LessNode::streamTo):
30511 (GreaterNode::streamTo):
30512 (LessEqNode::streamTo):
30513 (GreaterEqNode::streamTo):
30514 (InstanceOfNode::streamTo):
30515 (InNode::streamTo):
30516 (EqualNode::streamTo):
30517 (NotEqualNode::streamTo):
30518 (StrictEqualNode::streamTo):
30519 (NotStrictEqualNode::streamTo):
30520 (BitAndNode::streamTo):
30521 (BitXOrNode::streamTo):
30522 (BitOrNode::streamTo):
30523 (LogicalAndNode::streamTo):
30525 2007-10-23 Darin Adler <darin@apple.com>
30527 Reviewed by Maciej.
30529 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
30530 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
30532 Test: fast/js/math.html
30534 * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
30535 Fix abs to look at the sign bit. Add a special case for values in the range
30536 between -0 and -1 and a special case for ceil and for -0 for floor.
30538 2007-10-23 Darin Adler <darin@apple.com>
30542 - streamline exception handling code for a >1% speed-up of SunSpider
30544 * kjs/nodes.cpp: Changed macros to use functions for everything that's not
30545 part of normal execution. We'll take function call overhead when propagating
30546 an exception or out of memory.
30547 (KJS::createOutOfMemoryCompletion): Added.
30548 (KJS::substitute): Use append instead of the relatively inefficient + operator.
30549 (KJS::Node::rethrowException): Added.
30550 * kjs/nodes.h: Added rethrowException.
30552 2007-10-22 Darin Adler <darin@apple.com>
30554 Reviewed by Maciej.
30556 - fix http://bugs.webkit.org/show_bug.cgi?id=15636
30557 some JavaScriptCore regression tests are failing due to numeric conversion
30559 This should restore correctness and make speed better too, restoring some
30560 of the optimization we lost in my last check-in.
30562 * kjs/JSImmediate.h:
30563 (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
30564 I used in my patch yesterday.
30565 (KJS::JSImmediate::getTruncatedUInt32): Ditto.
30567 * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
30568 * kjs/internal.cpp:
30569 (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
30570 a way to write this more efficiently for float.
30571 (KJS::NumberImp::getTruncatedInt32): Added.
30572 (KJS::NumberImp::getTruncatedUInt32): Added.
30574 * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
30575 (KJS::JSValue::getUInt32):
30576 (KJS::JSValue::getTruncatedInt32): Added.
30577 (KJS::JSValue::getTruncatedUInt32): Added.
30578 (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
30579 (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
30581 (KJS::JSCell::getTruncatedInt32): Added.
30582 (KJS::JSCell::getTruncatedUInt32): Added.
30583 (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
30584 (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
30586 (KJS::JSValue::toUInt32SlowCase): Ditto.
30587 (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
30589 * JavaScriptCore.exp: Updated.
30591 2007-10-22 Darin Adler <darin@apple.com>
30595 - fix http://bugs.webkit.org/show_bug.cgi?id=15632
30596 js1_5/Array/array-001.js test failing
30598 One of the JavaScriptCore tests was failing; it failed because of
30599 my change to NumberImp::getUInt32. The incorrect code I copied was
30600 from JSImmediate::getUInt32, and was a pre-existing bug.
30602 This patch fixes correctness, but will surely slow down SunSpider.
30603 We may be able to code this tighter and get the speed back.
30605 * kjs/JSImmediate.h:
30606 (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
30607 reflect the fact that this function only returns true if the value is
30608 accurate (no fractional part, etc.). Changed code so that it returns
30609 false when the value has a fraction.
30610 (KJS::JSImmediate::getUInt32): Ditto.
30612 * kjs/internal.cpp:
30613 (KJS::NumberImp::getInt32): Changed code so that it returns false when
30614 the value has a fraction. Restores the old behavior.
30615 (KJS::NumberImp::getUInt32): Ditto.
30618 (KJS::JSValue::getInt32): Updated for name change.
30619 (KJS::JSValue::getUInt32): Ditto.
30620 (KJS::JSValue::toInt32): Ditto.
30621 (KJS::JSValue::toUInt32): Ditto.
30623 2007-10-22 Darin Adler <darin@apple.com>
30627 - fix crash seen when running JavaScriptCore tests
30629 * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
30630 Copy and paste error: I accidentally had code here that was
30631 making a copy of the HashMap -- that's illegal inside a mark
30632 function and was unnecessary. The other callsite was modifying
30633 the map as it iterated it, but this function is not.
30635 2007-10-22 Maciej Stachowiak <mjs@apple.com>
30637 Reviewed by Oliver.
30639 - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
30640 http://bugs.webkit.org/show_bug.cgi?id=15627
30642 * kjs/JSImmediate.h:
30643 (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
30644 registers since this is very slow.
30646 2007-10-22 Darin Adler <darin@apple.com>
30648 Reviewed by Eric Seidel.
30650 - http://bugs.webkit.org/show_bug.cgi?id=15617
30651 improve speed of integer conversions
30653 Makes SunSpider 6% faster.
30655 * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
30658 (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
30660 * kjs/internal.h: Added getInt32.
30661 * kjs/internal.cpp:
30662 (KJS::NumberImp::getInt32): Added.
30663 (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
30664 stolen from JSValue.
30667 (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
30669 (KJS::JSValue::getInt32): Added.
30670 (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
30671 to avoid converting from float to double.
30672 (KJS::JSValue::toInt32): Made inline, separated out the slow case.
30673 (KJS::JSValue::toUInt32): Ditto.
30675 (KJS::JSCell::getInt32): Added.
30676 (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
30677 new getInt32. Added a faster case for in-range numbers.
30678 (KJS::JSValue::toUInt32SlowCase): Ditto.
30679 (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
30681 * JavaScriptCore.exp: Updated for changes.
30683 2007-10-22 Adam Roben <aroben@apple.com>
30687 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
30688 warning about implicit conversion to bool.
30690 2007-10-22 Mark Rowe <mrowe@apple.com>
30694 * kjs/array_instance.cpp:
30696 2007-10-22 Darin Adler <darin@apple.com>
30698 Reviewed by Maciej.
30700 - http://bugs.webkit.org/show_bug.cgi?id=15606
30701 make cut-off for sparse vs. dense arrays smarter for speed with large arrays
30703 Makes the morph test in SunSpider 26% faster, and the overall
30704 benchmark 3% faster.
30706 This also fixes some small problems we had with the distinction
30707 between nonexistent and undefined values in arrays.
30709 * kjs/array_instance.h: Tweaked formatting and naming.
30710 * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
30711 (KJS::storageSize): Added. Computes the size of the storage given a vector length.
30712 (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
30713 (KJS::isDenseEnoughForVector): Added.
30714 (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
30715 (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
30716 (KJS::ArrayInstance::getItem): Updated for name changes.
30717 (KJS::ArrayInstance::lengthGetter): Ditto.
30718 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
30719 getOwnPropertySlot to share more code.
30720 (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
30721 (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
30722 array is dense enough. Also keep m_numValuesInVector up to date.
30723 (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
30725 (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
30726 for array indices with undefined values.
30727 (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
30728 simplified to only handle getting larger.
30729 (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
30730 zero out the unused part of the vector and to delete the map if it's no longer
30732 (KJS::ArrayInstance::mark): Tweaked formatting.
30733 (KJS::compareByStringForQSort): Ditto.
30734 (KJS::ArrayInstance::sort): Ditto.
30735 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
30737 (KJS::compareWithCompareFunctionForQSort): Ditto.
30738 (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
30739 undefined values into nonexistent values in some cases.
30741 * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
30742 * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
30744 * JavaScriptCore.pri: Added array_instance.cpp.
30745 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
30746 * kjs/AllInOneFile.cpp: Ditto.
30748 2007-10-22 Andrew Wellington <proton@wiretapped.net>
30750 Reviewed by Mark Rowe.
30752 Fix for local database support after r26879
30753 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
30755 * Configurations/JavaScriptCore.xcconfig:
30757 2007-10-22 Simon Hausmann <hausmann@kde.org>
30761 Build fix for the non-qmake builds.
30763 * wtf/Platform.h: Default to enabling the database features unless
30764 otherwise specified. (similar to ENABLE_ICONDATABASE)
30766 2007-10-22 Holger Freyther <zecke@selfish.org>
30768 Reviewed by Simon Hausmann <hausmann@kde.org>.
30770 * Do not build testkjs as an application bundle. This is
30771 needed for run-javascriptcore-tests on OSX.
30772 * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
30773 * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
30774 as we do not have -rpath on OSX.
30778 2007-10-21 Mark Rowe <mrowe@apple.com>
30782 http://bugs.webkit.org/show_bug.cgi?id=15575
30783 Bug 15575: [GTK] Implement threading using GThread
30785 * wtf/Platform.h: Do not enable pthreads for Gtk.
30787 2007-10-21 Mark Rowe <mrowe@apple.com>
30791 Fix http://bugs.webkit.org/show_bug.cgi?id=15603
30792 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
30794 * kjs/array_object.cpp:
30795 (KJS::freeStorage): Reinstate null-check that was removed in r26847.
30797 2007-10-21 Darin Adler <darin@apple.com>
30799 - fix Windows build
30801 * kjs/array_instance.h: Removed unused ExecState parameter.
30802 * kjs/array_object.cpp:
30803 (KJS::ArrayInstance::put): Ditto.
30804 (KJS::ArrayInstance::setLength): Ditto.
30806 2007-10-21 Darin Adler <darin@apple.com>
30808 * kjs/array_object.cpp: (KJS::ArrayInstance::put):
30809 Add missing assignment that was causing regression test crash.
30811 2007-10-21 Darin Adler <darin@apple.com>
30813 Reviewed by Maciej.
30815 - http://bugs.webkit.org/show_bug.cgi?id=15585
30816 speed up sparse arrays by using a custom map
30818 Speeds up SunSpider by 10%.
30820 * kjs/array_object.cpp:
30821 (allocateStorage): Leave room for an additional pointer.
30822 (reallocateStorage): Ditto.
30823 (freeStorage): Ditto.
30824 (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
30825 (ArrayInstance::getItem): Read values from the overflow map if present.
30826 Removed the check of length, since it slows down the common case.
30827 (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
30828 to the property map.
30829 (ArrayInstance::put): Write values into the overflow map as needed.
30830 Also create overflow map when needed.
30831 (ArrayInstance::deleteProperty): Remove values from the overflow map
30833 (ArrayInstance::getPropertyNames): Add a name for each identifier in
30834 the property map. This is extremely inefficient.
30835 (ArrayInstance::setLength): Remove any values in the overflow map
30836 that are past the new length, as we formerly did with the property map.
30837 (ArrayInstance::mark): Mark any values in the overflow map.
30838 (compareByStringForQSort): Removed unneeded undefined case, since
30839 compactForSorting guarantees we will have no undefined values.
30840 (compareWithCompareFunctionForQSort): Ditto.
30841 (ArrayInstance::compactForSorting): Copy all the values out of the
30842 overflow map and destroy it.
30844 * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
30845 * kjs/property_map.cpp: Ditto.
30847 2007-10-20 Darin Adler <darin@apple.com>
30849 Reviewed by Maciej.
30851 - http://bugs.webkit.org/show_bug.cgi?id=15579
30852 stop churning identifier reference counts copying Completion objects
30854 * kjs/completion.h: Replace the Identifier with an Identifier*.
30856 (ForInNode::execute): Update for change to Completion constructor.
30857 (ContinueNode::execute): Ditto.
30858 (BreakNode::execute): Ditto.
30860 2007-10-20 Mark Rowe <mrowe@apple.com>
30864 Gtk changes needed to enable HTML 5 client-side database storage.
30866 * wtf/Platform.h: Have Gtk use pthreads for now.
30868 2007-10-20 Geoffrey Garen <ggaren@apple.com>
30870 Reviewed by Maciej Stachowiak.
30872 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
30873 Store gathered declaration nodes in the function body node.
30875 This means that you only have to gather the declaration nodes the first
30876 time the function executes. Performance gain of 2.10% on SunSpider,
30877 0.90% on command-line JS iBench.
30879 * kjs/nodes.cpp: Split declaration stack initialization code off into
30880 initializeDeclarationStacks().
30881 (FunctionBodyNode::FunctionBodyNode):
30882 (FunctionBodyNode::initializeDeclarationStacks):
30883 (FunctionBodyNode::processDeclarations):
30885 * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
30886 since the actual Vectors are now stored either on the stack or in the
30887 function body node.
30889 2007-10-19 Geoffrey Garen <ggaren@apple.com>
30891 Reviewed by Darin Adler.
30893 http://bugs.webkit.org/show_bug.cgi?id=15559
30894 Moved processDeclarations call into FunctionBodyNode::execute
30896 To improve encapsulation, moved processDeclarations call into
30897 FunctionBodyNode::execute. Also marked processDeclarations
30898 ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
30899 on command-line JS iBench.
30901 * kjs/function.cpp:
30902 (KJS::FunctionImp::callAsFunction):
30903 (KJS::GlobalFuncImp::callAsFunction):
30905 * kjs/interpreter.cpp:
30906 (KJS::Interpreter::evaluate):
30908 (FunctionBodyNode::execute):
30911 2007-10-19 Brady Eidson <beidson@apple.com>
30915 Queue -> Deque! and small style tweaks
30917 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
30918 * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
30919 * wtf/Deque.h: Added.
30920 (WTF::DequeNode::DequeNode):
30921 (WTF::Deque::Deque):
30922 (WTF::Deque::~Deque):
30923 (WTF::Deque::size):
30924 (WTF::Deque::isEmpty):
30925 (WTF::Deque::append):
30926 (WTF::Deque::prepend):
30927 (WTF::Deque::first):
30928 (WTF::Deque::last):
30929 (WTF::Deque::removeFirst):
30930 (WTF::Deque::clear):
30931 * wtf/Queue.h: Removed.
30934 2007-10-19 Brady Eidson <beidson@apple.com>
30938 Added a simple LinkedList based Queue to wtf
30939 We can make a better, more sophisticated an efficient one later, but have
30940 needed one for some time, now!
30942 * JavaScriptCore.xcodeproj/project.pbxproj:
30943 * wtf/Queue.h: Added.
30944 (WTF::QueueNode::QueueNode):
30945 (WTF::Queue::Queue):
30946 (WTF::Queue::~Queue):
30947 (WTF::Queue::size):
30948 (WTF::Queue::isEmpty):
30949 (WTF::Queue::append):
30950 (WTF::Queue::prepend):
30951 (WTF::Queue::first):
30952 (WTF::Queue::last):
30953 (WTF::Queue::removeFirst):
30954 (WTF::Queue::clear):
30956 2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
30958 Reviewed by Anders.
30960 Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
30962 * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
30964 2007-10-19 Simon Hausmann <hausmann@kde.org>
30968 Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
30969 Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
30971 * wtf/ASCIICType.h:
30972 (WTF::isASCIIAlpha):
30973 (WTF::isASCIIAlphanumeric):
30974 (WTF::isASCIIDigit):
30975 (WTF::isASCIIHexDigit):
30976 (WTF::isASCIILower):
30977 (WTF::isASCIISpace):
30978 (WTF::toASCIILower):
30979 (WTF::toASCIIUpper):
30981 2007-10-19 Simon Hausmann <hausmann@kde.org>
30985 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.
30989 2007-10-18 Maciej Stachowiak <mjs@apple.com>
30993 - use __declspec(thread) for fast thread-local storage on Windows
30995 - 2.2% speedup on sunspider (on Windows)
30996 - 7% speedup on the string section
30997 - 6% speedup on JS iBench
30999 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
31000 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
31003 * wtf/FastMalloc.cpp:
31004 (WTF::getThreadHeap):
31005 (WTF::setThreadHeap):
31006 (WTF::TCMalloc_ThreadCache::GetCache):
31007 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
31008 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
31010 2007-10-17 Darin Adler <darin@apple.com>
31012 Reviewed by Mark Rowe.
31014 - fix http://bugs.webkit.org/show_bug.cgi?id=15543
31015 <rdar://problem/5545639> REGRESSION (r26697):
31016 GoogleDocs: Can't create new documents or open existing ones
31018 Test: fast/js/regexp-non-character.html
31020 * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
31021 in the \u sequences -- not needed and actively harmful.
31023 2007-10-17 Anders Carlsson <andersca@apple.com>
31025 Reviewed by Oliver.
31028 #define USE_PTHREADS on Mac.
31030 2007-10-17 Geoffrey Garen <ggaren@apple.com>
31032 Reviewed by Darin Adler.
31034 Merged DeclaredFunctionImp into FunctionImp (the base class) because
31035 the distinction between the two was unused.
31037 Removed codeType() from FunctionImp because FunctionImp and its
31038 subclasses all returned FunctionCode, so it was unused, practically
31041 Removed a different codeType() from GlobalFuncImp because it was unused.
31042 (Perhaps it was vestigial from a time when GlobalFuncImp used to
31043 inherit from FunctionImp.)
31045 * bindings/runtime_method.cpp:
31046 * bindings/runtime_method.h:
31047 * kjs/function.cpp:
31048 (KJS::FunctionImp::FunctionImp):
31049 (KJS::FunctionImp::callAsFunction):
31050 (KJS::FunctionImp::construct):
31051 (KJS::FunctionImp::execute):
31052 (KJS::FunctionImp::processVarDecls):
31054 (KJS::FunctionImp::implementsConstruct):
31055 (KJS::FunctionImp::scope):
31056 * kjs/function_object.cpp:
31057 (FunctionProtoFunc::callAsFunction):
31058 (FunctionObjectImp::construct):
31060 (FuncDeclNode::processFuncDecl):
31061 (FuncExprNode::evaluate):
31063 2007-10-17 Adam Roben <aroben@apple.com>
31065 Windows build fix part 2.
31067 Fix was by Darin, reviewed by Anders and Adam.
31069 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
31070 FastMallocPCRE.cpp to the project, and let Visual Studio have its way
31071 with the post-build step.
31072 * pcre/pcre.h: Don't DLL export the entry points just because this
31073 is Win32 -- this is an internal copy of PCRE and should be private.
31074 * pcre/pcre_compile.c: Fix an uninitialized variable warning --
31075 there's no real problem but it's better to quiet the compiler by
31076 tweaking the code slightly than turn off the warning entirely.
31078 2007-10-17 Adam Roben <aroben@apple.com>
31082 Reviewed by Anders.
31084 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
31085 some mismatched signed/unsigned comparison warnings.
31086 * pcre/pcre_exec.c:
31087 (match): #if-out some labels that don't seem to exist.
31089 2007-10-17 Mark Rowe <mrowe@apple.com>
31093 * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
31094 * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
31095 is currently unavailable for UTF-16.
31097 2007-10-16 Darin Adler <darin@apple.com>
31101 - merged PCRE changes between 6.4 and 6.5
31103 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
31104 * JavaScriptCore.xcodeproj/project.pbxproj:
31105 Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
31106 pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
31107 pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
31113 * pcre/pcre-config.h:
31116 * pcre/pcre_compile.c:
31117 * pcre/pcre_exec.c:
31118 * pcre/pcre_fullinfo.c:
31120 * pcre/pcre_internal.h:
31121 * pcre/pcre_maketables.c:
31122 * pcre/pcre_ord2utf8.c:
31123 * pcre/pcre_tables.c:
31124 * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
31125 * pcre/pcre_xclass.c:
31127 * pcre/ucpinternal.h:
31129 Updated with new versions from the PCRE 6.5 release, merged with changes.
31131 * pcre/pcre_config.c: Removed.
31132 * pcre/pcre_globals.c: Removed.
31133 * pcre/pcre_info.c: Removed.
31134 * pcre/pcre_printint.src: Removed.
31135 * pcre/pcre_refcount.c: Removed.
31136 * pcre/pcre_study.c: Removed.
31137 * pcre/pcre_try_flipped.c: Removed.
31138 * pcre/pcre_ucp_findchar.c: Removed.
31139 * pcre/pcre_version.c: Removed.
31141 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31143 Reviewed by Darin Adler.
31145 Removed KJS_VERBOSE because it was getting in the way of readability,
31146 and the messages didn't seem very helpful.
31148 * kjs/function.cpp:
31149 (KJS::FunctionImp::callAsFunction):
31150 (KJS::FunctionImp::passInParameters):
31154 (KJS::JSObject::put):
31157 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31159 Reviewed by Darin Adler.
31161 Removed the Parameter class because it was a redundant wrapper around
31164 * kjs/function.cpp:
31165 (KJS::FunctionImp::passInParameters):
31166 (KJS::FunctionImp::getParameterName):
31168 (FunctionBodyNode::addParam):
31170 (KJS::FunctionBodyNode::):
31172 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31174 Reviewed by Darin Adler.
31176 Global replace of assert with ASSERT.
31178 2007-10-16 Adam Roben <aroben@apple.com>
31180 Make testkjs not delay-load WebKit
31182 Soon, delay-loading WebKit will be impossible (because we will be
31183 using __declspec(thread) for thread-local storage). This change
31184 prepares testkjs for the future.
31188 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
31190 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
31191 WebKitInitializer, don't delay-load WebKit.
31192 * kjs/testkjs.cpp: Don't use WebKitInitializer.
31194 2007-10-16 Adam Roben <aroben@apple.com>
31196 Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
31198 Reviewed by Kevin McCullough.
31200 * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
31201 * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
31202 * JavaScriptCore.vcproj/release.vsprops: Ditto.
31203 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
31204 WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
31205 in the name of icuuc36[_debug].dll.
31207 2007-10-16 Geoffrey Garen <ggaren@apple.com>
31209 Reviewed by Maciej Stachowiak.
31211 Re-structured variable and function declaration code.
31213 Command-line JS iBench shows no regression.
31215 Here are the changes:
31217 1. Function declarations are now processed at the same time as var
31218 declarations -- namely, immediately upon entry to an execution context.
31219 This does not match Firefox, which waits to process a function
31220 declaration until the declaration's containing block executes, but it
31221 does match IE and the ECMA spec. (10.1.3 states that var and function
31222 declarations should be processed at the same time -- namely, "On
31223 entering an execution context." 12.2 states that "A Block does not
31224 define a new execution scope.")
31226 2. Declaration processing proceeds iteratively now, rather than
31227 recursively, storing the nodes is finds in stacks. This will later
31228 facilitate an optimization to hold on to the gathered declaration nodes,
31229 rather than re-fetching them in every function call.
31230 [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31232 Modified these tests because they expected the incorrect Mozilla
31233 behavior described above:
31235 * tests/mozilla/ecma_3/Function/scope-001.js:
31236 * tests/mozilla/js1_5/Scope/regress-184107.js:
31238 2007-10-16 Darin Adler <darin@apple.com>
31240 - try to fix the GTK build
31242 * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
31244 2007-10-16 Darin Adler <darin@apple.com>
31246 - try to fix the Windows build
31248 * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
31249 in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
31251 2007-10-16 Darin Adler <darin@apple.com>
31253 - try to fix the GTK build
31255 * kjs/ustring.cpp: Include ASCIICType.h.
31257 2007-10-16 Darin Adler <darin@apple.com>
31259 Reviewed by Maciej and Geoff (and looked over by Eric).
31261 - http://bugs.webkit.org/show_bug.cgi?id=15519
31262 eliminate use of <ctype.h> for processing ASCII
31264 * wtf/ASCIICType.h: Added.
31265 * wtf/DisallowCType.h: Added.
31267 * kjs/config.h: Include DisallowCType.h.
31269 * kjs/date_object.cpp:
31270 (KJS::skipSpacesAndComments):
31273 * kjs/function.cpp:
31276 (KJS::UString::toDouble):
31277 Use ASCIICType.h functions instead of ctype.h ones.
31279 2007-10-14 Maciej Stachowiak <mjs@apple.com>
31283 - fixes for "New JavaScript benchmark"
31284 http://bugs.webkit.org/show_bug.cgi?id=15515
31287 (TestFunctionImp::callAsFunction): Implement "load" for compatibility
31289 (TestFunctionImp::): ditto
31291 (kjsmain): Drop useless --> from output.
31293 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31295 Removed unnecessary #include.
31297 * API/JSObjectRef.cpp:
31299 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31301 Double-reverse build fix. My tree was out of date.
31304 (NumberNode::evaluate):
31306 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31311 (NumberNode::evaluate):
31313 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31315 Reviewed by Darin Adler.
31317 Removed surprising self-named "hack" that made nested functions
31318 available as named properties of their containing functions, and placed
31319 containing function objects in the scope chains of nested functions.
31321 There were a few reasons to remove this "hack:"
31323 1. It contradicted FF, IE, and the ECMA spec.
31325 2. It incurred a performance penalty, since merely parsing a function
31326 required parsing its body for nested functions (and so on).
31328 3. SVN history contains no explanation for why it was added. It was just
31329 legacy code in a large merge a long, long time ago.
31331 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31334 (FuncDeclNode::processFuncDecl):
31336 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31338 Reviewed by Darin Adler.
31340 Removed the concept of AnonymousCode. It was unused, and it doesn't
31341 exist in the ECMA spec.
31343 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31346 (KJS::Context::Context):
31349 (ReturnNode::execute):
31351 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31353 Reviewed by Darin Adler.
31355 Made function parameters DontDelete. This matches FF and the vague
31356 description in ECMA 10.1.3. It's also required in order to make
31357 symbol table based lookup of function parameters valid. (If the
31358 parameters aren't DontDelete, you can't guarantee that you'll find
31359 them later in the symbol table.)
31361 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31363 * kjs/function.cpp:
31364 (KJS::FunctionImp::passInParameters):
31366 2007-10-15 Geoffrey Garen <ggaren@apple.com>
31368 Reviewed by Maciej Stachowiak.
31370 Some Vector optimizations. These are especially important when using
31371 Vector as a stack for implementing recursive algorithms iteratively.
31373 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31375 1. Added shrink(), which is a version of resize() that you can call
31376 to save a branch / improve code generation and inlining when you know
31377 that the vector is not getting bigger.
31379 2. Changed subclassing relationship in VectorBuffer to remove a call to
31380 fastFree() in the destructor for the inlineCapacity != 0 template
31381 specialization. This brings inline Vectors one step closer to true
31382 stack-allocated arrays.
31384 Also changed abort() to CRASH(), since the latter works better.
31387 (WTF::VectorBufferBase::allocateBuffer):
31388 (WTF::VectorBufferBase::deallocateBuffer):
31389 (WTF::VectorBufferBase::VectorBufferBase):
31390 (WTF::VectorBufferBase::~VectorBufferBase):
31392 (WTF::VectorBuffer::VectorBuffer):
31393 (WTF::VectorBuffer::~VectorBuffer):
31394 (WTF::VectorBuffer::deallocateBuffer):
31395 (WTF::VectorBuffer::releaseBuffer):
31396 (WTF::Vector::clear):
31397 (WTF::Vector::removeLast):
31402 2007-10-12 Geoffrey Garen <ggaren@apple.com>
31404 Reviewed by Maciej Stachowiak.
31406 Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
31407 Iteration statements sometimes incorrectly evaluate to the empty value
31410 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
31412 This patch is a merge of KDE r670547, with substantial modification
31415 It fixes do-while statements to evaluate to a value. (They used
31416 to evaluate to the empty value in all cases.)
31418 It also fixes SourceElementsNode to maintain the value of abnormal
31419 completions like "break" and "continue."
31421 It also re-works the main execution loop in SourceElementsNode so that
31422 it (1) makes a little more sense and (2) avoids unnecessary work. This
31423 is a .28% speedup on command-line JS iBench.
31426 (DoWhileNode::execute):
31427 (SourceElementsNode::execute):
31429 2007-10-15 Simon Hausmann <hausmann@kde.org>
31433 Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
31435 * wtf/HashTraits.h:
31437 2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
31441 Add support for MSVC7, and fix cases where PLATFORM(WIN) should
31442 be PLATFORM(WIN_OS) for other ports building on Windows.
31444 * kjs/DateMath.cpp:
31445 (KJS::getDSTOffsetSimple):
31446 * kjs/JSImmediate.h:
31447 * wtf/Assertions.cpp:
31448 * wtf/Assertions.h:
31450 * wtf/StringExtras.h:
31454 2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
31458 Adds NegateNode optimization from KJS. The relevant revision in KDE
31463 (NumberNode::evaluate):
31466 (KJS::NumberNode::):
31467 * kjs/nodes2string.cpp:
31468 (NumberNode::streamTo):
31470 2007-10-14 Jason Foreman <jason@threeve.org>
31472 Reviewed by Maciej.
31474 Fix http://bugs.webkit.org/show_bug.cgi?id=15145
31476 Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
31477 that the property n < intPow10(p) is maintained.
31479 * kjs/number_object.cpp:
31480 (NumberProtoFunc::callAsFunction):
31482 == Rolled over to ChangeLog-2007-10-14 ==