blob: 0912aecff05efaa43bdcc24d77a1a972c2ca323d [file] [log] [blame]
2008-08-10 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed (and updated) by Alp Toker.
https://bugs.webkit.org/show_bug.cgi?id=16620
[GTK] Autotools make dist and make check support
Get make dist working.
Note that not all possible configurations have been tested yet.
* GNUmakefile.am:
2008-08-09 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Sam Weinig.
Added same heap debug checks to more code paths.
* kjs/JSActivation.cpp:
(KJS::JSActivation::put):
(KJS::JSActivation::putWithAttributes):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::putWithAttributes):
* kjs/JSObject.h:
(KJS::JSObject::putDirect):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePut):
(KJS::JSVariableObject::symbolTablePutWithAttributes):
2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Fix some style issues in the sampling tool.
* VM/SamplingTool.cpp:
(KJS::sleepForMicroseconds):
(KJS::SamplingTool::dump):
2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Revision 35651, despite being a rather trivial change, introduced a
large regression on the regexp-dna SunSpider test. This regression
stemmed from an increase in the size of CodeBlock::dump(). There is
no reason for this method (and several related methods) to be compiled
in non-debug builds with the sampling tool disabled. This patch
conditionally compiles them, reversing the regression on SunSpider.
* JavaScriptCore.exp:
* VM/CodeBlock.cpp:
* VM/CodeBlock.h:
* VM/Machine.cpp:
2008-08-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 20330: JSCore crash loading any filehurricane media page
<https://bugs.webkit.org/show_bug.cgi?id=20330>
Fix a typo in the constant loading patch. Also, add a case for
op_unexpected_load to CodeBlock::dump().
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addUnexpectedConstant):
2008-08-08 Matt Lilek <webkit@mattlilek.com>
Not reviewed, build fix.
* JavaScriptCore.exp:
2008-08-08 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
Improve performance of arithmetic operators
Added a fast (non-virtual) mechanism to determine if a non-immediate JSValue*
is a JSNumberCell. We then use this to allow improved specialisation in many
arithmetic operators. SunSpider reports a 2.5% progression overall, with greater
than 10% progressions on a number of arithmetic heavy tests.
* VM/Machine.cpp:
(KJS::fastIsNumber):
(KJS::fastToInt32):
(KJS::fastToUInt32):
(KJS::jsLess):
(KJS::jsLessEq):
(KJS::jsAdd):
(KJS::Machine::privateExecute):
* kjs/JSNumberCell.h:
(KJS::JSNumberCell::fastToInt32):
(KJS::JSNumberCell::fastToUInt32):
* kjs/collector.cpp:
(KJS::allocateBlock):
(KJS::Heap::heapAllocate):
* kjs/collector.h:
(KJS::Heap::fastIsNumber):
2008-08-06 Adam Roben <aroben@apple.com>
Try to fix the Windows build bots
* API/JSBase.cpp: Touch this to force JSC to rebuild and re-copy the
WTF headers.
2008-08-06 Tor Arne Vestbø <tavestbo@trolltech.com>
Revert change 35595.
* wtf/RetainPtr.h:
2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
Fix non-Mac build.
* wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
Fix non-Mac build.
* wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
2008-08-06 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
Reviewed by Darin. Landed by Cameron.
Bug 20272: typo in JavaScriptCore
<https://bugs.webkit.org/show_bug.cgi?id=20272>
Correct the documentation for op_not. (typo)
Fix #undef. (typo)
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-08-06 Cameron Zwarich <cwzwarich@webkit.org>
Reviewed by Maciej.
Bug 20286: Load constants all at once instead of using op_load
<https://bugs.webkit.org/show_bug.cgi?id=20286>
Load constants all at once into temporary registers instead of using
individual instances of op_load.
This is a 2.6% speedup on SunSpider.
* JavaScriptCore.exp:
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
(KJS::CodeBlock::mark):
* VM/CodeBlock.h:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::newTemporary):
(KJS::CodeGenerator::addConstant):
(KJS::CodeGenerator::addUnexpectedConstant):
(KJS::CodeGenerator::emitLoad):
(KJS::CodeGenerator::emitUnexpectedLoad):
(KJS::CodeGenerator::emitNewError):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::throwException):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* VM/Opcode.h:
* VM/RegisterID.h:
(KJS::RegisterID::RegisterID):
(KJS::RegisterID::makeConstant):
(KJS::RegisterID::isTemporary):
* kjs/NodeInfo.h:
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing):
* kjs/Parser.h:
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::NullNode::emitCode):
(KJS::BooleanNode::emitCode):
(KJS::NumberNode::emitCode):
(KJS::StringNode::emitCode):
(KJS::ArrayNode::emitCode):
(KJS::DeleteResolveNode::emitCode):
(KJS::DeleteValueNode::emitCode):
(KJS::VoidNode::emitCode):
(KJS::ConstDeclNode::emitCodeSingle):
(KJS::ReturnNode::emitCode):
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::ProgramNode::create):
(KJS::EvalNode::EvalNode):
(KJS::EvalNode::create):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::create):
(KJS::FunctionBodyNode::emitCode):
* kjs/nodes.h:
(KJS::ScopeNode::neededConstants):
2008-08-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Cameron.
- add fast path for immediates to % operator, as we have for many other math ops
This fixes handling for a 0 divisor relative to the last patch. Only an 0.2% speedup on SunSpider but
still a 1.4x win on Oliver's prime test.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Bug 20293: Crash in JavaScript codegen for eval("const a;")
<https://bugs.webkit.org/show_bug.cgi?id=20293>
Correctly handle constant declarations in eval code with no initializer.
* kjs/nodes.cpp:
(KJS::ConstDeclNode::emitCodeSingle):
2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Roll out r35555 because of correctness issues.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-08-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- add fast path for immediates to % operator, as we have for many other math ops
0.6% speedup on SunSpider. 1.4x speedup on a prime testing torture test that Oliver whipped up.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-07-31 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
Bug 19359: JavaScriptCore behaves differently from FF2/3 and IE when handling context in catch statement
<https://bugs.webkit.org/show_bug.cgi?id=19359>
Make our catch behave like Firefox and IE, we do this by using a StaticScopeObject
instead of a generic JSObject for the scope node. We still don't make use of the
fact that we have a static scope inside the catch block, so the internal performance
of the catch block is not improved, even though technically it would be possible to
do so.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitPushNewScope):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::createExceptionScope):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* VM/Opcode.h:
* kjs/JSStaticScopeObject.cpp:
(KJS::JSStaticScopeObject::toThisObject):
(KJS::JSStaticScopeObject::put):
* kjs/JSStaticScopeObject.h:
* kjs/nodes.cpp:
(KJS::TryNode::emitCode):
2008-08-02 Rob Gowin <robg@gowin.net>
Reviewed by Eric Seidel.
Added JavaScriptCore/API/WebKitAvailability to list of files in
javascriptcore_h_api.
* GNUmakefile.am:
2008-08-01 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Maciej.
Remove JSGlobalData::DataInstance. It was only needed when we had per-thread JSGlobalData
instances.
* kjs/JSGlobalData.h:
2008-07-31 Kevin Ollivier <kevino@theolliviers.com>
Second attempt at Windows/wx build fix. Instead of avoiding inclusion of windows.h,
use defines, etc. to avoid conflicts in each affected file. Also, change PLATFORM(WIN)
to PLATFORM(WIN_OS) so that other ports using Windows headers get the right impls.
* VM/SamplingTool.cpp:
* wtf/Threading.h:
2008-07-31 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Fix Windows build.
* kjs/collector.h:
* wtf/FastMalloc.cpp:
2008-07-31 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
Reviewed by Simon.
Bug 20170: [Qt] missing namespace defines in JavaScriptCore.pro
<https://bugs.webkit.org/show_bug.cgi?id=20170>
* JavaScriptCore.pro: Added missing define.
2008-07-31 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Maciej.
Eliminate JSLock (it was already disabled, removing the stub implementaion and all
call sites now).
* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
(JSGarbageCollect):
* API/JSCallbackConstructor.cpp:
(KJS::constructJSCallback):
* API/JSCallbackFunction.cpp:
(KJS::JSCallbackFunction::call):
* API/JSCallbackObjectFunctions.h:
(KJS::::init):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::construct):
(KJS::::hasInstance):
(KJS::::call):
(KJS::::getPropertyNames):
(KJS::::toNumber):
(KJS::::toString):
(KJS::::staticValueGetter):
(KJS::::callbackGetter):
* API/JSContextRef.cpp:
(JSGlobalContextCreateInGroup):
(JSGlobalContextRetain):
(JSGlobalContextRelease):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectGetPropertyAtIndex):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
(JSObjectCopyPropertyNames):
(JSPropertyNameArrayRelease):
(JSPropertyNameAccumulatorAddName):
* API/JSStringRef.cpp:
(JSStringRelease):
* API/JSValueRef.cpp:
(JSValueIsEqual):
(JSValueIsInstanceOfConstructor):
(JSValueMakeNumber):
(JSValueMakeString):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
(JSValueProtect):
(JSValueUnprotect):
* ForwardingHeaders/JavaScriptCore/JSLock.h: Removed.
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.order:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalData.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject):
(KJS::JSGlobalObject::init):
* kjs/JSLock.cpp: Removed.
* kjs/JSLock.h: Removed.
* kjs/Shell.cpp:
(functionGC):
(jscmain):
* kjs/collector.cpp:
(KJS::Heap::~Heap):
(KJS::Heap::heapAllocate):
(KJS::Heap::setGCProtectNeedsLocking):
(KJS::Heap::protect):
(KJS::Heap::unprotect):
(KJS::Heap::collect):
* kjs/identifier.cpp:
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
2008-07-31 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Oliver Hunt.
Fix the Mac project to not display "test/" as part of file name for tests.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-07-31 Eric Seidel <eric@webkit.org>
Reviewed by Alexey Proskuryakov.
Rename USE(MULTIPLE_THREADS) to ENABLE(JSC_MULTIPLE_THREADS)
to better match the use/enable pattern (and better describe
the usage of the feature in question.)
I also fixed a couple other ENABLE_ macros to be pre-processor
definition override-able to match the rest of the ENABLE_ macros
since it seems to be our convention that build systems can set
ENABLE_ macros in Makefiles.
* kjs/InitializeThreading.cpp:
(KJS::initializeThreadingOnce):
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
(KJS::JSGlobalData::~JSGlobalData):
* kjs/MathObject.cpp:
* kjs/collector.cpp:
(KJS::Heap::Heap):
(KJS::Heap::~Heap):
(KJS::allocateBlock):
(KJS::Heap::markStackObjectsConservatively):
* kjs/collector.h:
* kjs/dtoa.cpp:
(KJS::pow5mult):
(KJS::rv_alloc):
(KJS::freedtoa):
(KJS::dtoa):
* wtf/FastMalloc.cpp:
* wtf/Platform.h:
* wtf/RefCountedLeakCounter.cpp:
2008-07-30 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS) a little.
It looks like JSC assumes that if MULTIPLE_THREADS is defined, then pthreads will always be available
I'm not sure that's always the case for gtk, certainly not for Windows. We should eventually go back
and fix wtf/Threading.h to cover all these cases some day.
* kjs/JSLock.cpp:
* kjs/collector.h:
* wtf/Platform.h:
2008-07-30 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
MSVC warns when structs are called classes or vice versa.
Make all the source refer to JSGlobalData as a class.
* kjs/CommonIdentifiers.h:
* kjs/JSGlobalData.h:
* kjs/Parser.h:
* kjs/lexer.h:
2008-07-30 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Add consistency checks to UString to document and enforce its design.
* kjs/ustring.cpp:
(KJS::UString::Rep::create):
(KJS::UString::Rep::destroy):
(KJS::UString::Rep::checkConsistency):
(KJS::UString::expandCapacity):
(KJS::UString::expandPreCapacity):
(KJS::UString::UString):
(KJS::UString::spliceSubstringsWithSeparators):
(KJS::UString::append):
* kjs/ustring.h:
(KJS::UString::Rep::checkConsistency):
2008-07-30 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoff Garen.
Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes.
* GNUmakefile.am: Adding SamplingTool.cpp to build.
* JavaScriptCore.exp: Export hooks to init & control SamplingTool.
* JavaScriptCore.pri: Adding SamplingTool.cpp to build.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build.
* JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build.
* JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build.
* VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction
* VM/Machine.h:
* VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID.
* VM/Opcode.h:
* VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool.
* VM/SamplingTool.h:
* kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL.
* wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option.
* kjs/nodes.cpp: Header include to fix non-AllInOne builds.
2008-07-30 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Alexey Proskuryakov.
Fix compilation without multi-threading support.
* kjs/collector.cpp:
(KJS::Heap::Heap):
2008-07-30 Anders Carlsson <andersca@apple.com>
Add WebKitAvailability.h forwarding header.
* ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added.
2008-07-30 Anders Carlsson <andersca@apple.com>
Fix the else.
* API/WebKitAvailability.h:
2008-07-30 Anders Carlsson <andersca@apple.com>
* API/WebKitAvailability.h:
Fix Windows (and other non-Mac builds).
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
Add WebKitAvailability.h to the project.
2008-07-30 Anders Carlsson <andersca@apple.com>
One step closer towards fixing the Windows build.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Make sure to copy WebKitAvailability.h
2008-07-29 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoff Garen.
Bug 20209: Atomize constant strings
<https://bugs.webkit.org/show_bug.cgi?id=20209>
Prevents significant performance degradation seen when a script contains multiple
identical strings that are used as keys to identify properties on objects.
No performance change on SunSpider.
* kjs/nodes.cpp: Atomize constant strings.
2008-07-30 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey Proskuryakov.
<rdar://problem/6111648> JavaScript exceptions fail if the scope chain includes the global object
In an attempt to remove the branch I just added to KJS::depth I
used the existence of a Variable Object at a point in the scope
chain as an indicator of function or global scope activation.
However this assumption results in incorrect behaviour if the
global object is injected into the scope chain with 'with'.
* VM/Machine.cpp:
(KJS::depth):
2008-07-30 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Don't call JSGarbageCollect() on a released context.
* API/testapi.c: (main):
2008-07-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Implement JSContextGroup APIs to make concurrent execution possible for
JavaScriptCore clients.
This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
group for each context, making JSlock implicit locking unnecessary.
* API/JSContextRef.h:
* API/JSContextRef.cpp:
(JSContextGroupCreate):
(JSContextGroupRetain):
(JSContextGroupRelease):
(JSGlobalContextCreate):
(JSGlobalContextCreateInGroup):
(JSGlobalContextRelease):
(JSContextGetGroup):
Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
* API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
* API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
context is actually used.
* API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
JSGarbageCollect().
* JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
* kjs/JSGlobalData.cpp:
* kjs/JSGlobalData.h:
Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
variable still remains, to be deleted in a followup patch.
* kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
* kjs/collector.cpp:
(KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
JSGlobalData::sharedInstance.
* kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
2008-07-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Fix a leak of ThreadRegistrar objects.
As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
have a chance to clean up per-thread object. Switched to native pthread calls, storing a
plain pointer that doesn't require cleanup.
* kjs/collector.cpp:
(KJS::PlatformThread::PlatformThread):
(KJS::Heap::Thread::Thread):
(KJS::Heap::Heap):
(KJS::Heap::~Heap):
(KJS::Heap::registerThread):
(KJS::Heap::unregisterThread):
* kjs/collector.h:
2008-07-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Sam Weinig.
https://bugs.webkit.org/show_bug.cgi?id=20169
Memory allocated with fastMalloc is freed with delete
* VM/JSPropertyNameIterator.cpp:
(KJS::JSPropertyNameIterator::invalidate): Free the array properly.
(KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
invalidate().
2008-07-29 Mark Rowe <mrowe@apple.com>
Attempt to fix the Qt build.
* wtf/ThreadingQt.cpp: Add the extra argument to createThread.
2008-07-29 Adam Roben <aroben@apple.com>
Change Vector::find to return an index instead of an iterator
Indices are more natural than iterators when working with Vector.
Reviewed by John Sullivan.
* wtf/Vector.h:
(WTF::Vector::find): Changed to iterate the Vector manually and return
the index of the found item, rather than an iterator. When the item
could not be found, we return WTF::notFound.
2008-07-29 Adam Roben <aroben@apple.com>
Windows build fix
* wtf/ThreadingWin.cpp:
(WTF::setThreadName): Move a misplaced assertion to here...
(WTF::createThread): ...from here.
2008-07-29 Adam Roben <aroben@apple.com>
Add support for setting thread names on Windows
These thread names make it much easier to identify particular threads
in Visual Studio's Threads panel.
WTF::createThread now takes a const char* representing the thread's
name. On Windows, we throw a special exception to set this string as
the thread's name. Other platforms do nothing with this name for now.
Reviewed by Anders Carlsson.
* JavaScriptCore.exp: Export the new version of createThread that
takes 3 arguments (the old one continues to be exported for backward
compatibility).
* wtf/Threading.h: Add a threadName argument to createThread.
* wtf/ThreadingGtk.cpp:
(WTF::createThread):
* wtf/ThreadingNone.cpp:
(WTF::createThread):
Updated for function signature change.
* wtf/ThreadingPthreads.cpp:
(WTF::createThread): Updated for function signature change. We keep
around the old 2-argument version of createThread for backward
compatibility.
* wtf/ThreadingWin.cpp:
(WTF::setThreadName): Added. This function's implementation came from
MSDN.
(WTF::initializeThreading): Set the name of the main thread.
(WTF::createThread): Call setThreadName. We keep around the old
2-argument version of createThread for backward compatibility.
2008-07-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Oliver Hunt.
Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
slightly nicer code and a 0.5% SunSpider improvement.
* API/JSClassRef.cpp:
(OpaqueJSClass::~OpaqueJSClass):
(OpaqueJSClassContextData::OpaqueJSClassContextData):
* API/JSStringRef.cpp:
(JSStringRelease):
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::add):
* kjs/identifier.cpp:
(KJS::IdentifierTable::~IdentifierTable):
(KJS::IdentifierTable::add):
(KJS::Identifier::addSlowCase):
(KJS::Identifier::remove):
* kjs/identifier.h:
(KJS::Identifier::add):
* kjs/ustring.cpp:
(KJS::):
(KJS::UString::Rep::create):
(KJS::UString::Rep::destroy):
* kjs/ustring.h:
(KJS::UString::Rep::identifierTable):
(KJS::UString::Rep::setIdentifierTable):
(KJS::UString::Rep::isStatic):
(KJS::UString::Rep::setStatic):
(KJS::UString::cost):
2008-07-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Renamed "ConstructTypeNative" => "ConstructTypeHost".
2008-07-26 Mark Rowe <mrowe@apple.com>
Speculative fix for the wx build.
* JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
2008-07-25 Oliver Hunt <oliver@apple.com>
RS=Cameron Zwarich.
Whoops, forgot to save style correction.
* kjs/JSStaticScopeObject.h:
2008-07-25 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
Bug 19718: Named anonymous functions are slow accessing global variables
<https://bugs.webkit.org/show_bug.cgi?id=19718>
To fix this we switch over to an activation-like scope object for
on which we attach the function name property, and add logic to
prevent cross scope assignment to read only properties.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::findScopedProperty):
(KJS::CodeGenerator::emitResolve):
* VM/CodeGenerator.h:
* kjs/AllInOneFile.cpp:
* kjs/JSStaticScopeObject.cpp: Added.
(KJS::JSStaticScopeObject::putWithAttributes):
(KJS::JSStaticScopeObject::isDynamicScope):
(KJS::JSStaticScopeObject::~JSStaticScopeObject):
(KJS::JSStaticScopeObject::getOwnPropertySlot):
* kjs/JSStaticScopeObject.h: Added.
(KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
(KJS::JSStaticScopeObject::JSStaticScopeObject):
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::emitCode):
(KJS::PostfixResolveNode::emitCode):
(KJS::PrefixResolveNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignResolveNode::emitCode):
(KJS::FuncExprNode::makeFunction):
2008-07-25 kevino <kevino@theolliviers.com>
wx build fix for Win.
On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
for libjpeg and wx, and also wx needs to include windows.h itself first for wx
includes to work right. So until we can find a better solution to this problem,
on wx, we work around the need to include windows.h here.
* wtf/Threading.h:
2008-07-25 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
include path.
2008-07-25 Simon Hausmann <hausmann@webkit.org>
Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
include search path (added by WebKit.pri).
* kjs/jsc.pro:
2008-07-25 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Simon Hausmann.
Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
conflicts and developer confusion.
* API/JSNode.c: Removed.
* API/JSNode.h: Removed.
* API/JSNodeList.c: Removed.
* API/JSNodeList.h: Removed.
* API/Node.c: Removed.
* API/Node.h: Removed.
* API/NodeList.c: Removed.
* API/NodeList.h: Removed.
* API/minidom.c: Removed.
* API/minidom.html: Removed.
* API/minidom.js: Removed.
* API/testapi.c: Removed.
* API/testapi.js: Removed.
* API/tests: Added.
* API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
* API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
* API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
* API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
* API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
* API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
* API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
* API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
* API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
* API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
* API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
* API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
* API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
* GNUmakefile.am:
* JavaScriptCore.vcproj/testapi/testapi.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-07-25 Simon Hausmann <hausmann@webkit.org>
Prospective WX build fix, add JavaScriptCore/API to the include search
path.
* jscore.bkl:
2008-07-25 Simon Hausmann <hausmann@webkit.org>
Rubber-stamped by Lars.
Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
but operator delete was not implemented. Unfortunately MSVC decides to call/reference
the function, so a simple implementation using fastFree() fixes the build.
* kjs/ArgList.h:
(KJS::ArgList::operator delete):
2008-07-25 Simon Hausmann <hausmann@webkit.org>
Discussed with and rubber-stamped by Lars.
Fix the build system for the Qt port.
Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
include search path. With a build process that combines JavaScriptCore and
WebCore in one build process/Makefile the existance of
JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
This commit solves this by introducing a separate build of JavaScriptCore into
a static library.
As a result of the split-up a race-condition due to broken dependencies of
regular source files to header files of generated sources showed up very
frequently when doing parallel builds (which the buildbot does). This commit at
the same time tries to address the dependency problem by making the
addExtraCompiler() function also generate a pseudo extra compiler that
represents the header file output, so that qmake is aware of the creation of
the header file for dependency calculation.
At the same time I removed a lot of cruft from the pro files to ease maintenance.
* JavaScriptCore.pri:
* JavaScriptCore.pro: Added.
* kjs/jsc.pro:
2008-07-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed a strict aliasing violation, which caused hash tables with floating
point keys not to find items that were indeed in the tables
(intermittently, and only in release builds, of course).
SunSpider reports no change.
This bug doesn't seem to affect any existing code, but it causes obvious
crashes in some new code I'm working on.
* wtf/HashFunctions.h:
(WTF::FloatHash::hash): Use a union when punning between a float / double
and an unsigned (bucket of bits). With strict aliasing enabled, unions
are the only safe way to do this kind of type punning.
* wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
the table is indeed in the table. In the buggy case described above, this
ASSERT fires.
2008-07-24 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey Proskuryakov.
Bug 20142: REGRESSION(r35245): /=/ weirdness
<https://bugs.webkit.org/show_bug.cgi?id=20142>
When adding all the meta data needed for exception error messages
I accidentally clobbered the handling of regex beginning with /=.
* kjs/grammar.y:
2008-07-23 Alp Toker <alp@nuanti.com>
Build fix after r35293: Add API/ to the include path.
* GNUmakefile.am:
2008-07-23 Adam Roben <aroben@apple.com>
Windows build fixes
Build fix after r35293:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
to the include path.
Build fix after r35305:
* VM/Machine.cpp:
* VM/Machine.h:
* VM/Opcode.cpp:
* VM/Opcode.h:
Completely compile out all sampler-related code when
SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
non-AllInOne configurations due to circular header dependencies, and
2) on platforms that don't have a usleep() function, such as Windows.
2008-07-23 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff Garen and Sam Weinig.
Improve switch performance.
Improve switch performance by converting to a hashmap based jump
table to avoid the sequence of dispatches that would otherwise be
needed. This results in a 9-19x performance win for string switches
based on ad hoc testing, and a 6x improvement for integer switch
statements. SunSpider reports a 1.2% progression.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
(KJS::SimpleJumpTable::offsetForValue):
* VM/CodeBlock.h:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::beginSwitch):
(KJS::prepareJumpTableForImmediateSwitch):
(KJS::prepareJumpTableForCharacterSwitch):
(KJS::prepareJumpTableForStringSwitch):
(KJS::CodeGenerator::endSwitch):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::offsetForStringSwitch):
(KJS::Machine::privateExecute):
* VM/Opcode.cpp:
(KJS::):
* VM/Opcode.h:
* kjs/JSImmediate.h:
* kjs/nodes.cpp:
(KJS::):
(KJS::processClauseList):
(KJS::CaseBlockNode::tryOptimisedSwitch):
(KJS::CaseBlockNode::emitCodeForBlock):
* kjs/nodes.h:
(KJS::SwitchInfo::):
2008-07-23 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoff Garen.
Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
* JavaScriptCore.exp: Export symbols for Shell.cpp.
* VM/Machine.cpp: Added sampling hooks.
* VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
* VM/Opcode.cpp: Tool implementation.
* VM/Opcode.h: Tool declaration.
* kjs/Shell.cpp: Initialize the sampler, if enabled.
* kjs/nodes.cpp: Added sampling hooks.
2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
Bug 20097: [Qt] 20% Sunspider slow-down
<https://bugs.webkit.org/show_bug.cgi?id=20097>
Reviewed by Simon Hausmann.
* kjs/jsc.pro: Added missing NDEBUG define for release builds.
2008-07-23 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
JSClassRef is created context-free, but gets infatuated with the first context it sees.
The implicit API contract is that JSClassRef can be used with any context on any thread.
This no longer worked, because UStrings in the class were turned into per-context
identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
* API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
(OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
(clearReferenceToPrototype): Update for the new reference location.
(OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
(OpaqueJSClass::contextData): Added a function that finds the per-context part of
OpaqueJSClass in JSGlobalData, or creates it if not found.
(OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
a way to access JSGlobalData, so a per-context copy could not be made.
(OpaqueJSClass::staticValues): Updated for new data location.
(OpaqueJSClass::staticFunctions): Ditto.
(OpaqueJSClass::prototype): Changed to take an internal type for consistency.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
(KJS::JSGlobalData::~JSGlobalData):
* kjs/JSGlobalData.h:
Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
* API/JSCallbackObjectFunctions.h:
(KJS::::className):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::getPropertyNames):
(KJS::::staticValueGetter):
(KJS::::staticFunctionGetter):j
Use function accessors instead of accessing OpaqueJSClass members directly.
* API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
OpaqueJSClass::prototype() argument type.
* API/JSObjectRef.cpp:
(JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
(JSObjectMakeConstructor): Ditto.
2008-07-23 Alexey Proskuryakov <ap@webkit.org>
Build fix.
* kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
class definition.
2008-07-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt and Sam Weinig.
Next step toward putting doubles in registers: Prepare the Register class
and its clients for registers that don't contain JSValue*s.
This means a few things:
1. Register::jsValue() clients, including ArgList clients, must now supply
an ExecState* when accessing an entry in an ArgList, in case the entry
will need to create a JSValue* on the fly.
2. Register clients that definitely don't want to create a JSValue* on
the fly now use different APIs: getJSValue() for clients that know
the register contains a JSValue*, and v() for clients who just want a
void*.
3. I had to change some headers around in order to resolve dependency
problems created by using a Register in the ArgList header.
SunSpider reports no change.
2008-07-22 Gavin Barraclough <barraclough@apple.com>
Reviewed by Alexey Proskuryakov.
Prevent integer overflow when reallocating storage vector for arrays.
Sunspider reports 1.005x as fast (no change expected).
* kjs/JSArray.cpp:
2008-07-21 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
<rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
* Configurations/Version.xcconfig:
* Info.plist:
2008-07-21 Adam Roben <aroben@apple.com>
Add Vector::find
This is a convenience wrapper around std::find.
Reviewed by Anders Carlsson.
* wtf/Vector.h:
2008-07-19 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
<https://bugs.webkit.org/show_bug.cgi?id=20104>
To make this correct we make the dot and bracket assign nodes emit the information to indicate
the failure range is the dot/bracket accessor.
* kjs/grammar.y:
2008-07-18 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* kjs/JSGlobalObjectFunctions.cpp:
(KJS::isStrWhiteSpace):
2008-07-18 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* kjs/nodes.h:
(KJS::ThrowableExpressionData::ThrowableExpressionData):
2008-07-18 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
<rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
Add support for decent error messages in JavaScript. This patch achieves this by providing
ensuring the common errors and exceptions have messages that provide the text of expression
that trigger the exception. In addition it attaches a number of properties to the exception
object detailing where in the source the expression came from.
* JavaScriptCore.exp:
* VM/CodeBlock.cpp:
(KJS::CodeBlock::lineNumberForVPC):
(KJS::CodeBlock::expressionRangeForVPC):
Function to recover the expression range for an instruction
that triggered an exception.
* VM/CodeBlock.h:
(KJS::ExpressionRangeInfo::):
(KJS::CodeBlock::CodeBlock):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCall):
(KJS::CodeGenerator::emitCallEval):
Emit call needed to be modified so to place the expression range info internally,
as the CodeGenerator emits the arguments nodes itself, rather than the various call
nodes.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::emitExpressionInfo):
Record the expression range info.
* VM/ExceptionHelpers.cpp:
(KJS::createErrorMessage):
(KJS::createInvalidParamError):
(KJS::createUndefinedVariableError):
(KJS::createNotAConstructorError):
(KJS::createNotAFunctionError):
(KJS::createNotAnObjectErrorStub):
(KJS::createNotAnObjectError):
Rewrite all the code for the error messages so that they make use of the newly available
information.
* VM/ExceptionHelpers.h:
* VM/Machine.cpp:
(KJS::isNotObject): Now needs vPC and codeBlock
(KJS::Machine::throwException):
New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
(KJS::Machine::privateExecute):
* VM/Machine.h:
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::evaluate):
* kjs/Error.cpp:
(KJS::Error::create):
* kjs/Error.h:
* kjs/JSGlobalObjectFunctions.cpp:
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::toObject):
(KJS::JSImmediate::prototype):
My changes to the JSNotAnObject constructor needed to be handled here.
* kjs/JSNotAnObject.h:
(KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
(KJS::JSNotAnObjectErrorStub::isNull):
(KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
and potentially allow even more detailed error messages in future.
* kjs/JSObject.h:
* kjs/Parser.h:
(KJS::Parser::parse):
* kjs/SourceRange.h:
* kjs/grammar.y:
Large amounts of position propagation.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::shift):
(KJS::Lexer::lex):
The lexer needed a few changes to be able to correctly track token character positions.
* kjs/lexer.h:
* kjs/nodes.cpp:
(KJS::ThrowableExpressionData::emitThrowError):
(KJS::StatementNode::StatementNode):
(KJS::ResolveNode::emitCode):
(KJS::BracketAccessorNode::emitCode):
(KJS::DotAccessorNode::emitCode):
(KJS::NewExprNode::emitCode):
(KJS::EvalFunctionCallNode::emitCode):
(KJS::FunctionCallValueNode::emitCode):
(KJS::FunctionCallResolveNode::emitCode):
(KJS::FunctionCallBracketNode::emitCode):
(KJS::FunctionCallDotNode::emitCode):
(KJS::PostfixResolveNode::emitCode):
(KJS::PostfixBracketNode::emitCode):
(KJS::PostfixDotNode::emitCode):
(KJS::DeleteResolveNode::emitCode):
(KJS::DeleteBracketNode::emitCode):
(KJS::DeleteDotNode::emitCode):
(KJS::PrefixResolveNode::emitCode):
(KJS::PrefixBracketNode::emitCode):
(KJS::PrefixDotNode::emitCode):
(KJS::ThrowableBinaryOpNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
(KJS::ForInNode::ForInNode):
(KJS::ForInNode::emitCode):
(KJS::WithNode::emitCode):
(KJS::LabelNode::emitCode):
(KJS::ThrowNode::emitCode):
(KJS::ProgramNode::ProgramNode):
(KJS::ProgramNode::create):
(KJS::EvalNode::generateCode):
(KJS::FunctionBodyNode::create):
(KJS::FunctionBodyNode::generateCode):
(KJS::ProgramNode::generateCode):
All of these methods were handling the position information.
Constructors and create methods were modified to store the information.
All the emitCall implementations listed needed to be updated to actually
record the position information we have so carefully collected.
* kjs/nodes.h:
(KJS::ThrowableExpressionData::ThrowableExpressionData):
(KJS::ThrowableExpressionData::setExceptionSourceRange):
(KJS::ThrowableExpressionData::divot):
(KJS::ThrowableExpressionData::startOffset):
(KJS::ThrowableExpressionData::endOffset):
(KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
(KJS::ThrowableSubExpressionData::setSubexpressionInfo):
(KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
(KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
ThrowableExpressionData is just a uniform mechanism for storing the position
information.
(KJS::ResolveNode::):
(KJS::PrePostResolveNode::):
(KJS::ThrowableBinaryOpNode::):
(KJS::WithNode::):
2008-07-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Three renames:
"CallTypeNative" => "CallTypeHost"
"code" => "byteCode"
"generatedCode" => "generatedByteCode"
2008-07-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Optimized <= for immediate number cases.
SunSpider reports no overall change, but a 10% speedup on access-nsieve.
2008-07-18 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Sam Weinig.
Fix some casts added in a previous build fix to match the style used
throughout WebKit.
* VM/Machine.cpp:
(KJS::Machine::initializeCallFrame):
* VM/Register.h:
(KJS::Register::Register):
2008-07-18 Landry Breuil <landry@openbsd.org>
Bug 19975: [OpenBSD] Patches to enable build of WebKit
<https://bugs.webkit.org/show_bug.cgi?id=19975>
Reviewed by David Kilzer.
Support for OpenBSD, mostly threading and libm tweaks.
* kjs/collector.cpp: #include <pthread.h>
(KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
* kjs/config.h: OpenBSD also provides <pthread_np.h>
* wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
(isfinite), (signbit): as long as we don't have those functions provide fallback implementations
* wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
2008-07-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Next step toward putting doubles in registers: Store constant pool
entries as registers, not JSValue*s.
SunSpider reports no change.
2008-07-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by John Sullivan and Oliver Hunt.
A tiny bit of tidying in function call register allocation.
This patch saves one register when invoking a function expression and/or
a new expression that is stored in a temporary.
Since it's just one register, I can't make a testcase for it.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCall): No need to ref the function we're calling
or its base. We'd like the call frame to overlap with them, if possible.
op_call will read the function and its base before writing the call frame,
so this is safe.
* kjs/nodes.cpp:
(KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
for the same reasons stated above.
(KJS::FunctionCallValueNode::emitCode): ditto
2008-07-17 Steve Falkenburg <sfalken@apple.com>
Build fix.
* kjs/InternalFunction.cpp:
2008-07-17 Sam Weinig <sam@webkit.org>
Roll out r35199 as it is causing failures on the PPC build.
2008-07-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by David Kilzer.
Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
Support function.name (Firefox extension)
Pretty straight-forward.
2008-07-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed <rdar://problem/6081636> Functions calls use more temporary
registers than necessary
Holding a reference to the last statement result register caused each
successive statement to output its result to an even higher register.
Happily, statements don't actually need to return a result register
at all. I hope to make this clearer in a future cleanup patch,
but this change will fix the major bug for now.
* kjs/nodes.cpp:
(KJS::statementListEmitCode):
2008-07-17 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig.
Merge pre&post dot nodes to simplify the parse tree.
Sunspider results show 0.6% progression (no performance change expected).
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-07-17 Gavin Barraclough <barraclough@apple.com>
Reviewed by Cameron Zwarich.
Merge pre&post resolve nodes to simplify the parse tree.
Sunspider results show no performance change.
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-07-17 Gavin Barraclough <barraclough@apple.com>
Reviewed by Cameron Zwarich.
Merge logical nodes to simplify the parse tree.
Sunspider results show 0.6% progression (no performance change expected).
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
Fix MinGW build (broken in r35198) and simplify getLocalTime().
* kjs/DateMath.cpp:
(KJS::getLocalTime):
2008-07-17 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig.
Merge pre&post bracket nodes to simplify the parse tree.
Sunspider results show no performance change.
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
Fix the 32-bit gcc builds, conversion from "long int" to Register is
ambiguous. Explicitly choose the intptr_t constructor.
* VM/Machine.cpp:
(KJS::Machine::initializeCallFrame):
* VM/Register.h:
(KJS::Register::Register):
2008-07-16 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Geoff Garen.
Fix JavaScript in 64-bit by using a pointer-sized integer
type in the Register union. Also includes a rename of
the intType constant to IntType.
* VM/Machine.cpp:
(KJS::Machine::initializeCallFrame):
* VM/Register.h:
(KJS::Register::):
(KJS::Register::Register):
2008-07-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
First step toward putting doubles in registers: Turned Register into a
proper abstraction layer. It is no longer possible to cast a Register
to a JSValue*, or a Register& to a JSValue*&, or to access the union
inside a Register directly.
SunSpider reports no change.
In support of this change, I had to make the following mechanical changes
in a lot of places:
1. Clients now use explicit accessors to read data out of Registers, and
implicit copy constructors to write data into registers.
So, assignment that used to look like
x.u.jsValue = y;
now looks like
x = y;
And access that used to look like
x = y.u.jsValue;
now looks like
x = y.jsValue();
2. I made generic flow control specific in opcodes that made their flow
control generic by treating a Register& as a JSValue*&. This had the
added benefit of removing some exception checking branches from immediate
number code.
3. I beefed up PropertySlot to support storing a Register* in a property
slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
use this functionality, but I expect more clients to use it in the future.
4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
changed ArgList iterator clients to iterate Registers, not JSValue*'s.
2008-07-16 Ada Chan <adachan@apple.com>
Fixed build.
* kjs/JSGlobalObject.cpp:
2008-07-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam and Geoff.
<rdar://problem/5958840> Navigating to another page while profiler is
attached results in slow JavaScript for all time.
- The UNLIKELY keeps this from being a sunspider performance regression.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
with this exec state.
2008-07-16 Sam Weinig <sam@webkit.org>
Reviewed by Steve Falkenburg.
Replace adopting UString constructor in favor of explicit
static adopt method.
* API/JSStringRefCF.cpp:
(JSStringCreateWithCFString):
* kjs/StringConstructor.cpp:
(KJS::stringFromCharCode):
* kjs/StringPrototype.cpp:
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
* kjs/ustring.cpp:
(KJS::UString::adopt):
* kjs/ustring.h:
(KJS::UString::UString):
(KJS::UString::~UString):
2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
Fix potential crash (on Qt for Windows port) when performing JavaScript date
conversion.
* kjs/DateMath.cpp:
(KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
localtime_s() instead of localtime() since the latter might crash (on Windows)
given a non-sensible, e.g. NaN, argument.
2008-07-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Anders and Geoff.
https://bugs.webkit.org/show_bug.cgi?id=20023
Failed assertion in PropertyNameArray.cpp
This is already tested by testapi.
* API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
table to appease PropertyNameArray.
2008-07-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
objects).
* kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
* kjs/lookup.cpp: (KJS::HashTable::deleteTable):
* kjs/lookup.h:
* kjs/lexer.cpp: (KJS::Lexer::~Lexer)
HashTable cannot have a destructor, because check-for-global-initializers complains about
having a global constructor then.
2008-07-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Check pthread_key_create return value.
This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
It also looks useful for production builds.
* wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
2008-07-15 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
Rename pageGroupIdentifier to profileGroup to keep mention of a
pageGroup out of JavaScriptCore.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::setProfileGroup):
(KJS::JSGlobalObject::profileGroup):
* profiler/ProfileGenerator.cpp:
(KJS::ProfileGenerator::create):
(KJS::ProfileGenerator::ProfileGenerator):
* profiler/ProfileGenerator.h:
(KJS::ProfileGenerator::profileGroup):
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling):
(KJS::dispatchFunctionToProfiles):
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
2008-07-14 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Fix https://bugs.webkit.org/show_bug.cgi?id=20037
Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
* kjs/ustring.cpp:
(KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
* kjs/ustring.h:
* profiler/CallIdentifier.h:
(WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
2008-07-14 David Hyatt <hyatt@apple.com>
Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
position.
Reviewed by Maciej
* wtf/ListHashSet.h:
(WTF::ListHashSetConstIterator::operator--):
2008-07-14 David Hyatt <hyatt@apple.com>
Buidl fix. Make sure the second insertBefore method returns a value.
* wtf/ListHashSet.h:
(WTF::::insertBefore):
2008-07-14 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
include path.
2008-07-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Kevin McCullough.
Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
global data.
* JavaScriptCore.exp:
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::create):
* kjs/JSGlobalData.h:
Made contructor private, and added a static create() method. Made the class inherit from
RefCounted.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::globalData):
JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
WebCore one, which are never deleted).
* kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
2008-07-14 Simon Hausmann <hausmann@webkit.org>
Fix the single-threaded build.
* kjs/JSLock.cpp: Removed undeclared registerThread() function.
* kjs/collector.cpp:
(KJS::Heap::registerThread): Added dummy implementation.
2008-07-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Eliminate per-thread JavaScript global data instance support and make arbitrary
global data/global object combinations possible.
* kjs/collector.cpp:
(KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
This allows for going from any JS object to its associated global data, currently used in
JSGlobalObject constructor to initialize its JSGlobalData pointer.
(KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
only the shared heap could be used from multiple threads, so it was the only one that needed
thread registration, but now this can happen to any heap.
(KJS::Heap::unregisterThread): Ditto.
(KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
(KJS::Heap::setGCProtectNeedsLocking): Ditto.
(KJS::Heap::protect): Ditto.
(KJS::Heap::unprotect): Ditto.
(KJS::Heap::collect): Ditto.
(KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
not the late per-thread one.
(KJS::Heap::protectedGlobalObjectCount): Ditto.
* kjs/collector.h:
(KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
destroyed.
* kjs/JSLock.cpp:
(KJS::JSLock::JSLock):
* kjs/JSLock.h:
(KJS::JSLock::JSLock):
Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
places that use JSLock - we cannot guarantee absolute safety unless we always mark all
threads in the process, but these implicit registration calls should cover reasonable usage
scenarios, I hope.
* API/JSBase.cpp:
(JSEvaluateScript): Explicitly register the current thread.
(JSCheckScriptSyntax): Explicitly register the current thread.
(JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
condition for clients that pass an already released context to JSGarbageCollect - but it is
unlikely to create real life problems.
To maintain compatibility, the shared heap is collected if NULL is passed.
* API/JSContextRef.cpp:
(JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
(JSGlobalContextRetain): Register the thread.
(JSContextGetGlobalObject): Register the thread.
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectGetPropertyAtIndex):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
(JSObjectCopyPropertyNames):
(JSPropertyNameAccumulatorAddName):
* API/JSValueRef.cpp:
(JSValueIsEqual):
(JSValueIsInstanceOfConstructor):
(JSValueMakeNumber):
(JSValueMakeString):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
(JSValueProtect):
(JSValueUnprotect):
Register the thread.
* API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
* API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
* JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
their own instances. Adapt to other changes, too.
* JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
included by collector.h and is thus needed in other projects.
* kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
global data, as it no longer exists.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
(KJS::JSGlobalData::~JSGlobalData):
* kjs/JSGlobalData.h:
Removed support for per-thread instance. Made constructor and destructor public.
* kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
via the heap.
(KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
* kjs/JSGlobalObject.h:
* kjs/Shell.cpp:
(main):
(jscmain):
Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
2008-07-13 Ada Chan <adachan@apple.com>
Windows build fix: Add wtf/RefCountedLeakCounter to the project.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
build scripts
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCoreSources.bkl:
2008-07-11 Stephanie Lewis <slewis@apple.com>
Reviewed by Darin Adler and Oliver Hunt.
Refactor RefCounting Leak counting code into a common class.
In order to export the symbols I needed to put the debug defines inside the function names
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.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj: add new class
* kjs/nodes.cpp: remove old leak counting code
* wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
* wtf/RefCountedLeakCounter.h: Added.
2008-07-11 David Hyatt <hyatt@apple.com>
Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
at the end).
Reviewed by Anders
* wtf/ListHashSet.h:
(WTF::::insertBefore):
(WTF::::insertNodeBefore):
2008-07-11 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
Move call function to CallData.cpp and construct to ConstructData.cpp.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
* kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
* kjs/JSValue.cpp:
2008-07-10 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
* Configurations/Base.xcconfig:
2008-07-10 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
* API/WebKitAvailability.h:
2008-07-10 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
-Minor cleanup. Renamed callTree() to head() and no longer use m_head
directly but instead keep it private and access via a method().
* profiler/HeavyProfile.cpp:
(KJS::HeavyProfile::HeavyProfile):
(KJS::HeavyProfile::generateHeavyStructure):
(KJS::HeavyProfile::addNode):
* profiler/Profile.h:
(KJS::Profile::head):
* profiler/ProfileGenerator.cpp:
(KJS::ProfileGenerator::ProfileGenerator):
2008-07-10 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Mark Rowe.
Eliminate CollectorHeapIntrospector.
CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
way to label mapped regions is to use a VM tag.
So, it makes more sense to remove it completely than to make it work with multiple heaps.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/AllInOneFile.cpp:
* kjs/InitializeThreading.cpp:
(KJS::initializeThreading):
* kjs/collector.cpp:
* kjs/collector.h:
* kjs/CollectorHeapIntrospector.cpp: Removed.
* kjs/CollectorHeapIntrospector.h: Removed.
2008-07-09 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
view (19228)
- Implemented the time and call count portionof heavy. Now all that we
need is some UI.
* profiler/CallIdentifier.h: Removed an unused constructor.
* profiler/HeavyProfile.cpp:
(KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
node so that percentages work correctly.
(KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
nodes being merged.
* profiler/ProfileNode.cpp: Set the intital values of time and call
count when copying ProfileNodes.
(KJS::ProfileNode::ProfileNode):
2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
Gtk build fix.
* GNUmakefile.am: Add HeavyProfile.cpp
2008-07-09 Mark Rowe <mrowe@apple.com>
Reviewed by Geoff Garen.
Don't warn about deprecated functions in production builds.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
2008-07-09 Darin Adler <darin@apple.com>
* JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
wx biuld fix. Add HeavyProfile.cpp to build files.
* JavaScriptCoreSources.bkl:
2008-07-09 Kevin McCullough <kmccullough@apple.com>
- Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-07-09 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* profiler/HeavyProfile.cpp:
(KJS::HeavyProfile::mergeProfiles):
2008-07-09 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff and Adam.
<rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
- This is the plumbing for bottom-up, but does not include calculating
time, mostly because I'm still undclear about what the end result should
look like.
- This, obviously, does not include the UI to expose this in the
inspector yet.
* JavaScriptCore.xcodeproj/project.pbxproj:
* profiler/CallIdentifier.h:
(KJS::CallIdentifier::CallIdentifier):
(WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
* profiler/HeavyProfile.cpp: Added.
(KJS::HeavyProfile::HeavyProfile):
(KJS::HeavyProfile::generateHeavyStructure):
(KJS::HeavyProfile::addNode):
(KJS::HeavyProfile::mergeProfiles):
(KJS::HeavyProfile::addAncestorsAsChildren):
* profiler/HeavyProfile.h: Added.
(KJS::HeavyProfile::create):
(KJS::HeavyProfile::heavyProfile):
(KJS::HeavyProfile::treeProfile):
* profiler/Profile.cpp: Removed old commented out includes.
* profiler/Profile.h: The m_head is needed by the HeavyProfile so it
is now protected as opposed to private.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode): Created a constructor to copy
ProfileNodes.
(KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
children finding easier and avoid a potential crasher.
* profiler/ProfileNode.h: Mostly moved things around but also added some
functionality needed by HeavyProfile.
(KJS::ProfileNode::create):
(KJS::ProfileNode::functionName):
(KJS::ProfileNode::url):
(KJS::ProfileNode::lineNumber):
(KJS::ProfileNode::head):
(KJS::ProfileNode::setHead):
(KJS::ProfileNode::setNextSibling):
(KJS::ProfileNode::actualTotalTime):
(KJS::ProfileNode::actualSelfTime):
* profiler/TreeProfile.cpp: Implemented the ability to get a
HeavyProfile.
(KJS::TreeProfile::heavyProfile):
* profiler/TreeProfile.h:
2008-07-08 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Added support for checking if an object has custom properties in its
property map. WebCore uses this to optimize marking DOM wrappers.
2008-07-08 Simon Hausmann <hausmann@webkit.org>
Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
* GNUmakefile.am:
* JavaScriptCoreSources.bkl:
2008-07-08 Simon Hausmann <hausmann@webkit.org>
Fix the Qt build, add ProfileGenerator.cpp to the build.
* JavaScriptCore.pri:
2008-07-07 David Kilzer <ddkilzer@apple.com>
releaseFastMallocFreeMemory() should always be defined
Reviewed by Darin.
* JavaScriptCore.exp: Changed to export C++ binding for
WTF::releaseFastMallocFreeMemory() instead of C binding for
releaseFastMallocFreeMemory().
* wtf/FastMalloc.cpp: Moved definitions of
releaseFastMallocFreeMemory() to be in the WTF namespace
regardless whether FORCE_SYSTEM_MALLOC is defined.
* wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
extern "C" binding to WTF::releaseFastMallocFreeMemory().
2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Geoff.
Bug 19926: URL causes crash within a minute
<https://bugs.webkit.org/show_bug.cgi?id=19926>
Add a check that lastGlobalObject is non-null in Machine::execute()
before copying its globals to the current register file.
In theory, it is possible to make a test case for this, but it will
take a while to get it right.
* VM/Machine.cpp:
(KJS::Machine::execute):
2008-07-07 Darin Adler <darin@apple.com>
Rubber stamped by Adele.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Fix a typo in a comment.
2008-07-07 Steve Falkenburg <sfalken@apple.com>
Build fixes.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/testapi/testapi.vcproj:
2008-07-07 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
When the profiler is running it gathers information and creates a
Profile. After it finishes the Profile can be sorted and have other
data refinements run over it. Both of these were done in the same class
before. Now I split the gathering operations into a new class called
ProfileGenerator.
* JavaScriptCore.xcodeproj/project.pbxproj:
* profiler/Profile.cpp: Removed code related to the gather stage of a
Profile's creation.
(KJS::Profile::create):
(KJS::Profile::Profile):
* profiler/Profile.h: Ditto.
(KJS::Profile::title):
(KJS::Profile::callTree):
(KJS::Profile::setHead):
* profiler/ProfileGenerator.cpp: Added. This is the class that will
handle the stage of creating a Profile. Once the Profile is finished
being created, this class goes away.
(KJS::ProfileGenerator::create):
(KJS::ProfileGenerator::ProfileGenerator):
(KJS::ProfileGenerator::title):
(KJS::ProfileGenerator::willExecute):
(KJS::ProfileGenerator::didExecute):
(KJS::ProfileGenerator::stopProfiling):
(KJS::ProfileGenerator::didFinishAllExecution):
(KJS::ProfileGenerator::removeProfileStart):
(KJS::ProfileGenerator::removeProfileEnd):
* profiler/ProfileGenerator.h: Added.
(KJS::ProfileGenerator::profile):
(KJS::ProfileGenerator::originatingGlobalExec):
(KJS::ProfileGenerator::pageGroupIdentifier):
(KJS::ProfileGenerator::client):
(KJS::ProfileGenerator::stoppedProfiling):
* profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
of the Profile.
(KJS::Profiler::startProfiling):
(KJS::Profiler::stopProfiling):
(KJS::Profiler::didFinishAllExecution): It is here that the Profile is
handed off to its client and the Profile Generator is no longer needed.
(KJS::dispatchFunctionToProfiles):
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
* profiler/Profiler.h: Cleaned up the includes and subsequently the
forward declarations. Also use the new ProfileGenerator.
(KJS::ProfilerClient::~ProfilerClient):
(KJS::Profiler::currentProfiles):
* profiler/TreeProfile.cpp: Use Profile's new interface.
(KJS::TreeProfile::create):
(KJS::TreeProfile::TreeProfile):
* profiler/TreeProfile.h:
2008-07-07 Sam Weinig <sam@webkit.org>
Reviewed by Cameron Zwarich.
Third step in broad cleanup effort.
[ File list elided ]
2008-07-06 Sam Weinig <sam@webkit.org>
Reviewed by Cameron Zwarich.
Second step in broad cleanup effort.
[ File list elided ]
2008-07-05 Sam Weinig <sam@webkit.org>
Reviewed by Cameron Zwarich.
First step in broad cleanup effort.
[ File list elided ]
2008-07-05 Sam Weinig <sam@webkit.org>
Rubber-stamped by Cameron Zwarich.
Rename list.h/cpp to ArgList.h/cpp.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Machine.h:
* kjs/AllInOneFile.cpp:
* kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
* kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
* kjs/IndexToNameMap.cpp:
* kjs/JSGlobalData.cpp:
* kjs/JSGlobalData.h:
* kjs/JSObject.h:
* kjs/collector.cpp:
* kjs/list.cpp: Removed.
* kjs/list.h: Removed.
2008-07-05 Sam Weinig <sam@webkit.org>
Fix non-AllInOne builds again.
* kjs/BooleanPrototype.cpp:
* kjs/ErrorPrototype.cpp:
* kjs/FunctionPrototype.cpp:
* kjs/NumberPrototype.cpp:
* kjs/ObjectPrototype.cpp:
2008-07-05 Sam Weinig <sam@webkit.org>
Fix build on case-sensitive build systems.
* kjs/IndexToNameMap.cpp:
2008-07-05 Sam Weinig <sam@webkit.org>
Fix build.
* kjs/Arguments.cpp:
* kjs/BooleanPrototype.cpp:
* kjs/DateConstructor.cpp:
* kjs/ErrorPrototype.cpp:
* kjs/FunctionPrototype.cpp:
* kjs/NumberPrototype.cpp:
* kjs/ObjectPrototype.cpp:
* kjs/RegExpPrototype.cpp:
* kjs/StringConstructor.cpp:
* kjs/lookup.cpp:
2008-07-05 Sam Weinig <sam@webkit.org>
Fix non-AllInOne build.
* kjs/JSGlobalObject.cpp:
2008-07-05 Sam Weinig <sam@webkit.org>
Rubber-stamped by Cameron Zwarich.
Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
the functions on the global object out of JSFunction.h/cpp.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Machine.cpp:
* kjs/AllInOneFile.cpp:
* kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
* kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
* kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
* kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
* kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
* kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
* kjs/JSActivation.cpp:
* kjs/JSFunction.cpp:
* kjs/JSFunction.h:
* kjs/JSGlobalObject.cpp:
* kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
* kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
The functions on the global object should be in JSGlobalObject.cpp, but putting them there
was a 0.5% regression.
* kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
* kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
* kjs/Shell.cpp:
* kjs/lexer.cpp:
* kjs/ustring.cpp:
2008-07-04 Sam Weinig <sam@webkit.org>
Really fix the mac build.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-07-04 Sam Weinig <sam@webkit.org>
Fix mac build.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-07-04 Sam Weinig <sam@webkit.org>
Fix non-AllInOne builds.
* kjs/Error.cpp:
* kjs/GetterSetter.cpp:
* kjs/JSImmediate.cpp:
* kjs/operations.cpp:
2008-07-04 Sam Weinig <sam@webkit.org>
Rubber-stamped by Dan Bernstein.
Split Error and GetterSetter out of JSObject.h.
* API/JSCallbackObjectFunctions.h:
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
* kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
* kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
* kjs/GetterSetter.cpp:
* kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
* kjs/JSObject.cpp:
* kjs/JSObject.h:
* kjs/nodes.h:
2008-07-04 Simon Hausmann <hausmann@webkit.org>
Fix the Wx build, added TreeProfile.cpp to the build.
* JavaScriptCoreSources.bkl:
2008-07-03 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Fix output path of recently-added script phase to reference the correct file.
This prevents Xcode from running the script phase unnecessarily, which caused
the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-07-03 Mark Rowe <mrowe@apple.com>
Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
the latter is non-standard and does not exist on Windows.
* kjs/JSLock.cpp:
(KJS::JSLock::lockCount):
(KJS::JSLock::lock):
(KJS::JSLock::unlock):
(KJS::JSLock::DropAllLocks::DropAllLocks):
* kjs/JSLock.h:
2008-07-02 Mark Rowe <mrowe@apple.com>
Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
so use ssize_t rather than int to track the lock count to avoid warnings about
truncating the result of pthread_getspecific.
* kjs/JSLock.cpp:
(KJS::JSLock::lockCount):
(KJS::JSLock::lock):
(KJS::JSLock::unlock):
(KJS::JSLock::DropAllLocks::DropAllLocks):
* kjs/JSLock.h:
2008-07-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Removed checking for the array get/put fast case from the array code.
Callers who want the fast case should call getIndex and/or setIndex
instead. (get_by_val and put_by_val already do this.)
SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
a 3.6% speedup on nsieve.
2008-07-03 Dan Bernstein <mitz@apple.com>
- Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
2008-07-03 Dan Bernstein <mitz@apple.com>
Reviewed by Anders Carlsson.
- Windows build fix
* VM/Machine.cpp:
(KJS::Machine::Machine):
2008-07-03 Simon Hausmann <hausmann@webkit.org>
Reviewed by Alexey Proskuryakov.
Fix the non-threaded build.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::threadInstanceInternal):
2008-07-03 Simon Hausmann <hausmann@webkit.org>
Fix the Qt build, added TreeProfile to the build.
* JavaScriptCore.pri:
2008-07-02 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Don't create unnecessary JSGlobalData instances.
* kjs/JSGlobalData.h:
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::threadInstanceExists):
(KJS::JSGlobalData::sharedInstanceExists):
(KJS::JSGlobalData::threadInstance):
(KJS::JSGlobalData::sharedInstance):
(KJS::JSGlobalData::threadInstanceInternal):
(KJS::JSGlobalData::sharedInstanceInternal):
Added methods to query instance existence.
* kjs/InitializeThreading.cpp:
(KJS::initializeThreadingOnce):
Initialize thread instance static in a new way.
* API/JSBase.cpp:
(JSGarbageCollect):
* kjs/collector.cpp:
(KJS::Heap::collect):
Check for instance existence before accessing it.
2008-07-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
I was never able to reproduce this issue, but Cameron could, and he says
that this patch fixes it.
The crash seems tied to a timer or event handler callback. In such a case,
the sole reference to the global object may be in the current call frame,
so we can't depend on the global object to mark the call frame area in
the register file.
The new GC marking rule is: the global object is not responsible for
marking the whole register file -- it's just responsible for the globals
section it's tied to. The heap is responsible for marking the call frame area.
2008-07-02 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Add the ability to trace JavaScriptCore garabge collections using dtrace.
* JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
file when building on a new enough version of Mac OS X.
* JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
* kjs/Tracing.d: Declare three dtrace probes.
* kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
otherwise provide versions that do nothing.
* kjs/collector.cpp:
(KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
mark phase has completed, and when the collection is complete.
* wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
2008-07-02 Geoffrey Garen <ggaren@apple.com>
Rubber stamped by Oliver Hunt.
Reduced the max register file size from 8MB to 2MB.
We still allow about 20,000 levels of recursion.
2008-07-02 Alp Toker <alp@nuanti.com>
Build fix for r34960. Add TreeProfile.cpp to build.
* GNUmakefile.am:
2008-07-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Optimized a[n] get for cases when a is an array or a string. When a is
an array, we optimize both get and put. When a is a string, we only
optimize get, since you can't put to a string.
SunSpider says 3.4% faster.
2008-07-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
-Small cleanup in preparation for implementing Bottom-up.
* profiler/CallIdentifier.h: Rename debug function to make it clear of
its output and intention to be debug only.
(KJS::CallIdentifier::operator const char* ): Implement in terms of
c_str.
(KJS::CallIdentifier::c_str):
* profiler/ProfileNode.cpp: Impelment findChild() which will be needed
by the bottom-up implementation.
(KJS::ProfileNode::findChild):
* profiler/ProfileNode.h: Added comments to make the collections of
functions more clear.
(KJS::ProfileNode::operator==):
(KJS::ProfileNode::c_str):
2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
<https://bugs.webkit.org/show_bug.cgi?id=19776>
Perform the sign check for the exponent on the actual exponent value,
which is 1 less than the value of decimalPoint, instead of on the value
of decimalPoint itself.
* kjs/NumberPrototype.cpp:
(KJS::exponentialPartToString):
2008-07-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
- Subclass TreeProfile as I prepare for a HeavyProfile to be comming
later.
* JavaScriptCore.xcodeproj/project.pbxproj:
* profiler/Profile.cpp: By default we create a TreeProfile.
(KJS::Profile::create):
* profiler/Profile.h: Changes to the Profile class to make it amenable
to be inherited from.
(KJS::Profile::~Profile):
* profiler/TreeProfile.cpp: Added.
(KJS::TreeProfile::create):
(KJS::TreeProfile::TreeProfile):
(KJS::TreeProfile::heavyProfile):
* profiler/TreeProfile.h: Added.
(KJS::TreeProfile::treeProfile):
2008-07-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Dan.
Broke CallIdentifier out into its own file. I did this because it's
going to grow a lot soon and I wanted this to be a separate patch.
* JavaScriptCore.xcodeproj/project.pbxproj:
* profiler/CallIdentifier.h: Added.
(KJS::CallIdentifier::CallIdentifier):
(KJS::CallIdentifier::operator==):
(KJS::CallIdentifier::operator!=):
(KJS::CallIdentifier::operator const char* ):
(KJS::CallIdentifier::toString):
* profiler/ProfileNode.h:
2008-07-02 Simon Hausmann <hausmann@webkit.org>
Build fix. Implemented missing functions for single-threaded build.
* kjs/JSLock.cpp:
(KJS::JSLock::JSLock):
(KJS::JSLock::lock):
(KJS::JSLock::unlock):
(KJS::JSLock::DropAllLocks::DropAllLocks):
2008-07-02 Alexey Proskuryakov <ap@webkit.org>
Another non-AllInOne build fix.
* kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
2008-07-02 Alexey Proskuryakov <ap@webkit.org>
Non-AllInOne build fix.
* kjs/interpreter.cpp: Include JSLock.h.
2008-06-30 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Disable JSLock for per-thread contexts.
No change on SunSpider.
* kjs/JSGlobalData.h:
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
(KJS::JSGlobalData::sharedInstance):
Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
* kjs/JSLock.cpp:
(KJS::createJSLockCount):
(KJS::JSLock::lockCount):
(KJS::setLockCount):
(KJS::JSLock::JSLock):
(KJS::JSLock::lock):
(KJS::JSLock::unlock):
(KJS::JSLock::currentThreadIsHoldingLock):
(KJS::JSLock::DropAllLocks::DropAllLocks):
(KJS::JSLock::DropAllLocks::~DropAllLocks):
* kjs/JSLock.h:
(KJS::JSLock::JSLock):
(KJS::JSLock::~JSLock):
Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
if we want to keep existing assertions working.
Made recursion count per-thread, now that locks may not lock.
* API/JSBase.cpp:
(JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
locking in any case), so that a decision whether to actually lock can be made.
(JSCheckScriptSyntax): Ditto.
(JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
* API/JSObjectRef.cpp:
(JSClassCreate): Don't lock, as there is no reason to.
(JSClassRetain): Ditto.
(JSClassRelease): Ditto.
(JSPropertyNameArrayRetain): Ditto.
(JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
identifier table.
(JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
lookup, and possibly modification.
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters):
(JSStringCreateWithUTF8CString):
(JSStringRetain):
(JSStringRelease):
(JSStringGetUTF8CString):
(JSStringIsEqual):
* API/JSStringRefCF.cpp:
(JSStringCreateWithCFString):
JSStringRef operations other than releasing do not need locking.
* VM/Machine.cpp: Don't include unused JSLock.h.
* kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
the existing code could cause deadlocks.
* kjs/Shell.cpp:
(functionGC):
(main):
(jscmain):
The test tool uses a per-thread context, so no real locking is required.
* kjs/collector.h:
(KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
migration between threads" by using ProtectedPtr on a background thread.
(KJS::Heap::isShared): Keep a shared flag here, as well.
* kjs/protect.h:
(KJS::::ProtectedPtr):
(KJS::::~ProtectedPtr):
(KJS::::operator):
(KJS::operator==):
(KJS::operator!=):
ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
* kjs/collector.cpp:
(KJS::Heap::Heap): Initialize m_isShared.
(KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
in sweep() working.
(KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
so locking is always needed here.
(KJS::Heap::registerThread): Ditto.
(KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
instance for a small speedup.
(KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
(KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
m_protectedValues.
(KJS::Heap::unprotect): Ditto.
(KJS::Heap::markProtectedObjects): Ditto.
(KJS::Heap::protectedGlobalObjectCount): Ditto.
(KJS::Heap::protectedObjectCount): Ditto.
(KJS::Heap::protectedObjectTypeCounts): Ditto.
* kjs/ustring.cpp:
* kjs/ustring.h:
Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
to be added to many files in JavaScriptGlue, WebCore and WebKit.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
* API/JSCallbackConstructor.cpp:
(KJS::constructJSCallback):
* API/JSCallbackFunction.cpp:
(KJS::JSCallbackFunction::call):
* API/JSCallbackObjectFunctions.h:
(KJS::::init):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::construct):
(KJS::::hasInstance):
(KJS::::call):
(KJS::::getPropertyNames):
(KJS::::toNumber):
(KJS::::toString):
(KJS::::staticValueGetter):
(KJS::::callbackGetter):
* API/JSContextRef.cpp:
(JSGlobalContextCreate):
(JSGlobalContextRetain):
(JSGlobalContextRelease):
* API/JSValueRef.cpp:
(JSValueIsEqual):
(JSValueIsStrictEqual):
(JSValueIsInstanceOfConstructor):
(JSValueMakeNumber):
(JSValueMakeString):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
(JSValueProtect):
(JSValueUnprotect):
* JavaScriptCore.exp:
* kjs/PropertyNameArray.h:
(KJS::PropertyNameArray::globalData):
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
2008-07-01 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19834
Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
Creating a global object with a custom prototype resets it twice (wasteful!).
So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
the register array.
* kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
* kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
constructor and operator= to ensure that no one attempts to copy this object (for whatever
reason, I couldn't make Noncopyable work).
* kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
with new[].
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
(KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
"changing" the value from 0 to 0.
2008-07-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed and/or reordered exception checks in array-style a[n] access.
SunSpider says 1.4% faster.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): No need to check for exceptions before
calling toString, toNumber and/or get. If the call ends up being observable
through toString, valueOf, or a getter, we short-circuit it there, instead.
In the op_del_by_val case, I removed the incorrect comment without actually
removing the code, since I didn't want to tempt the GCC fates!
* kjs/JSObject.cpp:
(KJS::callDefaultValueFunction): Added exception check to prevent
toString and valueOf functions from observing execution after an exception
has been thrown. This removes some of the burden of exception checking
from the machine.
(KJS::JSObject::defaultValue): Removed redundant exception check here.
* kjs/PropertySlot.cpp:
(KJS::PropertySlot::functionGetter): Added exception check to prevent
getter functions from observing execution after an exception has been
thrown. This removes some of the burden of exception checking from the
machine.
2008-07-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Optimized a[n] get and put for cases where n is an immediate unsigned
value.
SunSpider says 3.5% faster.
2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Bug 19844: JavaScript Switch statement modifies "this"
<https://bugs.webkit.org/show_bug.cgi?id=19844>
Use a temporary when generating code for switch clauses to avoid
overwriting 'this' or a local variable.
* kjs/nodes.cpp:
(KJS::CaseBlockNode::emitCodeForBlock):
2008-07-01 Christian Dywan <christian@twotoasts.de>
Gtk+ build fix.
* kjs/list.cpp: Include "JSCell.h"
2008-07-01 Kevin McCullough <kmccullough@apple.com>
Build fix.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-07-01 Dan Bernstein <mitz@apple.com>
Reviewed by Anders Carlsson.
- Mac release build fix
* JavaScriptCore.exp:
2008-07-01 Sam Weinig <sam@webkit.org>
Try and fix mac builds.
* JavaScriptCore.exp:
2008-07-01 Sam Weinig <sam@webkit.org>
Fix non-AllInOne builds.
* kjs/DateMath.cpp:
2008-07-01 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Split JSCell and JSNumberCell class declarations out of JSValue.h
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/JSPropertyNameIterator.h:
* kjs/AllInOneFile.cpp:
* kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
* kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
(KJS::JSValue::getJSNumber):
* kjs/JSNumberCell.cpp:
* kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
* kjs/JSObject.h:
* kjs/JSString.cpp:
(KJS::jsString):
(KJS::jsOwnedString):
* kjs/JSString.h:
(KJS::JSValue::toThisJSString):
* kjs/JSValue.cpp:
* kjs/JSValue.h:
2008-07-01 Anders Carlsson <andersca@apple.com>
Build fixes.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::addStaticGlobals):
2008-07-01 Simon Hausmann <hausmann@webkit.org>
Build fix, include OwnPtr.h.
* kjs/RegExpConstructor.h:
2008-06-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed a global object leak caused by the switch to one register file.
Don't unconditionally mark the register file, since that logically
makes all global variables GC roots, even when their global object is
no longer reachable.
Instead, make the global object associated with the register file
responsible for marking the register file.
2008-06-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed the "registerBase" abstraction. Since the register file never
reallocates, we can keep direct pointers into it, instead of
<registerBase, offset> tuples.
SunSpider says 0.8% faster.
2008-06-30 Oliver Hunt <oliver@apple.com>
Reviewed by NOBODY (build fix).
Fix build by adding all (hopefully) the missing includes.
* kjs/BooleanPrototype.cpp:
* kjs/DateConstructor.cpp:
* kjs/ErrorPrototype.cpp:
* kjs/FunctionPrototype.cpp:
* kjs/NativeErrorConstructor.cpp:
* kjs/NumberPrototype.cpp:
* kjs/ObjectPrototype.cpp:
* kjs/RegExpConstructor.cpp:
* kjs/StringConstructor.cpp:
* kjs/StringPrototype.cpp:
2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
<https://bugs.webkit.org/show_bug.cgi?id=19830>
Ensure that we do not eliminate a write to a local register when doing
peephole optimizations.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfTrue):
(KJS::CodeGenerator::emitJumpIfFalse):
2008-06-30 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Alder.
Split InternalFunction into its own header file.
* API/JSCallbackFunction.h:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/ArrayConstructor.h:
* kjs/BooleanConstructor.h:
* kjs/DateConstructor.h:
* kjs/ErrorConstructor.h:
* kjs/FunctionConstructor.h:
* kjs/FunctionPrototype.h:
* kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
* kjs/JSFunction.h:
* kjs/NativeErrorConstructor.h:
* kjs/NumberConstructor.h:
* kjs/ObjectConstructor.h:
* kjs/RegExpConstructor.h:
* kjs/StringConstructor.h:
* profiler/Profiler.cpp:
2008-06-30 Sam Weinig <sam@webkit.org>
Reviewed by Kevin McCullough.
Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Instruction.cpp: Removed.
* VM/LabelID.cpp: Removed.
* VM/Register.cpp: Removed.
* VM/RegisterID.cpp: Removed.
2008-06-30 Sam Weinig <sam@webkit.org>
Rubber-stamped (reluctantly) by Kevin McCullough.
Rename date_object.h/cpp to DateInstance.h/cpp
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/DateConstructor.cpp:
* kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
* kjs/DateInstance.h: Copied from kjs/date_object.h.
* kjs/DatePrototype.cpp:
* kjs/DatePrototype.h:
* kjs/date_object.cpp: Removed.
* kjs/date_object.h: Removed.
2008-06-30 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
Remove internal.cpp and move its contents to there own .cpp files.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
* kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
* kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
* kjs/JSString.cpp: Copied from kjs/internal.cpp.
* kjs/JSString.h:
* kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
* kjs/NumberConstructor.cpp:
* kjs/NumberObject.cpp:
(KJS::constructNumber):
(KJS::constructNumberFromImmediateNumber):
* kjs/internal.cpp: Removed.
2008-06-30 Adam Roben <aroben@apple.com>
Fix <rdar://5954749> Assertion failure due to HashTable's use of
operator&
HashTable was passing &value to constructDeletedValue, which in
classes like WebCore::COMPtr would cause an assertion. We now pass
value by reference instead of by address so that the HashTraits
implementations have more flexibility in constructing the deleted
value.
Reviewed by Ada Chan.
* VM/CodeGenerator.h: Updated for changes to HashTraits.
* wtf/HashTable.h:
(WTF::::deleteBucket): Changed to pass bucket by reference instead of
by address.
(WTF::::checkKey): Ditto.
* wtf/HashTraits.h:
(WTF::): Updated HashTraits for HashTable change.
2008-07-01 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Cameron Zwarich.
Make RegisterFile really unmap memory on destruction.
This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
* VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
1/4 of it.
* kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
half of WebCore rebuild.
* VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
* VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Rubber-stamped by Oliver.
Correct the documentation for op_put_by_index.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 19821: Merge the instruction pair (less, jfalse)
<https://bugs.webkit.org/show_bug.cgi?id=19821>
This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
regression in regexp-dna.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::rewindBinaryOp):
(KJS::CodeGenerator::emitJumpIfFalse):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.cpp:
(KJS::):
* VM/Opcode.h:
2008-06-29 Sam Weinig <sam@webkit.org>
Fix non-AllInOne builds.
* kjs/JSObject.cpp:
* kjs/JSValue.cpp:
2008-06-29 Sam Weinig <sam@webkit.org>
Build fix for Qt.
* kjs/DateMath.cpp:
* kjs/DatePrototype.cpp:
2008-06-29 Sam Weinig <sam@webkit.org>
Rubber-stamped by Cameron Zwarich.
Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/ArrayConstructor.cpp:
* kjs/ArrayPrototype.cpp:
* kjs/BooleanPrototype.cpp:
* kjs/DatePrototype.cpp:
* kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
* kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
* kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
* kjs/ErrorInstance.h: Copied from kjs/error_object.h.
* kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
* kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
* kjs/JSGlobalObject.cpp:
* kjs/JSObject.cpp:
* kjs/JSValue.cpp:
* kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
* kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
* kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
* kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
* kjs/NumberPrototype.cpp:
* kjs/RegExpConstructor.cpp:
* kjs/RegExpObject.cpp:
* kjs/RegExpPrototype.cpp:
* kjs/StringPrototype.cpp:
* kjs/error_object.cpp: Removed.
* kjs/error_object.h: Removed.
* kjs/internal.cpp:
2008-06-29 Sam Weinig <sam@webkit.org>
Fix non-AllInOne build.
* kjs/DateConstructor.cpp:
* kjs/DateMath.cpp:
* kjs/JSObject.cpp:
2008-06-29 Sam Weinig <sam@webkit.org>
Rubber-stamped by Oliver Hunt.
Splits DateConstructor and DatePrototype out of date_object.h/cpp
Moves shared Date code into DateMath.
* DerivedSources.make:
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
* kjs/DateConstructor.h: Copied from kjs/date_object.h.
* kjs/DateMath.cpp:
(KJS::ymdhmsToSeconds):
(KJS::):
(KJS::skipSpacesAndComments):
(KJS::findMonth):
(KJS::parseDate):
(KJS::timeClip):
(KJS::formatDate):
(KJS::formatDateUTCVariant):
(KJS::formatTime):
* kjs/DateMath.h:
(KJS::gmtoffset):
* kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
* kjs/DatePrototype.h: Copied from kjs/date_object.h.
* kjs/JSGlobalObject.cpp:
* kjs/JSObject.cpp:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/internal.cpp:
2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
Rubber-stamped by Cameron Zwarich
Fix Gtk non-AllInOne build
* GNUmakefile.am: include JSVariableObject.cpp
* kjs/RegExpConstructor.cpp: include RegExpObject.h
* kjs/RegExpObject.h: forward declare RegExpPrototype
2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Sam and Cameron.
- fix https://bugs.webkit.org/show_bug.cgi?id=19805
Array.concat turns missing array elements into "undefined"
Test: fast/js/array-holes.html
* JavaScriptCore.exp: No longer export JSArray::getItem.
* kjs/ArrayPrototype.cpp:
(KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
JSArray::getItem -- need to handle properties from the prototype chain
instead of ignoring them.
* kjs/JSArray.cpp: Removed getItem.
* kjs/JSArray.h: Ditto.
2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Cameron.
- https://bugs.webkit.org/show_bug.cgi?id=19804
optimize access to arrays without "holes"
SunSpider says 1.8% faster.
* kjs/JSArray.cpp:
(KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
arrays. Also updated for new location of m_vectorLength.
(KJS::JSArray::getItem): Updated for new location of m_vectorLength.
(KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
getOwnPropertySlot to make the hot part faster.
(KJS::JSArray::getOwnPropertySlot): Added a new faster case for
indices lower than m_fastAccessCutoff. We can do theese with no
additional checks or branches.
(KJS::JSArray::put): Added a new faster case for indices lower than
m_fastAccessCutoff. We can do theese with no additional checks or
branches. Moved the maxArrayIndex handling out of this function.
Added code to set m_fastAccessCutoff when the very last hole in
an array is filled; this is how the cutoff gets set for most arrays.
(KJS::JSArray::putSlowCase): Moved the rest of the put function logic
in here, to make the hot part of the put function faster.
(KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
when a delete makes a new hole in the array.
(KJS::JSArray::getPropertyNames): Updated for new location of
m_vectorLength.
(KJS::JSArray::increaseVectorLength): Ditto.
(KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
when setLength makes the array smaller.
(KJS::JSArray::mark): Updated for new location of m_vectorLength.
(KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
all the holes to the end of the array.
(KJS::JSArray::compactForSorting): Ditto.
(KJS::JSArray::checkConsistency): Added consistency checks fro
m_fastAccessCutoff and updated for the new location of m_vectorLength.
* kjs/JSArray.h: Added declarations for slow case functions.
Replaced m_vectorLength with m_fastAccessCutoff.
2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Sam.
When executing a native call, check for an exception before writing the
return value.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-06-28 Mark Rowe <mrowe@apple.com>
Build fix. Flag headers as private or public as is appropriate.
These settings were accidentally removed during some project file cleanup.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-06-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
* DerivedSources.make:
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Machine.cpp:
* kjs/AllInOneFile.cpp:
* kjs/JSGlobalObject.cpp:
* kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
* kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
* kjs/RegExpObject.cpp:
* kjs/RegExpObject.h:
* kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
* kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
* kjs/StringPrototype.cpp:
* kjs/internal.cpp:
2008-06-28 Sam Weinig <sam@webkit.org>
Fix non-AllInOne builds.
* kjs/StringConstructor.cpp:
2008-06-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
StringConstructor and StringPrototype.
* DerivedSources.make:
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* kjs/AllInOneFile.cpp:
* kjs/JSGlobalObject.cpp:
* kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
* kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
* kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
* kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
* kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
* kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
* kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
* kjs/internal.cpp:
* kjs/string_object.cpp: Removed.
* kjs/string_object.h: Removed.
2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
Gtk build fix: JSVariableObject is now part of AllInOne
* GNUmakefile.am:
2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- https://bugs.webkit.org/show_bug.cgi?id=19801
add a feature so we can tell what regular expressions are taking time
* pcre/pcre_compile.cpp:
(jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
* pcre/pcre_exec.cpp:
(jsRegExpExecute): Add hook to time execution.
(Histogram::~Histogram): Print a sorted list of what took time.
(Histogram::add): Accumulate records of what took time.
(HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
Histogram::add at the right moment and creates the global histogram
object.
* pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
* pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
any more, but an omissions an earlier version of this patch detected.
* pcre/pcre_ucp_searchfuncs.cpp: Ditto.
* pcre/pcre_xclass.cpp: Ditto.
2008-06-28 Sam Weinig <sam@webkit.org>
Try and fix the Windows build again.
* kjs/RegExpObject.cpp:
* kjs/date_object.cpp:
* kjs/error_object.cpp:
2008-06-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
Remove unused StringConstructorFunction class.
* kjs/string_object.h:
2008-06-28 Sam Weinig <sam@webkit.org>
Fix windows build.
* kjs/ArrayPrototype.cpp:
* kjs/BooleanPrototype.cpp:
* kjs/BooleanPrototype.h:
* kjs/FunctionPrototype.cpp:
* kjs/JSImmediate.cpp:
* kjs/JSObject.cpp:
* kjs/MathObject.cpp:
* kjs/NumberPrototype.cpp:
* kjs/NumberPrototype.h:
* kjs/ObjectConstructor.cpp:
* kjs/RegExpObject.h:
* kjs/error_object.h:
* kjs/string_object.cpp:
2008-06-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Oliver Hunt.
Splits FunctionConstructor out of FunctionPrototype.h/cpp
Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
* API/JSCallbackConstructor.cpp:
* API/JSClassRef.cpp:
* API/JSObjectRef.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Machine.cpp:
* kjs/AllInOneFile.cpp:
* kjs/ArrayConstructor.cpp:
* kjs/ArrayConstructor.h:
* kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
* kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
* kjs/FunctionPrototype.cpp:
* kjs/FunctionPrototype.h:
* kjs/JSFunction.cpp:
* kjs/JSGlobalObject.cpp:
* kjs/JSImmediate.cpp:
* kjs/MathObject.h:
* kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
* kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
* kjs/NumberObject.cpp:
* kjs/NumberObject.h:
* kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
* kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
* kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
* kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
* kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
* kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
* kjs/RegExpObject.h:
* kjs/Shell.cpp:
* kjs/error_object.h:
* kjs/internal.cpp:
* kjs/nodes.cpp:
* kjs/object_object.cpp: Removed.
* kjs/object_object.h: Removed.
* kjs/string_object.h:
2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix https://bugs.webkit.org/show_bug.cgi?id=19796
optimize expressions with ignored results (especially post-increment)
SunSpider says 0.9% faster.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::tempDestination): Create a new temporary for
ignoredResult() too, just as we would for 0.
(KJS::CodeGenerator::finalDestination): Use the temporary if the
register passed in is ignoredResult() too, just as we would for 0.
(KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
passed in register is ignoredResult(), just as we would for 0.
(KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
register passed in is ignoredResult(). What matters is that we
don't want to emit a move. The return value won't be looked at.
(KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
through to the node's emitCode function.
* VM/RegisterID.h:
(KJS::ignoredResult): Added. Special value to indicate the result of
a node will be ignored and need not be put in any register.
* kjs/nodes.cpp:
(KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
(KJS::BooleanNode::emitCode): Ditto.
(KJS::NumberNode::emitCode): Ditto.
(KJS::StringNode::emitCode): Ditto.
(KJS::RegExpNode::emitCode): Ditto.
(KJS::ThisNode::emitCode): Ditto.
(KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
the identifier resolves to a local variable.
(KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
and the object is empty.
(KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
nothing for the local constant case, and do a pre-increment in all the
other cases.
(KJS::PostDecResolveNode::emitCode): Ditto.
(KJS::PostIncBracketNode::emitCode): Ditto.
(KJS::PostDecBracketNode::emitCode): Ditto.
(KJS::PostIncDotNode::emitCode): Ditto.
(KJS::PostDecDotNode::emitCode): Ditto.
(KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
the expression.
(KJS::VoidNode::emitCode): Ditto.
(KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
if the identifier resolves to a local variable, and don't bother generating
a typeof opcode in the other case.
(KJS::TypeOfValueNode::emitCode): Ditto.
(KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
the identifier resolves to a local constant.
(KJS::PreDecResolveNode::emitCode): Ditto.
(KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
places, because we need to put the result into a register so we can assign
it. At other sites this is taken care of by functions like finalDestination.
(KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
expression.
(KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
third expressions.
(KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
expression.
2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- https://bugs.webkit.org/show_bug.cgi?id=19787
create most arrays from values in registers rather than with multiple put operations
SunSpider says 0.8% faster.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Ditto.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitNewArray): Added.
* VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
* kjs/nodes.cpp:
(KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
initialized with as many elements as possible. If the array doesn't have any
holes in it, that's all that's needed. If there are holes, then emit some separate
put operations for the other values in the array and for the length as needed.
* kjs/nodes.h: Added some accessors to ElementNode so the code generator can
iterate through elements and generate code to evaluate them. Now ArrayNode does
not need to be a friend. Also took out some unused PlacementNewAdoptType
constructors.
2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Oliver.
* kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
We no longer mutate the AST in place.
2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed by Oliver Hunt.
Build fix
* VM/Machine.cpp: include stdio.h for printf
2008-06-27 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Fix platforms that don't use AllInOne.cpp
* kjs/BooleanConstructor.h:
* kjs/BooleanPrototype.h:
* kjs/FunctionPrototype.cpp:
2008-06-27 Sam Weinig <sam@webkit.org>
Rubber-stamped by Oliver Hunt.
Splits ArrayConstructor out of ArrayPrototype.h/cpp
Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Machine.cpp:
* kjs/AllInOneFile.cpp:
* kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
* kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
* kjs/ArrayPrototype.cpp:
* kjs/ArrayPrototype.h:
* kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
* kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
* kjs/BooleanObject.cpp:
* kjs/BooleanObject.h:
* kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
* kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
* kjs/CommonIdentifiers.h:
* kjs/FunctionPrototype.cpp:
* kjs/JSArray.cpp:
* kjs/JSGlobalObject.cpp:
* kjs/JSImmediate.cpp:
* kjs/Shell.cpp:
* kjs/internal.cpp:
* kjs/nodes.cpp:
* kjs/string_object.cpp:
2008-06-27 Oliver Hunt <oliver@apple.com>
Reviewed by Sam.
Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
<rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
Adds support for the slow script dialog in squirrelfish. This requires the addition
of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
same behaviour as their simple jump equivalents but have an additional time out check.
Additional assertions were added to other jump instructions to prevent accidentally
creating loops with jump types that do not support time out checks.
Sunspider does not report a regression, however this appears very sensitive to code
layout and hardware, so i would expect up to a 1% regression on other systems.
Part of this required moving the old timeout logic from JSGlobalObject and into Machine
which is the cause of a number of the larger diff blocks.
* JavaScriptCore.exp:
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfTrue):
(KJS::CodeGenerator::emitJumpScopes):
* VM/ExceptionHelpers.cpp:
(KJS::InterruptedExecutionError::isWatchdogException):
(KJS::createInterruptedExecutionException):
* VM/ExceptionHelpers.h:
* VM/LabelID.h:
* VM/Machine.cpp:
(KJS::Machine::Machine):
(KJS::Machine::throwException):
(KJS::Machine::resetTimeoutCheck):
(KJS::getCurrentTime):
(KJS::Machine::checkTimeout):
(KJS::Machine::privateExecute):
* VM/Machine.h:
(KJS::Machine::setTimeoutTime):
(KJS::Machine::startTimeoutCheck):
(KJS::Machine::stopTimeoutCheck):
(KJS::Machine::initTimeout):
* VM/Opcode.cpp:
(KJS::):
* VM/Opcode.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::setTimeoutTime):
(KJS::JSGlobalObject::startTimeoutCheck):
* kjs/JSGlobalObject.h:
* kjs/JSObject.h:
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
Gtk and Qt build fix: Remove RegisterFileStack from the build
scripts.
* GNUmakefile.am:
* JavaScriptCore.pri:
2008-06-27 Adele Peterson <adele@apple.com>
Reviewed by Geoff.
Build fixes.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* VM/RegisterFile.h:
(KJS::RegisterFile::RegisterFile):
* kjs/JSGlobalObject.cpp:
* kjs/collector.cpp:
2008-06-27 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
One RegisterFile to rule them all!
SunSpider reports a 0.2% speedup.
This patch removes the RegisterFileStack abstraction and replaces it with
a single register file that
(a) allocates a fixed storage area, including a fixed area for global
vars, so that no operation may cause the register file to reallocate
and
(b) swaps between global storage areas when executing code in different
global objects.
This patch also changes the layout of the register file so that all call
frames, including call frames for global code, get a header. This is
required to support re-entrant global code. It also just makes things simpler.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
that
(a) global vars don't contribute to a CodeBlock's numLocals count, since
global storage is fixed and allocated at startup
and
(b) references to global vars get shifted to elide intermediate stack
between "r" and the global storage area.
* VM/Machine.cpp:
(KJS::Machine::dumpRegisters): Updated this function to match the new
register file layout, and added the ability to dump exact identifiers
for the different parts of a call frame.
(KJS::Machine::unwindCallFrame): Updated this function to match the new
register file layout.
(KJS::Machine::execute): Updated this function to initialize a call frame
header for global code, and to swap global storage areas when switching
to execution in a new global object.
(KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
of registerBase because the register file is always safe for reentry now,
and registerBase never changes.
* VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
to resolve a header dependency problem (a good sign that the enum belonged
in RegisterFile all along!)
* VM/RegisterFile.cpp:
* VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
area. This allows us to avoid re-allocting the register file later on.
Instead, we rely on the OS to allocate physical pages to the register
file as necessary.
* VM/RegisterFileStack.cpp: Removed. Tada!
* VM/RegisterFileStack.h: Removed. Tada!
* kjs/DebuggerCallFrame.cpp: Updated this class to match the new
register file layout, greatly simplifying it in the process.
* kjs/JSActivation.h:
* kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
since the global object now needs to be able to tear off its registers
just like the activation object.
* kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
* kjs/JSGlobalObject.h:
* kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
global storage area into and out of the register file.
* kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
* kjs/collector.cpp: Renamed markStackObjectConservatively to
markConservatively, since we don't just mark stack objects this way.
Also, added code to mark the machine's register file.
* kjs/config.h: Moved some platforms #defines from here...
* wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
in RegisterFile.h.
2008-06-26 Mark Rowe <mrowe@apple.com>
Speculative fix for the Windows build.
* kjs/JSImmediate.cpp:
2008-06-26 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler and Geoff Garen.
Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
bogus output in an application that uses JavaScriptCore.
* kjs/CollectorHeapIntrospector.cpp:
(KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
* kjs/CollectorHeapIntrospector.h:
* wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
Returning zero for all values is preferable to returning bogus data.
2008-06-26 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- https://bugs.webkit.org/show_bug.cgi?id=19721
speed up JavaScriptCore by not wrapping strings in objects just
to call functions on them
- optimize UString append and the replace function a bit
SunSpider says 1.8% faster.
* JavaScriptCore.exp: Updated.
* VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
because jsString returns a JSString*.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Removed the toObject call from native
function calls. Also removed code to put the this value into a register.
* kjs/BooleanObject.cpp:
(KJS::booleanProtoFuncToString): Rewrite to handle false and true
separately.
* kjs/FunctionPrototype.cpp:
(KJS::constructFunction): Use single-character append rather than building
a string for each character.
* kjs/JSFunction.cpp:
(KJS::globalFuncUnescape): Ditto.
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
use with an immediate value. To be used instead of toObject when doing a
get on an immediate value.
* kjs/JSImmediate.h: Added prototype.
* kjs/JSObject.cpp:
(KJS::JSObject::toString): Tweaked formatting.
* kjs/JSObject.h:
(KJS::JSValue::get): Use prototype instead of toObject to avoid creating
an object wrapper just to search for properties. This also saves an
unnecessary hash table lookup since the object wrappers themselves don't
have any properties.
* kjs/JSString.h: Added toThisString and toThisJSString.
* kjs/JSValue.cpp:
(KJS::JSCell::toThisString): Added.
(KJS::JSCell::toThisJSString): Added.
(KJS::JSCell::getJSNumber): Added.
(KJS::jsString): Changed return type to JSString*.
(KJS::jsOwnedString): Ditto.
* kjs/JSValue.h:
(KJS::JSValue::toThisString): Added.
(KJS::JSValue::toThisJSString): Added.
(KJS::JSValue::getJSNumber): Added.
* kjs/NumberObject.cpp:
(KJS::NumberObject::getJSNumber): Added.
(KJS::integer_part_noexp): Append C string directly rather than first
turning it into a UString.
(KJS::numberProtoFuncToString): Use getJSNumber to check if the value
is a number rather than isObject(&NumberObject::info). This works for
immediate numbers, number cells, and NumberObject instances.
(KJS::numberProtoFuncToLocaleString): Ditto.
(KJS::numberProtoFuncValueOf): Ditto.
(KJS::numberProtoFuncToFixed): Ditto.
(KJS::numberProtoFuncToExponential): Ditto.
(KJS::numberProtoFuncToPrecision): Ditto.
* kjs/NumberObject.h: Added getJSNumber.
* kjs/PropertySlot.cpp: Tweaked comment.
* kjs/internal.cpp:
(KJS::JSString::toThisString): Added.
(KJS::JSString::toThisJSString): Added.
(KJS::JSString::getOwnPropertySlot): Changed code that searches the
prototype chain to start with the string prototype and not create a
string object.
(KJS::JSNumberCell::toThisString): Added.
(KJS::JSNumberCell::getJSNumber): Added.
* kjs/lookup.cpp:
(KJS::staticFunctionGetter): Moved here, because there's no point in
having a function that's only used for a function pointer be inline.
(KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
* kjs/lookup.h:
(KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
to have a function that's only used for a function pointer be inline.
(KJS::getStaticFunctionSlot): Changed to get properties from the parent
first before doing any handling of functions. This is the fastest way
to return the function once the initial setup is done.
* kjs/string_object.cpp:
(KJS::StringObject::getPropertyNames): Call value() instead of getString(),
avoiding an unnecessary virtual function call (the call to the type()
function in the implementation of the isString() function).
(KJS::StringObject::toString): Added.
(KJS::StringObject::toThisString): Added.
(KJS::StringObject::toThisJSString): Added.
(KJS::substituteBackreferences): Rewrote to use a appending algorithm
instead of a the old one that tried to replace in place.
(KJS::stringProtoFuncReplace): Merged this function and the replace function.
Replaced the hand-rolled dynamic arrays for source ranges and replacements
with Vector.
(KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
Removed the separate valueOf implementation, since it can just share this.
(KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
well as StringObject, and is slightly more efficient than the old code too.
(KJS::stringProtoFuncCharCodeAt): Ditto.
(KJS::stringProtoFuncConcat): Ditto.
(KJS::stringProtoFuncIndexOf): Ditto.
(KJS::stringProtoFuncLastIndexOf): Ditto.
(KJS::stringProtoFuncMatch): Ditto.
(KJS::stringProtoFuncSearch): Ditto.
(KJS::stringProtoFuncSlice): Ditto.
(KJS::stringProtoFuncSplit): Ditto.
(KJS::stringProtoFuncSubstr): Ditto.
(KJS::stringProtoFuncSubstring): Ditto.
(KJS::stringProtoFuncToLowerCase): Use toThisJSString.
(KJS::stringProtoFuncToUpperCase): Ditto.
(KJS::stringProtoFuncToLocaleLowerCase): Ditto.
(KJS::stringProtoFuncToLocaleUpperCase): Ditto.
(KJS::stringProtoFuncLocaleCompare): Ditto.
(KJS::stringProtoFuncBig): Use toThisString.
(KJS::stringProtoFuncSmall): Ditto.
(KJS::stringProtoFuncBlink): Ditto.
(KJS::stringProtoFuncBold): Ditto.
(KJS::stringProtoFuncFixed): Ditto.
(KJS::stringProtoFuncItalics): Ditto.
(KJS::stringProtoFuncStrike): Ditto.
(KJS::stringProtoFuncSub): Ditto.
(KJS::stringProtoFuncSup): Ditto.
(KJS::stringProtoFuncFontcolor): Ditto.
(KJS::stringProtoFuncFontsize): Ditto.
(KJS::stringProtoFuncAnchor): Ditto.
(KJS::stringProtoFuncLink): Ditto.
* kjs/string_object.h: Added toString, toThisString, and toThisJSString.
* kjs/ustring.cpp:
(KJS::UString::append): Added a version that takes a character pointer and
size, so we don't have to create a UString just to append to another UString.
* kjs/ustring.h:
2008-06-26 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej.
Make JSGlobalData per-thread.
No change on SunSpider total.
* wtf/ThreadSpecific.h: Re-enabled the actual implementation.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
want to preserve these somehow to keep legacy behavior in working condition.
(KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
when updating JSGlobalObject linked list.
* kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
to use JSGlobalData associated with the current object.
* kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
Heap::registerAsMainThread() call.
* kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
transient, and while newParserObjects may conceptually be such, there is still some node
manipulation going on outside Parser::parse which touches it.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
(KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
* kjs/collector.cpp:
(KJS::Heap::Heap):
(KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
(KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
(KJS::Heap::collect): Ditto.
(KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
work with the main thread currently anyway.
(KJS::Heap::protectedGlobalObjectCount): Ditto.
* kjs/collector.h: Removed code related to "collect on main thread only" logic.
* JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
2008-06-26 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19767
REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
* kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
Made changing balance factor from -1 to +1 work correctly.
* wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
this slightly earlier.
2008-06-25 Timothy Hatcher <timothy@apple.com>
Fixes an ASSERT in the profiler when starting multiple profiles
with the same name inside the same function/program.
Reviewed by Kevin McCullough.
* profiler/Profile.cpp:
(KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
(KJS::Profile::stopProfiling): Set the current node to the parent,
because we are in a call that will not get a didExecute call.
(KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
account for didExecute not being called for profile.
(KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
(KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
greater than zero, and return early.
* profiler/Profile.h: Added stoppedProfiling().
* profiler/Profiler.cpp:
(KJS::Profiler::findProfile): Removed.
(KJS::Profiler::startProfiling): Don't return early for stopped profiles.
(KJS::Profiler::stopProfiling): Skipp stopped profiles.
(KJS::Profiler::didFinishAllExecution): Code clean-up.
* profiler/Profiler.h: Removed findProfile.
2008-06-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Alexey Proskuryakov.
Attempt to fix Windows debug build. The compiler gives a warning when
Structured Exception Handling and destructors are used in the same
function. Using manual locking and unlocking instead of constructors
and destructors should fix the warning.
* kjs/Shell.cpp:
(main):
2008-06-25 Alexey Proskuryakov <ap@webkit.org>
Forgot to address a review comment about better names for tracked objects, doing it now.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalData.h:
* kjs/nodes.cpp:
(KJS::ParserRefCounted::ParserRefCounted):
(KJS::ParserRefCounted::ref):
(KJS::ParserRefCounted::deref):
(KJS::ParserRefCounted::hasOneRef):
(KJS::ParserRefCounted::deleteNewObjects):
2008-06-25 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Remove more threadInstance() calls.
* kjs/JSFunction.cpp:
(KJS::JSFunction::getParameterName):
(KJS::IndexToNameMap::unMap):
(KJS::Arguments::deleteProperty):
* kjs/JSFunction.h:
Access nullIdentifier without going to thread specific storage.
* JavaScriptCore.exp:
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalData.h:
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::ParserRefCountedData::ParserRefCountedData):
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ParserRefCounted::ParserRefCounted):
(KJS::ParserRefCounted::ref):
(KJS::ParserRefCounted::deref):
(KJS::ParserRefCounted::hasOneRef):
(KJS::ParserRefCounted::deleteNewObjects):
(KJS::Node::Node):
(KJS::StatementNode::StatementNode):
(KJS::BreakpointCheckStatement::BreakpointCheckStatement):
(KJS::ConstDeclNode::ConstDeclNode):
(KJS::BlockNode::BlockNode):
(KJS::ForInNode::ForInNode):
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::ProgramNode::create):
(KJS::EvalNode::EvalNode):
(KJS::EvalNode::create):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::create):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::NullNode::):
(KJS::BooleanNode::):
(KJS::NumberNode::):
(KJS::ImmediateNumberNode::):
(KJS::StringNode::):
(KJS::RegExpNode::):
(KJS::ThisNode::):
(KJS::ResolveNode::):
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyNode::):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::BracketAccessorNode::):
(KJS::DotAccessorNode::):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::NewExprNode::):
(KJS::EvalFunctionCallNode::):
(KJS::FunctionCallValueNode::):
(KJS::FunctionCallResolveNode::):
(KJS::FunctionCallBracketNode::):
(KJS::FunctionCallDotNode::):
(KJS::PrePostResolveNode::):
(KJS::PostIncResolveNode::):
(KJS::PostDecResolveNode::):
(KJS::PostfixBracketNode::):
(KJS::PostIncBracketNode::):
(KJS::PostDecBracketNode::):
(KJS::PostfixDotNode::):
(KJS::PostIncDotNode::):
(KJS::PostDecDotNode::):
(KJS::PostfixErrorNode::):
(KJS::DeleteResolveNode::):
(KJS::DeleteBracketNode::):
(KJS::DeleteDotNode::):
(KJS::DeleteValueNode::):
(KJS::VoidNode::):
(KJS::TypeOfResolveNode::):
(KJS::TypeOfValueNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::PrefixBracketNode::):
(KJS::PreIncBracketNode::):
(KJS::PreDecBracketNode::):
(KJS::PrefixDotNode::):
(KJS::PreIncDotNode::):
(KJS::PreDecDotNode::):
(KJS::PrefixErrorNode::):
(KJS::UnaryOpNode::UnaryOpNode):
(KJS::UnaryPlusNode::):
(KJS::NegateNode::):
(KJS::BitwiseNotNode::):
(KJS::LogicalNotNode::):
(KJS::BinaryOpNode::BinaryOpNode):
(KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
(KJS::MultNode::):
(KJS::DivNode::):
(KJS::ModNode::):
(KJS::AddNode::):
(KJS::SubNode::):
(KJS::LeftShiftNode::):
(KJS::RightShiftNode::):
(KJS::UnsignedRightShiftNode::):
(KJS::LessNode::):
(KJS::GreaterNode::):
(KJS::LessEqNode::):
(KJS::GreaterEqNode::):
(KJS::InstanceOfNode::):
(KJS::InNode::):
(KJS::EqualNode::):
(KJS::NotEqualNode::):
(KJS::StrictEqualNode::):
(KJS::NotStrictEqualNode::):
(KJS::BitAndNode::):
(KJS::BitOrNode::):
(KJS::BitXOrNode::):
(KJS::LogicalAndNode::):
(KJS::LogicalOrNode::):
(KJS::ConditionalNode::):
(KJS::ReadModifyResolveNode::):
(KJS::AssignResolveNode::):
(KJS::ReadModifyBracketNode::):
(KJS::AssignBracketNode::):
(KJS::AssignDotNode::):
(KJS::ReadModifyDotNode::):
(KJS::AssignErrorNode::):
(KJS::CommaNode::):
(KJS::VarDeclCommaNode::):
(KJS::ConstStatementNode::):
(KJS::SourceElements::SourceElements):
(KJS::EmptyStatementNode::):
(KJS::DebuggerStatementNode::):
(KJS::ExprStatementNode::):
(KJS::VarStatementNode::):
(KJS::IfNode::):
(KJS::IfElseNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::ForNode::):
(KJS::ContinueNode::):
(KJS::BreakNode::):
(KJS::ReturnNode::):
(KJS::WithNode::):
(KJS::LabelNode::):
(KJS::ThrowNode::):
(KJS::TryNode::):
(KJS::ParameterNode::):
(KJS::FuncExprNode::):
(KJS::FuncDeclNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
(KJS::CaseBlockNode::):
(KJS::SwitchNode::):
Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
threadInstance calls.
2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Alexey Proskuryakov.
Make the JavaScript shell collect the heap from main() instead of
jscmain() to suppress leak messages in debug builds.
* kjs/Shell.cpp:
(main):
(jscmain):
2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Make the conversion of the pair (less, jtrue) to jless use register
reference counting information for safety instead of requiring callers
to decide whether it is safe.
No changes on SunSpider codegen.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfTrue):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::CaseBlockNode::emitCodeForBlock):
2008-06-24 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/6031594> JSProfiler: Profiler goes into an infinite
loop sometimes.
<rdar://problem/6031603> JSProfiler: Profiler asserts in debug and
give the wrong times in release
Fixed two issues found by Tim in the same test.
* profiler/Profile.cpp:
(KJS::Profile::removeProfileStart): No longer take profile's time from
all ancestors, but instead attribute it to its parent. Also add an
Assert to ensure we only delete the child we mean to.
(KJS::Profile::removeProfileEnd): Ditto for profileEnd.
(KJS::Profile::didExecute): Cleaned up the execution order and correctly
attribute all of the parent's time to the new node.
* profiler/ProfileNode.cpp: If this node does not have a startTime it
should not get a giant total time, but instead be 0.
(KJS::ProfileNode::endAndRecordCall):
* profiler/ProfileNode.h:
(KJS::ProfileNode::removeChild): Should reset the sibling pointers since
one of them has been removed.
2008-06-24 Darin Adler <darin@apple.com>
Reviewed by Cameron.
- fix https://bugs.webkit.org/show_bug.cgi?id=19739
REGRESSION: fast/js/property-getters-and-setters.html fails
* kjs/JSObject.cpp:
(KJS::JSObject::put): Remove an untested optimization I checked in by accident.
The two loops up the prototype chain both need to start from this; instead the
second loop was starting where the first loop left off.
2008-06-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* kjs/nodes.cpp:
2008-06-24 Joerg Bornemann <joerg.bornemann@trolltech.com>
Reviewed by Simon.
For the Qt build on Windows don't depend on the presence of GNU CPP
but use MSVC's preprocessor instead.
dftables accepts a --preprocessor option which is set in pcre.pri for MSVC platforms.
* pcre/dftables: Added support for specifying the preprocessor command
to use via --preprocessor, similar to
WebCore/bindings/scripts/generate-bindings.pl.
* pcre/pcre.pri: Pass --preprocessor='cl /e' to dftables, or more
generally speaking QMAKE_CC /E for the win32-msvc buildspecs.
2008-06-24 Simon Hausmann <hausmann@webkit.org>
Fix the Qt build, added missing include.
* kjs/PropertySlot.cpp:
2008-06-24 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Cameron Zwarich.
Make ParserRefCountedCounter actually perform a leak check.
* kjs/nodes.cpp:
(KJS::ParserRefCountedCounter::~ParserRefCountedCounter): Check for leaks in destructor,
not in constructor.
(KJS::ParserRefCountedCounter::increment):
(KJS::ParserRefCountedCounter::decrement):
(KJS::ParserRefCounted::ParserRefCounted):
(KJS::ParserRefCounted::~ParserRefCounted):
While at it, also made counting thread-safe.
2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 19730: REGRESSION (r34497): Text in alerts in "Leisure suit Larry" is not wrapped
<https://bugs.webkit.org/show_bug.cgi?id=19730>
Do not convert the pair (less, jtrue) to jless when jtrue is a jump
target. An example of this is when the condition of a while loop is a
LogicalOrNode.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitLabel):
2008-06-20 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Adam Roben.
Fix compile with MinGW.
* kjs/Shell.cpp:
* wtf/Threading.h:
(WTF::atomicIncrement):
(WTF::atomicDecrement):
2008-06-23 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Prepration for returning memory to the OS on Windows. Track whether a portion of a span of memory was returned to the OS.
If it was, ask that it be recommitted before returning it to the application as an allocated region.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::New): If the span was decommitted, ask that it be recommitted before returning it.
(WTF::TCMalloc_PageHeap::AllocLarge): Ditto.
(WTF::TCMalloc_PageHeap::Carve): When splitting a span, ensure that the decommitted state propogates to the two new spans.
(WTF::TCMalloc_PageHeap::Delete): When merging a span, ensure that the resulting span is marked as decommitted if any of the
spans being merged were marked as decommitted.
(WTF::TCMalloc_PageHeap::IncrementalScavenge): Mark as decommitted after releasing the span.
(WTF::TCMalloc_Central_FreeList::FetchFromSpans): Add an assertion to catch a decommitted span being returned to the application
without first being recommitted.
(WTF::TCMalloc_Central_FreeList::Populate): Ditto.
* wtf/TCSystemAlloc.cpp: Stub out TCMalloc_SystemCommit.
* wtf/TCSystemAlloc.h:
2008-06-23 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Remove the sample member of Span when NO_TCMALLOC_SAMPLES is defined.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::Delete): Only update Span::sample if NO_TCMALLOC_SAMPLES is not defined.
(WTF::TCMallocStats::do_free): Ditto.
2008-06-23 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- work toward https://bugs.webkit.org/show_bug.cgi?id=19721
More preparation toward making functions work on primitive types without
creating wrapper objects. No speedup this time, but prepares for a future
speedup without slowing things down.
SunSpider reports no change.
- Eliminated the implementsCall, callAsFunction and construct virtual
functions from JSObject. Instead, the CallData and ConstructData for
a native function includes a function pointer that the caller can use
directly. Changed all call sites to use CallData and ConstructData.
- Changed the "this" argument to native functions to be a JSValue rather
than a JSObject. This prepares us for passing primitives into these
functions. The conversion to an object now must be done inside the
function. Critically, if it's a function that can be called on a DOM
window object, then we have to be sure to call toThisObject on the
argument before we use it for anything even if it's already an object.
- Eliminated the practice of using constructor objects in the global
object to make objects of the various basic types. Since these
constructors can't be replaced by script, there's no reason to involve
a constructor object at all. Added functions to do the construction
directly.
- Made some more class members private and protected, including virtual
function overrides. This can catch code using unnecessarily slow virtual
function code paths when the type of an object is known statically. If we
later find a new reason use the members outside the class it's easy to
make them public again.
- Moved the declarations of the native implementations for functions out
of header files. These can have internal linkage and be declared inside
the source file.
- Changed PrototypeFunction to take function pointers with the right
arguments to be put directly into CallData. This eliminates the
need to have a separate PrototypeReflexiveFunction, and reveals that the
real purpose of that class included something else specific to eval --
storage of a cached global object. So renamed PrototypeReflexiveFunction
to GlobalEvalFunction.
* API/JSCallbackConstructor.cpp:
(KJS::constructJSCallback):
(KJS::JSCallbackConstructor::getConstructData):
* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.cpp:
(KJS::JSCallbackFunction::implementsHasInstance):
(KJS::JSCallbackFunction::call):
(KJS::JSCallbackFunction::getCallData):
* API/JSCallbackFunction.h:
(KJS::JSCallbackFunction::classInfo):
* API/JSCallbackObject.h:
(KJS::JSCallbackObject::classRef):
(KJS::JSCallbackObject::classInfo):
* API/JSCallbackObjectFunctions.h:
(KJS::::getConstructData):
(KJS::::construct):
(KJS::::getCallData):
(KJS::::call):
* API/JSObjectRef.cpp:
(JSObjectMakeFunction):
(JSObjectIsFunction):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
* JavaScriptCore.exp:
* VM/Machine.cpp:
(KJS::jsTypeStringForValue):
(KJS::Machine::privateExecute):
* kjs/ArrayPrototype.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncReverse):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSort):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
(KJS::ArrayConstructor::ArrayConstructor):
(KJS::constructArrayWithSizeQuirk):
(KJS::constructWithArrayConstructor):
(KJS::ArrayConstructor::getConstructData):
(KJS::callArrayConstructor):
(KJS::ArrayConstructor::getCallData):
* kjs/ArrayPrototype.h:
* kjs/BooleanObject.cpp:
(KJS::booleanProtoFuncToString):
(KJS::booleanProtoFuncValueOf):
(KJS::constructBoolean):
(KJS::constructWithBooleanConstructor):
(KJS::BooleanConstructor::getConstructData):
(KJS::callBooleanConstructor):
(KJS::BooleanConstructor::getCallData):
(KJS::constructBooleanFromImmediateBoolean):
* kjs/BooleanObject.h:
* kjs/CallData.h:
(KJS::):
* kjs/ConstructData.h:
(KJS::):
* kjs/FunctionPrototype.cpp:
(KJS::callFunctionPrototype):
(KJS::FunctionPrototype::getCallData):
(KJS::functionProtoFuncToString):
(KJS::functionProtoFuncApply):
(KJS::functionProtoFuncCall):
(KJS::constructWithFunctionConstructor):
(KJS::FunctionConstructor::getConstructData):
(KJS::callFunctionConstructor):
(KJS::FunctionConstructor::getCallData):
(KJS::constructFunction):
* kjs/FunctionPrototype.h:
* kjs/JSArray.cpp:
(KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
(KJS::JSArray::sort):
(KJS::constructEmptyArray):
(KJS::constructArray):
* kjs/JSArray.h:
(KJS::JSArray::classInfo):
* kjs/JSFunction.cpp:
(KJS::JSFunction::call):
(KJS::globalFuncEval):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncIsNaN):
(KJS::globalFuncIsFinite):
(KJS::globalFuncDecodeURI):
(KJS::globalFuncDecodeURIComponent):
(KJS::globalFuncEncodeURI):
(KJS::globalFuncEncodeURIComponent):
(KJS::globalFuncEscape):
(KJS::globalFuncUnescape):
(KJS::globalFuncKJSPrint):
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeFunction::getCallData):
(KJS::GlobalEvalFunction::GlobalEvalFunction):
(KJS::GlobalEvalFunction::mark):
* kjs/JSFunction.h:
(KJS::InternalFunction::classInfo):
(KJS::InternalFunction::functionName):
(KJS::JSFunction::classInfo):
(KJS::GlobalEvalFunction::cachedGlobalObject):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
(KJS::JSGlobalObject::mark):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObject):
(KJS::JSGlobalObject::evalFunction):
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::toObject):
* kjs/JSNotAnObject.cpp:
* kjs/JSNotAnObject.h:
* kjs/JSObject.cpp:
(KJS::JSObject::put):
(KJS::callDefaultValueFunction):
(KJS::JSObject::defaultValue):
(KJS::JSObject::lookupGetter):
(KJS::JSObject::lookupSetter):
(KJS::JSObject::hasInstance):
(KJS::JSObject::fillGetterPropertySlot):
(KJS::Error::create):
(KJS::constructEmptyObject):
* kjs/JSObject.h:
(KJS::GetterSetter::GetterSetter):
(KJS::GetterSetter::getter):
(KJS::GetterSetter::setGetter):
(KJS::GetterSetter::setter):
(KJS::GetterSetter::setSetter):
* kjs/JSValue.cpp:
(KJS::JSCell::deleteProperty):
(KJS::call):
(KJS::construct):
* kjs/JSValue.h:
* kjs/MathObject.cpp:
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/MathObject.h:
* kjs/NumberObject.cpp:
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncValueOf):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
(KJS::NumberConstructor::NumberConstructor):
(KJS::constructWithNumberConstructor):
(KJS::NumberConstructor::getConstructData):
(KJS::callNumberConstructor):
(KJS::NumberConstructor::getCallData):
(KJS::constructNumber):
(KJS::constructNumberFromImmediateNumber):
* kjs/NumberObject.h:
(KJS::NumberObject::classInfo):
(KJS::NumberConstructor::classInfo):
* kjs/PropertySlot.cpp:
(KJS::PropertySlot::functionGetter):
* kjs/RegExpObject.cpp:
(KJS::regExpProtoFuncTest):
(KJS::regExpProtoFuncExec):
(KJS::regExpProtoFuncCompile):
(KJS::regExpProtoFuncToString):
(KJS::callRegExpObject):
(KJS::RegExpObject::getCallData):
(KJS::constructRegExp):
(KJS::constructWithRegExpConstructor):
(KJS::RegExpConstructor::getConstructData):
(KJS::callRegExpConstructor):
(KJS::RegExpConstructor::getCallData):
* kjs/RegExpObject.h:
(KJS::RegExpConstructor::classInfo):
* kjs/Shell.cpp:
(GlobalObject::GlobalObject):
(functionPrint):
(functionDebug):
(functionGC):
(functionVersion):
(functionRun):
(functionLoad):
(functionReadline):
(functionQuit):
* kjs/date_object.cpp:
(KJS::gmtoffset):
(KJS::formatLocaleDate):
(KJS::fillStructuresUsingDateArgs):
(KJS::DateInstance::getTime):
(KJS::DateInstance::getUTCTime):
(KJS::DateConstructor::DateConstructor):
(KJS::constructDate):
(KJS::DateConstructor::getConstructData):
(KJS::callDate):
(KJS::DateConstructor::getCallData):
(KJS::dateParse):
(KJS::dateNow):
(KJS::dateUTC):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetMilliSeconds):
(KJS::dateProtoFuncSetUTCMilliseconds):
(KJS::dateProtoFuncSetSeconds):
(KJS::dateProtoFuncSetUTCSeconds):
(KJS::dateProtoFuncSetMinutes):
(KJS::dateProtoFuncSetUTCMinutes):
(KJS::dateProtoFuncSetHours):
(KJS::dateProtoFuncSetUTCHours):
(KJS::dateProtoFuncSetDate):
(KJS::dateProtoFuncSetUTCDate):
(KJS::dateProtoFuncSetMonth):
(KJS::dateProtoFuncSetUTCMonth):
(KJS::dateProtoFuncSetFullYear):
(KJS::dateProtoFuncSetUTCFullYear):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/date_object.h:
(KJS::DateInstance::internalNumber):
(KJS::DateInstance::classInfo):
* kjs/error_object.cpp:
(KJS::errorProtoFuncToString):
(KJS::constructError):
(KJS::constructWithErrorConstructor):
(KJS::ErrorConstructor::getConstructData):
(KJS::callErrorConstructor):
(KJS::ErrorConstructor::getCallData):
(KJS::NativeErrorConstructor::construct):
(KJS::constructWithNativeErrorConstructor):
(KJS::NativeErrorConstructor::getConstructData):
(KJS::callNativeErrorConstructor):
(KJS::NativeErrorConstructor::getCallData):
* kjs/error_object.h:
(KJS::NativeErrorConstructor::classInfo):
* kjs/internal.cpp:
(KJS::JSNumberCell::toObject):
(KJS::JSNumberCell::toThisObject):
(KJS::GetterSetter::mark):
(KJS::GetterSetter::toPrimitive):
(KJS::GetterSetter::toBoolean):
(KJS::GetterSetter::toNumber):
(KJS::GetterSetter::toString):
(KJS::GetterSetter::toObject):
(KJS::InternalFunction::InternalFunction):
(KJS::InternalFunction::implementsHasInstance):
* kjs/lookup.h:
(KJS::HashEntry::):
* kjs/nodes.cpp:
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::makeFunction):
* kjs/object_object.cpp:
(KJS::objectProtoFuncValueOf):
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncIsPrototypeOf):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
(KJS::ObjectConstructor::ObjectConstructor):
(KJS::constructObject):
(KJS::constructWithObjectConstructor):
(KJS::ObjectConstructor::getConstructData):
(KJS::callObjectConstructor):
(KJS::ObjectConstructor::getCallData):
* kjs/object_object.h:
* kjs/string_object.cpp:
(KJS::replace):
(KJS::stringProtoFuncToString):
(KJS::stringProtoFuncValueOf):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
(KJS::stringFromCharCode):
(KJS::StringConstructor::StringConstructor):
(KJS::constructWithStringConstructor):
(KJS::StringConstructor::getConstructData):
(KJS::callStringConstructor):
(KJS::StringConstructor::getCallData):
* kjs/string_object.h:
2008-06-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 19716: REGRESSION (SquirrelFish): Reproducible crash after entering a username at mint.com
<https://bugs.webkit.org/show_bug.cgi?id=19716>
When unwinding callframes for exceptions, check whether the callframe
was created by a reentrant native call to JavaScript after tearing off
the local variables instead of before.
* VM/Machine.cpp:
(KJS::Machine::unwindCallFrame):
2008-06-23 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Get testapi passing again in a debug build.
* API/testapi.c:
(main): Update the expected output of calling JSValueMakeString on a function object.
2008-06-21 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Print a blank line when exiting the jsc interactive mode to ensure that the shell
prompt will start on a new line.
* kjs/Shell.cpp:
(runInteractive):
2008-06-21 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Sam Weinig.
Tweak the paths of the items in the "tests" group to clean things up a little.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-06-21 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Sam Weinig.
Fix jsc to link against libedit.dylib rather than libedit.2.dylib.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-06-21 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Copy the JavaScriptCore shell (jsc) into JavaScriptCore.framework so that it will
be included in nightly builds.
https://bugs.webkit.org/show_bug.cgi?id=19691
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-06-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Mark Rowe.
Fix the build for non-Mac Darwin platforms by disabling their support
for readline in the JavaScript shell.
* kjs/config.h:
2008-06-20 Timothy Hatcher <timothy@apple.com>
Use member function pointers for the Profile::forEach function.
Eliminating a few static functions and simplified things a little.
Reviewed by Alexey Proskuryakov.
* JavaScriptCore.exp: Change the symbol for forEach.
* profiler/Profile.cpp:
(KJS::Profile::forEach): Use a member function pointer.
* profiler/Profile.h:
(KJS::Profile::sortTotalTimeDescending): Pass a function pointer.
(KJS::Profile::sortTotalTimeAscending): Ditto.
(KJS::Profile::sortSelfTimeDescending): Ditto.
(KJS::Profile::sortSelfTimeAscending): Ditto.
(KJS::Profile::sortCallsDescending): Ditto.
* profiler/ProfileNode.h:
(KJS::ProfileNode::sortTotalTimeDescending): No longer static.
(KJS::ProfileNode::sortTotalTimeAscending): Ditto.
(KJS::ProfileNode::sortSelfTimeDescending): Ditto.
(KJS::ProfileNode::sortSelfTimeAscending): Ditto.
(KJS::ProfileNode::sortCallsDescending): Ditto.
2008-06-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Remove unused destructors.
* kjs/nodes.cpp:
* kjs/nodes.h:
2008-06-20 Timothy Hatcher <timothy@apple.com>
Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
and stopping a profile from the Develop menu. Also prevents
inserting an incorrect parent node as the new head after profiling
is stopped from the Develop menu.
Reviewed by Dan Bernstein.
* profiler/Profile.cpp:
(KJS::Profile::stopProfiling): If the current node is already the head
then there is no more need to record future nodes in didExecute.
(KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
into here since this was the only caller. When setting the total time
keep any current total time while adding the self time of the head.
(KJS::Profile::setupCurrentNodeAsStopped): Removed.
* profiler/Profile.h: Removed setupCurrentNodeAsStopped.
2008-06-20 Kevin Ollivier <kevino@theolliviers.com>
!USE(MULTIPLE_THREADS) on Darwin build fix
* kjs/InitializeThreading.cpp:
(KJS::initializeThreading):
* kjs/collector.h:
2008-06-20 Kevin McCullough <kmccullough@apple.com>
-Leopard Build Fix.
* profiler/Profile.cpp:
(KJS::Profile::removeProfileStart):
(KJS::Profile::removeProfileEnd):
2008-06-20 Kevin McCullough <kmccullough@apple.com>
Just giving credit.
* ChangeLog:
2008-06-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim and Dan.
<rdar://problem/6024846> JSProfiler: ASSERT hit in Profiler.
- Because InspectorController can call startProfiling() and
stopProfiling() we cannot assert that console.profile() and
console.profileEnd() will be in the profile tree.
* profiler/Profile.cpp:
(KJS::Profile::removeProfileStart):
(KJS::Profile::removeProfileEnd):
2008-06-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
if profiling is started and finished within the same function. (19230)
- Now we profile one more stack frame up from the last frame to allocate
the time spent in it, if it exists.
* JavaScriptCore.exp:
* VM/Machine.cpp: We need to let the profiler know when the JS program
has finished since that is what will actually stop the profiler instead
of just calling stopProfiling().
(KJS::Machine::execute):
* profiler/Profile.cpp:
(KJS::Profile::create): Moved from Profile.h since it was getting pretty
long.
(KJS::Profile::Profile): We now have a client, which is a listener who
we will return this profile to, once it has actually finished.
(KJS::Profile::stopProfiling): Instead of fully stopping the profiler
here, we set the flag and keep it profiling in the background.
(KJS::Profile::didFinishAllExecution): This is where the profiler
actually finishes and creates the (idle) node if one should be made.
(KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
needed by the profiler as it runs silently in the background.
(KJS::Profile::removeProfileEnd): Ditto.
(KJS::Profile::willExecute): Don't profile new functions if we have
stopped profiling.
(KJS::Profile::didExecute): Only record one more return as all the
remaining time will be attributed to that function.
(KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
* profiler/Profile.h: Added functions and variables for the above
changes.
(KJS::Profile::client):
* profiler/ProfileNode.h:
(KJS::CallIdentifier::toString): Debug method.
* profiler/Profiler.cpp: Added support for the ProfilerClient.
(KJS::Profiler::startProfiling):
(KJS::Profiler::stopProfiling): No longer return sthe profile.
(KJS::Profiler::didFinishAllExecution): Now returns the profile to the
client instead of stopProfiling.
* profiler/Profiler.h:
(KJS::ProfilerClient::~ProfilerClient): Clients will implement this
interface.
2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
Surpress compiler warning (int vs unsigned comparison).
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::toLower):
2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Timothy Hatcher.
Introduce compiler define for MinGW, to have COMPILER(MINGW).
* wtf/Platform.h:
2008-06-19 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Make Machine per-JSGlobalData.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitOpcode):
* VM/Machine.cpp:
(KJS::callEval):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::throwException):
(KJS::Machine::execute):
(KJS::Machine::debug):
* VM/Machine.h:
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::evaluate):
* kjs/DebuggerCallFrame.h:
(KJS::DebuggerCallFrame::DebuggerCallFrame):
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/ExecState.h:
(KJS::ExecState::machine):
* kjs/JSFunction.cpp:
(KJS::JSFunction::callAsFunction):
(KJS::JSFunction::argumentsGetter):
(KJS::JSFunction::callerGetter):
(KJS::JSFunction::construct):
(KJS::globalFuncEval):
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalData.h:
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
2008-06-19 Alp Toker <alp@nuanti.com>
GTK+/autotools build fix. JSGlobalObject.cpp in now in
AllInOneFile.cpp and shouldn't be built separately.
* GNUmakefile.am:
2008-06-19 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Get rid of some threadInstance calls.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Shell.cpp:
(jscmain):
2008-06-19 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Sam.
Fix an assertion failure at startup.
* kjs/JSObject.h: (KJS::JSObject::JSObject): Allow jsNull prototype in an assertion (I had
it fixed in a wrong copy of the file, so I wasn't getting the failure).
2008-06-19 Alexey Proskuryakov <ap@webkit.org>
Build fix.
* kjs/collector.cpp:
(KJS::Heap::Heap):
(KJS::allocateBlock):
* kjs/collector.h:
No, #if PLATFORM(UNIX) was not right. I've just moved the unsafe initialization back for now,
as the platforms that use that code path do not use multiple threads yet.
2008-06-19 Alexey Proskuryakov <ap@webkit.org>
Windows and Qt build fixes.
* kjs/collector.h:
* kjs/collector.cpp:
(KJS::Heap::Heap):
Wrapped m_pagesize in #if PLATFORM(UNIX), which should better match the sequence of #elifs
in allocateBlock(). Changed MIN_ARRAY_SIZE to be explicitly size_t, as this type is different
on different platforms.
2008-06-17 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Prepare JavaScript heap for being per-thread.
* kjs/ExecState.h: Shuffle includes, making it possible to include ExecState.h in JSValue.h.
(KJS::ExecState::heap): Added an accessor.
* API/JSBase.cpp: (JSGarbageCollect): Collect both shared and per-thread heaps.
* API/JSContextRef.cpp: (JSGlobalContextCreate): When allocating JSGlobalObject, indicate
that it belongs to a shared heap.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/AllInOneFile.cpp:
Moved JSGlobalObject.cpp to AllInOneFile, as a build fix for inlineAllocate magic.
* VM/CodeGenerator.h: (KJS::CodeGenerator::globalExec): Added an accessor (working via
m_scopeChain).
* VM/RegisterFile.h:
(KJS::RegisterFile::mark):
* VM/RegisterFileStack.h:
(KJS::RegisterFileStack::mark):
Made these pseudo-mark functions take Heap*.
* kjs/InitializeThreading.cpp:
(KJS::initializeThreading): Initialize heap introspector.
* kjs/JSGlobalData.h: Added Heap to the structure.
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData): Initialize Heap.
(KJS::JSGlobalData::sharedInstance): Added a method to access shared global data instance
for legacy clients.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject): Changed to work with per-thread head; fixed list
maintenance logic.
(KJS::JSGlobalObject::init): Changed to work with per-thread head.
(KJS::JSGlobalObject::put): Assert that a cross-heap operation is not being attempted.
(KJS::JSGlobalObject::reset): Pass ExecState* where now required.
(KJS::JSGlobalObject::mark): Pass the current heap to RegisterFileStack::mark.
(KJS::JSGlobalObject::operator new): Overload operator new to use per-thread or shared heap.
* kjs/JSGlobalObject.h: Removed static s_head member.
* kjs/PropertyMap.h: (KJS::PropertyMap::PropertyMap): Removed unused SavedProperty.
* kjs/collector.h: Turned Collector into an actual object with its own data, renamed to Heap.
(KJS::Heap::initializeHeapIntrospector): Added.
(KJS::Heap::heap): Added a method to determine which heap a JSValue is in, if any.
(KJS::Heap::allocate): Made non-static.
(KJS::Heap::inlineAllocateNumber): Ditto.
(KJS::Heap::markListSet): Ditto.
(KJS::Heap::cellBlock): Ditto.
(KJS::Heap::cellOffset): Ditto.
(KJS::Heap::isCellMarked): Ditto.
(KJS::Heap::markCell): Ditto.
(KJS::Heap::reportExtraMemoryCost): Ditto.
(KJS::CollectorBlock): Added a back-reference to Heap for Heap::heap() method.
(KJS::SmallCellCollectorBlock): Ditto.
* kjs/collector.cpp: Changed MIN_ARRAY_SIZE to a #define to avoid a PIC branch. Removed
main thread related machinery.
(KJS::Heap::Heap): Initialize the newly added data members.
(KJS::allocateBlock): Marked NEVER_INLINE, as this is a rare case that uses a PIC branch.
Moved static pagesize to the class to make it safely initialized.
(KJS::Heap::heapAllocate): Initialize heap back reference after a new block is allocated.
(KJS::Heap::registerThread): Removed introspector initialization, as it is now performed
in InitializeThreading.cpp.
(KJS::Heap::markOtherThreadConservatively): Assert that the "other thread" case only occurs
for legacy clients using a shared heap.
(KJS::Heap::markStackObjectsConservatively): Moved fastMallocForbid/Allow down here, since
it doesn't need to be forbidden during other GC phases.
* kjs/JSImmediate.h:
(KJS::jsUndefined):
(KJS::jsNull):
(KJS::jsBoolean):
Moved from JSvalue.h, to make these usable in files that cannot include JSValue.h (such
as list.h).
* API/JSCallbackObjectFunctions.h:
(KJS::::staticFunctionGetter):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
* API/JSValueRef.cpp:
(JSValueMakeNumber):
(JSValueMakeString):
* JavaScriptCore.exp:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitLoad):
* VM/JSPropertyNameIterator.cpp:
(KJS::JSPropertyNameIterator::create):
(KJS::JSPropertyNameIterator::next):
* VM/Machine.cpp:
(KJS::jsAddSlowCase):
(KJS::jsAdd):
(KJS::jsTypeStringForValue):
(KJS::scopeChainForCall):
(KJS::Machine::throwException):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
(KJS::Machine::retrieveArguments):
* kjs/ArrayPrototype.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
(KJS::ArrayConstructor::ArrayConstructor):
(KJS::ArrayConstructor::construct):
(KJS::ArrayConstructor::callAsFunction):
* kjs/BooleanObject.cpp:
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::BooleanConstructor::BooleanConstructor):
(KJS::BooleanConstructor::construct):
* kjs/FunctionPrototype.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
(KJS::functionProtoFuncToString):
(KJS::FunctionConstructor::FunctionConstructor):
(KJS::FunctionConstructor::construct):
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject):
* kjs/JSArray.cpp:
(KJS::JSArray::JSArray):
(KJS::JSArray::lengthGetter):
* kjs/JSFunction.cpp:
(KJS::JSFunction::lengthGetter):
(KJS::JSFunction::construct):
(KJS::Arguments::Arguments):
(KJS::encode):
(KJS::decode):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncEscape):
(KJS::globalFuncUnescape):
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::toObject):
* kjs/JSLock.cpp:
(KJS::JSLock::registerThread):
* kjs/JSObject.cpp:
(KJS::JSObject::put):
(KJS::JSObject::defineGetter):
(KJS::JSObject::defineSetter):
(KJS::Error::create):
* kjs/JSObject.h:
(KJS::JSObject::putDirect):
* kjs/JSString.h:
(KJS::JSString::JSString):
* kjs/JSValue.cpp:
(KJS::JSCell::operator new):
(KJS::jsString):
(KJS::jsOwnedString):
* kjs/JSValue.h:
(KJS::JSNumberCell::operator new):
(KJS::jsNumberCell):
(KJS::jsNaN):
(KJS::jsNumber):
(KJS::JSCell::marked):
(KJS::JSCell::mark):
(KJS::JSValue::toJSNumber):
* kjs/MathObject.cpp:
(KJS::MathObject::getValueProperty):
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/NumberObject.cpp:
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
(KJS::NumberConstructor::NumberConstructor):
(KJS::NumberConstructor::getValueProperty):
(KJS::NumberConstructor::construct):
(KJS::NumberConstructor::callAsFunction):
* kjs/RegExpObject.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::regExpProtoFuncToString):
(KJS::RegExpObject::getValueProperty):
(KJS::RegExpConstructor::RegExpConstructor):
(KJS::RegExpMatchesArray::fillArrayInstance):
(KJS::RegExpConstructor::arrayOfMatches):
(KJS::RegExpConstructor::getBackref):
(KJS::RegExpConstructor::getLastParen):
(KJS::RegExpConstructor::getLeftContext):
(KJS::RegExpConstructor::getRightContext):
(KJS::RegExpConstructor::getValueProperty):
(KJS::RegExpConstructor::construct):
* kjs/RegExpObject.h:
* kjs/Shell.cpp:
(GlobalObject::GlobalObject):
(functionGC):
(functionRun):
(functionReadline):
(jscmain):
* kjs/date_object.cpp:
(KJS::formatLocaleDate):
(KJS::DatePrototype::DatePrototype):
(KJS::DateConstructor::DateConstructor):
(KJS::DateConstructor::construct):
(KJS::DateConstructor::callAsFunction):
(KJS::DateFunction::DateFunction):
(KJS::DateFunction::callAsFunction):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::errorProtoFuncToString):
(KJS::ErrorConstructor::ErrorConstructor):
(KJS::ErrorConstructor::construct):
(KJS::NativeErrorPrototype::NativeErrorPrototype):
(KJS::NativeErrorConstructor::NativeErrorConstructor):
(KJS::NativeErrorConstructor::construct):
* kjs/identifier.h:
* kjs/internal.cpp:
(KJS::StringObject::create):
(KJS::JSString::lengthGetter):
(KJS::JSString::indexGetter):
(KJS::JSString::indexNumericPropertyGetter):
* kjs/interpreter.cpp:
* kjs/list.cpp:
(KJS::ArgList::slowAppend):
* kjs/list.h:
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::cacheGlobalObject):
* kjs/nodes.cpp:
(KJS::Node::emitThrowError):
(KJS::StringNode::emitCode):
(KJS::ArrayNode::emitCode):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::makeFunction):
* kjs/nodes.h:
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
(KJS::ObjectConstructor::ObjectConstructor):
(KJS::ObjectConstructor::construct):
* kjs/protect.h:
(KJS::gcProtect):
(KJS::gcUnprotect):
* kjs/string_object.cpp:
(KJS::StringObject::StringObject):
(KJS::StringPrototype::StringPrototype):
(KJS::replace):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
(KJS::StringConstructor::StringConstructor):
(KJS::StringConstructor::construct):
(KJS::StringConstructor::callAsFunction):
(KJS::StringConstructorFunction::StringConstructorFunction):
(KJS::StringConstructorFunction::callAsFunction):
* kjs/string_object.h:
(KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
* kjs/ustring.h:
Updated for the above changes.
2008-06-17 Timothy Hatcher <timothy@apple.com>
Added a type to DebuggerCallFrame so the under interface can
distinguish anonymous functions and program call frames.
https://bugs.webkit.org/show_bug.cgi?id=19585
Reviewed by Geoff Garen.
* JavaScriptCore.exp: Export the DebuggerCallFrame::type symbol.
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::type): Added.
* kjs/DebuggerCallFrame.h:
2008-06-17 Eric Seidel <eric@webkit.org>
Reviewed by Tim H.
Remove bogus ASSERT which tripped every time for those who use PAC files.
* kjs/Parser.cpp:
(KJS::Parser::parse):
2008-06-17 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
<rdar://problem/5951534> JSProfiler: Don't profile console.profile()
or console.profileEnd()
* profiler/Profile.cpp:
(KJS::Profile::stopProfiling): Moved the creation of the (idle) node to
the Profile (not ProfileNode). This makes sense since the Profile
should be the one to modify the profile tree. Also each stopProfiling()
does not need to check if it's the head node anymore. Also fixed an
oddity where I was using willExecute to create the node.
(KJS::Profile::removeProfileStart): Removes the call to console.profile
that started this profile.
(KJS::Profile::removeProfileEnd): Removes the call to console.profileEnd
that ended this profile.
* profiler/Profile.h:
* profiler/ProfileNode.cpp: Moved the creation of the (idle) node to
the Profile object.
(KJS::ProfileNode::stopProfiling):
* profiler/ProfileNode.h: Added some helper functions and whitespace to
facilitate readability and the removal of profile() and profileEnd()
from the Profile tree.
(KJS::CallIdentifier::operator const char* ):
(KJS::ProfileNode::firstChild):
(KJS::ProfileNode::lastChild):
(KJS::ProfileNode::removeChild):
(KJS::ProfileNode::toString):
2008-06-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
Rubber stamped by Adam Roben.
Include JSGlobalObject.h to fix the build.
* kjs/ScopeChain.cpp:
2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Reduce code duplication in emitReadModifyAssignment().
* kjs/nodes.cpp:
(KJS::emitReadModifyAssignment):
2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Sort includes alphabetically.
* kjs/nodes.cpp:
2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
<https://bugs.webkit.org/show_bug.cgi?id=19596>
When growing SegmentedVector, we start adding segments at the position
of the last segment, overwriting it. The destructor frees allocated
segments starting at the segment of index 1, because the segment of
index 0 is assumed to be the initial inline segment. This causes a leak
of the segment that is referenced by index 0. Modifying grow() so that
it starts adding segments at the position after the last segment fixes
the leak.
Since the initial segment is a special case in the lookup code, this
bug never manifested itself via incorrect results.
* VM/SegmentedVector.h:
(KJS::SegmentedVector::grow):
2008-06-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Alexey.
- removed nearly unused types.h and LocalStorageEntry.h headers
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/ExecState.h:
* kjs/LocalStorageEntry.h: Removed.
* kjs/RegExpObject.cpp:
* kjs/error_object.cpp:
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/types.h: Removed.
2008-06-16 Alp Toker <alp@nuanti.com>
Rubber-stamped by Geoff.
Change c++ to c in minidom and testapi emacs mode line comments.
* API/Node.h:
* API/NodeList.c:
* API/NodeList.h:
* API/testapi.c:
2008-06-16 Alexey Proskuryakov <ap@webkit.org>
Trying to fix Windows build.
* kjs/PropertyNameArray.h:
* kjs/identifier.cpp:
Include ExecState.h
2008-06-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Slight cleanup to the SymbolTableEntry class.
Renamed isEmpty to isNull, since we usually use "empty" to mean "holds
the valid, empty value", and "null" to mean "holds no value".
Changed an "== 0" to a "!", to match our style guidelines.
Added some ASSERTs to verify the (possibly questionable) assumption that
all register indexes will have their high two bits set. Also clarified a
comment to make that assumption clear.
2008-06-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Initialize functionQueueMutex in a safe manner.
* wtf/MainThread.cpp:
(WTF::functionQueueMutex): Made it an AtomicallyInitializedStatic.
(WTF::dispatchFunctionsFromMainThread):
(WTF::setMainThreadCallbacksPaused):
Assert that the current thread is main, meaning that the callbacksPaused static can be
accessed.
2008-06-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Make Identifier construction use an explicitly passed IdentifierTable.
No change on SunSpider total.
* API/JSCallbackObjectFunctions.h:
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::getPropertyNames):
* API/JSObjectRef.cpp:
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeFunction):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectDeleteProperty):
(OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
(JSObjectCopyPropertyNames):
* JavaScriptCore.exp:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::registerForLocal):
(KJS::CodeGenerator::isLocal):
(KJS::CodeGenerator::addConstant):
(KJS::CodeGenerator::findScopedProperty):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::globalData):
(KJS::CodeGenerator::propertyNames):
* VM/JSPropertyNameIterator.cpp:
(KJS::JSPropertyNameIterator::create):
* VM/Machine.cpp:
(KJS::Machine::throwException):
(KJS::Machine::privateExecute):
* kjs/ArrayPrototype.cpp:
(KJS::ArrayConstructor::ArrayConstructor):
* kjs/BooleanObject.cpp:
(KJS::BooleanConstructor::BooleanConstructor):
* kjs/FunctionPrototype.cpp:
(KJS::FunctionConstructor::FunctionConstructor):
(KJS::FunctionConstructor::construct):
* kjs/JSArray.cpp:
(KJS::JSArray::inlineGetOwnPropertySlot):
(KJS::JSArray::put):
(KJS::JSArray::deleteProperty):
(KJS::JSArray::getPropertyNames):
* kjs/JSFunction.cpp:
(KJS::Arguments::Arguments):
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/JSObject.cpp:
(KJS::JSObject::getOwnPropertySlot):
(KJS::JSObject::put):
(KJS::JSObject::putWithAttributes):
(KJS::JSObject::deleteProperty):
(KJS::JSObject::findPropertyHashEntry):
(KJS::JSObject::getPropertyNames):
(KJS::Error::create):
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames):
* kjs/NumberObject.cpp:
(KJS::NumberConstructor::NumberConstructor):
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::add):
* kjs/PropertyNameArray.h:
(KJS::PropertyNameArray::PropertyNameArray):
(KJS::PropertyNameArray::addKnownUnique):
* kjs/PropertySlot.h:
(KJS::PropertySlot::getValue):
* kjs/RegExpObject.cpp:
(KJS::RegExpConstructor::RegExpConstructor):
* kjs/ScopeChain.cpp:
(KJS::ScopeChainNode::print):
* kjs/Shell.cpp:
(GlobalObject::GlobalObject):
* kjs/date_object.cpp:
(KJS::DateConstructor::DateConstructor):
* kjs/error_object.cpp:
(KJS::ErrorConstructor::ErrorConstructor):
(KJS::NativeErrorConstructor::NativeErrorConstructor):
* kjs/grammar.y:
* kjs/identifier.cpp:
(KJS::Identifier::add):
(KJS::Identifier::addSlowCase):
* kjs/identifier.h:
(KJS::Identifier::Identifier):
(KJS::Identifier::from):
(KJS::Identifier::equal):
(KJS::Identifier::add):
(KJS::operator==):
(KJS::operator!=):
* kjs/internal.cpp:
(KJS::JSString::getOwnPropertySlot):
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::lex):
(KJS::Lexer::makeIdentifier):
* kjs/lexer.h:
* kjs/lookup.cpp:
(KJS::HashTable::createTable):
* kjs/lookup.h:
(KJS::HashTable::initializeIfNeeded):
(KJS::HashTable::entry):
(KJS::getStaticPropertySlot):
(KJS::getStaticFunctionSlot):
(KJS::getStaticValueSlot):
(KJS::lookupPut):
* kjs/object_object.cpp:
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::ObjectConstructor::ObjectConstructor):
* kjs/string_object.cpp:
(KJS::StringObject::getOwnPropertySlot):
(KJS::StringObject::getPropertyNames):
(KJS::StringConstructor::StringConstructor):
Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
explicit.
* kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
char*, which was incorrect, as that uses the pointer value as a key.
2008-06-16 Thiago Macieira <tjmaciei@trolltech.com>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19577
Fix compilation in C++ environments where C99 headers are not present
The stdbool.h header is a C99 feature, defining the "_Bool" type as well as the
"true" and "false" constants. But it's completely unnecessary in C++ as the
language already defines the "bool" type and its two values.
* API/JSBase.h:
* API/JSContextRef.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSValueRef.h:
2008-06-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by John.
<rdar://problem/6012509> JSProfiler: %s are incorrect if you exclude a
top level node like (idle)
* profiler/Profile.cpp:
(KJS::Profile::focus):
(KJS::Profile::exclude): Subtract the selfTime from the totalTime of the
head since its self time will only be non-zero when one of its children
were excluded. Since the head's totalTime is used to calculate %s when
its totalTime is the same as the sum of all its visible childrens' times
their %s will sum to 100%.
2008-06-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam Weinig.
<rdar://problem/5969992> JSProfiler: Remove the recursion limit in the profiler.
* profiler/Profile.cpp:
(KJS::Profile::willExecute):
2008-06-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
profiler.
- Remove the last of the uses of recursion in the profiler.
* JavaScriptCore.exp: Export the new function's signature.
* profiler/Profile.cpp:
(KJS::calculateVisibleTotalTime): Added a new static method for
recalculating the visibleTotalTime of methods after focus has changed
which are visible.
(KJS::stopProfiling):
(KJS::Profile::focus): Implemented focus without recursion.
* profiler/Profile.h: Moved implementation into the definition file.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::traverseNextNodePreOrder): Added an argument for
whether or not to process the children nodes, this allows focus to skip
sub trees which have been set as not visible.
(KJS::ProfileNode::calculateVisibleTotalTime): This function set's a
node's total visible time to the sum of its self time and its children's
total times.
(KJS::ProfileNode::focus): Implemented focus without recursion.
* profiler/ProfileNode.h:
(KJS::CallIdentifier::operator!= ):
(KJS::ProfileNode::setActualTotalTime): Expanded setting the total time
so that focus could modify only the visible total time.
(KJS::ProfileNode::setVisibleTotalTime):
2008-06-16 Christian Dywan <christian@twotoasts.de>
Reviewed by Sam.
https://bugs.webkit.org/show_bug.cgi?id=19552
JavaScriptCore headers use C++ style comments
Replace all C++ style comments with C style multiline
comments and remove all "mode" lines.
* API/JSBase.h:
* API/JSClassRef.h:
* API/JSContextRef.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSStringRefBSTR.h:
* API/JSStringRefCF.h:
* API/JSValueRef.h:
* API/JavaScript.h:
* API/JavaScriptCore.h:
2008-06-16 Christian Dywan <christian@twotoasts.de>
Reviewed by Sam.
https://bugs.webkit.org/show_bug.cgi?id=19557
(JavaScriptCore) minidom uses C++ style comments
Use only C style comments in minidom sources
* API/JSNode.c:
(JSNode_appendChild):
(JSNode_removeChild):
* API/JSNode.h:
* API/JSNodeList.c:
(JSNodeList_getProperty):
* API/JSNodeList.h:
* API/Node.c:
* API/Node.h:
* API/NodeList.c:
(NodeList_new):
(NodeList_item):
* API/NodeList.h:
* API/minidom.c:
(createStringWithContentsOfFile):
* wtf/Assertions.h:
* wtf/UnusedParam.h:
2008-06-16 Adriaan de Groot <groot@kde.org>
Reviewed by Simon.
Fix compilation on Solaris
On some systems, munmap takes a char* instead of a void* (contrary to POSIX and
Single Unix Specification). Since you can always convert from char* to void*
but not vice-versa, do the casting to char*.
* kjs/collector.cpp:
(KJS::allocateBlock):
(KJS::freeBlock):
2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Make a UnaryOpNode class to reduce boilerplate code for UnaryPlusNode,
NegateNode, BitwiseNotNode, and LogicalNotNode.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::emitToJSNumber):
* kjs/nodes.cpp:
(KJS::UnaryOpNode::emitCode):
* kjs/nodes.h:
(KJS::UnaryOpNode::UnaryOpNode):
(KJS::UnaryPlusNode::):
(KJS::NegateNode::):
(KJS::NegateNode::precedence):
(KJS::BitwiseNotNode::):
(KJS::BitwiseNotNode::precedence):
(KJS::LogicalNotNode::):
(KJS::LogicalNotNode::precedence):
2008-06-16 Jan Michael Alonzo <jmalonzo@webkit.org>
Gtk build fix
* GNUmakefile.am:
2008-06-15 Darin Adler <darin@apple.com>
- rename KJS::List to KJS::ArgList
* API/JSCallbackConstructor.cpp:
(KJS::JSCallbackConstructor::construct):
* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.cpp:
(KJS::JSCallbackFunction::callAsFunction):
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::::construct):
(KJS::::callAsFunction):
* API/JSObjectRef.cpp:
(JSObjectMakeFunction):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
* JavaScriptCore.exp:
* VM/Machine.cpp:
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* kjs/ArrayPrototype.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncReverse):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSort):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
(KJS::ArrayConstructor::construct):
(KJS::ArrayConstructor::callAsFunction):
* kjs/ArrayPrototype.h:
* kjs/BooleanObject.cpp:
(KJS::booleanProtoFuncToString):
(KJS::booleanProtoFuncValueOf):
(KJS::BooleanConstructor::construct):
(KJS::BooleanConstructor::callAsFunction):
* kjs/BooleanObject.h:
* kjs/CommonIdentifiers.h:
* kjs/ExecState.h:
(KJS::ExecState::emptyList):
* kjs/FunctionPrototype.cpp:
(KJS::FunctionPrototype::callAsFunction):
(KJS::functionProtoFuncToString):
(KJS::functionProtoFuncApply):
(KJS::functionProtoFuncCall):
(KJS::FunctionConstructor::construct):
(KJS::FunctionConstructor::callAsFunction):
* kjs/FunctionPrototype.h:
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject):
* kjs/JSArray.cpp:
(KJS::JSArray::JSArray):
(KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
* kjs/JSArray.h:
* kjs/JSFunction.cpp:
(KJS::JSFunction::callAsFunction):
(KJS::JSFunction::construct):
(KJS::IndexToNameMap::IndexToNameMap):
(KJS::Arguments::Arguments):
(KJS::encode):
(KJS::decode):
(KJS::globalFuncEval):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncIsNaN):
(KJS::globalFuncIsFinite):
(KJS::globalFuncDecodeURI):
(KJS::globalFuncDecodeURIComponent):
(KJS::globalFuncEncodeURI):
(KJS::globalFuncEncodeURIComponent):
(KJS::globalFuncEscape):
(KJS::globalFuncUnescape):
(KJS::globalFuncKJSPrint):
(KJS::PrototypeFunction::callAsFunction):
(KJS::PrototypeReflexiveFunction::callAsFunction):
* kjs/JSFunction.h:
* kjs/JSGlobalData.h:
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::toObject):
* kjs/JSNotAnObject.cpp:
(KJS::JSNotAnObject::construct):
(KJS::JSNotAnObject::callAsFunction):
* kjs/JSNotAnObject.h:
* kjs/JSObject.cpp:
(KJS::JSObject::put):
(KJS::JSObject::construct):
(KJS::JSObject::callAsFunction):
(KJS::Error::create):
* kjs/JSObject.h:
* kjs/MathObject.cpp:
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/MathObject.h:
* kjs/NumberObject.cpp:
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncValueOf):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
(KJS::NumberConstructor::construct):
(KJS::NumberConstructor::callAsFunction):
* kjs/NumberObject.h:
* kjs/RegExpObject.cpp:
(KJS::regExpProtoFuncTest):
(KJS::regExpProtoFuncExec):
(KJS::regExpProtoFuncCompile):
(KJS::regExpProtoFuncToString):
(KJS::RegExpObject::match):
(KJS::RegExpObject::test):
(KJS::RegExpObject::exec):
(KJS::RegExpObject::callAsFunction):
(KJS::RegExpConstructor::construct):
(KJS::RegExpConstructor::callAsFunction):
* kjs/RegExpObject.h:
* kjs/Shell.cpp:
(functionPrint):
(functionDebug):
(functionGC):
(functionVersion):
(functionRun):
(functionLoad):
(functionReadline):
(functionQuit):
* kjs/collector.cpp:
(KJS::Collector::collect):
* kjs/collector.h:
(KJS::Collector::markListSet):
* kjs/date_object.cpp:
(KJS::formatLocaleDate):
(KJS::fillStructuresUsingTimeArgs):
(KJS::fillStructuresUsingDateArgs):
(KJS::DateConstructor::construct):
(KJS::DateConstructor::callAsFunction):
(KJS::DateFunction::callAsFunction):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetMilliSeconds):
(KJS::dateProtoFuncSetUTCMilliseconds):
(KJS::dateProtoFuncSetSeconds):
(KJS::dateProtoFuncSetUTCSeconds):
(KJS::dateProtoFuncSetMinutes):
(KJS::dateProtoFuncSetUTCMinutes):
(KJS::dateProtoFuncSetHours):
(KJS::dateProtoFuncSetUTCHours):
(KJS::dateProtoFuncSetDate):
(KJS::dateProtoFuncSetUTCDate):
(KJS::dateProtoFuncSetMonth):
(KJS::dateProtoFuncSetUTCMonth):
(KJS::dateProtoFuncSetFullYear):
(KJS::dateProtoFuncSetUTCFullYear):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/date_object.h:
* kjs/debugger.h:
* kjs/error_object.cpp:
(KJS::errorProtoFuncToString):
(KJS::ErrorConstructor::construct):
(KJS::ErrorConstructor::callAsFunction):
(KJS::NativeErrorConstructor::construct):
(KJS::NativeErrorConstructor::callAsFunction):
* kjs/error_object.h:
* kjs/internal.cpp:
(KJS::JSNumberCell::toObject):
(KJS::JSNumberCell::toThisObject):
* kjs/list.cpp:
(KJS::ArgList::getSlice):
(KJS::ArgList::markLists):
(KJS::ArgList::slowAppend):
* kjs/list.h:
(KJS::ArgList::ArgList):
(KJS::ArgList::~ArgList):
* kjs/object_object.cpp:
(KJS::objectProtoFuncValueOf):
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncIsPrototypeOf):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
(KJS::ObjectConstructor::construct):
(KJS::ObjectConstructor::callAsFunction):
* kjs/object_object.h:
* kjs/string_object.cpp:
(KJS::replace):
(KJS::stringProtoFuncToString):
(KJS::stringProtoFuncValueOf):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
(KJS::StringConstructor::construct):
(KJS::StringConstructor::callAsFunction):
(KJS::StringConstructorFunction::callAsFunction):
* kjs/string_object.h:
2008-06-15 Darin Adler <darin@apple.com>
- new names for more JavaScriptCore files
* API/JSCallbackFunction.cpp:
* API/JSObjectRef.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/Machine.cpp:
* kjs/AllInOneFile.cpp:
* kjs/ArrayPrototype.cpp: Copied from JavaScriptCore/kjs/array_object.cpp.
* kjs/ArrayPrototype.h: Copied from JavaScriptCore/kjs/array_object.h.
* kjs/BooleanObject.cpp: Copied from JavaScriptCore/kjs/bool_object.cpp.
* kjs/BooleanObject.h: Copied from JavaScriptCore/kjs/bool_object.h.
* kjs/ExecState.cpp:
* kjs/ExecState.h:
* kjs/FunctionPrototype.cpp: Copied from JavaScriptCore/kjs/function_object.cpp.
* kjs/FunctionPrototype.h: Copied from JavaScriptCore/kjs/function_object.h.
* kjs/JSArray.cpp: Copied from JavaScriptCore/kjs/array_instance.cpp.
* kjs/JSArray.h: Copied from JavaScriptCore/kjs/array_instance.h.
* kjs/JSFunction.cpp:
* kjs/JSFunction.h:
* kjs/JSGlobalObject.cpp:
* kjs/JSImmediate.cpp:
* kjs/JSObject.h:
* kjs/JSString.h:
* kjs/JSValue.h:
* kjs/JSVariableObject.cpp:
* kjs/MathObject.cpp: Copied from JavaScriptCore/kjs/math_object.cpp.
* kjs/MathObject.h: Copied from JavaScriptCore/kjs/math_object.h.
* kjs/NumberObject.cpp: Copied from JavaScriptCore/kjs/number_object.cpp.
* kjs/NumberObject.h: Copied from JavaScriptCore/kjs/number_object.h.
* kjs/PropertyMap.cpp: Copied from JavaScriptCore/kjs/property_map.cpp.
* kjs/PropertyMap.h: Copied from JavaScriptCore/kjs/property_map.h.
* kjs/PropertySlot.cpp: Copied from JavaScriptCore/kjs/property_slot.cpp.
* kjs/PropertySlot.h: Copied from JavaScriptCore/kjs/property_slot.h.
* kjs/RegExpObject.cpp: Copied from JavaScriptCore/kjs/regexp_object.cpp.
* kjs/RegExpObject.h: Copied from JavaScriptCore/kjs/regexp_object.h.
* kjs/ScopeChain.cpp: Copied from JavaScriptCore/kjs/scope_chain.cpp.
* kjs/ScopeChain.h: Copied from JavaScriptCore/kjs/scope_chain.h.
* kjs/ScopeChainMark.h: Copied from JavaScriptCore/kjs/scope_chain_mark.h.
* kjs/Shell.cpp:
* kjs/array_instance.cpp: Removed.
* kjs/array_instance.h: Removed.
* kjs/array_object.cpp: Removed.
* kjs/array_object.h: Removed.
* kjs/bool_object.cpp: Removed.
* kjs/bool_object.h: Removed.
* kjs/error_object.h:
* kjs/function_object.cpp: Removed.
* kjs/function_object.h: Removed.
* kjs/internal.cpp:
* kjs/math_object.cpp: Removed.
* kjs/math_object.h: Removed.
* kjs/nodes.cpp:
* kjs/number_object.cpp: Removed.
* kjs/number_object.h: Removed.
* kjs/object_object.cpp:
* kjs/property_map.cpp: Removed.
* kjs/property_map.h: Removed.
* kjs/property_slot.cpp: Removed.
* kjs/property_slot.h: Removed.
* kjs/regexp_object.cpp: Removed.
* kjs/regexp_object.h: Removed.
* kjs/scope_chain.cpp: Removed.
* kjs/scope_chain.h: Removed.
* kjs/scope_chain_mark.h: Removed.
* kjs/string_object.cpp:
* kjs/string_object.h:
2008-06-15 Darin Adler <darin@apple.com>
- new names for a few key JavaScriptCore files
* API/JSBase.cpp:
* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.cpp:
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
* API/JSClassRef.h:
* API/JSContextRef.cpp:
* API/JSObjectRef.cpp:
* API/JSStringRef.cpp:
* API/JSStringRefCF.cpp:
* API/JSValueRef.cpp:
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/CodeBlock.cpp:
* VM/CodeGenerator.cpp:
* VM/ExceptionHelpers.cpp:
* VM/ExceptionHelpers.h:
* VM/JSPropertyNameIterator.cpp:
* VM/JSPropertyNameIterator.h:
* VM/Machine.cpp:
* kjs/AllInOneFile.cpp:
* kjs/DateMath.cpp:
* kjs/DebuggerCallFrame.cpp:
* kjs/ExecState.cpp:
* kjs/JSActivation.cpp:
* kjs/JSFunction.cpp: Copied from JavaScriptCore/kjs/function.cpp.
* kjs/JSFunction.h: Copied from JavaScriptCore/kjs/function.h.
* kjs/JSImmediate.cpp:
* kjs/JSNotAnObject.h:
* kjs/JSObject.cpp: Copied from JavaScriptCore/kjs/object.cpp.
* kjs/JSObject.h: Copied from JavaScriptCore/kjs/object.h.
* kjs/JSString.h: Copied from JavaScriptCore/kjs/internal.h.
* kjs/JSValue.cpp: Copied from JavaScriptCore/kjs/value.cpp.
* kjs/JSValue.h: Copied from JavaScriptCore/kjs/value.h.
* kjs/JSVariableObject.h:
* kjs/JSWrapperObject.h:
* kjs/Shell.cpp:
* kjs/SymbolTable.h:
* kjs/array_instance.h:
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/error_object.cpp:
* kjs/function.cpp: Removed.
* kjs/function.h: Removed.
* kjs/function_object.cpp:
* kjs/function_object.h:
* kjs/grammar.y:
* kjs/internal.cpp:
* kjs/internal.h: Removed.
* kjs/lexer.cpp:
* kjs/list.h:
* kjs/lookup.h:
* kjs/nodes.h:
* kjs/object.cpp: Removed.
* kjs/object.h: Removed.
* kjs/object_object.h:
* kjs/operations.cpp:
* kjs/property_map.cpp:
* kjs/property_slot.cpp:
* kjs/property_slot.h:
* kjs/protect.h:
* kjs/regexp_object.cpp:
* kjs/scope_chain.cpp:
* kjs/string_object.h:
* kjs/ustring.cpp:
* kjs/value.cpp: Removed.
* kjs/value.h: Removed.
* profiler/Profile.cpp:
* profiler/Profiler.cpp:
2008-06-15 Darin Adler <darin@apple.com>
Rubber stamped by Sam.
- cut down on confusing uses of "Object" and "Imp" in
JavaScriptCore class names
* API/JSCallbackFunction.cpp:
(KJS::JSCallbackFunction::JSCallbackFunction):
* API/JSCallbackFunction.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/ExecState.h:
(KJS::ExecState::regExpTable):
(KJS::ExecState::regExpConstructorTable):
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
(KJS::JSGlobalData::~JSGlobalData):
* kjs/JSGlobalData.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::objectConstructor):
(KJS::JSGlobalObject::functionConstructor):
(KJS::JSGlobalObject::arrayConstructor):
(KJS::JSGlobalObject::booleanConstructor):
(KJS::JSGlobalObject::stringConstructor):
(KJS::JSGlobalObject::numberConstructor):
(KJS::JSGlobalObject::dateConstructor):
(KJS::JSGlobalObject::regExpConstructor):
(KJS::JSGlobalObject::errorConstructor):
(KJS::JSGlobalObject::evalErrorConstructor):
(KJS::JSGlobalObject::rangeErrorConstructor):
(KJS::JSGlobalObject::referenceErrorConstructor):
(KJS::JSGlobalObject::syntaxErrorConstructor):
(KJS::JSGlobalObject::typeErrorConstructor):
(KJS::JSGlobalObject::URIErrorConstructor):
* kjs/array_object.cpp:
(KJS::ArrayConstructor::ArrayConstructor):
(KJS::ArrayConstructor::getConstructData):
(KJS::ArrayConstructor::construct):
(KJS::ArrayConstructor::callAsFunction):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(KJS::BooleanObject::BooleanObject):
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::booleanProtoFuncValueOf):
(KJS::BooleanConstructor::BooleanConstructor):
(KJS::BooleanConstructor::getConstructData):
(KJS::BooleanConstructor::construct):
(KJS::BooleanConstructor::callAsFunction):
* kjs/bool_object.h:
* kjs/date_object.cpp:
(KJS::DatePrototype::DatePrototype):
(KJS::DateConstructor::DateConstructor):
(KJS::DateConstructor::getConstructData):
(KJS::DateConstructor::construct):
(KJS::DateConstructor::callAsFunction):
(KJS::DateFunction::DateFunction):
(KJS::DateFunction::callAsFunction):
* kjs/date_object.h:
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::ErrorConstructor::ErrorConstructor):
(KJS::ErrorConstructor::getConstructData):
(KJS::ErrorConstructor::construct):
(KJS::ErrorConstructor::callAsFunction):
(KJS::NativeErrorConstructor::NativeErrorConstructor):
(KJS::NativeErrorConstructor::getConstructData):
(KJS::NativeErrorConstructor::construct):
(KJS::NativeErrorConstructor::callAsFunction):
(KJS::NativeErrorConstructor::mark):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::JSFunction::JSFunction):
(KJS::JSFunction::mark):
(KJS::JSFunction::getOwnPropertySlot):
(KJS::JSFunction::put):
(KJS::JSFunction::deleteProperty):
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
(KJS::PrototypeReflexiveFunction::mark):
* kjs/function.h:
* kjs/function_object.cpp:
(KJS::functionProtoFuncToString):
(KJS::FunctionConstructor::FunctionConstructor):
(KJS::FunctionConstructor::getConstructData):
(KJS::FunctionConstructor::construct):
(KJS::FunctionConstructor::callAsFunction):
* kjs/function_object.h:
* kjs/internal.cpp:
(KJS::StringObject::create):
(KJS::JSString::toObject):
(KJS::JSString::toThisObject):
(KJS::JSString::getOwnPropertySlot):
(KJS::InternalFunction::InternalFunction):
(KJS::InternalFunction::getCallData):
(KJS::InternalFunction::implementsHasInstance):
* kjs/math_object.cpp:
(KJS::MathObject::MathObject):
(KJS::MathObject::getOwnPropertySlot):
(KJS::MathObject::getValueProperty):
* kjs/math_object.h:
* kjs/number_object.cpp:
(KJS::NumberObject::NumberObject):
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncValueOf):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
(KJS::NumberConstructor::NumberConstructor):
(KJS::NumberConstructor::getOwnPropertySlot):
(KJS::NumberConstructor::getValueProperty):
(KJS::NumberConstructor::getConstructData):
(KJS::NumberConstructor::construct):
(KJS::NumberConstructor::callAsFunction):
* kjs/number_object.h:
* kjs/object.cpp:
(KJS::JSObject::putDirectFunction):
* kjs/object.h:
* kjs/object_object.cpp:
(KJS::ObjectConstructor::ObjectConstructor):
(KJS::ObjectConstructor::getConstructData):
(KJS::ObjectConstructor::construct):
(KJS::ObjectConstructor::callAsFunction):
* kjs/object_object.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp):
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncTest):
(KJS::regExpProtoFuncExec):
(KJS::regExpProtoFuncCompile):
(KJS::regExpProtoFuncToString):
(KJS::RegExpObject::RegExpObject):
(KJS::RegExpObject::~RegExpObject):
(KJS::RegExpObject::getOwnPropertySlot):
(KJS::RegExpObject::getValueProperty):
(KJS::RegExpObject::put):
(KJS::RegExpObject::putValueProperty):
(KJS::RegExpObject::match):
(KJS::RegExpObject::test):
(KJS::RegExpObject::exec):
(KJS::RegExpObject::getCallData):
(KJS::RegExpObject::callAsFunction):
(KJS::RegExpConstructorPrivate::RegExpConstructorPrivate):
(KJS::RegExpConstructor::RegExpConstructor):
(KJS::RegExpConstructor::performMatch):
(KJS::RegExpMatchesArray::RegExpMatchesArray):
(KJS::RegExpMatchesArray::~RegExpMatchesArray):
(KJS::RegExpMatchesArray::fillArrayInstance):
(KJS::RegExpConstructor::arrayOfMatches):
(KJS::RegExpConstructor::getBackref):
(KJS::RegExpConstructor::getLastParen):
(KJS::RegExpConstructor::getLeftContext):
(KJS::RegExpConstructor::getRightContext):
(KJS::RegExpConstructor::getOwnPropertySlot):
(KJS::RegExpConstructor::getValueProperty):
(KJS::RegExpConstructor::put):
(KJS::RegExpConstructor::putValueProperty):
(KJS::RegExpConstructor::getConstructData):
(KJS::RegExpConstructor::construct):
(KJS::RegExpConstructor::callAsFunction):
(KJS::RegExpConstructor::input):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(KJS::StringObject::StringObject):
(KJS::StringObject::getOwnPropertySlot):
(KJS::StringObject::put):
(KJS::StringObject::deleteProperty):
(KJS::StringObject::getPropertyNames):
(KJS::StringPrototype::StringPrototype):
(KJS::StringPrototype::getOwnPropertySlot):
(KJS::replace):
(KJS::stringProtoFuncToString):
(KJS::stringProtoFuncValueOf):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
(KJS::StringConstructor::StringConstructor):
(KJS::StringConstructor::getConstructData):
(KJS::StringConstructor::construct):
(KJS::StringConstructor::callAsFunction):
(KJS::StringConstructorFunction::StringConstructorFunction):
(KJS::StringConstructorFunction::callAsFunction):
* kjs/string_object.h:
(KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
* profiler/Profiler.cpp:
(KJS::createCallIdentifier):
2008-06-15 Darin Adler <darin@apple.com>
Rubber stamped by Sam.
- use JS prefix and simpler names for basic JavaScriptCore types,
to complement JSValue and JSObject
* JavaScriptCore.exp:
* VM/Machine.cpp:
(KJS::jsLess):
(KJS::jsLessEq):
(KJS::jsAdd):
(KJS::callEval):
(KJS::Machine::execute):
(KJS::Machine::retrieveArguments):
(KJS::Machine::retrieveCaller):
(KJS::Machine::getCallFrame):
(KJS::Machine::getFunctionAndArguments):
* VM/Machine.h:
* VM/Register.h:
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::functionName):
* kjs/ExecState.h:
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject):
* kjs/array_instance.cpp:
(KJS::JSArray::checkConsistency):
(KJS::JSArray::JSArray):
(KJS::JSArray::~JSArray):
(KJS::JSArray::getItem):
(KJS::JSArray::lengthGetter):
(KJS::JSArray::inlineGetOwnPropertySlot):
(KJS::JSArray::getOwnPropertySlot):
(KJS::JSArray::put):
(KJS::JSArray::deleteProperty):
(KJS::JSArray::getPropertyNames):
(KJS::JSArray::increaseVectorLength):
(KJS::JSArray::setLength):
(KJS::JSArray::mark):
(KJS::JSArray::sort):
(KJS::JSArray::compactForSorting):
(KJS::JSArray::lazyCreationData):
(KJS::JSArray::setLazyCreationData):
* kjs/array_instance.h:
* kjs/array_object.cpp:
(KJS::ArrayPrototype::ArrayPrototype):
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncSort):
(KJS::ArrayObjectImp::construct):
* kjs/array_object.h:
* kjs/completion.h:
* kjs/function.cpp:
(KJS::JSFunction::JSFunction):
(KJS::JSFunction::mark):
(KJS::JSFunction::getCallData):
(KJS::JSFunction::callAsFunction):
(KJS::JSFunction::argumentsGetter):
(KJS::JSFunction::callerGetter):
(KJS::JSFunction::lengthGetter):
(KJS::JSFunction::getOwnPropertySlot):
(KJS::JSFunction::put):
(KJS::JSFunction::deleteProperty):
(KJS::JSFunction::getParameterName):
(KJS::JSFunction::getConstructData):
(KJS::JSFunction::construct):
(KJS::IndexToNameMap::IndexToNameMap):
(KJS::Arguments::Arguments):
* kjs/function.h:
* kjs/function_object.cpp:
(KJS::functionProtoFuncToString):
(KJS::functionProtoFuncApply):
(KJS::FunctionObjectImp::construct):
* kjs/internal.cpp:
(KJS::JSString::toPrimitive):
(KJS::JSString::getPrimitiveNumber):
(KJS::JSString::toBoolean):
(KJS::JSString::toNumber):
(KJS::JSString::toString):
(KJS::StringInstance::create):
(KJS::JSString::toObject):
(KJS::JSString::toThisObject):
(KJS::JSString::lengthGetter):
(KJS::JSString::indexGetter):
(KJS::JSString::indexNumericPropertyGetter):
(KJS::JSString::getOwnPropertySlot):
(KJS::JSNumberCell::type):
(KJS::JSNumberCell::toPrimitive):
(KJS::JSNumberCell::getPrimitiveNumber):
(KJS::JSNumberCell::toBoolean):
(KJS::JSNumberCell::toNumber):
(KJS::JSNumberCell::toString):
(KJS::JSNumberCell::toObject):
(KJS::JSNumberCell::toThisObject):
(KJS::JSNumberCell::getUInt32):
(KJS::JSNumberCell::getTruncatedInt32):
(KJS::JSNumberCell::getTruncatedUInt32):
(KJS::GetterSetter::mark):
(KJS::GetterSetter::toPrimitive):
(KJS::GetterSetter::getPrimitiveNumber):
(KJS::GetterSetter::toBoolean):
(KJS::GetterSetter::toNumber):
(KJS::GetterSetter::toString):
(KJS::GetterSetter::toObject):
(KJS::GetterSetter::getOwnPropertySlot):
(KJS::GetterSetter::put):
(KJS::GetterSetter::toThisObject):
* kjs/internal.h:
(KJS::JSString::JSString):
(KJS::JSString::getStringPropertySlot):
* kjs/nodes.cpp:
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::makeFunction):
* kjs/nodes.h:
* kjs/object.cpp:
(KJS::JSObject::put):
(KJS::JSObject::deleteProperty):
(KJS::JSObject::defineGetter):
(KJS::JSObject::defineSetter):
(KJS::JSObject::lookupGetter):
(KJS::JSObject::lookupSetter):
(KJS::JSObject::fillGetterPropertySlot):
* kjs/object.h:
(KJS::GetterSetter::GetterSetter):
* kjs/operations.cpp:
(KJS::equal):
(KJS::strictEqual):
* kjs/property_map.cpp:
(KJS::PropertyMap::containsGettersOrSetters):
* kjs/regexp_object.cpp:
(KJS::RegExpMatchesArray::getOwnPropertySlot):
(KJS::RegExpMatchesArray::put):
(KJS::RegExpMatchesArray::deleteProperty):
(KJS::RegExpMatchesArray::getPropertyNames):
(KJS::RegExpMatchesArray::RegExpMatchesArray):
(KJS::RegExpMatchesArray::fillArrayInstance):
* kjs/string_object.cpp:
(KJS::StringInstance::StringInstance):
(KJS::replace):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
* kjs/string_object.h:
(KJS::StringInstance::internalValue):
* kjs/value.cpp:
(KJS::JSCell::getNumber):
(KJS::JSCell::getString):
(KJS::JSCell::getObject):
(KJS::jsString):
(KJS::jsOwnedString):
* kjs/value.h:
(KJS::JSNumberCell::JSNumberCell):
(KJS::jsNumberCell):
(KJS::JSValue::uncheckedGetNumber):
* profiler/Profiler.cpp:
(KJS::createCallIdentifier):
(KJS::createCallIdentifierFromFunctionImp):
2008-06-15 Maciej Stachowiak <mjs@apple.com>
Reviewed by Alexey.
- add emitUnaryOp, emitNullaryOp and emitUnaryOpNoDst; use them
This removes some boilerplate code and also reduces the number of
places that will need to be changed to do on-demand emit of
loads (and thus support k operands).
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitUnaryOp):
(KJS::CodeGenerator::emitNullaryOp):
(KJS::CodeGenerator::emitUnaryOpNoDst):
(KJS::CodeGenerator::emitPushScope):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::emitNewObject):
(KJS::CodeGenerator::emitNewArray):
(KJS::CodeGenerator::emitNot):
(KJS::CodeGenerator::emitBitNot):
(KJS::CodeGenerator::emitToJSNumber):
(KJS::CodeGenerator::emitNegate):
(KJS::CodeGenerator::emitInstanceOf):
(KJS::CodeGenerator::emitTypeOf):
(KJS::CodeGenerator::emitIn):
(KJS::CodeGenerator::emitReturn):
(KJS::CodeGenerator::emitEnd):
(KJS::CodeGenerator::emitGetPropertyNames):
2008-06-15 Alp Toker <alp@nuanti.com>
Rubber-stamped by Maciej.
Install 'jsc' application by default.
* GNUmakefile.am:
2008-06-15 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- rename testkjs to jsc
* GNUmakefile.am:
* JavaScriptCore.vcproj/JavaScriptCore.sln:
* JavaScriptCore.vcproj/jsc: Added.
* JavaScriptCore.vcproj/jsc/jsc.vcproj: Copied from JavaScriptCore.vcproj/testkjs/testkjs.vcproj.
* JavaScriptCore.vcproj/testkjs: Removed.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Removed.
* JavaScriptCore.xcodeproj/project.pbxproj:
* jscore.bkl:
* kjs/Shell.cpp: Copied from kjs/testkjs.cpp.
(main):
(printUsageStatement):
(jscmain):
* kjs/jsc.pro: Copied from kjs/testkjs.pro.
* kjs/testkjs.cpp: Removed.
* kjs/testkjs.pro: Removed.
* tests/mozilla/expected.html:
* tests/mozilla/js1_2/Array/tostring_1.js:
* tests/mozilla/js1_2/Array/tostring_2.js:
* tests/mozilla/jsDriver.pl:
2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Mac build fix.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.h:
2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Change the spelling of PrecMultiplicitave to PrecMultiplicative.
* kjs/nodes.h:
(KJS::MultNode::precedence):
(KJS::DivNode::precedence):
(KJS::ModNode::precedence):
2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Remove unused preprocessor macros related to exceptions in the old
interpreter.
* kjs/nodes.cpp:
2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 19484: More instructions needs to use temporary registers
<https://bugs.webkit.org/show_bug.cgi?id=19484>
Fix codegen for all binary operations so that temporaries are used if
necessary. This was done by making BinaryOpNode and ReverseBinaryOpNode
subclasses of ExpressionNode, and eliminating the custom emitCode()
methods for the individual node classes.
This only adds 3 new instructions to SunSpider code, and there is no
difference in SunSpider execution time.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitBitNot):
(KJS::CodeGenerator::emitBinaryOp):
* VM/CodeGenerator.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::BinaryOpNode::emitCode):
(KJS::ReverseBinaryOpNode::emitCode):
(KJS::emitReadModifyAssignment):
(KJS::CaseBlockNode::emitCodeForBlock):
* kjs/nodes.h:
(KJS::BinaryOpNode::BinaryOpNode):
(KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
(KJS::MultNode::):
(KJS::DivNode::):
(KJS::DivNode::precedence):
(KJS::ModNode::):
(KJS::ModNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::SubNode::):
(KJS::SubNode::precedence):
(KJS::LeftShiftNode::):
(KJS::LeftShiftNode::precedence):
(KJS::RightShiftNode::):
(KJS::RightShiftNode::precedence):
(KJS::UnsignedRightShiftNode::):
(KJS::UnsignedRightShiftNode::precedence):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::GreaterNode::):
(KJS::GreaterNode::precedence):
(KJS::LessEqNode::):
(KJS::LessEqNode::precedence):
(KJS::GreaterEqNode::):
(KJS::GreaterEqNode::precedence):
(KJS::InstanceOfNode::):
(KJS::InstanceOfNode::precedence):
(KJS::InNode::):
(KJS::InNode::precedence):
(KJS::EqualNode::):
(KJS::EqualNode::precedence):
(KJS::NotEqualNode::):
(KJS::NotEqualNode::precedence):
(KJS::StrictEqualNode::):
(KJS::StrictEqualNode::precedence):
(KJS::NotStrictEqualNode::):
(KJS::NotStrictEqualNode::precedence):
(KJS::BitAndNode::):
(KJS::BitAndNode::precedence):
(KJS::BitOrNode::):
(KJS::BitOrNode::precedence):
(KJS::BitXOrNode::):
(KJS::BitXOrNode::precedence):
* kjs/nodes2string.cpp:
(KJS::LessNode::streamTo):
(KJS::GreaterNode::streamTo):
(KJS::LessEqNode::streamTo):
(KJS::GreaterEqNode::streamTo):
(KJS::InstanceOfNode::streamTo):
(KJS::InNode::streamTo):
(KJS::EqualNode::streamTo):
(KJS::NotEqualNode::streamTo):
(KJS::StrictEqualNode::streamTo):
(KJS::NotStrictEqualNode::streamTo):
(KJS::BitAndNode::streamTo):
(KJS::BitXOrNode::streamTo):
(KJS::BitOrNode::streamTo):
2008-06-14 Darin Adler <darin@apple.com>
Rubber stamped by Sam.
- rename a bunch of local symbols within the regular expression code to
follow our usual coding style, and do a few other name tweaks
* pcre/pcre_compile.cpp:
(CompileData::CompileData):
(checkEscape):
(readRepeatCounts):
(compileBranch):
(compileBracket):
(calculateCompiledPatternLength):
(returnError):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::popCurrentFrame):
(match):
(tryFirstByteOptimization):
(tryRequiredByteOptimization):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Remove redundant uses of get().
* kjs/nodes.cpp:
(KJS::BracketAccessorNode::emitCode):
(KJS::AddNode::emitCode):
(KJS::SubNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Make code generation not use a temporary for the left-hand side of an
expression if the right-hand side is a local variable.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::isLocal):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::leftHandSideNeedsCopy):
(KJS::CodeGenerator::emitNodeForLeftHandSide):
* kjs/nodes.cpp:
(KJS::ResolveNode::isPure):
(KJS::BracketAccessorNode::emitCode):
(KJS::AddNode::emitCode):
(KJS::SubNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::BooleanNode::):
(KJS::NumberNode::):
(KJS::StringNode::):
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more of https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* kjs/nodes.cpp:
(KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
* kjs/nodes.h: Replaced refcount with hasOneRef.
* wtf/ListRefPtr.h:
(WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
refcount, so this class can be used with the RefCounted template.
* wtf/RefCounted.h:
(WTF::RefCounted::hasOneRef): Made const, since there's no reason for
it to be non-const.
2008-06-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- initialize local vars as side effect of call instead of in bytecode
1.004x speedup on SunSpider.
This removes just the dispatch overhead for these loads - in the
future, dead store elimination might be able to eliminate them
entirely.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator): For function blocks, don't
emit loads of undefined for var initialization.
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall): Instead, initialize locals
as part of the call.
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Remove helper functions in the parser that are no longer needed.
* kjs/grammar.y:
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 19484: More instructions needs to use temporary registers
<https://bugs.webkit.org/show_bug.cgi?id=19484>
Make code generation for AddNode and SubNode use temporaries when
necessary.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::AddNode::emitCode):
(KJS::SubNode::emitCode):
* kjs/nodes.h:
(KJS::AddNode::):
(KJS::SubNode::):
2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Combine TrueNode and FalseNode to make BooleanNode, and remove the
unused class PlaceholderTrueNode.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BooleanNode::emitCode):
* kjs/nodes.h:
(KJS::BooleanNode::):
(KJS::BooleanNode::precedence):
* kjs/nodes2string.cpp:
(KJS::BooleanNode::streamTo):
2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Eliminate the use of temporaries to store the left hand side of an
expression when the right hand side is a constant. This slightly
improves the generated bytecode for a few SunSpider tests, but it is
mostly in preparation for fixing
Bug 19484: More instructions needs to use temporary registers
<https://bugs.webkit.org/show_bug.cgi?id=19484>
* VM/CodeGenerator.h:
(KJS::CodeGenerator::leftHandSideNeedsCopy):
(KJS::CodeGenerator::emitNodeForLeftHandSide):
* kjs/nodes.cpp:
(KJS::BracketAccessorNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::FalseNode::):
(KJS::TrueNode::):
(KJS::NumberNode::):
(KJS::StringNode::):
2008-06-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- prettify opcode stats output
I changed things to be a bit more aligned, also there is a new
section listing most common opcodes and most common sequences that
include them.
* VM/Opcode.cpp:
(KJS::OpcodeStats::~OpcodeStats):
* VM/Opcode.h:
2008-06-13 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
<rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
profiler.
- Remove recursion from exclude(). This leaves only focus() to fix.
* JavaScriptCore.exp: Change the signatures of the exported functions.
* profiler/Profile.cpp:
(KJS::Profile::forEach): I added a traverseNextNodePreOrder() function
and so needed to distinguish the other function by labeling it
traverseNextNodePostOrder().
(KJS::Profile::exclude): All new exclude that iteratively walks the tree
* profiler/Profile.h:
(KJS::Profile::focus): Add a null check for m_head.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::traverseNextNodePostOrder): Renamed
(KJS::ProfileNode::traverseNextNodePreOrder): Walks the tree in pre-
order, where the parent is processed before the children.
(KJS::ProfileNode::setTreeVisible): Iterate over the sub-tree and set
all of the nodes visible value. This changes another function that used
recursion.
(KJS::ProfileNode::exclude): Remove recursion from this function.
Because we now check for m_visible and we are walking the tree in pre-
order we do not need to check if an excluded node is in an excluded
sub-tree.
* profiler/ProfileNode.h: Added specific selfTime functions to
facilitate exclude().
(KJS::ProfileNode::setSelfTime):
(KJS::ProfileNode::setActualSelfTime):
(KJS::ProfileNode::setVisibleSelfTime):
2008-06-12 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- https://bugs.webkit.org/show_bug.cgi?id=19434
speed up SunSpider by avoiding some string boxing
Speeds up SunSpider by 1.1%.
Optimized code path for getting built-in properties from strings -- avoid
boxing with a string object in that case. We can make further changes to avoid
even more boxing, but this change alone is a win.
* API/JSCallbackObjectFunctions.h:
(KJS::JSCallbackObject::staticValueGetter): Use isObject instead of inherits
in asssert, since the type of slotBase() is now JSValue, not JSObject.
(KJS::JSCallbackObject::staticFunctionGetter): Ditto.
(KJS::JSCallbackObject::callbackGetter): Ditto.
* kjs/internal.cpp:
(KJS::StringImp::getPrimitiveNumber): Updated for change of data member name.
(KJS::StringImp::toBoolean): Ditto.
(KJS::StringImp::toNumber): Ditto.
(KJS::StringImp::toString): Ditto.
(KJS::StringInstance::create): Added; avoids a bit of cut and paste code.
(KJS::StringImp::toObject): Use StringInstance::create.
(KJS::StringImp::toThisObject): Ditto.
(KJS::StringImp::lengthGetter): Added. Replaces the getter that used to live in
the StringInstance class.
(KJS::StringImp::indexGetter): Ditto.
(KJS::StringImp::indexNumericPropertyGetter): Ditto.
(KJS::StringImp::getOwnPropertySlot): Added. Deals with built in properties of
the string class without creating a StringInstance.
* kjs/internal.h:
(KJS::StringImp::getStringPropertySlot): Added. To be used by both the string
and string object getOwnPropertySlot function.
* kjs/lookup.h:
(KJS::staticFunctionGetter): Updated since slotBase() is now a JSValue rather
than a JSObject.
* kjs/object.h: Removed PropertySlot::slotBase() function, which can now move
back into property_slot.h where it belongs since it doesn't have to cast to
JSObject*.
* kjs/property_slot.cpp:
(KJS::PropertySlot::functionGetter): Updated since slot.slotBase() is now a JSValue*
instead of JSObject*. setGetterSlot still guarantees the base is a JSObject*.
* kjs/property_slot.h:
(KJS::PropertySlot::PropertySlot): Changed base to JSValue* intead of JSCell*.
(KJS::PropertySlot::setStaticEntry): Ditto.
(KJS::PropertySlot::setCustom): Ditto.
(KJS::PropertySlot::setCustomIndex): Ditto.
(KJS::PropertySlot::setCustomNumeric): Ditto.
(KJS::PropertySlot::slotBase): Moved inline here since it no longer involves a
downcast to JSObject*.
(KJS::PropertySlot::setBase): Changed to JSValue*.
* kjs/string_object.cpp:
(KJS::StringInstance::getOwnPropertySlot): Changed to use getStringPropertySlot
instead of coding the properties here. This allows sharing the code with StringImp.
* kjs/string_object.h: Removed inlineGetOwnPropertySlot, lengthGetter, and indexGetter.
Made one of the constructors protected.
* kjs/value.h: Made getOwnPropertySlot private in the JSCell class -- this is better
since it's not the real JSObject getOwnPropertySlot semantic and most callers shouldn't
use it.
2008-06-12 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej.
Preparation to making JavaScript heap per-thread.
* kjs/collector.cpp:
(KJS::Collector::collect):
* kjs/collector.h:
(KJS::Collector::markListSet):
The collector now holds the list of protected lists itself, to be made per-instance.
* kjs/list.h: Changed to hold a pointer to a mark set this list is in, if any.
(KJS::List::List): Explicitly initialize m_size with zero, as m_vector.size() is
guaranteed to be such anyway.
(KJS::List::append): Changed the fast case to only be executed as long as inline buffer
is used, because otherwise, we now do more expensive checks.
* kjs/list.cpp:
(KJS::List::markLists): Renamed from markProtectedListsSlowCase, made it take the list set
as a parameter.
(KJS::List::slowAppend): If a non-immediate value is appended, the list needs to be added
to an appropriate Heap's protected list. For now, a static Collector::markListSet() is
used, but the code is layed out in preparation to making the switch to multiple heaps.
* JavaScriptCore.exp: Updated export list.
2008-06-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 19510: CodeBlock::needsFullScopeChain not always set for global code
<https://bugs.webkit.org/show_bug.cgi?id=19510>
This fixes the symptoms by using CodeGenerator::m_codeType to determine
when to use temporaries instead of CodeBlock::needsFullScopeChain, but
it does not fix the problem itself.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::leftHandSideNeedsCopy):
2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 19498: REGRESSION (r34497): crash while loading GMail
<https://bugs.webkit.org/show_bug.cgi?id=19498>
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfTrueMayCombine):
(KJS::CodeGenerator::emitJumpIfTrue):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::CaseBlockNode::emitCodeForBlock):
2008-06-11 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- a little bit of cleanup and prep for some upcoming optimizations
* JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
need to make sure the type is unsigned long.
* kjs/object.cpp:
(KJS::Error::create): Eliminated unused error names array, and also put
the strings into the code since there was already a switch statment.
This also avoids having to contemplate a hypothetical access past the
end of the array.
* kjs/object.h: Got rid of errorNames.
* kjs/property_slot.cpp: Deleted unused ungettableGetter.
* kjs/property_slot.h: Ditto.
* wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Bug 19457: Create fused opcodes for tests and conditional jumps
<https://bugs.webkit.org/show_bug.cgi?id=19457>
Add a new jless instruction, and modify the code generator to emit it
instead of the pair (less, jtrue).
Gives a 3.6% improvement on SunSpider.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::emitOpcode):
(KJS::CodeGenerator::retrieveLastBinaryOp):
(KJS::CodeGenerator::rewindBinaryOp):
(KJS::CodeGenerator::emitJump):
(KJS::CodeGenerator::emitJumpIfTrue):
(KJS::CodeGenerator::emitJumpIfFalse):
(KJS::CodeGenerator::emitMove):
(KJS::CodeGenerator::emitNot):
(KJS::CodeGenerator::emitEqual):
(KJS::CodeGenerator::emitNotEqual):
(KJS::CodeGenerator::emitStrictEqual):
(KJS::CodeGenerator::emitNotStrictEqual):
(KJS::CodeGenerator::emitLess):
(KJS::CodeGenerator::emitLessEq):
(KJS::CodeGenerator::emitPreInc):
(KJS::CodeGenerator::emitPreDec):
(KJS::CodeGenerator::emitPostInc):
(KJS::CodeGenerator::emitPostDec):
(KJS::CodeGenerator::emitToJSNumber):
(KJS::CodeGenerator::emitNegate):
(KJS::CodeGenerator::emitAdd):
(KJS::CodeGenerator::emitMul):
(KJS::CodeGenerator::emitDiv):
(KJS::CodeGenerator::emitMod):
(KJS::CodeGenerator::emitSub):
(KJS::CodeGenerator::emitLeftShift):
(KJS::CodeGenerator::emitRightShift):
(KJS::CodeGenerator::emitUnsignedRightShift):
(KJS::CodeGenerator::emitBitAnd):
(KJS::CodeGenerator::emitBitXOr):
(KJS::CodeGenerator::emitBitOr):
(KJS::CodeGenerator::emitBitNot):
(KJS::CodeGenerator::emitInstanceOf):
(KJS::CodeGenerator::emitTypeOf):
(KJS::CodeGenerator::emitIn):
(KJS::CodeGenerator::emitLoad):
(KJS::CodeGenerator::emitNewObject):
(KJS::CodeGenerator::emitNewArray):
(KJS::CodeGenerator::emitResolve):
(KJS::CodeGenerator::emitGetScopedVar):
(KJS::CodeGenerator::emitPutScopedVar):
(KJS::CodeGenerator::emitResolveBase):
(KJS::CodeGenerator::emitResolveWithBase):
(KJS::CodeGenerator::emitResolveFunction):
(KJS::CodeGenerator::emitGetById):
(KJS::CodeGenerator::emitPutById):
(KJS::CodeGenerator::emitPutGetter):
(KJS::CodeGenerator::emitPutSetter):
(KJS::CodeGenerator::emitDeleteById):
(KJS::CodeGenerator::emitGetByVal):
(KJS::CodeGenerator::emitPutByVal):
(KJS::CodeGenerator::emitDeleteByVal):
(KJS::CodeGenerator::emitPutByIndex):
(KJS::CodeGenerator::emitNewFunction):
(KJS::CodeGenerator::emitNewRegExp):
(KJS::CodeGenerator::emitNewFunctionExpression):
(KJS::CodeGenerator::emitCall):
(KJS::CodeGenerator::emitReturn):
(KJS::CodeGenerator::emitEnd):
(KJS::CodeGenerator::emitConstruct):
(KJS::CodeGenerator::emitPushScope):
(KJS::CodeGenerator::emitPopScope):
(KJS::CodeGenerator::emitDebugHook):
(KJS::CodeGenerator::emitComplexJumpScopes):
(KJS::CodeGenerator::emitJumpScopes):
(KJS::CodeGenerator::emitNextPropertyName):
(KJS::CodeGenerator::emitGetPropertyNames):
(KJS::CodeGenerator::emitCatch):
(KJS::CodeGenerator::emitThrow):
(KJS::CodeGenerator::emitNewError):
(KJS::CodeGenerator::emitJumpSubroutine):
(KJS::CodeGenerator::emitSubroutineReturn):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.cpp:
* VM/Opcode.h:
2008-06-11 Darin Adler <darin@apple.com>
Reviewed by Alexey.
- fix https://bugs.webkit.org/show_bug.cgi?id=19442
JavaScript array implementation doesn't maintain m_numValuesInVector when sorting
* kjs/array_instance.cpp:
(KJS::ArrayInstance::checkConsistency): Added. Empty inline version for when
consistency checks are turned off.
(KJS::ArrayInstance::ArrayInstance): Check consistency after construction.
(KJS::ArrayInstance::~ArrayInstance): Check consistency before destruction.
(KJS::ArrayInstance::put): Check consistency before and after.
(KJS::ArrayInstance::deleteProperty): Ditto.
(KJS::ArrayInstance::setLength): Ditto.
(KJS::compareByStringPairForQSort): Use typedef for clarity.
(KJS::ArrayInstance::sort): Check consistency before and after. Also broke the loop
to set up sorting into two separate passes. Added FIXMEs about various exception
safety issues. Added code to set m_numValuesInVector after sorting.
(KJS::ArrayInstance::compactForSorting): Ditto.
* kjs/array_instance.h: Added a definition of an enum for the types of consistency
check and a declaration of the consistency checking function.
2008-06-10 Kevin Ollivier <kevino@theolliviers.com>
wx build fix. Link against libedit on Mac since HAVE(READLINE) is defined there.
* jscore.bkl:
2008-06-10 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=16503
match limit takes at least 13% of the time on the SunSpider regexp-dna test
Make the limit test slightly more efficient. It is not clear how much of a win it is,
as the improvement on regexp-dna varies from 2.3% to 0.6% depending on what revision I
apply the patch to. Today, the win on regexp-dna was minimal, but the total win was whopping
0.5%, due to random code generation changes.
* pcre/pcre_exec.cpp: (match): Avoid loading a constant on each iteration.
2008-06-09 Alp Toker <alp@nuanti.com>
gcc3/autotools build fix. Add explicit -O2 -fno-strict-aliasing to
each of the tools since these are no longer set globally.
* GNUmakefile.am:
2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Sam.
Add an include for readline/history.h to fix the build for Darwin users
with the GNU readline library installed. Also, clean up the style of
the HAVE(READLINE) check.
* kjs/testkjs.cpp:
(runInteractive):
2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Bug 17531: Add interactive mode to testkjs
<https://bugs.webkit.org/show_bug.cgi?id=17531>
This is a cleaned up version of Sam's earlier patch to add an
interactive mode to testkjs.
Readline support is only enabled on Darwin platforms for now, but
other ports can enable it by defining HAVE_READLINE in kjs/config.h.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/config.h:
* kjs/testkjs.cpp:
(Options::Options):
(runWithScripts):
(runInteractive):
(printUsageStatement):
(parseArguments):
(kjsmain):
2008-06-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
<https://bugs.webkit.org/show_bug.cgi?id=19346>
A check for whether a function's caller is eval code accidentally included
the case where the caller's caller is native code. Add a CodeType field to
CodeBlock and use this for the eval caller test instead.
* VM/CodeBlock.h:
(KJS::CodeBlock::CodeBlock):
(KJS::ProgramCodeBlock::ProgramCodeBlock):
(KJS::EvalCodeBlock::EvalCodeBlock):
* VM/Machine.cpp:
(KJS::getCallerFunctionOffset):
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::generateCode):
(KJS::ProgramNode::generateCode):
2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Dan Bernstein.
Bug 17928: testkjs shouldn't require "-f"
<https://bugs.webkit.org/show_bug.cgi?id=17928>
* kjs/testkjs.cpp:
(printUsageStatement):
(parseArguments):
2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Eric.
Bug 17548: JavaScriptCore print(a, b) differs from Spidermonkey Behavior
<https://bugs.webkit.org/show_bug.cgi?id=17548>
* kjs/testkjs.cpp:
(functionPrint):
2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Sam.
Bug 17547: JavaScriptCore print() differs from Spidermonkey Behavior
<https://bugs.webkit.org/show_bug.cgi?id=17547>
* kjs/testkjs.cpp:
(functionPrint):
2008-06-07 Alexey Proskuryakov <ap@webkit.org>
More build fixes.
* kjs/JSGlobalData.cpp: Fixed an included file name for case-sensitive file systems, fixed
JSGlobalData::threadInstance() for non-multithreaded builds.
2008-06-07 Alexey Proskuryakov <ap@webkit.org>
Build fix - actually adding JSGlobalData.cpp to non-Mac builds!
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCoreSources.bkl:
2008-06-07 Alexey Proskuryakov <ap@webkit.org>
Try to fix Gtk/gcc 4.3 build.
* kjs/JSGlobalData.h: Include ustring.h instead of forward-declaring UString::Rep.
2008-06-06 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Combine per-thread objects into one, to make it easier to support legacy clients (for
which they shouldn't be really per-thread).
No change on SunSpider total.
* JavaScriptCore.xcodeproj/project.pbxproj: Added JSGlobalData.{h,cpp}
* kjs/JSGlobalData.cpp: Added.
(KJS::JSGlobalData::JSGlobalData):
(KJS::JSGlobalData::~JSGlobalData):
(KJS::JSGlobalData::threadInstance):
* kjs/JSGlobalData.h: Added.
This class encapsulates all data that should be per-thread (or shared between legacy clients).
It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
* kjs/identifier.h:
(KJS::Identifier::Identifier):
Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually,
all of them should, but this will be a separate patch.
* kjs/identifier.cpp:
(KJS::IdentifierTable::literalTable):
(KJS::createIdentifierTable):
(KJS::deleteIdentifierTable):
(KJS::Identifier::add):
(KJS::Identifier::addSlowCase):
Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
* kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::EvalFunctionCallNode::emitCode):
(KJS::ScopeNode::ScopeNode):
Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a
temporary measure, they will need to use JSGlobalData explicitly.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::callEval):
* kjs/CommonIdentifiers.cpp:
(KJS::CommonIdentifiers::CommonIdentifiers):
* kjs/CommonIdentifiers.h:
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::evaluate):
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/ExecState.h:
(KJS::ExecState::globalData):
(KJS::ExecState::identifierTable):
(KJS::ExecState::propertyNames):
(KJS::ExecState::emptyList):
(KJS::ExecState::lexer):
(KJS::ExecState::parser):
(KJS::ExecState::arrayTable):
(KJS::ExecState::dateTable):
(KJS::ExecState::mathTable):
(KJS::ExecState::numberTable):
(KJS::ExecState::RegExpImpTable):
(KJS::ExecState::RegExpObjectImpTable):
(KJS::ExecState::stringTable):
* kjs/InitializeThreading.cpp:
(KJS::initializeThreadingOnce):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
(KJS::JSGlobalObject::head):
(KJS::JSGlobalObject::globalData):
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Parser.h:
* kjs/function.cpp:
(KJS::FunctionImp::getParameterName):
(KJS::IndexToNameMap::unMap):
(KJS::globalFuncEval):
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct):
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
* kjs/lexer.cpp:
(kjsyylex):
* kjs/lexer.h:
* kjs/testkjs.cpp:
(prettyPrintScript):
Updated for the above changes. Most of threadInstance uses here will need to be replaced with
explicitly passed pointers to support legacy JSC clients.
* JavaScriptCore.exp: Removed KJS::parser().
2008-06-06 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 19424: Add support for logging opcode pair counts
<https://bugs.webkit.org/show_bug.cgi?id=19424>
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.cpp:
(KJS::OpcodeStats::OpcodeStats):
(KJS::compareOpcodeIndices):
(KJS::compareOpcodePairIndices):
(KJS::OpcodeStats::~OpcodeStats):
(KJS::OpcodeStats::recordInstruction):
(KJS::OpcodeStats::resetLastInstruction):
* VM/Opcode.h:
2008-06-06 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
<rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
profiler.
- Change the remaining functions that do not take arguments, from using
recursion to using iteration.
* JavaScriptCore.exp:
* profiler/Profile.cpp:
(KJS::stopProfiling):
(KJS::restoreAll):
(KJS::Profile::stopProfiling): Use foreach instead of recursion.
(KJS::Profile::restoreAll): Ditto.
* profiler/Profile.h:
* profiler/ProfileNode.cpp: Remove recursion.
(KJS::ProfileNode::stopProfiling):
(KJS::ProfileNode::restore):
* profiler/ProfileNode.h:
2008-06-05 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey.
Fix Greater and GreaterEq nodes to emit code for the left
and right sub-expressions in the correct order.
* kjs/nodes.cpp:
(KJS::GreaterNode::emitCode):
(KJS::GreaterEqNode::emitCode):
2008-06-05 Antti Koivisto <antti@apple.com>
Reviewed by Alp Toker.
Fix whitespaces.
* kjs/collector.cpp:
(KJS::getPlatformThreadRegisters):
2008-06-05 Antti Koivisto <antti@apple.com>
Reviewed by Darin.
Support compiling JavaScriptCore for ARM.
* kjs/collector.cpp:
(KJS::getPlatformThreadRegisters):
(KJS::otherThreadStackPointer):
2008-06-05 Kevin McCullough <kmccullough@apple.com>
Reviewed by Jon.
- Name changes.
* JavaScriptCore.exp:
* profiler/Profile.cpp:
(KJS::Profile::Profile):
(KJS::Profile::stopProfiling):
(KJS::Profile::didExecute):
(KJS::Profile::forEach):
(KJS::Profile::debugPrintData):
(KJS::Profile::debugPrintDataSampleStyle):
* profiler/Profile.h:
(KJS::Profile::callTree):
(KJS::Profile::totalTime):
(KJS::Profile::sortTotalTimeDescending):
(KJS::Profile::sortTotalTimeAscending):
(KJS::Profile::sortSelfTimeDescending):
(KJS::Profile::sortSelfTimeAscending):
(KJS::Profile::sortCallsDescending):
(KJS::Profile::sortCallsAscending):
(KJS::Profile::sortFunctionNameDescending):
(KJS::Profile::sortFunctionNameAscending):
(KJS::Profile::focus):
(KJS::Profile::exclude):
(KJS::Profile::restoreAll):
2008-06-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Stephanie Lewis.
Added the -fno-move-loop-invariants flag to the pcre_exec.cpp build, to
tell GCC not to perform loop invariant motion, since GCC's loop
invariant motion doesn't do very well with computed goto code.
SunSpider reports no change.
2008-06-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Stephanie Lewis.
Added the -fno-tree-pre flag to the Machine.cpp build, to tell GCC not
to perform Partial Redundancy Elimination (PRE) on trees in Machine.cpp,
since GCC's PRE doesn't do very well with computed goto code.
SunSpider reports a .7% speedup.
2008-06-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Stephanie Lewis (or maybe the other way around).
Minor change to PCRE to help out certain compilers.
SunSpider reports no change, maybe a small speedup.
* pcre/pcre_exec.cpp:
(match): Use instructionPtr++ a little less, to avoid confusing the
optimizer.
2008-06-05 Alexey Proskuryakov <ap@webkit.org>
Re-landing an independent part of a previously rolled out threading patch.
* wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
(replaced "new T" with "new T()").
2008-06-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Hyatt.
- force inlining of a template function that only has one call site per specialization
1.3% speedup on SunSpider
* kjs/collector.cpp:
(KJS::Collector::heapAllocate): This template function is only
called from allocate() and allocateNumber() (once per
specialization) and the extra call overhead for GC allocation
shows up, so force inlining.
2008-06-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Alexey and Oliver.
- remove profiler fetch hack
I measure an 0.5% progression from this, others show a wash. It seems not needed any more.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-06-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 19400: subscript operator does not protect base when necessary
<https://bugs.webkit.org/show_bug.cgi?id=19400>
Use a temporary for the base in BracketAccessorNode if the subscript
might possibly modify it.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BracketAccessorNode::emitCode):
* kjs/nodes.h:
(KJS::BracketAccessorNode::):
2008-06-04 Sam Weinig <sam@webkit.org>
Reviewed by Maciej Stachowiak.
Big cleanup of formatting and whitespace.
2008-06-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Add an option to dump statistics on executed instructions.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.cpp:
(KJS::OpcodeStats::~OpcodeStats):
(KJS::OpcodeStats::recordInstruction):
* VM/Opcode.h:
2008-06-04 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
<rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
profiler.
- This patch removes the use of recursion for the sort functions.
* JavaScriptCore.exp: Change the signatures of the functions being
exported.
* profiler/Profile.cpp:
(KJS::Profile::sort): This generic function will accept any of the
static sort functions and apply them to the whole tree.
* profiler/Profile.h: All of the sorting functions now call the new
sort() function.
(KJS::Profile::sortTotalTimeDescending):
(KJS::Profile::sortTotalTimeAscending):
(KJS::Profile::sortSelfTimeDescending):
(KJS::Profile::sortSelfTimeAscending):
(KJS::Profile::sortCallsDescending):
(KJS::Profile::sortCallsAscending):
(KJS::Profile::sortFunctionNameDescending):
(KJS::Profile::sortFunctionNameAscending):
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode): m_head used to point to the head node
if this was the head node. It now points to null to make iteration easy
(KJS::ProfileNode::willExecute): Now must check if m_head is null, this
check used to happend in the constructor.
(KJS::ProfileNode::stopProfiling): Again the check is slightly different
to determine if this is the head.
(KJS::ProfileNode::traverseNextNode): This function returns the next
node in post order.
(KJS::ProfileNode::sort): This generic function will sort according to
the comparator passed in, then reset the children pointers to macth the
new order.
* profiler/ProfileNode.h: The sorting function were removed from the
definition file and instead use the new generic sort() function
(KJS::ProfileNode::totalPercent): because the head can now be empty we
need to check here too for the head node.
(KJS::ProfileNode::selfPercent): Ditto
(KJS::ProfileNode::firstChild): This function is necessary for the
iterative algorithm in Profile.cpp.
(KJS::ProfileNode::sortTotalTimeDescending):
(KJS::ProfileNode::sortTotalTimeAscending):
(KJS::ProfileNode::sortSelfTimeDescending):
(KJS::ProfileNode::sortSelfTimeAscending):
(KJS::ProfileNode::sortCallsDescending):
(KJS::ProfileNode::sortCallsAscending):
(KJS::ProfileNode::sortFunctionNameDescending):
(KJS::ProfileNode::sortFunctionNameAscending):
(KJS::ProfileNode::childrenBegin):
(KJS::ProfileNode::childrenEnd):
(KJS::ProfileNode::totalTimeDescendingComparator):
(KJS::ProfileNode::totalTimeAscendingComparator):
(KJS::ProfileNode::selfTimeDescendingComparator):
(KJS::ProfileNode::selfTimeAscendingComparator):
(KJS::ProfileNode::callsDescendingComparator):
(KJS::ProfileNode::callsAscendingComparator):
(KJS::ProfileNode::functionNameDescendingComparator):
(KJS::ProfileNode::functionNameAscendingComparator):
2008-06-04 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Fix JSClassCreate to work with old JSCore API threading model.
No change on SunSpider.
* API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
a context, there is no way for it to create Identifiers.
Also, added initializeThreading(), just for good measure.
* API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
string here, because propertyNames.add() needs that.
* kjs/identifier.cpp:
* kjs/identifier.h:
(KJS::Identifier::equal):
* kjs/ustring.cpp:
(KJS::equal):
Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
and to make it possible to use it from StrHash.
Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
to be included.
* wtf/StrHash.h: Removed.
* kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
used to default to pointer equality). Moved the whole StrHash header into ustring.h.
* JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
jni_class.cpp, and npruntime.cpp).
2008-06-04 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Darin.
Fix spacing in collector.{h,cpp}.
* kjs/collector.cpp:
* kjs/collector.h:
2008-06-03 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Build fix. The cleanup in r34355 missed a method.
* kjs/nodes.cpp:
* kjs/nodes.h:
2008-06-03 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- https://bugs.webkit.org/show_bug.cgi?id=19269
speed up SunSpider by eliminating the toObject call for most get/put/delete
Makes standalone SunSpider 1.025x as fast as before.
The getOwnPropertySlot virtual function now takes care of the toObject call
for get. Similarly, the put function (and later deleteProperty) does the
same for those operations. To do this, the virtual functions were moved from
the JSObject class to the JSCell class. Also, since the caller no longer knows
the identity of the "original object", which is used by JavaScript-function
based getters, changed the PropertySlot class so the original object is
already stored in the slot when getOwnPropertySlot is called, if the caller
intends to call getValue.
This affected the old interpreter code enough that the easiest thing for me
was to just delete it. While I am not certain the mysterious slowdown is not
still occurring, the net change is definitely a significant speedup.
* JavaScriptCore.exp: Updated.
* VM/Machine.cpp: Moved the UNLIKELY macro into AlwaysInline.h.
(KJS::resolve): Set up the originalObject in the PropertySlot before
calling getPropertySlot. Also removed the originalObject argument from
getValue.
(KJS::resolve_skip): Ditto.
(KJS::resolveBaseAndProperty): Ditto.
(KJS::resolveBaseAndFunc): Ditto.
(KJS::Machine::privateExecute): Removed the toObject calls from the get and
put functions where possible, instead calling directly with JSValue and letting
the JSValue and JSCell calls handle toObject. Same for toThisObject.
* kjs/ExecState.h: Removed OldInterpreterExecState.
* API/JSBase.cpp: Updated includes.
* kjs/LocalStorageEntry.h: Removed contents. Later we can remove the file too.
* kjs/array_instance.cpp:
(KJS::ArrayInstance::lengthGetter): Removed originalObject argumet.
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Don't pass a base value to
setValueSlot. Also use UNLIKELY around the "getting elements past the end of
the array" code path; less common than successfully getting an element.
* kjs/array_object.cpp:
(KJS::getProperty): Initialize the PropertySlot with the original object.
Don't pass the original object to the get function.
(KJS::arrayProtoFuncFilter): Ditto.
(KJS::arrayProtoFuncMap): Ditto.
(KJS::arrayProtoFuncEvery): Ditto.
(KJS::arrayProtoFuncForEach): Ditto.
(KJS::arrayProtoFuncSome): Ditto.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct): Removed an obsolete comment.
* kjs/grammar.y: Eliminated support for some of the node types that were
used to optimize executing from the syntax tree.
* kjs/internal.cpp:
(KJS::StringImp::toThisObject): Added. Same as toObject.
(KJS::NumberImp::toThisObject): Ditto.
(KJS::GetterSetterImp::getOwnPropertySlot): Added. Not reached.
(KJS::GetterSetterImp::put): Ditto.
(KJS::GetterSetterImp::toThisObject): Ditto.
* kjs/internal.h: Added toThisObject to NumberImp for speed.
* kjs/lexer.cpp:
(KJS::Lexer::shift): Changed shift to just do a single character, to unroll
the loop and especially to make the one character case faster.
(KJS::Lexer::setCode): Call shift multiple times instead of passing a number.
(KJS::Lexer::lex): Ditto.
(KJS::Lexer::matchPunctuator): Ditto. Also removed unneeded elses after returns.
(KJS::Lexer::scanRegExp): Ditto.
* kjs/lexer.h: Removed the count argument from shift.
* kjs/math_object.cpp:
(KJS::mathProtoFuncPow): Call jsNaN instead of jsNumber(NaN).
* kjs/nodes.cpp: Removed some of the things needed only for the pre-SquirrelFish
execution model.
(KJS::ForNode::emitCode): Handle cases where some expressions are missing by
not emitting any code at all. The old way was to emit code for "true", but
this is an unnecessary remnant of the old way of doing things.
* kjs/nodes.h: Removed some of the things needed only for the pre-SquirrelFish
execution model.
* kjs/object.cpp:
(KJS::JSObject::fillGetterPropertySlot): Changed to only pass in the getter
function. The old code passed in a base, but it was never used when
actually getting the property; the toThisObject call was pointless. Also
changed to not pass a base for setUndefined.
* kjs/object.h: Added the new JSCell operations to GetterSetterImp.
Never called.
(KJS::JSObject::get): Initialize the object in the PropertySlot and don't
pass it in getValue.
(KJS::JSObject::getOwnPropertySlotForWrite): Removed the base argument
in calls to setValueSlot.
(KJS::JSObject::getOwnPropertySlot): Ditto.
(KJS::JSValue::get): Added. Here because it calls through to JSObject.
A version of JSObject::get that also handles the other types of JSValue
by creating the appropriate wrapper. Saves the virtual call to toObject.
(KJS::JSValue::put): Ditto.
(KJS::JSValue::deleteProperty): Ditto.
* kjs/property_slot.cpp:
(KJS::PropertySlot::undefinedGetter): Removed the originalObject argument.
(KJS::PropertySlot::ungettableGetter): Ditto.
(KJS::PropertySlot::functionGetter): Ditto. Use the value in the base
as the "this" object, which will be set to the original object by the new
PropertySlot initialization code. Also call toThisObject. The old code did
not do this, but needed to so we can properly handle the activation object
like the other similar code paths.
* kjs/property_slot.h:
(KJS::PropertySlot::PropertySlot): Added a constructor that takes a base
object. In debug builds, set the base to 0 if you don't pass one.
(KJS::PropertySlot::getValue): Don't take or pass the originalObject.
(KJS::PropertySlot::setValueSlot): Don't take a base object, and clear the
base object in debug builds.
(KJS::PropertySlot::setGetterSlot): Ditto.
(KJS::PropertySlot::setUndefined): Ditto.
(KJS::PropertySlot::setUngettable): Ditto.
(KJS::PropertySlot::slotBase): Assert that a base object is present.
This will fire if someone actually calls the get function without having
passed in a base object and the getter needs it.
(KJS::PropertySlot::setBase): Added. Used by the code that implements
toObject so it can supply the original object after the fact.
(KJS::PropertySlot::clearBase): Added. Clears the base, but is debug-only
code because it's an error to fetch the base if you don't have a guarantee
it was set.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::JSCallbackObject::cachedValueGetter):
(KJS::JSCallbackObject::staticValueGetter):
(KJS::JSCallbackObject::staticFunctionGetter):
(KJS::JSCallbackObject::callbackGetter):
* kjs/JSActivation.cpp:
(KJS::JSActivation::getOwnPropertySlot):
(KJS::JSActivation::argumentsGetter):
* kjs/JSActivation.h:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet):
* kjs/array_instance.h:
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::callerGetter):
(KJS::FunctionImp::lengthGetter):
(KJS::Arguments::mappedIndexGetter):
* kjs/function.h:
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
* kjs/string_object.cpp:
(KJS::StringInstance::lengthGetter):
(KJS::StringInstance::indexGetter):
(KJS::stringInstanceNumericPropertyGetter):
* kjs/string_object.h:
Removed originalObject arguments from getters. Don't pass base values to
the various PropertySlot functions that no longer take them.
* kjs/value.cpp:
(KJS::JSCell::getOwnPropertySlot): Added. Calls toObject and then sets the slot.
This function has to always return true, because the caller can't walk the prototype
chain. Because of that, we do a getPropertySlot, not getOwnPropertySlot, which works
for the caller. This is private, only called by getOwnPropertySlotInternal.
(KJS::JSCell::put): Added. Calls toObject and then put.
(KJS::JSCell::toThisObject): Added. Calls toObject.
* kjs/value.h: Added get, put, and toThisObject to both JSValue
and JSCell. These take care of the toObject operation without an additional virtual
function call, and so make the common "already an object" case faster.
* wtf/AlwaysInline.h: Moved the UNLIKELY macro here for now. Maybe we can find a
better place later, or rename this header.
2008-06-03 Oliver Hunt <oliver@apple.com>
Reviewed by Tim.
Bug 12983: Web Inspector break on the debugger keyword
<https://bugs.webkit.org/show_bug.cgi?id=12983>
Added a DebuggerStatementNode to handle codegen, and added a new
DidReachBreakPoint debug event (which will hopefully be useful
if we ever move breakpoint management into JSC proper). Also
added didReachBreakpoint to Debugger to allow us to actually respond
to this event.
* VM/CodeBlock.cpp:
(KJS::debugHookName):
* VM/Machine.cpp:
(KJS::Machine::debug):
* VM/Machine.h:
* kjs/debugger.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::DebuggerStatementNode::emitCode):
(KJS::DebuggerStatementNode::execute):
* kjs/nodes.h:
(KJS::DebuggerStatementNode::):
* kjs/nodes2string.cpp:
(KJS::DebuggerStatementNode::streamTo):
2008-06-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- document remaining opcodes.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Document call, call_eval,
construct, ret and end opcodes.
2008-06-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Document throw and catch opcodes.
2008-06-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Alexey Proskuryakov.
Removed JSObject::call, since it just called JSObject::callAsFunction.
SunSpider reports no change.
2008-06-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
A little cleanup in the CodeGenerator.
* VM/CodeGenerator.cpp: A few changes here.
(1) Removed remaining cases of the old hack of putting "this" into the
symbol table; replaced with explicit tracking of m_thisRegister.
(2) Made m_thisRegister behave the same for function, eval, and program
code, removing the static programCodeThis() function.
(3) Added a feature to nix a ScopeNode's declaration stacks when done
compiling, to save memory.
(4) Removed code that copied eval declarations into special vectors: we
just use the originals in the ScopeNode now.
* VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
constructor: we just use get that data from the ScopeNode now.
* VM/Machine.cpp:
(KJS::Machine::execute): When executing an eval node, don't iterate a
special copy of its declarations; iterate the originals, instead.
* kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
away into the CodeGenerator. Nodes no longer call shrinkCapacity on
their data directly.
* kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
data stays around even after we've thrown away the AST, unless we explicitly
throw away the declaration data, too. This is useful for eval code, which
needs to reference its declaration data at execution time. (Soon, it will
be useful for program code, too, since program code should do the same.)
2008-06-02 Adam Roben <aroben@apple.com>
Build fix for non-AllInOne builds
* kjs/array_object.cpp: Added a missing #include.
2008-06-02 Kevin McCullough <kmccullough@apple.com>
Took out accidental confilct lines I checked in.
* ChangeLog:
2008-06-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
profiler
Implement Next Sibling pointers as groundwork for removing the recursion
limit in the profiler.
* profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
'node' is redundant.
(KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
(KJS::ProfileNode::willExecute): If there are already children then the
new child needs to be the nextSibling of the last child.
(KJS::ProfileNode::didExecute):
(KJS::ProfileNode::addChild): Ditto.
(KJS::ProfileNode::stopProfiling):
(KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
algorithms once the children are sorted their nextSibling pointers need
to be reset to reflect the new order.
(KJS::ProfileNode::sortTotalTimeAscending):
(KJS::ProfileNode::sortSelfTimeDescending):
(KJS::ProfileNode::sortSelfTimeAscending):
(KJS::ProfileNode::sortCallsDescending):
(KJS::ProfileNode::sortCallsAscending):
(KJS::ProfileNode::sortFunctionNameDescending):
(KJS::ProfileNode::sortFunctionNameAscending):
(KJS::ProfileNode::resetChildrensSiblings): This new function simply
loops over all of the children and sets their nextSibling pointers to
the next child in the Vector
(KJS::ProfileNode::debugPrintData):
* profiler/ProfileNode.h:
(KJS::ProfileNode::parent):
(KJS::ProfileNode::setParent):
(KJS::ProfileNode::nextSibling):
(KJS::ProfileNode::setNextSibling):
(KJS::ProfileNode::totalPercent):
(KJS::ProfileNode::selfPercent):
2008-06-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Removed the recursion limit from JSObject::call, since the VM does
recursion checking now.
This should allow us to remove JSObject::call entirely, netting a small
speedup.
* kjs/object.cpp:
(KJS::JSObject::call):
2008-06-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adele Peterson.
Added a specific affordance for avoiding stack overflow when converting
recursive arrays to string, in preparation for removing generic stack
overflow checking from JSObject::call.
Tested by fast/js/toString-stack-overflow.html.
2008-06-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Alice Liu.
Refactored some hand-rolled code to call ScopeChain::globalObject instead.
2008-06-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed ASSERT due to execution continuing after an exception is thrown
during array sort.
* kjs/array_instance.cpp:
(KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
custom comparator function if an exception has been thrown. Just return
1 for everything, so the sort completes quickly. (The result will be
thrown away.)
2008-05-30 Timothy Hatcher <timothy@apple.com>
Made the starting line number of scripts be 1-based throughout the engine.
This cleans up script line numbers so they are all consistent now and fixes
some cases where script execution was shown as off by one line in the debugger.
No change in SunSpider.
Reviewed by Oliver Hunt.
* API/minidom.c:
(main): Pass a line number of 1 instead of 0 to parser().parse().
* API/testapi.c:
(main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
to use 1 instead of 2 for the line number.
* VM/Machine.cpp:
(KJS::callEval): Pass a line number of 1 instead of 0.
(KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
0 to parser().parse().
* kjs/Parser.cpp:
(KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
for release builds to maintain compatibility with the JavaScriptCore API.
* kjs/function.cpp:
(KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
* kjs/function_object.cpp:
(FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
* kjs/lexer.cpp:
(Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
* kjs/testkjs.cpp:
(functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
(functionLoad): Ditto.
(prettyPrintScript): Ditto.
(runWithScripts): Ditto.
* profiler/Profiler.cpp:
(WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
2008-05-30 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19180
speed up SunSpider by optimizing immediate number cases
Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
parameter to 0...31.
0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/JSImmediate.h:
(KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
to unsigned.
2008-05-30 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Oliver Hunt.
https://bugs.webkit.org/show_bug.cgi?id=19180
speed up SunSpider by optimizing immediate number cases
Also fixed two JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
parameter to 0...31.
1.6% improvement on SunSpider, without significant regressions on any tests.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
cases, making them less dependent on gcc's ability to properly assign registers. With this,
I could move exception checks back into slow code paths, and saw less randomness in general.
* kjs/JSImmediate.h:
(KJS::JSImmediate::rightShiftImmediateNumbers):
Added.
2008-05-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fixed <rdar://problem/5972943> REGRESSION(r33979): Flash clips do not play on cnn.com
Finally blocks could clobber registers that had to remain live
until they returned. This patch takes a conservative approach and
makes sure that finally blocks do not reuse any registers that
were previously allocated for the function. In the future this
could probably be tightened up to be less profligate with the
register allocation.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::highestUsedRegister):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::TryNode::emitCode):
2008-05-29 Steve Falkenburg <sfalken@apple.com>
Build fix.
* kjs/array_instance.cpp:
2008-05-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19294
<rdar://problem/5969062> A crash when iterating over a sparse array backwards.
* kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
doesn't cause a PIC branch.
(KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
preserving class invariants.
(KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
the vector from the map in all code paths.
2008-05-29 Thiago Macieira <tjmaciei@trolltech.com>
Reviewed by Simon.
Fix compilation in Solaris with Sun CC
Lots of WebKit code uses C99 functions that, strict as it
is, the Solaris system doesn't provide in C++. So we must define them
for both GCC and the Sun CC.
* wtf/MathExtras.h:
2008-05-28 Oliver Hunt <oliver@apple.com>
Reviewed by Anders.
Fix codegen for assignment being used as a function.
FunctionCallValueNode::emitCode failed to account for the
potential of the function expression to allocate arbitrary
registers.
* kjs/nodes.cpp:
(KJS::FunctionCallValueNode::emitCode):
2008-05-27 Geoffrey Garen <ggaren@apple.com>
Reviewed by Tim Hatcher.
Fixed https://bugs.webkit.org/show_bug.cgi?id=19183
REGRESSION (r33979): Crash in DebuggerCallFrame::functionName when
clicking button in returnEvent-crash.html
Added two new debugger hooks, willExecuteProgram and didExecuteProgram,
along with code to generate them, code to invoke them when unwinding
due to an exception, and code to dump them.
SunSpider reports no change.
* VM/CodeBlock.cpp:
(KJS::debugHookName): I had to mark this function NEVER_INLINE to avoid
a .4% performance regression. The mind boggles.
2008-05-28 Adam Roben <aroben@apple.com>
Fix JavaScriptCore tests on OS X
We were quoting the path to testkjs too late, after it had already
been combined with spaces and other options.
* tests/mozilla/jsDriver.pl:
(top level): Move path quoting from here...
(sub get_kjs_engine_command): ...to here.
2008-05-28 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver.
<rdar://problem/5968071> "const f" crashes in JavaScriptCore
Make sure to null check the initializer.
* kjs/nodes.cpp:
(KJS::ConstDeclNode::emitCodeSingle):
2008-05-28 Adam Roben <aroben@apple.com>
Make run-javascriptcore-tests work with a space in the path to testkjs
Reviewed by Alexey Proskuryakov.
* tests/mozilla/jsDriver.pl: Quote the path to the engine so that
spaces will be interpreted correctly.
2008-05-28 Alexey Proskuryakov <ap@webkit.org>
Fixed a misguiding comment - my measurement for negative numbers only included cases
where both operands were negative, which is not very interesting.
* VM/Machine.cpp:
2008-05-28 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej.
Based on a patch by Oliver Hunt.
https://bugs.webkit.org/show_bug.cgi?id=19180
speed up SunSpider by optimizing immediate number cases
1.4% speedup on SunSpider.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/JSImmediate.h:
(KJS::JSImmediate::incImmediateNumber):
(KJS::JSImmediate::decImmediateNumber):
Added fast paths for ++ and --.
(KJS::JSImmediate::canDoFastAdditiveOperations): Corrected a comment.
2008-05-28 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19180
speed up SunSpider by optimizing immediate number cases
2% speedup overall, maximum 10% on controlflow-recursive and bitops-3bit-bits-in-byte,
but a 4% regression on bitops-bits-in-byte and bitops-bitwise-and.
* kjs/JSImmediate.h:
(KJS::JSImmediate::canDoFastAdditiveOperations):
(KJS::JSImmediate::addImmediateNumbers):
(KJS::JSImmediate::subImmediateNumbers):
Added fast cases that work with positive values less than 2^30.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Use the above operations. Also updated SunSpider frequencies
with my results (looks like tag values have changed, not sure what caused the minor variation
in actual frequencies).
2008-05-27 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Remove code that appended Cygwin's /bin directory to PATH.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
Prepend Cygwin's /bin directory to PATH. We prepend instead of append
so that Cygwin's utilities will win out over Win32 versions of the
same utilities (particularly perl). We do the prepend here instead of
in the Makefile because nmake doesn't seem to like prepending to PATH
inside the Makefile. This also matches the way WebCoreGenerated works.
2008-05-27 Adam Roben <aroben@apple.com>
Roll out r34163
A better fix is on the way.
* DerivedSources.make:
* JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
2008-05-27 Adam Roben <aroben@apple.com>
Windows build fix
* DerivedSources.make: Don't generate the bytecode docs if
OMIT_BYTECODE_DOCS is set to 1.
* JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Set
OMIT_BYTECODE_DOCS for production builds.
2008-05-27 Anders Carlsson <andersca@apple.com>
Reviewed by Geoff and Maciej.
<rdar://problem/5806428>
https://bugs.webkit.org/show_bug.cgi?id=17925
Crash in KJS::JSObject::put after setting this.__proto__
Set slotIsWriteable to false for __proto__, we want setting __proto__ to go through JSObject::put instead.
* kjs/object.h:
(KJS::JSObject::getOwnPropertySlotForWrite):
2008-05-27 Kevin Ollivier <kevino@theolliviers.com>
wx build fixes to catch up with SquirrelFish, etc.
* JavaScriptCoreSources.bkl:
* jscore.bkl:
* wtf/Platform.h:
2008-05-27 Darin Adler <darin@apple.com>
Reviewed by Tim Hatcher.
- https://bugs.webkit.org/show_bug.cgi?id=19180
speed up SunSpider by optimizing immediate number cases
Add immediate number cases for the &, |, and ^ operators.
Makes standalone SunSpider 1.010x faster.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Add areBothImmediateNumbers special cases
for the &, |, and ^ operators.
* kjs/JSImmediate.h:
(KJS::JSImmediate::xorImmediateNumbers): Added.
(KJS::JSImmediate::orImmediateNumbers): Added.
2008-05-26 Stephanie Lewis <slewis@apple.com>
Windows build fix.
* kjs/testkjs.cpp:
2008-05-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Anders.
- make addStaticGlobals protected instead of private so subclasses can use it
* JavaScriptCore.exp:
* kjs/JSGlobalObject.h:
2008-05-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed <rdar://problem/5960859> After an eval of a non-string or a syntax
error, all profile stack frames are incorrect
SunSpider reports a .3% speedup, possibly because eval of a string is a
little more efficient now.
* VM/Machine.cpp:
(KJS::callEval): Make sure to call didExecute when returning early. I
simplified this function to remove one early return, making the job
of adding special code to early returns easier.
(KJS::Machine::execute): Use the new function ExecState when notifying
the profiler. (This doesn't change behavior now, but it might prevent
subtle errors in the future.)
2008-05-23 Tor Arne Vestbø <tavestbo@trolltech.com>
Reviewed by Simon.
Fixed toLower and toUpper implementations to allow being called
with a null result pointer and resultLength, to determine the
number of characters needed for the case conversion.
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::toLower):
(WTF::Unicode::toUpper):
2008-05-25 Alexey Proskuryakov <ap@webkit.org>
Fixing a typo in the previous commit made as a last minute change.
* kjs/regexp_object.cpp:
2008-05-24 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Changed regular expression matching result array to be lazily filled, because many callers
only care about it being non-null.
2% improvement on Acid3 test 26.
* kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses
to use.
* kjs/array_instance.h:
(KJS::ArrayInstance::lazyCreationData):
(KJS::ArrayInstance::setLazyCreationData):
Added methods to access it from subclasses.
* kjs/regexp_object.cpp:
(KJS::RegExpMatchesArray::RegExpMatchesArray):
(KJS::RegExpMatchesArray::getOwnPropertySlot):
(KJS::RegExpMatchesArray::put):
(KJS::RegExpMatchesArray::deleteProperty):
(KJS::RegExpMatchesArray::getPropertyNames):
(KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded):
(KJS::RegExpMatchesArray::~RegExpMatchesArray):
(KJS::RegExpObjectImp::arrayOfMatches):
RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until
accessed for the first time.
2008-05-24 Alp Toker <alp@nuanti.com>
Win32/gcc build fix. Remove MSVC assumption.
* wtf/TCSpinLock.h:
(TCMalloc_SlowLock):
2008-05-24 Oleg Finkelshteyn <olegfink@gmail.com>
Rubber-stamped, tweaked and landed by Alexey.
Build fix for gcc 4.3.
* JavaScriptCore/kjs/testkjs.cpp:
* JavaScriptCore/VM/CodeBlock.cpp:
Add missing standard includes.
2008-05-23 Anders Carlsson <andersca@apple.com>
Reviewed by Geoff.
<rdar://problem/5959886> REGRESSION: Assertion failure in JSImmediate::toString when loading GMail (19217)
Change List to store a JSValue*** pointer + an offset instead of a JSValue** pointer to protect against the case where
a register file changes while a list object points to its buffer.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject):
* kjs/list.cpp:
(KJS::List::getSlice):
* kjs/list.h:
(KJS::List::List):
(KJS::List::at):
(KJS::List::append):
(KJS::List::begin):
(KJS::List::end):
(KJS::List::buffer):
2008-05-23 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
too deep.
-Use a simple depth limit to restrict too deep of recursion.
* profiler/Profile.cpp:
(KJS::Profile::willExecute):
(KJS::Profile::didExecute):
* profiler/Profile.h:
2008-05-23 Geoffrey Garen <ggaren@apple.com>
Rolling back in r34085, with performance resolved.
Apparently, passing the eval function to callEval gave GCC a hernia.
Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.
Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
JavaScript profiler
* VM/Machine.cpp:
(KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
when unwinding from inside eval and/or program code: detect the
difference, and do the right thing. Also, be sure to notify the profiler
*before* deref'ing the scope chain, since the profiler uses the scope chain.
(KJS::Machine::execute): Fixed incorrect reporting / crash when calling
a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
should not invoke the didExecute hook, because op_ret already does that.
Also, use the new function's ExecState when calling out to the profiler.
(Not important now, but could have become a subtle bug later.)
(KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
profiling JS functions: notify the profiler *before* deref'ing the scope
chain, since the profiler uses the scope chain.
* kjs/object.cpp:
(KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
* profiler/Profile.cpp: Added a comment to explain a subtlety that only
Kevin and I understood previously. (Now, the whole world can understand!)
* profiler/Profiler.cpp:
(KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was
a hack to fix bugs that no longer exist.
Finally, sped things up a little bit by changing the "Is the profiler
running?" check into an ASSERT, since we only call into the profiler
when it's running:
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
2008-05-23 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
- fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
SunSpider reports no change.
This is a reworking of r34073, which I rolled out because it caused
lots of crashes.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
properties whose names collide with new functions. (Don't use putWithAttributes
because that tries to write to the register file, which hasn't grown to
fit this program yet.)
2008-05-23 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
As allocateNumber is used via jsNumberCell outside of JavaScriptCore,
we need to provide a non-inlined version of it to avoid creating a
weak external symbol.
* JavaScriptCore.exp:
* kjs/AllInOneFile.cpp:
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
* kjs/collector.h:
(KJS::Collector::allocate):
(KJS::Collector::inlineAllocateNumber):
* kjs/value.h:
(KJS::NumberImp::operator new):
2008-05-23 Geoffrey Garen <ggaren@apple.com>
Rolled out r34073 because it caused lots of layout test crashes.
2008-05-23 Geoffrey Garen <ggaren@apple.com>
Rolled out r34085 because it measured as a 7.6% performance regression.
2008-05-23 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add the
profiler directory to the include path.
2008-05-23 Oliver Hunt <oliver@apple.com>
Reviewed by Anders.
SQUIRRELFISH: JavaScript error messages are missing informative text
Partial fix.
Tidy up error messages, makes a couple of them provide slightly more info.
Inexplicably leads to a 1% SunSpider Progression.
* VM/ExceptionHelpers.cpp:
(KJS::createError):
(KJS::createInvalidParamError):
(KJS::createNotAConstructorError):
(KJS::createNotAFunctionError):
* VM/ExceptionHelpers.h:
* VM/Machine.cpp:
(KJS::isNotObject):
2008-05-23 Oliver Hunt <oliver@apple.com>
Reviewed by Tim H.
Fix call stack reported by profiler when entering event handlers.
JSObject::call was arbitrarily notifying the profiler when it was
called, even if it was JS code, which notifies the profile on entry
in any case.
* kjs/object.cpp:
(KJS::JSObject::call):
2008-05-16 Alp Toker <alp@nuanti.com>
Build fix for gcc 3. Default constructor required in ExecState,
used by OldInterpreterExecState.
* kjs/ExecState.h:
(KJS::ExecState::ExecState):
2008-05-23 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.
Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
register file may be too close to its maximum size to grow successfully. By using grow,
checking the result and throwing a stack overflow error we can avoid crashing.
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
2008-05-23 Oliver Hunt <oliver@apple.com>
RS=Kevin McCullough
Remove JAVASCRIPT_PROFILER define
* VM/Machine.cpp:
(KJS::callEval):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* kjs/config.h:
* kjs/object.cpp:
(KJS::JSObject::call):
2008-05-23 Oliver Hunt <oliver@apple.com>
<rdar://problem/5951561> Turn on JavaScript Profiler
Reviewed by Kevin McCullough.
Flipped the switch on the profiler, rearranged how we
signal the the profiler is active so that calls aren't
needed in the general case.
Also fixed the entry point for Machine::execute(FunctionBodyNode..)
to correctly indicate function exit.
Results in a 0.7-1.0% regression in SunSpider :-(
* VM/Machine.cpp:
(KJS::callEval):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* kjs/config.h:
* profiler/Profiler.cpp:
(KJS::Profiler::profiler):
(KJS::Profiler::startProfiling):
(KJS::Profiler::stopProfiling):
* profiler/Profiler.h:
(KJS::Profiler::enabledProfilerReference):
2008-05-23 Simon Hausmann <hausmann@webkit.org>
Fix the Qt build by adding profiler/ to the include search path.
* JavaScriptCore.pri:
2008-05-22 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
Fix a bug in the profiler where time in the current function is given to
(idle).
* profiler/Profile.cpp:
(KJS::Profile::didExecute): Set the start time and then call didExecute
to calculate the time spent in this function.
* profiler/ProfileNode.cpp: Remove confusing calculations that are no
longer necessary.
(KJS::ProfileNode::insertNode):
* profiler/ProfileNode.h: Expose access to the start time to allow the
simpler time calculations above.
(KJS::ProfileNode::startTime):
(KJS::ProfileNode::setStartTime):
2008-05-22 Adam Roben <aroben@apple.com>
Show "(Function object)" instead of "(JSInpectorCallbackWrapper
object)" in profiles
Reviewed by Kevin McCullough.
* profiler/Profiler.cpp:
(KJS::createCallIdentifier): Use JSObject::className instead of
getting the class name from the ClassInfo directly. JSObject
subclasses can override className to provide a custom class name, and
it seems like we should honor that.
2008-05-22 Timothy Hatcher <timothy@apple.com>
Added Profile::restoreAll and added ProfileNode::restoreAll
to the export file.
Reviewed by Adam Roben.
* JavaScriptCore.exp:
* profiler/Profile.h:
2008-05-22 Alp Toker <alp@nuanti.com>
GTK+ build fix. Add JavaScriptCore/profiler to include path.
* GNUmakefile.am:
2008-05-22 Adam Roben <aroben@apple.com>
Implement sub-millisecond profiling on Windows
Reviewed by Kevin McCullough.
* profiler/ProfileNode.cpp:
(KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
other platforms, we use getCurrentUTCTimeWithMicroseconds.
(KJS::ProfileNode::endAndRecordCall): Use getCount instead of
getCurrentUTCTimeWithMicroseconds.
(KJS::ProfileNode::startTimer): Ditto.
2008-05-22 Adam Roben <aroben@apple.com>
Fix a profiler assertion when calling a NodeList as a function
Reviewed by Kevin McCullough.
* profiler/Profiler.cpp:
(KJS::createCallIdentifier): Don't assert when a non-function object
is called as a function. Instead, build up a CallIdentifier using the
object's class name.
2008-05-22 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
profile node.
-Implement 'exclude'; where the excluded node attributes its time to its
parent's self time.
* JavaScriptCore.exp: Export the exclude function.
* profiler/Profile.h:
(KJS::Profile::exclude):
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::setTreeVisible): New function that allows a change in
visiblitiy to be propogated to all the children of a node.
(KJS::ProfileNode::exclude): If the node matches the callIdentifier then
set the visiblity of this node and all of its children to false and
attribute it's total time to it's caller's self time.
* profiler/ProfileNode.h:
2008-05-22 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Fix access to static global variables in Windows release builds.
* kjs/JSGlobalObject.h: Don't store a reference to an Identifier
in GlobalPropertyInfo as the Identifier is likely to be a temporary
and therefore may be destroyed before the GlobalPropertyInfo.
2008-05-22 Kevin McCullough <kmccullough@apple.com>
Build fix.
* VM/Machine.cpp:
(KJS::callEval):
2008-05-22 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5951561> Turn on JavaScript Profiler
Get basic JS profiling working.
Even with this patch the profiler will not be compiled in because we do
not know the extend, if any, of the performance regression it would cause
when it is not in use. However with these changes, if the profiler were
on, it would not crash and show good profiling data.
* VM/Machine.cpp: Instrument the calls sites that are needed for profiling.
(KJS::callEval):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* kjs/function.cpp: Ditto.
(KJS::globalFuncEval):
* kjs/interpreter.cpp: Ditto.
(KJS::Interpreter::evaluate):
* profiler/Profile.cpp:
(KJS::Profile::willExecute):
(KJS::Profile::didExecute): Because we do not get a good context when
startProfiling is called it is possible that m_currentNode will be at the
top of the known stack when a didExecute() is called. What we then do is
create a new node that represents the function being exited and insert
it between the head and the currently known children, since they should
be children of this new node.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode):
(KJS::ProfileNode::willExecute): Rename the add function for consistency.
(KJS::ProfileNode::addChild): Appends the child to this node but also
sets the parent pointer of the children to this node.
(KJS::ProfileNode::insertNode): Insert a node between this node and its
children. Also set the time for the new node since it is now exiting
and we don't really know when it started.
(KJS::ProfileNode::stopProfiling):
(KJS::ProfileNode::startTimer):
* profiler/ProfileNode.h:
(KJS::CallIdentifier::toString): Added for debugging.
(KJS::ProfileNode::setParent):
(KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the
visibleTotalTime not the visibleSelfTime.
(KJS::ProfileNode::children):
(KJS::ProfileNode::toString): Added for debugging.
* profiler/Profiler.cpp: remove unecessary calls.
(KJS::Profiler::startProfiling):
2008-05-22 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Rename register arguments for op_call, op_call_eval, op_end, and op_construct
to document what they are for.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCall):
(KJS::CodeGenerator::emitCallEval):
(KJS::CodeGenerator::emitEnd):
(KJS::CodeGenerator::emitConstruct):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-05-22 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Bug 19116: SquirrelFish shouldn't regress on variable lookups
<https://bugs.webkit.org/show_bug.cgi?id=19116>
Last of the multiscope look up optimisations. This is a wash overall on SunSpider
but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
... applied to any non-local var).
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::emitCode):
(KJS::PostDecResolveNode::emitCode):
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
2008-05-22 David Kilzer <ddkilzer@apple.com>
<rdar://problem/5954233> Add method to release free memory from FastMalloc
Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
* JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
* wtf/FastMalloc.cpp:
(WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
system malloc and FastMalloc code paths.
* wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
2008-05-22 Oliver Hunt <oliver@apple.com>
RS=Maciej.
Roll out r34020 as it causes recursion tests to fail.
* kjs/object.cpp:
(KJS::JSObject::call):
2008-05-22 Oliver Hunt <oliver@apple.com>
Reviewed by Mark.
Don't leak the SymbolTable when compiling eval code.
* kjs/nodes.cpp:
(KJS::EvalNode::generateCode):
2008-05-22 Simon Hausmann <hausmann@webkit.org>
Reviewed by Oliver.
Qt build fix.
* JavaScriptCore.pri: Added DebuggerCallFrame to the build.
* VM/LabelID.h: Include limits.h for UINT_MAX.
* wtf/VectorTraits.h: Include memory for std::auto_ptr.
2008-05-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Removed the old recursion guard mechanism, since squirrelfish has its
own mechanism. Also removed some old JS call tracing code, since we
have other ways to do that, too.
SunSpider reports no change.
* kjs/object.cpp:
(KJS::JSObject::call):
2008-05-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
* kjs/nodes.cpp:
(KJS::WithNode::emitCode):
(KJS::TryNode::emitCode):
2008-05-21 Kevin McCullough <kmccullough@apple.com>
Reviewed by Maciej and Geoff.
<rdar://problem/5951561> Turn on JavaScript Profiler
-As part of the effort to turn on the profiler it would be helpful if it
did not need ExecStates to represent the stack location of the currently
executing statement.
-We now create each node as necessary with a reference to the current
node and each node knows its parent so that the tree can be made without
the entire stack.
* profiler/Profile.cpp:
(KJS::Profile::Profile): The current node starts at the head.
(KJS::Profile::stopProfiling): The current node is cleared when profiling
stops.
(KJS::Profile::willExecute): The current node either adds a new child or
starts and returns a reference to an already existing child if the call
ID that is requested already exists.
(KJS::Profile::didExecute): The current node finishes and returns its
parent.
* profiler/Profile.h: Use a single callIdentifier instead of a vector
since we no longer use the whole stack.
* profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
parent.
(KJS::ProfileNode::ProfileNode): Initialize the parent.
(KJS::ProfileNode::didExecute): Record the time and return the parent.
(KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
already a child, start it and return it, otherwise create a new one and
return that.
(KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
* profiler/ProfileNode.h: Utilize the parent.
(KJS::ProfileNode::create):
(KJS::ProfileNode::parent):
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling): Here is the only place where the
ExecState is used to figure out where in the stack the profiler is
currently profiling.
(KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
of a vector of them.
(KJS::Profiler::willExecute): Ditto.
(KJS::Profiler::didExecute): Ditto.
(KJS::createCallIdentifier): Create only one CallIdentifier.
(KJS::createCallIdentifierFromFunctionImp): Ditto.
* profiler/Profiler.h:
2008-05-21 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- https://bugs.webkit.org/show_bug.cgi?id=19180
speed up the < operator for the case when both values are integers
Makes standalone SunSpider 1.022x faster.
* VM/Machine.cpp:
(KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
2008-05-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver and Sam.
- fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
Track global this value in the scope chain so we can retrieve it
efficiently but it follows lexical scope properly.
* kjs/ExecState.h:
(KJS::ExecState::globalThisValue):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct):
* kjs/scope_chain.h:
(KJS::ScopeChainNode::ScopeChainNode):
(KJS::ScopeChainNode::globalThisObject):
(KJS::ScopeChainNode::push):
(KJS::ScopeChain::ScopeChain):
2008-05-21 Kevin McCullough <kmccullough@apple.com>
Sadness :(
* kjs/config.h:
2008-05-21 Kevin McCullough <kmccullough@apple.com>
Reviewed by Maciej.
<rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
profile node.
- This patch updatest the times of the visible nodes correctly, but to do
so, some of the design of the ProfileNode changed.
* JavaScriptCore.exp: export focus' symbol.
* profiler/Profile.cpp: ProfileNodes now take a reference to the head of
the profile tree to get up-to-date accurate total profile time.
(KJS::Profile::Profile): Pass 0 for the head node.
(KJS::Profile::stopProfiling): stopProfiling no longer needs the time
passed into it, since it can get it from the head and it does not need to
be told it is the head because it can figure it out on it's own.
(KJS::Profile::willExecute): Set the head node for each created node.
* profiler/Profile.h:
(KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
would have to create, now focus() takes a ProfileNode that they should
already have a reference to and focus() can extract the CallIdentifier
from it.
* profiler/ProfileNode.cpp: Create actual and visible versions fo the
total and self times for focus and exclude. Also add a head node
reference so that nodes can get information from their head.
(KJS::ProfileNode::ProfileNode):
(KJS::ProfileNode::stopProfiling): Rename the total and self time
variables and set the visual ones to the actual ones, so that without any
changes to the visual versions of these variables, their times will match
the actual times.
(KJS::ProfileNode::focus): Now focus() has a bool to force it's children
to be visible if this node is visible. If this node does not match the
CallIdentifier being focused then the visibleTotalTime is only updated if
one or more of it's children is the CallIdentifier being focused.
(KJS::ProfileNode::restoreAll): Restores all variables with respect to
the visible data in the ProfileNode.
(KJS::ProfileNode::endAndRecordCall): Name change.
(KJS::ProfileNode::debugPrintData): Dump the new variables.
(KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
* profiler/ProfileNode.h: Use the new variables and reference to the head
node.
(KJS::ProfileNode::create):
(KJS::ProfileNode::totalTime):
(KJS::ProfileNode::setTotalTime):
(KJS::ProfileNode::selfTime):
(KJS::ProfileNode::setSelfTime):
(KJS::ProfileNode::totalPercent):
(KJS::ProfileNode::selfPercent):
(KJS::ProfileNode::setVisible):
2008-05-21 Alp Toker <alp@nuanti.com>
GTK+/UNIX testkjs build fix. Include signal.h.
* kjs/testkjs.cpp:
2008-05-21 Oliver Hunt <oliver@apple.com>
Yet more windows build fixes
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-21 Oliver Hunt <oliver@apple.com>
Yet more windows build fixes
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-21 Alp Toker <alp@nuanti.com>
GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
changes into account.
* GNUmakefile.am:
2008-05-21 Oliver Hunt <oliver@apple.com>
Add DebuggerCallFrame.{h,cpp} to the project file
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-21 Alp Toker <alp@nuanti.com>
GTK+ port build fixes following squirrelfish merge r33979.
* GNUmakefile.am:
2008-05-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- save a hash lookup wne writing to global properties
0.3% speedup on SunSpider, 7% on bitops-bitwise-and
* VM/Machine.cpp:
(KJS::resolveBase): Check for being a the end of the scope chain
before hash lookup.
2008-05-21 Alp Toker <alp@nuanti.com>
Rubber-stamped by Maciej.
Replace non-standard #pragma marks with comments to avoid compiler
warnings.
* profiler/ProfileNode.cpp:
2008-05-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Mark Rowe.
Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
* JavaScriptCore.exp:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::defineGetter):
(KJS::JSGlobalObject::defineSetter):
* kjs/JSGlobalObject.h:
=== End merge of squirrelfish ===
2008-05-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Tim Hatcher.
Merged with trunk WebCore's new debugger.
* kjs/DebuggerCallFrame.cpp:
(KJS::DebuggerCallFrame::evaluate): Changed this function to separate
the exception value from the return value. The WebKit debugger treats
them as one, but the WebCore debugger doesn't.
* kjs/DebuggerCallFrame.h:
(KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
the dynamic global object, since the debugger doesn't want the lexical
global object.
2008-05-21 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 19116: SquirrelFish shouldn't regress on variable lookups
<https://bugs.webkit.org/show_bug.cgi?id=19116>
Optimise cross scope assignment, 0.4% progression in sunspider.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitPutScopedVar):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::AssignResolveNode::emitCode):
2008-05-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- check property map before symbol table in JSGlobalObject::getOwnPropertySlot
0.5% speedup on SunSpider
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
because symbol table access is likely to have been optimized.
2008-05-21 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 19116: SquirrelFish shouldn't regress on variable lookups
<https://bugs.webkit.org/show_bug.cgi?id=19116>
Optimise multiscope lookup of statically resolvable function calls.
SunSpider reports a 1.5% improvement, including 37% on
controlflow-recursive for some reason :D
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitResolve):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::emitCode):
2008-05-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
(WebCore change using this is a 2.6% speedup on in-browser SunSpider).
* JavaScriptCore.exp:
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::getOwnPropertySlot):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet):
* kjs/object.h:
(KJS::JSObject::getDirectLocation):
(KJS::JSObject::getOwnPropertySlotForWrite):
* kjs/property_map.cpp:
(KJS::PropertyMap::getLocation):
* kjs/property_map.h:
* kjs/property_slot.h:
(KJS::PropertySlot::putValue):
2008-05-20 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 19116: SquirrelFish shouldn't regress on variable lookups
<https://bugs.webkit.org/show_bug.cgi?id=19116>
This restores multiscope optimisation to simple resolve, producing
a 2.6% progression in SunSpider. Have verified that none of the
sites broken by the multiscope optimisation in trunk were effected
by this change.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeBlock.h:
(KJS::CodeBlock::CodeBlock):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::findScopedProperty):
(KJS::CodeGenerator::emitResolve):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::resolve_n):
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/JSVariableObject.h:
2008-05-20 Oliver Hunt <oliver@apple.com>
Fixerate the windows build.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* VM/CodeGenerator.cpp:
* VM/RegisterFile.h:
* kjs/JSGlobalObject.h:
* kjs/Parser.cpp:
* kjs/interpreter.h:
2008-05-20 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 19110: SquirrelFish: Google Maps - no maps
<https://bugs.webkit.org/show_bug.cgi?id=19110>
Correct a comedy of errors present in my original patch to "fix"
exceptions occurring midway through pre and post increment. This
solution is cleaner than the original, doesn't need the additional
opcodes, and as an added benefit does not break Google Maps.
Sunspider reports a 0.4% progression.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::PreIncBracketNode::emitCode):
(KJS::PreDecBracketNode::emitCode):
(KJS::PreIncDotNode::emitCode):
(KJS::PreDecDotNode::emitCode):
2008-05-20 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- inline JSGlobalObject::getOwnPropertySlot
1% improvement on in-browser SunSpider (a wash command-line)
* kjs/JSGlobalObject.cpp:
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::getOwnPropertySlot):
2008-05-18 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
<https://bugs.webkit.org/show_bug.cgi?id=18752>
Handle exceptions thrown by toString conversion in subscript operators,
this should basically complete exception handling in SquirrelFish.
Sunspider reports no regression.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-05-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
[Reapplying patch with previously missing files from r33553 -- Oliver]
Behold: debugging.
SunSpider reports no change.
* JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
and created a debugger folder.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::generate): If the debugger is attached, always
generate full scope chains for its sake.
* VM/Machine.cpp:
(KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
due to an exception, so it doesn't keep stale call frames around.
(KJS::Machine::execute): Set Callee to 0 in eval frames, so the
debugger can distinguish them from function call frames.
(KJS::Machine::debug): Simplified this function, since the debugger
doesn't actually need all the information we used to provide.
(KJS::Machine::privateExecute): Treat debugging hooks like other function
calls, so the code we hook into (the debugger UI) can be optimized.
* kjs/debugger.cpp: Nixed these default callback implementations and
made the callbacks pure virtual instead, so the compiler could tell me
if I made a mistake in one of the subclasses.
* kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
callbacks. Changed from passing an ExecState* to passing a
DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
information anymore.
* kjs/function.cpp:
(KJS::globalFuncEval): Easiest bug fix evar!
[Previously missing files from r33553]
* kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
(KJS::DebuggerCallFrame::functionName):
(KJS::DebuggerCallFrame::thisObject):
(KJS::DebuggerCallFrame::evaluateScript):
* kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
(KJS::DebuggerCallFrame::DebuggerCallFrame):
(KJS::DebuggerCallFrame::scopeChain):
(KJS::DebuggerCallFrame::exception):
2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
<https://bugs.webkit.org/show_bug.cgi?id=18991>
Fix the last remaining blocking cases of this bug.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ReadModifyResolveNode::emitCode):
2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Partial fix for:
Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
<https://bugs.webkit.org/show_bug.cgi?id=18991>
Ensure that the code generated for assignments uses temporaries whenever
necessary. This patch covers the vast majority of situations, but there
are still a few left.
This patch also adds some missing cases to CodeBlock::dump().
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::destinationForAssignResult):
(KJS::CodeGenerator::leftHandSideNeedsCopy):
(KJS::CodeGenerator::emitNodeForLeftHandSide):
* kjs/NodeInfo.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
(KJS::ForInNode::ForInNode):
* kjs/nodes.h:
(KJS::ReadModifyResolveNode::):
(KJS::AssignResolveNode::):
(KJS::ReadModifyBracketNode::):
(KJS::AssignBracketNode::):
(KJS::AssignDotNode::):
(KJS::ReadModifyDotNode::):
2008-05-17 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 19106: SquirrelFish: Activation is not marked correctly
<https://bugs.webkit.org/show_bug.cgi?id=19106>
We can't rely on the symbol table for a count of the number of globals
we need to mark as that misses duplicate parameters and 'this'. Now we
use the actual local register count from the codeBlock.
* kjs/JSActivation.cpp:
(KJS::JSActivation::mark):
2008-05-16 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
<https://bugs.webkit.org/show_bug.cgi?id=19076>
Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
to allocate the global 'this' register safely at any point after initialisation of the Global
Object.
Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
support for the static slot optimisation for the global Math object which brings it to a 0.3%
progression.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::programCodeThis):
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::addParameter):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::execute):
* kjs/ExecState.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
(KJS::JSGlobalObject::addStaticGlobals):
* kjs/nodes.cpp:
2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
<https://bugs.webkit.org/show_bug.cgi?id=19098>
When doing code generation for a statement list, increase the reference
count on a register that might eventually be returned, so that it doesn't
get clobbered by a request for a new temporary.
* kjs/nodes.cpp:
(KJS::statementListEmitCode):
2008-05-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
https://bugs.webkit.org/show_bug.cgi?id=19044
* kjs/JSActivation.cpp:
(KJS::JSActivation::copyRegisters): Use numLocals from the code
block rather than the size of the symbol table for the number of
registers to copy, to account for duplicate parameters and vars
with the same name as parameters (we still have potentially
suboptimal codegen in that we allocate a local register for the
var in the latter case but it is never used).
2008-05-15 Geoffrey Garen <ggaren@apple.com>
Not reviewed.
We regret to inform you that your program is crashing because you were
stupid.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Math is hard.
2008-05-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A little more debugger action: filled in op_debug. All debugger control
flow works now, but variable inspection and backtraces still don't.
SunSpider reports no change.
* VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
* VM/Machine.cpp:
(KJS::Machine::getFunctionAndArguments): Moved op_debug into a
NEVER_INLINE function to avoid a stunning 10% performance regression.
Also factored out a common function for retrieving the function and
arguments from a call frame.
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject): Use the new factored out
function mentioned above.
* kjs/Parser.cpp:
(KJS::Parser::parse): Increment m_sourceId before assigning it, so the
sourceId we send to the debugger matches the sourceId recorded in the
node.
* kjs/nodes.cpp: Emit debugging hooks.
2008-05-14 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
<https://bugs.webkit.org/show_bug.cgi?id=19024>
This fixes a number of issues. The most important is that we now check every register
file for tainting rather than just looking for function register files as that was
insufficient. Additionally guarded against implicit re-entry into Eval code.
Also added a few additional assertions to reduce the amout of time between something
going wrong and us seeing the error.
* VM/Machine.cpp:
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/RegisterFile.cpp:
(KJS::RegisterFile::growBuffer):
(KJS::RegisterFile::addGlobalSlots):
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::pushGlobalRegisterFile):
(KJS::RegisterFileStack::pushFunctionRegisterFile):
* VM/RegisterFileStack.h:
(KJS::RegisterFileStack::inImplicitCall):
2008-05-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A little more debugger action: emit opcodes for debugger hooks. Right
now, the opcode implementation is just a stub.
SunSpider reports no change.
Some example codegen for "function f() { 1; }":
[ 0] dbg DidEnterCallFrame
[ 2] dbg WillExecuteStatement
[ 4] load tr0, 1(@k0)
[ 7] load tr0, undefined(@k1)
[ 10] dbg WillLeaveCallFrame
[ 12] ret tr0
2008-05-14 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
<https://bugs.webkit.org/show_bug.cgi?id=19025>
Simple fix -- move the use of functionBodyNode to after the null check.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct):
2008-05-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed a codegen crash with run-time parse errors.
SunSpider reports no change.
emitThrowError needs to return the temporary holding the error, not dst,
since dst may be NULL. In fact, emitThrowError shouldn't take a dst
parameter at all, since exceptions should not modify the destination
register.
2008-05-13 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
<https://bugs.webkit.org/show_bug.cgi?id=19027>
This fixes the codegen issues for the pre-inc/decrement operators
to prevent incorrectly clobbering the destination in the event of
an exception.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitPreInc):
(KJS::CodeGenerator::emitPreDec):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::PreIncBracketNode::emitCode):
(KJS::PreDecBracketNode::emitCode):
(KJS::PreIncDotNode::emitCode):
(KJS::PreDecDotNode::emitCode):
2008-05-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A little more debugger action: supply a real line number, sourceId,
and sourceURL in op_new_error.
SunSpider reports a .2% speedup. Not sure what that's about.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
* kjs/nodes.cpp:
(KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
rolling our own.
2008-05-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A little more debugger action: implemented the exception callback.
SunSpider reports a .2% speedup. Not sure what that's about.
* VM/CodeBlock.h: A little refactoring here. Store a pointer to our
owner ScopeNode so we can retrieve data from it. This allows us to
stop storing copies of the data ourselves. Also, store a "this" register
instead of a code type, since we were only using the code type to
calculate the "this" register.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::generate): Calculate the "this" register mentioned
above. Also, take care of removing "this" from the symbol table after
codegen is done, since relying on the timing of a destructor for correct
behavior is not so good.
* VM/Machine.cpp:
(KJS::Machine::throwException): Invoke the debugger's exception callback.
(KJS::Machine::privateExecute): Use the "this" register mentioned above.
2008-05-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed some unused exception machinery.
SunSpider reports a .3% speedup.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
* JavaScriptCore.exp:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/internal.cpp:
* kjs/object.cpp:
* kjs/object.h:
* kjs/value.h:
2008-05-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A little more debugger action.
* kjs/debugger.cpp:
* kjs/debugger.h: Removed debuggersPresent because it was unused.
Replaced AttachedGlobalObject linked list with a HashSet because HashSet
is faster and simpler. Changed all functions to return void instead of
bool, because no clients ever return false, and we don't want to support
it.
* kjs/nodes.cpp: Did some up-keep to avoid build bustage.
(KJS::Node::handleException):
(KJS::BreakpointCheckStatement::execute):
(KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2008-05-13 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
<https://bugs.webkit.org/show_bug.cgi?id=18752>
Replace old attempt at "branchless" exceptions as the extra information
being passed made gcc an unhappy compiler, replacing these custom toNumber
calls with ordinary toNumber logic (by relying on toNumber now preventing
side effects after an exception has been thrown) provided sufficient leeway
to add the additional checks for the remaining unchecked cases.
This leaves only toString conversions in certain contexts as possibly
misbehaving.
* VM/Machine.cpp:
(KJS::jsAdd):
(KJS::resolve):
(KJS::resolveBaseAndProperty):
(KJS::resolveBaseAndFunc):
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/value.h:
(KJS::JSValue::safeGetNumber):
2008-05-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
First steps toward supporting the debugger API: support the sourceParsed
callback; plus some minor fixups.
SunSpider reports no regression.
* VM/CodeGenerator.h: Removed a misleading comment.
* kjs/Parser.h: Changed the parser to take an ExecState*, so it can
implement the sourceParsed callback -- that way, we only have to
implement the callback in one place.
* kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
was to demonstrate the misapplication of design patterns.
* kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
reduce copying, and not to return a value, because pausing execution
after parsing is complicated, and no clients needed that ability, anyway.
* kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
didFinishParsing -- that simplifies some code down the road.
* kjs/nodes.cpp: Don't generate special AST nodes just because the
debugger is attached -- that's a relic of the old AST execution model,
and those nodes haven't been maintained.
2008-05-13 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
<https://bugs.webkit.org/show_bug.cgi?id=18752>
First step: prevent incorrect evaluation of valueOf/toString conversion
in right hand side of expression after earlier conversion throws.
* API/JSCallbackObjectFunctions.h:
(KJS::::toNumber):
* kjs/object.cpp:
(KJS::JSObject::defaultValue):
2008-05-12 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
<https://bugs.webkit.org/show_bug.cgi?id=18934>
Unfortunately we cannot create new statically optimised globals if there are any
tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
(in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::pushFunctionRegisterFile):
* VM/RegisterFileStack.h:
2008-05-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Introduced support for function.caller.
Improved support for walking interesting scopes for function introspection.
This fixes all remaining layout tests not blocked by rebasing to trunk.
SunSpider reports no change.
* VM/Machine.cpp:
(KJS::Machine::dumpRegisters): Fixed a spacing issue.
2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 18961: SQUIRRELFISH: Gmail doesn't load
<https://bugs.webkit.org/show_bug.cgi?id=18961>
Fix codegen for logical nodes so that they don't use their destination
as a temporary.
* kjs/nodes.cpp:
(KJS::LogicalAndNode::emitCode):
(KJS::LogicalOrNode::emitCode):
2008-05-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
https://bugs.webkit.org/show_bug.cgi?id=18869
Three layout tests are fixed:
fast/js/toString-elision-trailing-comma.html
fast/js/toString-prefix-postfix-preserve-parens.html
fast/js/kde/lval-exceptions.html
Functions now save a shared subrange of the original source used
to make them (so in the common case this adds no storage above the
memory cache).
* kjs/SourceProvider.h: Added.
(KJS::SourceProvider): New abstract base class for classes that provide on-demand access
to the source for a JavaScript program. This allows function objects to have access to their
original source without copying.
(KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
(KJS::UStringSourceProvider::create):
(KJS::UStringSourceProvider::getRange):
(KJS::UStringSourceProvider::data):
(KJS::UStringSourceProvider::length):
(KJS::UStringSourceProvider::UStringSourceProvider):
* kjs/SourceRange.h: Added.
(KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
the source, to encapsulate on-demand access to the source of a function.
(KJS::SourceRange::toString):
* VM/Machine.cpp:
(KJS::eval): Pass a UStringSourceProvider to the parser.
* kjs/Parser.cpp:
(KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
* kjs/Parser.h:
(KJS::Parser::parse): Take a SourceProvider.
* kjs/lexer.cpp:
(KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
use it to get the raw buffer and length.
* kjs/lexer.h:
(KJS::Lexer::sourceRange): Convenience function to get a source
range based on the lexer's source provieder, and char offsets
right before and after the desired range.
* kjs/function.cpp:
(KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
* kjs/function_object.cpp:
(KJS::functionProtoFuncToString): Use toSourceString to get the source.
(KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
* kjs/grammar.y: When parsing a function declaration, function
expression, or getter or setter, tell the function body about its
SourceRange.
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
(KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
* kjs/interpreter.h:
* kjs/nodes.h:
(KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
(KJS::FunctionBodyNode::toSourceString): Get the source string out
of the SourceRange.
(KJS::FuncExprNode::): Take a SourceRange and set it on the body.
(KJS::FuncDeclNode::): ditto
* kjs/testkjs.cpp:
(prettyPrintScript): Use a SourceProvider appropriately.
* JavaScriptCore.exp: Export new symbols.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
* JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
2008-05-09 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bring back RegisterFile tainting in order to correctly handle
natively implemented getters and setters that re-enter JavaScript
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/RegisterFile.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::put):
(KJS::tryGetAndCallProperty):
* kjs/property_slot.cpp:
(KJS::PropertySlot::functionGetter):
2008-05-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- track character offsets of open and close braces, in preparation for saving function source
I verified that there is no performance regression from this change.
* kjs/grammar.y:
* kjs/lexer.cpp:
(KJS::Lexer::lex):
(KJS::Lexer::matchPunctuator):
* kjs/lexer.h:
2008-05-09 Oliver Hunt <oliver@apple.com>
Debug build fix
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::restoreLocalStorage):
2008-05-09 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Build fixes for SquirrelFish on windows.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
* VM/Register.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::restoreLocalStorage):
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
* kjs/collector.h:
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
* kjs/property_slot.cpp:
2008-05-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- fix activation tearoff in the case where functions are called with too many arguments
Fixes:
fast/canvas/patternfill-repeat.html
fast/dom/SelectorAPI/bug-17313.html
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall):
(KJS::scopeChainForCall):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
2008-05-08 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
SunSpider reports a small speedup. Not sure what that's about.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
This helped me while debugging.
* VM/Machine.cpp:
(KJS::Machine::unwindCallFrame): When looking for an activation to tear
off, don't use the scope chain. Inside eval, the scope chain doesn't
belong to us; it belongs to our calling function.
Also, don't use the needsFullScopeChain flag to decide whether to tear
off the activation. "function.arguments" can create an activation
for a function whose needsFullScopeChain flag is set to false.
2008-05-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix function.call for calls of more than 8 arguments
Fixes svg/carto.net/button.svg
* kjs/list.cpp:
(KJS::List::getSlice): properly set up the m_buffer of the target list.
2008-05-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
Fixes:
- fast/regex/early-acid3-86.html
- http/tests/misc/acid3.html
* kjs/nodes.cpp:
(KJS::RegExpNode::emitCode):
2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Fix a performance regression caused by the introduction of property
attributes to SymbolTable in r32859 by encoding the attributes and the
register index into a single field of SymbolTableEntry.
This leaves Node::optimizeVariableAccess() definitely broken, although
it was probably not entirely correct in SquirrelFish before this change.
* VM/CodeBlock.h:
(KJS::missingThisObjectMarker):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar):
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::registerForLocal):
(KJS::CodeGenerator::registerForLocalConstInit):
(KJS::CodeGenerator::isLocalConstant):
(KJS::CodeGenerator::addConstant):
(KJS::CodeGenerator::emitCall):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::saveLocalStorage):
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames):
(KJS::JSVariableObject::getPropertyAttributes):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet):
(KJS::JSVariableObject::symbolTablePut):
(KJS::JSVariableObject::symbolTablePutWithAttributes):
* kjs/SymbolTable.h:
(KJS::SymbolTableEntry::SymbolTableEntry):
(KJS::SymbolTableEntry::isEmpty):
(KJS::SymbolTableEntry::getIndex):
(KJS::SymbolTableEntry::getAttributes):
(KJS::SymbolTableEntry::setAttributes):
(KJS::SymbolTableEntry::isReadOnly):
* kjs/nodes.cpp:
(KJS::getSymbolTableEntry):
(KJS::PostIncResolveNode::optimizeVariableAccess):
(KJS::PostDecResolveNode::optimizeVariableAccess):
(KJS::DeleteResolveNode::optimizeVariableAccess):
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::PreIncResolveNode::optimizeVariableAccess):
(KJS::PreDecResolveNode::optimizeVariableAccess):
(KJS::ReadModifyResolveNode::optimizeVariableAccess):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::ProgramNode::initializeSymbolTable):
2008-05-06 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Oliver.
- add missing ! in an assert that I failed to reverse
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
2008-05-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
https://bugs.webkit.org/show_bug.cgi?id=18868
The basic approach is to have "this" only be present in the symbol
table at compile time, not runtime.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
(KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
a symbol table.
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::execute): Don't assert that "this" is in the symbol table.
2008-05-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Trivial support for function.arguments: Currently, we only support
function.arguments from within the scope of function.
This fixes the remaining Mozilla JS test failures.
SunSpider reports no change.
* JavaScriptCore.exp:
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Separated scope chain deref from
activation register copying: since it is now possible for client code
to create an activation on behalf of a function that otherwise wouldn't
need one, having an activation no longer necessarily means that you need
to deref the scope chain.
(KJS::Machine::getCallFrame): For now, this function only examines the
current scope. Walking parent scopes requires some refactoring in the
way we track execution stacks.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState): We use a negative call frame offset to
indicate that a given scope is not a function call scope.
2008-05-05 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Fix call frame set up for native -> JS function calls.
* VM/Machine.cpp:
(KJS::Machine::execute):
2008-05-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
SunSpider reports a .4% speedup. Not sure what that's about.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Check for exception return from equal,
since toPrimitive can throw.
* kjs/operations.cpp:
(KJS::strictEqual): In response to an error I made in an earlier version
of this patch, I changed strictEqual to make clear the fact that it
performs no conversions and can't throw, making it slightly more efficient
in the process.
2008-05-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix some dumb mistakes in my last patch
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitPushScope):
(KJS::CodeGenerator::emitGetPropertyNames):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-05-05 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- document opcodes relating to jumps, scopes, and property name iteration
Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
next_pname and jmp_scopes.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJump):
(KJS::CodeGenerator::emitJumpIfTrue):
(KJS::CodeGenerator::emitJumpIfFalse):
(KJS::CodeGenerator::emitPushScope):
(KJS::CodeGenerator::emitNextPropertyName):
(KJS::CodeGenerator::emitGetPropertyNames):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/nodes.cpp:
(KJS::LogicalAndNode::emitCode):
(KJS::LogicalOrNode::emitCode):
(KJS::ConditionalNode::emitCode):
(KJS::IfNode::emitCode):
(KJS::IfElseNode::emitCode):
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::ForInNode::emitCode):
(KJS::WithNode::emitCode):
2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 18749: SQUIRRELFISH: const support is broken
<https://bugs.webkit.org/show_bug.cgi?id=18749>
Adds support for const during code generation.
Fixes 2 layout tests.
* ChangeLog:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar):
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::isLocalConstant):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::addVar):
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::emitCode):
(KJS::PostDecResolveNode::emitCode):
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignResolveNode::emitCode):
2008-05-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- document some more opcodes (and fix argument names)
Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitEqual):
(KJS::CodeGenerator::emitNotEqual):
(KJS::CodeGenerator::emitStrictEqual):
(KJS::CodeGenerator::emitNotStrictEqual):
(KJS::CodeGenerator::emitLess):
(KJS::CodeGenerator::emitLessEq):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/nodes.cpp:
(KJS::LessNode::emitCode):
(KJS::GreaterNode::emitCode):
(KJS::LessEqNode::emitCode):
(KJS::GreaterEqNode::emitCode):
(KJS::EqualNode::emitCode):
(KJS::NotEqualNode::emitCode):
(KJS::StrictEqualNode::emitCode):
(KJS::NotStrictEqualNode::emitCode):
(KJS::CaseBlockNode::emitCodeForBlock):
2008-05-04 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
More scaffolding for f.arguments.
Track the offset of the last call frame in the ExecState, so we can
produce a backtrace at any time.
Also, record numLocals, the sum of numVars + numParameters, in each code
block, to make updates to the ExecState a little cheaper than they
would be otherwise.
We now use numLocals in a bunch of places where we used to calculate
numVars + numParameters or -numVars - numParameters.
Reports are mixed, but all in all, this seems to be a wash on SunSpider.
2008-05-04 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Whoops, correctly handle properties that don't exist in the
symbol table.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePutWithAttributes):
2008-05-04 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Add attribute information to SymbolTable as ground work for
various DontEnum and ReadOnly issues.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar):
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::registerForLocal):
(KJS::CodeGenerator::registerForLocalConstInit):
(KJS::CodeGenerator::addConstant):
* VM/Machine.cpp:
(KJS::Machine::execute):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::saveLocalStorage):
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames):
(KJS::JSVariableObject::getPropertyAttributes):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePut):
(KJS::JSVariableObject::symbolTablePutWithAttributes):
* kjs/SymbolTable.h:
(KJS::SymbolTableEntry::SymbolTableEntry):
(KJS::SymbolTableIndexHashTraits::emptyValue):
* kjs/nodes.cpp:
(KJS::getSymbolTableEntry):
(KJS::ReadModifyResolveNode::optimizeVariableAccess):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::ProgramNode::initializeSymbolTable):
2008-05-04 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
More scaffolding for f.arguments.
Store the register file associated with an ExecState in the ExecState.
SunSpider reports no change.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
registerFileStack above globalExec, so it gets initialized first.
Removed remnants of old activation scheme.
2008-05-04 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Oliver.
- renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
equal --> eq
nequal --> neq
resolve_base_and_property --> resolve_with_base
resolve_base_and_func --> resolve_func
get_prop_id --> get_by_id
put_prop_id --> put_by_id
delete_prop_id --> del_by_id
get_prop_val --> get_by_val
put_prop_val --> put_by_val
delete_prop_val --> del_by_val
put_prop_index --> put_by_index
* VM/CodeBlock.cpp:
(KJS::printUnaryOp):
(KJS::printBinaryOp):
(KJS::printConditionalJump):
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitEqual):
(KJS::CodeGenerator::emitNotEqual):
(KJS::CodeGenerator::emitResolveWithBase):
(KJS::CodeGenerator::emitResolveFunction):
(KJS::CodeGenerator::emitGetById):
(KJS::CodeGenerator::emitPutById):
(KJS::CodeGenerator::emitDeleteById):
(KJS::CodeGenerator::emitGetByVal):
(KJS::CodeGenerator::emitPutByVal):
(KJS::CodeGenerator::emitDeleteByVal):
(KJS::CodeGenerator::emitPutByIndex):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::ArrayNode::emitCode):
(KJS::PropertyListNode::emitCode):
(KJS::BracketAccessorNode::emitCode):
(KJS::DotAccessorNode::emitCode):
(KJS::EvalFunctionCallNode::emitCode):
(KJS::FunctionCallResolveNode::emitCode):
(KJS::FunctionCallBracketNode::emitCode):
(KJS::FunctionCallDotNode::emitCode):
(KJS::PostIncResolveNode::emitCode):
(KJS::PostDecResolveNode::emitCode):
(KJS::PostIncBracketNode::emitCode):
(KJS::PostDecBracketNode::emitCode):
(KJS::PostIncDotNode::emitCode):
(KJS::PostDecDotNode::emitCode):
(KJS::DeleteResolveNode::emitCode):
(KJS::DeleteBracketNode::emitCode):
(KJS::DeleteDotNode::emitCode):
(KJS::TypeOfResolveNode::emitCode):
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::PreIncBracketNode::emitCode):
(KJS::PreDecBracketNode::emitCode):
(KJS::PreIncDotNode::emitCode):
(KJS::PreDecDotNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
(KJS::AssignResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
(KJS::ConstDeclNode::emitCodeSingle):
(KJS::ForInNode::emitCode):
(KJS::TryNode::emitCode):
2008-05-04 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix assertion when accessing arguments object with too many arguments provided
The arguments constructor was assuming that the register offset given for argv
was an absolute offset into the registerfile, rather than the offset from the
frame. This patches corrects that issue.
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject):
2008-05-04 Geoffrey Garen <ggaren@apple.com>
Rubber stamped by Sam Weinig.
Cleaned up Machine.cpp according to our style guidelines: moved static
data to the top of the file; moved stand-alone functions below that;
moved the Machine constructor above other Machine member functions.
2008-05-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- fix accidental breakage from last patch
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-05-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- a bunch more opcode documentation and corresponding parameter name fixes
I renamed a few opcodes:
type_of --> typeof (that's what the JS operator is named)
instance_of --> instanceof (ditto)
create_error --> new_error (for consistency with other new_* opcodes)
I documented the following opcodes:
- load
- new_object
- new_array
- new_regexp
- mov
- pre_inc
- pre_dec
- post_inc
- post_dec
- to_jsnumber
- negate
- bitnot
- not
- instanceof
- typeof
- in
- new_func
- new_funcexp
- new_error
I also fixed formatting on some existing opcode docs.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitMove):
(KJS::CodeGenerator::emitNot):
(KJS::CodeGenerator::emitPreInc):
(KJS::CodeGenerator::emitPreDec):
(KJS::CodeGenerator::emitPostInc):
(KJS::CodeGenerator::emitPostDec):
(KJS::CodeGenerator::emitToJSNumber):
(KJS::CodeGenerator::emitNegate):
(KJS::CodeGenerator::emitBitNot):
(KJS::CodeGenerator::emitInstanceOf):
(KJS::CodeGenerator::emitTypeOf):
(KJS::CodeGenerator::emitIn):
(KJS::CodeGenerator::emitLoad):
(KJS::CodeGenerator::emitNewObject):
(KJS::CodeGenerator::emitNewArray):
(KJS::CodeGenerator::emitNewRegExp):
(KJS::CodeGenerator::emitNewError):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::scopeDepth):
(KJS::CodeGenerator::addVar):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::Node::emitThrowError):
(KJS::RegExpNode::emitCode):
(KJS::TypeOfValueNode::emitCode):
(KJS::UnaryPlusNode::emitCode):
(KJS::NegateNode::emitCode):
(KJS::BitwiseNotNode::emitCode):
(KJS::LogicalNotNode::emitCode):
(KJS::InstanceOfNode::emitCode):
(KJS::InNode::emitCode):
2008-05-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff and Sam.
- generate HTML bytecode docs at build time
* DerivedSources.make:
* docs: Added.
* docs/make-bytecode-docs.pl: Added.
2008-05-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Update ExecState::m_scopeChain when switching scope chains inside the
machine.
This fixes uses of lexicalGlobalObject, such as, in a subframe
alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
and a bunch of the security failures listed in
https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
seemingly because of regressions in exception messages).
SunSpider reports no change.
* VM/Machine.cpp: Factored out scope chain updating into a common
function that takes care to update ExecState::m_scopeChain, too.
* kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
could update ExecState::m_scopeChain, even though that value is
read-only for everyone else.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
this client to be a little friendlier to ExecState's internal
storage type for scope chain data.
2008-05-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
SunSpider reports no change.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Don't construct a ScopeChain object,
since the direct threaded interpreter will goto across its destructor.
2008-05-03 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A bit more efficient fix than r32832: Don't copy globals into function
register files; instead, have the RegisterFileStack track only the base
of the last *global* register file, so the global object's register
references stay good.
SunSpider reports a .3% speedup. Not sure what that's about.
2008-05-03 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18864: SquirrelFish: Support getter and setter definition in object literals
<https://bugs.webkit.org/show_bug.cgi?id=18864>
Add new opcodes to allow us to add getters and setters to an object. These are
only used by the codegen for object literals.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitPutGetter):
(KJS::CodeGenerator::emitPutSetter):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::PropertyListNode::emitCode):
2008-05-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- properly copy globals into and out of implicit call register
files, otherwise they will fail at global lookup
Fixes fast/js/array-tostring-and-join.html layout test.
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::pushGlobalRegisterFile):
(KJS::RegisterFileStack::popGlobalRegisterFile):
(KJS::RegisterFileStack::pushFunctionRegisterFile):
(KJS::RegisterFileStack::popFunctionRegisterFile):
2008-05-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
SQUIRRELFISH: incorrect eval used in some cases
Changed all code inside the machine to fetch the lexical global object
directly from the scope chain, instead of from the ExecState.
Clients who fetch the lexical global object through the ExecState
still don't work.
SunSpider reports no change.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Fetch the lexical global object from
the scope chain.
* kjs/ExecState.h:
(KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
this function into ScopeChainNode, but kept this function around to
support existing clients.
2008-05-02 Geoffrey Garen <ggaren@apple.com>
Rubber stamped by Oliver Hunt.
Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/AllInOneFile.cpp:
2008-05-01 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff and Maciej.
Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
<https://bugs.webkit.org/show_bug.cgi?id=18827>
Remove safe/unsafe RegisterFile concept, and instead just add additional
logic to ensure we always push/pop RegisterFiles when executing getters
and setters, similar to the logic for valueOf and toString.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/RegisterFile.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::put):
* kjs/property_slot.cpp:
(KJS::PropertySlot::functionGetter):
2008-05-01 Oliver Hunt <oliver@apple.com>
RS=Geoff
Rename unsafeForReentry to safeForReentry to avoid double negatives.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/RegisterFile.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
2008-05-01 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
<https://bugs.webkit.org/show_bug.cgi?id=18827>
This patch makes getters and setters work. It does this by
tracking whether the RegisterFile is "safe", that is whether
the interpreter is in a state that in which it can handle
the RegisterFile being reallocated.
* VM/Machine.cpp:
(KJS::resolve):
(KJS::Machine::privateExecute):
* VM/RegisterFile.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
2008-04-30 Geoffrey Garen <ggaren@apple.com>
Release build fix: Always compile in "isGlobalObject", since it's
listed in our .exp file.
* kjs/ExecState.cpp:
(KJS::ExecState::isGlobalObject):
* kjs/ExecState.h:
2008-04-30 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Minor code restructuring to prepare for getters and setters,
also helps exception semantics a bit.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-30 Geoffrey Garen <ggaren@apple.com>
Fixed tyop.
* kjs/ExecState.h:
2008-04-30 Geoffrey Garen <ggaren@apple.com>
Debug build fix: export a missing symbol.
* JavaScriptCore.exp:
2008-04-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A little more ExecState refactoring: Now, only the global object creates
an ExecState.
Also inlined ExecState::lexicalGlobalObject().
SunSpider reports no change.
2008-04-30 Geoffrey Garen <ggaren@apple.com>
WebCore build fix: forward-declare ScopeChain.
* kjs/interpreter.h:
2008-04-30 Geoffrey Garen <ggaren@apple.com>
Build fix for JavaScriptGlue: export a missing symbol.
* JavaScriptCore.exp:
2008-04-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed a lot of unused bits from ExecState, moving them into
OldInterpreterExecState, the fake scaffolding class.
The clutter was making it hard to see the forest from the trees.
.4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
is faster now.
2008-04-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
<https://bugs.webkit.org/show_bug.cgi?id=18643>
Prevent static slot optimisation for new variables and functions in
globally re-entrant code called from an an implicit function call.
This is necessary to prevent us from needing to resize the global
slot portion of the root RegisterFile during an implicit (and hence
unguarded) function call.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/RegisterFile.h:
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::pushGlobalRegisterFile):
(KJS::RegisterFileStack::popGlobalRegisterFile):
(KJS::RegisterFileStack::pushFunctionRegisterFile):
(KJS::RegisterFileStack::popFunctionRegisterFile):
* VM/RegisterFileStack.h:
(KJS::RegisterFileStack::inImplicitFunctionCall):
(KJS::RegisterFileStack::lastGlobal):
* kjs/nodes.cpp:
(KJS::ProgramNode::generateCode):
* kjs/nodes.h:
(KJS::ProgramNode::):
2008-04-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
In nested program code, don't propogate "this" back to the parent
register file. ("this" should remain constant in the parent register
file, regardless of the scripts it invokes.)
* VM/RegisterFile.cpp:
(KJS::RegisterFile::copyGlobals):
2008-04-28 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Restore base pointer when popping a global RegisterFile
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::popGlobalRegisterFile):
2008-04-28 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
<https://bugs.webkit.org/show_bug.cgi?id=18643>
Partial fix. This results in all implicit calls to toString or valueOf
executing in a separate RegisterFile, so ensuring that the the pointers
in the triggering interpreter don't get trashed. This still leaves the
task of preventing new global re-entry from toString and valueOf from
clobbering the RegisterFile.
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::pushFunctionRegisterFile):
(KJS::RegisterFileStack::popFunctionRegisterFile):
* VM/RegisterFileStack.h:
* kjs/object.cpp:
(KJS::tryGetAndCallProperty):
2008-04-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Simplified activation object a bit: No need to store the callee
in the activation object -- we can pull it out of the call frame
when needed, instead.
SunSpider reports no change.
2008-04-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
Substantially more handling of "arguments": "arguments" works fully
now, but "f.arguments" still doesn't work.
Fixes 10 regression tests.
SunSpider reports no regression.
* kjs/JSActivation.cpp:
(KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
List to pass to the arguments object constructor.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
because that seems to make GCC happy. (Previously, I had added
JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
happy. So it goes.)
2008-04-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Groundwork for more handling of "arguments". I'm not checking in the
actual handling of "arguments" yet, because it still needs a little
fiddling to avoid a performance regression.
SunSpider reports no change.
* VM/Machine.cpp:
(KJS::initializeCallFrame): Put argc in the register file, so the
arguments object can find it later, to determine arguments.length.
* kjs/nodes.h:
(KJS::FunctionBodyNode::): Added a special code accessor for when you
know the code has already been generated, and you don't have a scopeChain
to supply for potential code generation. (This is the case when the
activation object creates the arguments object.)
2008-04-28 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Replace unsafe use of auto_ptr in Vector with manual memory
management.
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::~RegisterFileStack):
(KJS::RegisterFileStack::popRegisterFile):
* VM/RegisterFileStack.h:
2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
<https://bugs.webkit.org/show_bug.cgi?id=18746>
Change the base to the correct value of the 'this' object after the direct
eval test instead of before.
Fixes 5 layout tests.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/nodes.cpp:
(KJS::EvalFunctionCallNode::emitCode):
2008-04-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- document all property getting, setting and deleting opcodes
(And fix function parameter names to match corresponding opcode parameter names.)
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitResolve):
(KJS::CodeGenerator::emitResolveBase):
(KJS::CodeGenerator::emitResolveBaseAndProperty):
(KJS::CodeGenerator::emitResolveBaseAndFunc):
(KJS::CodeGenerator::emitGetPropId):
(KJS::CodeGenerator::emitPutPropId):
(KJS::CodeGenerator::emitDeletePropId):
(KJS::CodeGenerator::emitPutPropVal):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::resolve):
(KJS::resolveBase):
(KJS::resolveBaseAndProperty):
(KJS::resolveBaseAndFunc):
(KJS::Machine::privateExecute):
* kjs/nodes.cpp:
(KJS::ResolveNode::emitCode):
(KJS::ArrayNode::emitCode):
(KJS::PropertyListNode::emitCode):
(KJS::BracketAccessorNode::emitCode):
(KJS::EvalFunctionCallNode::emitCode):
(KJS::FunctionCallResolveNode::emitCode):
(KJS::FunctionCallBracketNode::emitCode):
(KJS::PostIncResolveNode::emitCode):
(KJS::PostDecResolveNode::emitCode):
(KJS::PostIncBracketNode::emitCode):
(KJS::PostDecBracketNode::emitCode):
(KJS::PostIncDotNode::emitCode):
(KJS::PostDecDotNode::emitCode):
(KJS::DeleteResolveNode::emitCode):
(KJS::TypeOfResolveNode::emitCode):
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::PreIncBracketNode::emitCode):
(KJS::PreDecBracketNode::emitCode):
(KJS::AssignResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
(KJS::AssignBracketNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
(KJS::ConstDeclNode::emitCodeSingle):
2008-04-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18628: SQUIRRELFISH: need to support recursion limit
<https://bugs.webkit.org/show_bug.cgi?id=18628>
Basically completes recursion limiting. There is still some
tuning we may want to do to make things better in the face of
very bad code, but certainly nothing worse than anything already
possible in trunk.
Also fixes a WebKit test by fixing the exception text :D
* JavaScriptCore.exp:
* VM/ExceptionHelpers.cpp:
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/RegisterFile.cpp:
(KJS::RegisterFile::growBuffer):
(KJS::RegisterFile::addGlobalSlots):
* VM/RegisterFile.h:
(KJS::RegisterFile::grow):
(KJS::RegisterFile::uncheckedGrow):
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::pushRegisterFile):
* VM/RegisterFileStack.h:
2008-04-25 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18628: SQUIRRELFISH: need to support recursion limit
<https://bugs.webkit.org/show_bug.cgi?id=18628>
Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
seems reasonable as it is greater than the old eval limit, and a long way short of
the reentry depth needed to overflow the stack.
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/Machine.h:
2008-04-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
A tiny bit of cleanup to the regexp code.
Removed some static_cast.
Removed createRegExpImp because it's no longer used.
2008-04-25 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
<https://bugs.webkit.org/show_bug.cgi?id=18736>
Ensure the "default" target is correct in the absence of an explicit default handler.
* kjs/nodes.cpp:
(KJS::CaseBlockNode::emitCodeForBlock):
2008-04-25 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18628: SQUIRRELFISH: need to support recursion limit
<https://bugs.webkit.org/show_bug.cgi?id=18628>
More bounds checking.
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/RegisterFile.cpp:
(KJS::RegisterFile::growBuffer):
* VM/RegisterFile.h:
2008-04-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix signal catching magic
The signal handlers are restored to _exit but are only set when
running under run-javascriptcore-tests. fprintf from a signal
handler is not safe.
* kjs/testkjs.cpp:
(main):
(parseArguments):
* tests/mozilla/jsDriver.pl:
2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
<https://bugs.webkit.org/show_bug.cgi?id=18732>
Fixes another regression test.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
<https://bugs.webkit.org/show_bug.cgi?id=18728>
Fixes another regression test.
* kjs/nodes.cpp:
(KJS::RegExpNode::emitCode):
2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Geoffrey Garen.
Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
<https://bugs.webkit.org/show_bug.cgi?id=18735>
The overloaded toThisObject method was not copied over to JSActivation.
Fixes two regression tests.
* kjs/JSActivation.cpp:
(KJS::JSActivation::toThisObject):
* kjs/JSActivation.h:
2008-04-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Added support for arguments.callee.
2008-04-24 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18628: SQUIRRELFISH: need to support recursion limit
<https://bugs.webkit.org/show_bug.cgi?id=18628>
Partial fix -- this gets us some of the required bounds checking, but not
complete coverage. But it does manage to do them without regressing :D
* VM/ExceptionHelpers.cpp:
(KJS::createError):
(KJS::createStackOverflowError):
* VM/ExceptionHelpers.h:
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/RegisterFile.cpp:
* VM/RegisterFile.h:
(KJS::RegisterFile::):
(KJS::RegisterFile::RegisterFile):
(KJS::RegisterFile::grow):
2008-04-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
A tiny bit more handling of "arguments": create a real, but mostly
hollow, arguments object.
Fixes 2 regression tests.
2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
<https://bugs.webkit.org/show_bug.cgi?id=18717>
Fixes a regression test, but exposes the failure of another due to the
lack of getters and setters.
* kjs/nodes.cpp:
(KJS::ConstDeclNode::emitCodeSingle):
(KJS::ConstDeclNode::emitCode):
(KJS::ConstStatementNode::emitCode):
(KJS::VarStatementNode::emitCode):
* kjs/nodes.h:
2008-04-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Print a CRASH statement when crashing, so test failures are not a
mystery.
* kjs/testkjs.cpp:
(handleCrash):
(main):
2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Geoffrey Garen.
Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
<https://bugs.webkit.org/show_bug.cgi?id=18716>
This fixes 2 more regression tests.
* kjs/nodes.cpp:
(KJS::TypeOfResolveNode::emitCode):
2008-04-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Put the callee in the call frame.
Necessary in order to support "arguments" and "arguments.callee".
Also fixes a latent GC bug, where an executing function could be
subject to GC if the register holding it were overwritten. Here's
an example that would have caused problems:
function f()
{
// Flood the machine stack to eliminate any old pointers to f.
g.call({});
// Overwrite f in the register file.
f = 1;
// Force a GC.
for (var i = 0; i < 5000; ++i) {
({});
}
// Welcome to crash-ville.
}
function g()
{
}
f();
* VM/Machine.h: Changed the order of arguments to
execute(FunctionBodyNode*...) to match the other execute functions.
* kjs/function.cpp: Updated to match new argument requirements from
execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
rest of JavaScriptCore.
SunSpider reports no change.
2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
<https://bugs.webkit.org/show_bug.cgi?id=18707>
This fixes 4 more regression tests.
* VM/Machine.cpp:
(KJS::eval):
2008-04-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
Fixes 3 JSC tests.
* VM/SegmentedVector.h:
(KJS::SegmentedVector::grow):
2008-04-23 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Degenerate handling of "arguments" as a property of the activation
object. Currently, we just return a vanilla object.
SunSpider reports no change.
Fixes:
ecma_3/Function/regress-94506.js.
Reveals to have been secretly broken:
ecma_3/Function/15.3.4.3-1.js
ecma_3/Function/15.3.4.4-1.js
These tests were passing incorrectly. testkjs creates a global array
named "arguments" to hold command-line arguments. That array was
tricking these tests into thinking that an arguments object with length
0 had been created. Since our new vanilla object shadows the global
property named arguments, that object no longer fools these tests into
passing.
Net change: +1 failing test.
* kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2008-04-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- save and restore callFrame
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* kjs/testkjs.cpp:
(main):
2008-04-23 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed scopes for named function expressions.
Fixes one regression test.
Two changes here:
(1) The function's name is supposed to have attributes DontDelete,
ReadOnly, regardless of the type of code executing.
(2) Push the name object on the function's scope chain, rather than
the ExecState's scope chain because, well, that's where it belongs.
2008-04-23 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Inlined JSObject::putDirect, for a .4% SunSpider speedup.
I did this as a first step toward removing nodes.cpp from
AllInOneFile.cpp, but I'm putting that larger project aside for now.
2008-04-23 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Geoff.
- add OldInterpreterExecState class and use it in dead code
This will allow removing things from the real ExecState class
without having to figure out how to remove all this code without
getting a perf regression.
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToNumber):
(KJS::ExpressionNode::evaluateToBoolean):
(KJS::ExpressionNode::evaluateToInt32):
(KJS::ExpressionNode::evaluateToUInt32):
(KJS::Node::setErrorCompletion):
(KJS::Node::throwError):
(KJS::Node::throwUndefinedVariableError):
(KJS::Node::handleException):
(KJS::Node::rethrowException):
(KJS::BreakpointCheckStatement::execute):
(KJS::BreakpointCheckStatement::optimizeVariableAccess):
(KJS::NullNode::evaluate):
(KJS::FalseNode::evaluate):
(KJS::TrueNode::evaluate):
(KJS::NumberNode::evaluate):
(KJS::NumberNode::evaluateToNumber):
(KJS::NumberNode::evaluateToBoolean):
(KJS::NumberNode::evaluateToInt32):
(KJS::NumberNode::evaluateToUInt32):
(KJS::ImmediateNumberNode::evaluate):
(KJS::ImmediateNumberNode::evaluateToInt32):
(KJS::ImmediateNumberNode::evaluateToUInt32):
(KJS::StringNode::evaluate):
(KJS::StringNode::evaluateToNumber):
(KJS::StringNode::evaluateToBoolean):
(KJS::RegExpNode::evaluate):
(KJS::ThisNode::evaluate):
(KJS::ResolveNode::inlineEvaluate):
(KJS::ResolveNode::evaluate):
(KJS::ResolveNode::evaluateToNumber):
(KJS::ResolveNode::evaluateToBoolean):
(KJS::ResolveNode::evaluateToInt32):
(KJS::ResolveNode::evaluateToUInt32):
(KJS::getSymbolTableEntry):
(KJS::ResolveNode::optimizeVariableAccess):
(KJS::LocalVarAccessNode::inlineEvaluate):
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarAccessNode::evaluateToNumber):
(KJS::LocalVarAccessNode::evaluateToBoolean):
(KJS::LocalVarAccessNode::evaluateToInt32):
(KJS::LocalVarAccessNode::evaluateToUInt32):
(KJS::getNonLocalSymbol):
(KJS::ScopedVarAccessNode::inlineEvaluate):
(KJS::ScopedVarAccessNode::evaluate):
(KJS::ScopedVarAccessNode::evaluateToNumber):
(KJS::ScopedVarAccessNode::evaluateToBoolean):
(KJS::ScopedVarAccessNode::evaluateToInt32):
(KJS::ScopedVarAccessNode::evaluateToUInt32):
(KJS::NonLocalVarAccessNode::inlineEvaluate):
(KJS::NonLocalVarAccessNode::evaluate):
(KJS::NonLocalVarAccessNode::evaluateToNumber):
(KJS::NonLocalVarAccessNode::evaluateToBoolean):
(KJS::NonLocalVarAccessNode::evaluateToInt32):
(KJS::NonLocalVarAccessNode::evaluateToUInt32):
(KJS::ElementNode::optimizeVariableAccess):
(KJS::ElementNode::evaluate):
(KJS::ArrayNode::optimizeVariableAccess):
(KJS::ArrayNode::evaluate):
(KJS::ObjectLiteralNode::optimizeVariableAccess):
(KJS::ObjectLiteralNode::evaluate):
(KJS::PropertyListNode::optimizeVariableAccess):
(KJS::PropertyListNode::evaluate):
(KJS::PropertyNode::optimizeVariableAccess):
(KJS::PropertyNode::evaluate):
(KJS::BracketAccessorNode::optimizeVariableAccess):
(KJS::BracketAccessorNode::inlineEvaluate):
(KJS::BracketAccessorNode::evaluate):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::BracketAccessorNode::evaluateToBoolean):
(KJS::BracketAccessorNode::evaluateToInt32):
(KJS::BracketAccessorNode::evaluateToUInt32):
(KJS::DotAccessorNode::optimizeVariableAccess):
(KJS::DotAccessorNode::inlineEvaluate):
(KJS::DotAccessorNode::evaluate):
(KJS::DotAccessorNode::evaluateToNumber):
(KJS::DotAccessorNode::evaluateToBoolean):
(KJS::DotAccessorNode::evaluateToInt32):
(KJS::DotAccessorNode::evaluateToUInt32):
(KJS::ArgumentListNode::optimizeVariableAccess):
(KJS::ArgumentListNode::evaluateList):
(KJS::ArgumentsNode::optimizeVariableAccess):
(KJS::NewExprNode::optimizeVariableAccess):
(KJS::NewExprNode::inlineEvaluate):
(KJS::NewExprNode::evaluate):
(KJS::NewExprNode::evaluateToNumber):
(KJS::NewExprNode::evaluateToBoolean):
(KJS::NewExprNode::evaluateToInt32):
(KJS::NewExprNode::evaluateToUInt32):
(KJS::ExpressionNode::resolveAndCall):
(KJS::EvalFunctionCallNode::optimizeVariableAccess):
(KJS::EvalFunctionCallNode::evaluate):
(KJS::FunctionCallValueNode::optimizeVariableAccess):
(KJS::FunctionCallValueNode::evaluate):
(KJS::FunctionCallResolveNode::optimizeVariableAccess):
(KJS::FunctionCallResolveNode::inlineEvaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluateToNumber):
(KJS::FunctionCallResolveNode::evaluateToBoolean):
(KJS::FunctionCallResolveNode::evaluateToInt32):
(KJS::FunctionCallResolveNode::evaluateToUInt32):
(KJS::LocalVarFunctionCallNode::inlineEvaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluateToNumber):
(KJS::LocalVarFunctionCallNode::evaluateToBoolean):
(KJS::LocalVarFunctionCallNode::evaluateToInt32):
(KJS::LocalVarFunctionCallNode::evaluateToUInt32):
(KJS::ScopedVarFunctionCallNode::inlineEvaluate):
(KJS::ScopedVarFunctionCallNode::evaluate):
(KJS::ScopedVarFunctionCallNode::evaluateToNumber):
(KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
(KJS::ScopedVarFunctionCallNode::evaluateToInt32):
(KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
(KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
(KJS::NonLocalVarFunctionCallNode::evaluate):
(KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
(KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
(KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
(KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
(KJS::FunctionCallBracketNode::optimizeVariableAccess):
(KJS::FunctionCallBracketNode::evaluate):
(KJS::FunctionCallDotNode::optimizeVariableAccess):
(KJS::FunctionCallDotNode::inlineEvaluate):
(KJS::FunctionCallDotNode::evaluate):
(KJS::FunctionCallDotNode::evaluateToNumber):
(KJS::FunctionCallDotNode::evaluateToBoolean):
(KJS::FunctionCallDotNode::evaluateToInt32):
(KJS::FunctionCallDotNode::evaluateToUInt32):
(KJS::PostIncResolveNode::optimizeVariableAccess):
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::optimizeVariableAccess):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToBoolean):
(KJS::PostDecLocalVarNode::evaluateToInt32):
(KJS::PostDecLocalVarNode::evaluateToUInt32):
(KJS::PostfixBracketNode::optimizeVariableAccess):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostfixDotNode::optimizeVariableAccess):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::PostfixErrorNode::evaluate):
(KJS::DeleteResolveNode::optimizeVariableAccess):
(KJS::DeleteResolveNode::evaluate):
(KJS::LocalVarDeleteNode::evaluate):
(KJS::DeleteBracketNode::optimizeVariableAccess):
(KJS::DeleteBracketNode::evaluate):
(KJS::DeleteDotNode::optimizeVariableAccess):
(KJS::DeleteDotNode::evaluate):
(KJS::DeleteValueNode::optimizeVariableAccess):
(KJS::DeleteValueNode::evaluate):
(KJS::VoidNode::optimizeVariableAccess):
(KJS::VoidNode::evaluate):
(KJS::TypeOfValueNode::optimizeVariableAccess):
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::TypeOfResolveNode::evaluate):
(KJS::TypeOfValueNode::evaluate):
(KJS::PreIncResolveNode::optimizeVariableAccess):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::optimizeVariableAccess):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::PreIncConstNode::evaluate):
(KJS::PreDecConstNode::evaluate):
(KJS::PostIncConstNode::evaluate):
(KJS::PostDecConstNode::evaluate):
(KJS::PrefixBracketNode::optimizeVariableAccess):
(KJS::PreIncBracketNode::evaluate):
(KJS::PreDecBracketNode::evaluate):
(KJS::PrefixDotNode::optimizeVariableAccess):
(KJS::PreIncDotNode::evaluate):
(KJS::PreDecDotNode::evaluate):
(KJS::PrefixErrorNode::evaluate):
(KJS::UnaryPlusNode::optimizeVariableAccess):
(KJS::UnaryPlusNode::evaluate):
(KJS::UnaryPlusNode::evaluateToBoolean):
(KJS::UnaryPlusNode::evaluateToNumber):
(KJS::UnaryPlusNode::evaluateToInt32):
(KJS::UnaryPlusNode::evaluateToUInt32):
(KJS::NegateNode::optimizeVariableAccess):
(KJS::NegateNode::evaluate):
(KJS::NegateNode::evaluateToNumber):
(KJS::BitwiseNotNode::optimizeVariableAccess):
(KJS::BitwiseNotNode::inlineEvaluateToInt32):
(KJS::BitwiseNotNode::evaluate):
(KJS::BitwiseNotNode::evaluateToNumber):
(KJS::BitwiseNotNode::evaluateToBoolean):
(KJS::BitwiseNotNode::evaluateToInt32):
(KJS::BitwiseNotNode::evaluateToUInt32):
(KJS::LogicalNotNode::optimizeVariableAccess):
(KJS::LogicalNotNode::evaluate):
(KJS::LogicalNotNode::evaluateToBoolean):
(KJS::MultNode::optimizeVariableAccess):
(KJS::MultNode::inlineEvaluateToNumber):
(KJS::MultNode::evaluate):
(KJS::MultNode::evaluateToNumber):
(KJS::MultNode::evaluateToBoolean):
(KJS::MultNode::evaluateToInt32):
(KJS::MultNode::evaluateToUInt32):
(KJS::DivNode::optimizeVariableAccess):
(KJS::DivNode::inlineEvaluateToNumber):
(KJS::DivNode::evaluate):
(KJS::DivNode::evaluateToNumber):
(KJS::DivNode::evaluateToInt32):
(KJS::DivNode::evaluateToUInt32):
(KJS::ModNode::optimizeVariableAccess):
(KJS::ModNode::inlineEvaluateToNumber):
(KJS::ModNode::evaluate):
(KJS::ModNode::evaluateToNumber):
(KJS::ModNode::evaluateToBoolean):
(KJS::ModNode::evaluateToInt32):
(KJS::ModNode::evaluateToUInt32):
(KJS::throwOutOfMemoryErrorToNumber):
(KJS::addSlowCase):
(KJS::addSlowCaseToNumber):
(KJS::add):
(KJS::addToNumber):
(KJS::AddNode::optimizeVariableAccess):
(KJS::AddNode::evaluate):
(KJS::AddNode::inlineEvaluateToNumber):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNode::evaluateToInt32):
(KJS::AddNode::evaluateToUInt32):
(KJS::AddNumbersNode::inlineEvaluateToNumber):
(KJS::AddNumbersNode::evaluate):
(KJS::AddNumbersNode::evaluateToNumber):
(KJS::AddNumbersNode::evaluateToInt32):
(KJS::AddNumbersNode::evaluateToUInt32):
(KJS::AddStringsNode::evaluate):
(KJS::AddStringLeftNode::evaluate):
(KJS::AddStringRightNode::evaluate):
(KJS::SubNode::optimizeVariableAccess):
(KJS::SubNode::inlineEvaluateToNumber):
(KJS::SubNode::evaluate):
(KJS::SubNode::evaluateToNumber):
(KJS::SubNode::evaluateToInt32):
(KJS::SubNode::evaluateToUInt32):
(KJS::LeftShiftNode::optimizeVariableAccess):
(KJS::LeftShiftNode::inlineEvaluateToInt32):
(KJS::LeftShiftNode::evaluate):
(KJS::LeftShiftNode::evaluateToNumber):
(KJS::LeftShiftNode::evaluateToInt32):
(KJS::LeftShiftNode::evaluateToUInt32):
(KJS::RightShiftNode::optimizeVariableAccess):
(KJS::RightShiftNode::inlineEvaluateToInt32):
(KJS::RightShiftNode::evaluate):
(KJS::RightShiftNode::evaluateToNumber):
(KJS::RightShiftNode::evaluateToInt32):
(KJS::RightShiftNode::evaluateToUInt32):
(KJS::UnsignedRightShiftNode::optimizeVariableAccess):
(KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluateToNumber):
(KJS::UnsignedRightShiftNode::evaluateToInt32):
(KJS::UnsignedRightShiftNode::evaluateToUInt32):
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNode::optimizeVariableAccess):
(KJS::LessNode::inlineEvaluateToBoolean):
(KJS::LessNode::evaluate):
(KJS::LessNode::evaluateToBoolean):
(KJS::LessNumbersNode::inlineEvaluateToBoolean):
(KJS::LessNumbersNode::evaluate):
(KJS::LessNumbersNode::evaluateToBoolean):
(KJS::LessStringsNode::inlineEvaluateToBoolean):
(KJS::LessStringsNode::evaluate):
(KJS::LessStringsNode::evaluateToBoolean):
(KJS::GreaterNode::optimizeVariableAccess):
(KJS::GreaterNode::inlineEvaluateToBoolean):
(KJS::GreaterNode::evaluate):
(KJS::GreaterNode::evaluateToBoolean):
(KJS::LessEqNode::optimizeVariableAccess):
(KJS::LessEqNode::inlineEvaluateToBoolean):
(KJS::LessEqNode::evaluate):
(KJS::LessEqNode::evaluateToBoolean):
(KJS::GreaterEqNode::optimizeVariableAccess):
(KJS::GreaterEqNode::inlineEvaluateToBoolean):
(KJS::GreaterEqNode::evaluate):
(KJS::GreaterEqNode::evaluateToBoolean):
(KJS::InstanceOfNode::optimizeVariableAccess):
(KJS::InstanceOfNode::evaluate):
(KJS::InstanceOfNode::evaluateToBoolean):
(KJS::InNode::optimizeVariableAccess):
(KJS::InNode::evaluate):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::optimizeVariableAccess):
(KJS::EqualNode::inlineEvaluateToBoolean):
(KJS::EqualNode::evaluate):
(KJS::EqualNode::evaluateToBoolean):
(KJS::NotEqualNode::optimizeVariableAccess):
(KJS::NotEqualNode::inlineEvaluateToBoolean):
(KJS::NotEqualNode::evaluate):
(KJS::NotEqualNode::evaluateToBoolean):
(KJS::StrictEqualNode::optimizeVariableAccess):
(KJS::StrictEqualNode::inlineEvaluateToBoolean):
(KJS::StrictEqualNode::evaluate):
(KJS::StrictEqualNode::evaluateToBoolean):
(KJS::NotStrictEqualNode::optimizeVariableAccess):
(KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
(KJS::NotStrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::evaluateToBoolean):
(KJS::BitAndNode::optimizeVariableAccess):
(KJS::BitAndNode::evaluate):
(KJS::BitAndNode::inlineEvaluateToInt32):
(KJS::BitAndNode::evaluateToNumber):
(KJS::BitAndNode::evaluateToBoolean):
(KJS::BitAndNode::evaluateToInt32):
(KJS::BitAndNode::evaluateToUInt32):
(KJS::BitXOrNode::optimizeVariableAccess):
(KJS::BitXOrNode::inlineEvaluateToInt32):
(KJS::BitXOrNode::evaluate):
(KJS::BitXOrNode::evaluateToNumber):
(KJS::BitXOrNode::evaluateToBoolean):
(KJS::BitXOrNode::evaluateToInt32):
(KJS::BitXOrNode::evaluateToUInt32):
(KJS::BitOrNode::optimizeVariableAccess):
(KJS::BitOrNode::inlineEvaluateToInt32):
(KJS::BitOrNode::evaluate):
(KJS::BitOrNode::evaluateToNumber):
(KJS::BitOrNode::evaluateToBoolean):
(KJS::BitOrNode::evaluateToInt32):
(KJS::BitOrNode::evaluateToUInt32):
(KJS::LogicalAndNode::optimizeVariableAccess):
(KJS::LogicalAndNode::evaluate):
(KJS::LogicalAndNode::evaluateToBoolean):
(KJS::LogicalOrNode::optimizeVariableAccess):
(KJS::LogicalOrNode::evaluate):
(KJS::LogicalOrNode::evaluateToBoolean):
(KJS::ConditionalNode::optimizeVariableAccess):
(KJS::ConditionalNode::evaluate):
(KJS::ConditionalNode::evaluateToBoolean):
(KJS::ConditionalNode::evaluateToNumber):
(KJS::ConditionalNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToUInt32):
(KJS::valueForReadModifyAssignment):
(KJS::ReadModifyResolveNode::optimizeVariableAccess):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::AssignLocalVarNode::evaluate):
(KJS::ReadModifyConstNode::evaluate):
(KJS::AssignConstNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::AssignDotNode::optimizeVariableAccess):
(KJS::AssignDotNode::evaluate):
(KJS::ReadModifyDotNode::optimizeVariableAccess):
(KJS::ReadModifyDotNode::evaluate):
(KJS::AssignErrorNode::evaluate):
(KJS::AssignBracketNode::optimizeVariableAccess):
(KJS::AssignBracketNode::evaluate):
(KJS::ReadModifyBracketNode::optimizeVariableAccess):
(KJS::ReadModifyBracketNode::evaluate):
(KJS::CommaNode::optimizeVariableAccess):
(KJS::CommaNode::evaluate):
(KJS::ConstDeclNode::optimizeVariableAccess):
(KJS::ConstDeclNode::handleSlowCase):
(KJS::ConstDeclNode::evaluateSingle):
(KJS::ConstDeclNode::evaluate):
(KJS::ConstStatementNode::optimizeVariableAccess):
(KJS::ConstStatementNode::execute):
(KJS::statementListExecute):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::execute):
(KJS::EmptyStatementNode::execute):
(KJS::ExprStatementNode::optimizeVariableAccess):
(KJS::ExprStatementNode::execute):
(KJS::VarStatementNode::optimizeVariableAccess):
(KJS::VarStatementNode::execute):
(KJS::IfNode::optimizeVariableAccess):
(KJS::IfNode::execute):
(KJS::IfElseNode::optimizeVariableAccess):
(KJS::IfElseNode::execute):
(KJS::DoWhileNode::optimizeVariableAccess):
(KJS::DoWhileNode::execute):
(KJS::WhileNode::optimizeVariableAccess):
(KJS::WhileNode::execute):
(KJS::ForNode::optimizeVariableAccess):
(KJS::ForNode::execute):
(KJS::ForInNode::optimizeVariableAccess):
(KJS::ForInNode::execute):
(KJS::ContinueNode::execute):
(KJS::BreakNode::execute):
(KJS::ReturnNode::optimizeVariableAccess):
(KJS::ReturnNode::execute):
(KJS::WithNode::optimizeVariableAccess):
(KJS::WithNode::execute):
(KJS::CaseClauseNode::optimizeVariableAccess):
(KJS::CaseClauseNode::evaluate):
(KJS::CaseClauseNode::executeStatements):
(KJS::ClauseListNode::optimizeVariableAccess):
(KJS::CaseBlockNode::optimizeVariableAccess):
(KJS::CaseBlockNode::executeBlock):
(KJS::SwitchNode::optimizeVariableAccess):
(KJS::SwitchNode::execute):
(KJS::LabelNode::optimizeVariableAccess):
(KJS::LabelNode::execute):
(KJS::ThrowNode::optimizeVariableAccess):
(KJS::ThrowNode::execute):
(KJS::TryNode::optimizeVariableAccess):
(KJS::TryNode::execute):
(KJS::ProgramNode::initializeSymbolTable):
(KJS::ScopeNode::optimizeVariableAccess):
(KJS::ProgramNode::processDeclarations):
(KJS::EvalNode::processDeclarations):
(KJS::ProgramNode::execute):
(KJS::EvalNode::execute):
(KJS::FunctionBodyNodeWithDebuggerHooks::execute):
(KJS::FuncDeclNode::execute):
(KJS::FuncExprNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::FalseNode::):
(KJS::TrueNode::):
(KJS::ArgumentsNode::):
2008-04-23 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
<https://bugs.webkit.org/show_bug.cgi?id=18672>
Add a SegmentedVector type, which provides a Vector<T> which maintains
existing memory locations during resize. This allows dynamically sizing
local, temporary and label "vectors" in CodeGenerator.
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar):
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::newTemporary):
(KJS::CodeGenerator::newLabel):
* VM/CodeGenerator.h:
* VM/SegmentedVector.h: Added.
(KJS::SegmentedVector::SegmentedVector):
(KJS::SegmentedVector::~SegmentedVector):
(KJS::SegmentedVector::last):
(KJS::SegmentedVector::append):
(KJS::SegmentedVector::removeLast):
(KJS::SegmentedVector::size):
(KJS::SegmentedVector::operator[]):
(KJS::SegmentedVector::resize):
(KJS::SegmentedVector::shrink):
(KJS::SegmentedVector::grow):
2008-04-23 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
A little refactoring in preparation for supporting 'arguments'.
Fixes 2 regression tests.
SunSpider reports no change.
We now check the activation register, instead of the codeBlock, to
determine whether we need to tear off the activation. This is to support
"f.arguments", which will create an activation/arguments pair for f,
even though the needsFullScopeChain flag is false for f's codeBlock.
The test fixes resulted from calling initializeCallFrame for re-entrant
function code, instead of initializing (not enough) parts of the call
frame by hand.
2008-04-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- propagate the "this" value properly to local eval
(fixes a measly one regression test)
* VM/CodeBlock.h:
(KJS::CodeBlock::CodeBlock):
(KJS::ProgramCodeBlock::ProgramCodeBlock):
(KJS::EvalCodeBlock::EvalCodeBlock):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Add support for function declarations in eval code.
(this fixes 12 more regression tests)
* VM/CodeBlock.h:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::execute):
* kjs/nodes.cpp:
(KJS::EvalNode::generateCode):
2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Implement LabelNode.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::pushJumpContext):
(KJS::CodeGenerator::jumpContextForContinue):
(KJS::CodeGenerator::jumpContextForBreak):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::ForInNode::emitCode):
(KJS::ContinueNode::emitCode):
(KJS::BreakNode::emitCode):
(KJS::SwitchNode::emitCode):
(KJS::LabelNode::emitCode):
2008-04-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed crash when unwinding from exceptions inside eval.
* VM/Machine.cpp:
(KJS::Machine::unwindCallFrame): Don't assume that the top of the
current call frame's scope chain is an activation: it can be the global
object, instead.
2008-04-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
* kjs/testkjs.cpp:
(main): Convert signals to exit codes, so that crashing tests are
detected as regression test failures.
2008-04-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt and Maciej Stachowiak.
Renamed "needsActivation" to "needsFullScopeChain" because lying will
make hair grow on the backs of your hands.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed ScopeChainNode lifetime problems:
(1) In "with" and "catch" scopes, we would construct a ScopeChain
object and then jump across its destructor, leaking the ScopeChainNode
we had pushed.
(2) In global and eval scopes, we would fail to initially ref
"scopeChain", causing us to overrelease it later. Now that we ref
"scopeChain" properly, we also need to deref it when the script
terminates.
SunSpider reports a .2% regression, but an earlier round of ScopeChain
refactoring was a .4% speedup, so there.
2008-04-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Alexey.
- use global object instead of null for "this" on unqualified calls
This fixes 10 more JSC test regressions.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- throw proper exceptions for objects that don't implement call or construct
This fixes 21 more JSC test regressions. It is also seemingly an
0.5% progression.
* VM/ExceptionHelpers.cpp:
(KJS::createNotAnObjectError):
(KJS::createNotAConstructorError):
(KJS::createNotAFunctionError):
* VM/ExceptionHelpers.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-21 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Implement emitCode for ConstDeclNode.
This fixes the crash (assertion) in js1_5/Scope/scope-001.js
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::registerForLocalConstInit):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::AssignResolveNode::emitCode):
(KJS::ConstDeclNode::emitCodeSingle):
(KJS::ConstDeclNode::emitCode):
(KJS::ConstStatementNode::emitCode):
* kjs/nodes.h:
2008-04-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- add some support for the split window object
This fixes many layout tests.
* VM/Machine.cpp:
(KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
wrapper global, if one exists, as the "this" object.
* kjs/function.cpp:
(KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
case properly.
2008-04-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- restore ScopeChain::operator= to avoid crash on many layout tests
Otherwise, FunctionImp::setScope would cause a reference
underflow. I implemented using the copy construct and swap idiom.
* kjs/scope_chain.h:
(KJS::ScopeChain::swap):
(KJS::ScopeChain::operator=):
2008-04-21 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
<https://bugs.webkit.org/show_bug.cgi?id=18649>
Allocate a callframe for eval() and initialise with a null codeBlock to
indicate native code. This prevents the unwinder from clobbering the
register stack.
* VM/Machine.cpp:
(KJS::Machine::execute):
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
ScopeChain::print to ScopeChainNode.
ScopeChain is now nothing more than a resource-handling wrapper around
ScopeChainNode.
2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 18671: SquirrelFish: continue inside switch fails
<https://bugs.webkit.org/show_bug.cgi?id=18671>
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::jumpContextForLabel):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::ContinueNode::emitCode):
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
rearranging scope_chain.h a bit.
SunSpider reports no change.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
on the knowledge that the ScopeChain is never empty.
SunSpider reports no change.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Moved begin() and end() from ScopeChain to ScopeChainNode.
Also marked a few methods "const".
SunSpider reports no change.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Turned ScopeChain::depth into a stand-alone function, and simplified it
a bit.
I also moved ScopeChain::depth to Machine.cpp because it doesn't report
the true depth of the ScopeChain -- just the Machine's perspective of
its depth within a given call frame.
SunSpider reports no change.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Removed indirection in ScopeChain::ref / ScopeChain::deref.
SunSpider reports no change.
* kjs/scope_chain.h:
(KJS::ScopeChain::ScopeChain):
(KJS::ScopeChain::~ScopeChain):
(KJS::ScopeChain::clear):
2008-04-21 Oliver Hunt <oliver@apple.com>
Fix debug build
* kjs/nodes.cpp:
(KJS::ConstDeclNode::evaluateSingle):
2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
<https://bugs.webkit.org/show_bug.cgi?id=18664>
Correctly throw a SyntaxError when parsing of eval code fails.
* VM/Machine.cpp:
(KJS::eval):
2008-04-21 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
Make sure we correct the register state before jumping to vm_throw.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Simplified ScopeChain ref/deref.
SunSpider reports a .4% speedup.
* kjs/scope_chain.h:
(KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
ScopeChainNodes are initialized with a refCount of 1, so the loop was
guaranteed to iterate exactly once.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Removed support for empty ScopeChains.
SunSpider reports no change.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Removed some completely unused ScopeChain member functions.
SunSpider reports no change.
2008-04-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
SunSpider reports no change.
2008-04-21 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Alexey.
Add some braces.x
* kjs/testkjs.cpp:
(runWithScripts):
2008-04-21 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- only print "End:" output when -d flag is passed.
This fixes half of our failing JSC regression tests.
* kjs/testkjs.cpp:
(runWithScripts):
2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Add support for variable declarations in eval code.
* VM/CodeBlock.h:
(KJS::EvalCodeBlock::EvalCodeBlock):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/Machine.h:
* kjs/function.cpp:
(KJS::globalFuncEval):
* kjs/nodes.cpp:
(KJS::EvalNode::generateCode):
* kjs/nodes.h:
(KJS::EvalNode::):
2008-04-20 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Throw exceptions for invalid continue, break, and return statements.
Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::pushJumpContext):
(KJS::CodeGenerator::popJumpContext):
(KJS::CodeGenerator::jumpContextForLabel):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::Node::emitThrowError):
(KJS::ContinueNode::emitCode):
(KJS::BreakNode::emitCode):
(KJS::ReturnNode::emitCode):
* kjs/nodes.h:
2008-04-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
things that used to be inlined automatically.
1.9% speedup on SunSpider.
My hope is that we'll face fewer surprises in Machine.cpp codegen, now
that GCC is making fewer decisions. The speedup seems to confirm that.
2008-04-20 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18642: Iterator context may get placed into the return register, leading to much badness
<https://bugs.webkit.org/show_bug.cgi?id=18642>
To prevent incorrectly reusing what will become the result register for
eval and global code execution, we need to request and ref the destination
in advance of codegen. Unfortunately this may lead to unnecessary copying,
although in future we can probably limit this. Curiously SunSpider shows
a progression in a number of tests, although it comes out as a wash overall.
* kjs/nodes.cpp:
(KJS::EvalNode::emitCode):
(KJS::ProgramNode::emitCode):
2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCreateError):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::PostfixErrorNode::emitCode):
(KJS::PrefixErrorNode::emitCode):
(KJS::AssignErrorNode::emitCode):
* kjs/nodes.h:
2008-04-20 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff and Mark.
Provide line number information in exceptions
Simple patch, adds line number information metadata to CodeBlock
and a simple method to get the line number responsible for a given
Instruction*.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::lineNumberForVPC):
* VM/CodeBlock.h:
* VM/CodeGenerator.h:
(KJS::CodeGenerator::emitNode):
* VM/Machine.cpp:
(KJS::Machine::throwException):
2008-04-20 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Provide "sourceURL" in exceptions
* VM/CodeBlock.h:
* VM/Machine.cpp:
(KJS::Machine::throwException):
* kjs/nodes.cpp:
(KJS::EvalNode::generateCode):
(KJS::ProgramNode::generateCode):
2008-04-19 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
This patch just a preparation for tracking line numbers.
* kjs/nodes.cpp:
(KJS::ObjectLiteralNode::emitCode):
(KJS::PropertyListNode::emitCode):
(KJS::ArgumentListNode::emitCode):
(KJS::TryNode::emitCode):
2008-04-19 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18619: Support continue, break, and return in try .. finally blocks
<https://bugs.webkit.org/show_bug.cgi?id=18619>
This patch replaces the current partial finally support (which uses code
duplication to achieve what it does) with a subroutine based approach.
This has a number of advantages over code duplication:
* Reduced code size
* Simplified exception handling as the finaliser code only exists in
one place, so no "magic" is needed to get the correct handler for a
finaliser.
* When we support instruction to line number mapping we won't need to
worry about the dramatic code movement caused by duplication
On the downside it is necessary to add two new opcodes, op_jsr and op_sret
to enter and exit the finaliser subroutines, happily SunSpider reports
a performance progression (gcc amazes me) and ubench reports a wash.
While jsr and sret provide a mechanism that allows us to enter and exit
any arbitrary finaliser we need to, it was still necessary to increase
the amount of information tracked when entering and exiting both finaliser
scopes and dynamic scopes ("with"). This means "scopeDepth" is now
the combination of "finaliserDepth" and "dynamicScopeDepth". We also
now use a scopeContextStack to ensure that we pop scopes and execute
finalisers in the correct order. This increases the cost of "with" nodes
during codegen, but it should not be significant enough to effect real
world performance and greatly simplifies codegen for return, break and
continue when interacting with finalisers.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
Pretty printing of jsr/sret opcodes
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::emitPushScope):
(KJS::CodeGenerator::emitPopScope):
Dynamic scopes need to be tracked on the scopeContextStack now
(KJS::CodeGenerator::pushFinallyContext):
(KJS::CodeGenerator::popFinallyContext):
Handle entry and exit from code regions with finalisers. This is
needed solely to support return, continue and break inside finaliser
regions.
(KJS::CodeGenerator::emitComplexJumpScopes):
Helper function for emitJumpScopes to handle the complex codegen
needed to handle return, continue and break inside a finaliser region
(KJS::CodeGenerator::emitJumpScopes):
Updated to be aware of finalisers, if a cross-scope jump occurs inside
a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
we can handle the normal (trivial) case with a single instruction.
(KJS::CodeGenerator::emitJumpSubroutine):
(KJS::CodeGenerator::emitSubroutineReturn):
Trivial opcode emitter functions.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::scopeDepth):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
Implement op_jsr and op_sret.
* VM/Opcode.h:
Ad op_jsr and op_sret
* kjs/nodes.cpp:
(KJS::TryNode::emitCode):
Fix codegen for new finaliser model.
2008-04-17 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Oliver Hunt.
Remove unnecessary files from testkjs, testapi and minidom targets.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-04-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed ASSERT seen during run-sunspider of a debug build.
* VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
runs all tests in one global environment, so you end up with more than
128 locals. This is just a stop-gap until we code up a real
solution to arbitrary symbol and label limits.
2008-04-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed a bug in exception unwinding, where we wouldn't deref the scope
chain in global scope, so we would leak ScopeChainNodes when exceptions
were thrown inside "with" and "catch" scopes.
Also did some cleanup of the unwinding code along the way.
Scope chain reference counting is still wrong in a few ways. I thought
I would fix this portion of it first.
run-sunspider shows no change.
* VM/Machine.cpp:
(KJS::Machine::unwindCallFrame):
(KJS::Machine::throwException):
(KJS::Machine::privateExecute):
* VM/Machine.h:
2008-04-17 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Add more exception checking to toNumber conversions
This corrects op_pre_dec, op_negate, op_mod and op_sub.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Behold: eval.
Introduced a new opcode: op_call_eval. In the normal case, it performs
an eval. In the case where eval has been overridden in some way, it
performs a function call.
* VM/CodeGenerator.h: Added a feature so the code generator knows not
to optimized locals in eval code.
2008-04-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Added some ASSERTs to document codegen failures in
run-javascriptcore-tests.
For all tests, program-level codegen now either succeeds, or fails with
an ASSERT.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar):
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::newTemporary):
(KJS::CodeGenerator::newLabel):
2008-04-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed another case of a dst register being an unreferenced temporary
(caused an ASSERT when running the full sunspider suite).
* kjs/nodes.cpp:
(KJS::CaseBlockNode::emitCodeForBlock):
2008-04-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitMul):
(KJS::CodeGenerator::emitDiv):
(KJS::CodeGenerator::emitMod):
(KJS::CodeGenerator::emitSub):
(KJS::CodeGenerator::emitLeftShift):
(KJS::CodeGenerator::emitRightShift):
(KJS::CodeGenerator::emitUnsignedRightShift):
(KJS::CodeGenerator::emitBitAnd):
(KJS::CodeGenerator::emitBitXOr):
(KJS::CodeGenerator::emitBitOr):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::MultNode::emitCode):
(KJS::DivNode::emitCode):
(KJS::ModNode::emitCode):
(KJS::SubNode::emitCode):
(KJS::LeftShiftNode::emitCode):
(KJS::RightShiftNode::emitCode):
(KJS::UnsignedRightShiftNode::emitCode):
(KJS::BitAndNode::emitCode):
(KJS::BitXOrNode::emitCode):
(KJS::BitOrNode::emitCode):
(KJS::emitReadModifyAssignment):
(KJS::ReadModifyResolveNode::emitCode):
2008-04-16 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Exception checks for toNumber in op_pre_inc
This is somewhat more convoluted than the simple hadException checks
we currently use. Instead we use special toNumber conversions that
select between the exception and ordinary vPC. This allows us to
remove any branches in the common case (incrementing a number).
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::::toNumber):
* ChangeLog:
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/JSPropertyNameIterator.cpp:
(KJS::JSPropertyNameIterator::toNumber):
* VM/JSPropertyNameIterator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/ExecState.h:
* kjs/JSNotAnObject.cpp:
(KJS::JSNotAnObject::toNumber):
* kjs/JSNotAnObject.h:
* kjs/internal.cpp:
(KJS::StringImp::toNumber):
(KJS::NumberImp::toNumber):
(KJS::GetterSetterImp::toNumber):
* kjs/internal.h:
* kjs/object.cpp:
(KJS::JSObject::toNumber):
* kjs/object.h:
* kjs/value.h:
(KJS::JSValue::toNumber):
2008-04-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- ensure that activations are kept in a register to protect them from GC
Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
that is what is now kept there, and there is no more need to keep the scope chain in
the register file.
* VM/Machine.cpp:
(KJS::initializeCallFrame):
(KJS::scopeChainForCall):
* VM/Machine.h:
(KJS::Machine::):
2008-04-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Made "this" work in program code / global scope.
The machine can initialize "this" prior to execution because it knows
that, for program code, "this" is always stored in lr1.
* VM/Machine.cpp:
(KJS::Machine::execute):
* VM/Machine.h:
(KJS::Machine::):
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
2008-04-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed a codegen bug when returning from inside a dynamic scope (a with
or catch block): we need to pop any dynamic scope(s) that have been
added so op_ret can find the activation object at the top of the scope
chain.
* kjs/nodes.cpp:
(KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
and then branching to the return instruction.
2008-04-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- document the add and get_prop_id opcodes
In addition to adding documentation in comments, I changed
references to register IDs or indices relating to these opcodes to
have meaningful names instead of r0 r1 r2.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitAdd):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/nodes.cpp:
(KJS::DotAccessorNode::emitCode):
(KJS::FunctionCallDotNode::emitCode):
(KJS::PostIncDotNode::emitCode):
(KJS::PostDecDotNode::emitCode):
(KJS::PreIncDotNode::emitCode):
(KJS::PreDecDotNode::emitCode):
(KJS::AddNode::emitCode):
(KJS::ReadModifyDotNode::emitCode):
2008-04-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt and Maciej Stachowiak.
Fixed a codegen bug in with and switch, and added an ASSERT to
make sure it doesn't happen again.
emitCode() assumes that dst, if non-zero, is either referenced or
non-temporary (i.e., it assumes that newTemporary() will return a
register not equal to dst). Certain callers to emitCode() weren't
guaranteeing that to be so, so temporary register values were being
overwritten.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
* kjs/nodes.cpp:
(KJS::CommaNode::emitCode): Reference the dst we pass.
(KJS::WithNode::emitCode): No need to pass an explicit dst register.
(KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
(KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
* kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
emitCode.
2008-04-15 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
<https://bugs.webkit.org/show_bug.cgi?id=18526>
Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
* VM/Machine.cpp:
(KJS::resolveBaseAndFunc):
(KJS::Machine::privateExecute):
2008-04-15 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix incorrect result on 3d-raytrace test
Oliver found and tracked down this bug, I just typed in the fix.
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
account for the space for local variables.
2008-04-15 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix codegen handling of dst registers
1.006x speedup (not sure why).
Most emitCode functions take an optional "dst" parameter that says
where the output of the instruction should be written. I made some
functions for convenient handling of the dst register:
* VM/CodeGenerator.h:
(KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
it is not null and is a temporary, otherwise allocates a new temporary. This is
intended for cases where an intermediate value might be written into the dst
(KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
register that was used as a temp destination. Picks the right thing for the final
output. Intended to be used as the output register for the instruction that generates
the final value of a particular node.
(KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
RegisterID; moves from the register to dst if dst is defined and
different from the register. This is intended for cases where the
result of a node is already in a specific register (likely a
local), and so no code needs to be generated unless a specific
destination has been requested, in which case a move is needed.
I also applied these methods throughout emitCode functions. In
some cases this was just cleanup, in other cases I fixed actual
codegen bugs. Below I have given specific comments for the cases
where I believe I fixed a codegen bug, or improved quality of codegen.
* kjs/nodes.cpp:
(KJS::NullNode::emitCode):
(KJS::FalseNode::emitCode):
(KJS::TrueNode::emitCode):
(KJS::NumberNode::emitCode):
(KJS::StringNode::emitCode):
(KJS::RegExpNode::emitCode):
(KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
the same as the this register (the unlikely case of "this = this");
(KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
is the same as the local regiester, in the local var case (the
unlikely case of "x = x");
(KJS::ArrayNode::emitCode): Fixed a codegen bug where array
literal element expressions may have observed an intermediate
value of constructing the array.
(KJS::ObjectLiteralNode::emitCode):
(KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
property definition expressions may have obesrved an intermediate value of
constructing the object.
(KJS::BracketAccessorNode::emitCode):
(KJS::DotAccessorNode::emitCode):
(KJS::NewExprNode::emitCode):
(KJS::FunctionCallValueNode::emitCode):
(KJS::FunctionCallBracketNode::emitCode):
(KJS::FunctionCallDotNode::emitCode):
(KJS::PostIncResolveNode::emitCode):
(KJS::PostDecResolveNode::emitCode):
(KJS::PostIncBracketNode::emitCode):
(KJS::PostDecBracketNode::emitCode):
(KJS::PostIncDotNode::emitCode):
(KJS::PostDecDotNode::emitCode):
(KJS::DeleteResolveNode::emitCode):
(KJS::DeleteBracketNode::emitCode):
(KJS::DeleteDotNode::emitCode):
(KJS::DeleteValueNode::emitCode):
(KJS::VoidNode::emitCode):
(KJS::TypeOfResolveNode::emitCode):
(KJS::TypeOfValueNode::emitCode):
(KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
value would not be output to the dst register in the local var case.
(KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
value would not be output to the dst register in the local var case.
(KJS::PreIncBracketNode::emitCode):
(KJS::PreDecBracketNode::emitCode):
(KJS::PreIncDotNode::emitCode):
(KJS::PreDecDotNode::emitCode):
(KJS::UnaryPlusNode::emitCode):
(KJS::NegateNode::emitCode):
(KJS::BitwiseNotNode::emitCode):
(KJS::LogicalNotNode::emitCode):
(KJS::MultNode::emitCode):
(KJS::DivNode::emitCode):
(KJS::ModNode::emitCode):
(KJS::AddNode::emitCode):
(KJS::SubNode::emitCode):
(KJS::LeftShiftNode::emitCode):
(KJS::RightShiftNode::emitCode):
(KJS::UnsignedRightShiftNode::emitCode):
(KJS::LessNode::emitCode):
(KJS::GreaterNode::emitCode):
(KJS::LessEqNode::emitCode):
(KJS::GreaterEqNode::emitCode):
(KJS::InstanceOfNode::emitCode):
(KJS::InNode::emitCode):
(KJS::EqualNode::emitCode):
(KJS::NotEqualNode::emitCode):
(KJS::StrictEqualNode::emitCode):
(KJS::NotStrictEqualNode::emitCode):
(KJS::BitAndNode::emitCode):
(KJS::BitXOrNode::emitCode):
(KJS::BitOrNode::emitCode):
(KJS::LogicalAndNode::emitCode):
(KJS::LogicalOrNode::emitCode):
(KJS::ConditionalNode::emitCode):
(KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
needed for fixes below.
(KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
the expression may observe an intermediate value.
(KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
expression may observe an intermediate value.
(KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
expression may observe an intermediate value.
(KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
expression may observe an intermediate value.
(KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
(KJS::ReturnNode::emitCode): Void return should return undefined, not null.
(KJS::FuncExprNode::emitCode):
2008-04-15 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- fix huge performance regression (from trunk) in string-unpack-code
This restores string-unpack-code performance to parity with
trunk (2.27x speedup relative to previous SquirrelFish)
* VM/Machine.cpp:
(KJS::Machine::execute): Shrink register file after call to avoid
growing repeatedly.
2008-04-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed dumpCallFrame to match our new convention of passing around a
ScopeChainNode* instead of a ScopeChain*.
* JavaScriptCore.exp:
* VM/Machine.cpp:
(KJS::Machine::dumpCallFrame):
* VM/Machine.h:
2008-04-15 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
<https://bugs.webkit.org/show_bug.cgi?id=18436>
Add op_resolve_base_and_property for read/modify/write operations,
this adds a "superinstruction" to resolve the base and value of a
property simultaneously. Just using resolveBase and resolve results
in an 5% regression in ubench, 30% in loop-empty-resolve (which is
expected). 1.3% progression in sunspider, 2.1% in ubench, with a
21% gain in loop-empty-resolve. The only outlier is function-missing-args
which gets a 3% regression that I could never resolve.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitResolveBaseAndProperty):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::resolveBaseAndProperty):
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::emitCode):
(KJS::PostDecResolveNode::emitCode):
(KJS::PreIncResolveNode::emitCode):
(KJS::PreDecResolveNode::emitCode):
(KJS::ReadModifyResolveNode::emitCode):
2008-04-15 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
https://bugs.webkit.org/show_bug.cgi?id=18508
3d-raytrace and string-unpack-code now run.
The basic approach is to pass around ScopeChainNode* instead of
ScopeChain*, which in addition to not becoming suddenly an invalid
pointer also saves an indirection.
This is an 0.4% speedup on SunSpider --squirrelfish (1.8% on --ubench)
* VM/Machine.cpp:
(KJS::resolve):
(KJS::resolveBase):
(KJS::resolveBaseAndFunc):
(KJS::initializeCallFrame):
(KJS::scopeChainForCall):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::throwException):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* VM/Register.h:
(KJS::Register::):
* kjs/nodes.cpp:
(KJS::EvalNode::generateCode):
(KJS::FunctionBodyNode::generateCode):
(KJS::ProgramNode::generateCode):
(KJS::ProgramNode::processDeclarations):
(KJS::EvalNode::processDeclarations):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::makeFunction):
* kjs/nodes.h:
(KJS::ProgramNode::):
(KJS::EvalNode::):
(KJS::FunctionBodyNode::):
* kjs/object.h:
* kjs/scope_chain.h:
(KJS::ScopeChainNode::ScopeChainNode):
(KJS::ScopeChainNode::deref):
(KJS::ScopeChainIterator::ScopeChainIterator):
(KJS::ScopeChainIterator::operator*):
(KJS::ScopeChainIterator::operator->):
(KJS::ScopeChain::ScopeChain):
(KJS::ScopeChain::node):
(KJS::ScopeChain::deref):
(KJS::ScopeChain::ref):
(KJS::ScopeChainNode::ref):
(KJS::ScopeChainNode::release):
(KJS::ScopeChainNode::begin):
(KJS::ScopeChainNode::end):
2008-04-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed crash when accessing registers in a torn-off activation object.
* kjs/JSActivation.cpp:
(KJS::JSActivation::copyRegisters): Update our registerOffset after
copying our registers, since our offset should now be relative to
our private register array, not the shared register file.
2008-04-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix a codegen flaw that makes some tests run way too fast or way too slow
The basic problem was that FunctionCallResolveNode results in
codegen which can incorrectly write an intermediate value into the
dst register even when that is a local. I added convenience
functions to CodeGenerator for getting this right, but for now I
only fixed FunctionCallResolve.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::tempDestination):
(KJS::CodeGenerator::):
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::emitCode):
2008-04-14 Gabor Loki <loki@inf.u-szeged.hu>
Reviewed and slightly tweaked by Geoffrey Garen.
Bug 18489: Squirrelfish doesn't build on linux
<https://bugs.webkit.org/show_bug.cgi?id=18489>
* JavaScriptCore.pri: Add VM into include path and its files into
source set
* VM/JSPropertyNameIterator.cpp: Fix include name
* VM/Machine.cpp: Add UNLIKELY macro for GCC
* VM/Machine.h: Add missing includes
* VM/RegisterFile.cpp: Add missing include
* kjs/testkjs.pro: Add VM into include path
2008-04-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Restored OwnPtr in some places where I had removed it previously. We
can have an OwnPtr to an undefined class in a header as long as the
class's destructor isn't in the header.
2008-04-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed access to "this" inside dynamic scopes.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::registerForLocal): Always return a register for
"this", even if we're not optimizing access to other locals. Because
"this" is a keyword, it's always in a register and always accessible.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::shouldOptimizeLocals): Factored out a function
for determining whether we should optimize access to locals, since
eval will need to make this test a little more complicated.
2008-04-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- fix crash when running SunSpider full harness
When growing the register file's buffer to make space for new globals,
make sure to copy accounting for the fact that the new space is logically
at the beginning of the buffer in this case, instead of at the end as when
growing for a new call frame.
* VM/RegisterFile.cpp:
(KJS::RegisterFile::newBuffer):
(KJS::RegisterFile::growBuffer):
(KJS::RegisterFile::addGlobalSlots):
* VM/RegisterFile.h:
2008-04-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Mark constant pools for global and eval code (collectively known as
"program code"). (Constant pools for function code are already marked by
their functions.)
The global object is responsible for marking program code constant
pools. Code blocks add themselves to the mark set at creation time, and
remove themselves from the mark set at destruction time.
sunspider --squirrelfish reports a 1% speedup, perhaps because
generateCode() is now non-virtual.
* kjs/nodes.cpp: I had to use manual init and delete in this file
because putting an OwnPtr into the header would have created a circular
header dependency.
2008-04-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Bug 18231: Improve support for function call nodes in SquirrelFish
<https://bugs.webkit.org/show_bug.cgi?id=18231>
Use correct value of 'this' for function calls.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitResolveBaseAndFunc):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::resolveBaseAndFunc):
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::emitCode):
2008-04-10 Geoffrey Garen <ggaren@apple.com>
This time for sure.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
2008-04-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed Interpreter::execute to honor the new model for returning non-NULL
values when an exception is thrown.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
2008-04-10 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Fix SquirrelFish interpreter to pass internal exceptions back to
native code correctly.
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-10 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Replace the use of getCallData in op_construct with the new
getConstructData function that replaces implementsConstruct.
* API/JSCallbackConstructor.cpp:
(KJS::JSCallbackConstructor::getConstructData):
* API/JSCallbackConstructor.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::::getConstructData):
(KJS::::construct):
* API/JSObjectRef.cpp:
(JSObjectIsConstructor):
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/CallData.h:
* kjs/ConstructData.h: Copied from JavaScriptCore/kjs/CallData.h.
* kjs/array_object.cpp:
(KJS::ArrayObjectImp::getConstructData):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(KJS::BooleanObjectImp::getConstructData):
* kjs/bool_object.h:
* kjs/date_object.cpp:
(KJS::DateObjectImp::getConstructData):
* kjs/date_object.h:
* kjs/error_object.cpp:
(KJS::ErrorObjectImp::getConstructData):
(KJS::NativeErrorImp::getConstructData):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::FunctionImp::getCallData):
(KJS::FunctionImp::getConstructData):
(KJS::FunctionImp::construct):
* kjs/function.h:
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::getConstructData):
* kjs/function_object.h:
* kjs/nodes.cpp:
(KJS::NewExprNode::inlineEvaluate):
* kjs/number_object.cpp:
(KJS::NumberObjectImp::getConstructData):
* kjs/number_object.h:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
(KJS::ObjectObjectImp::getConstructData):
* kjs/object_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::getConstructData):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(KJS::StringObjectImp::getConstructData):
* kjs/string_object.h:
* kjs/value.cpp:
(KJS::JSCell::getConstructData):
* kjs/value.h:
(KJS::JSValue::getConstructData):
2008-04-10 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18420: SquirrelFish: need to throw Reference and Type errors
when attempting invalid operations on JSValues
Add validation and exception checks to SquirrelFish so that the
correct exceptions are thrown for undefined variables, type errors
and toObject failure. Also handle exceptions thrown by native
function calls.
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/ExceptionHelpers.cpp: Added.
(KJS::substitute):
(KJS::createError):
(KJS::createUndefinedVariableError):
* VM/ExceptionHelpers.h: Added.
Helper functions
* VM/Machine.cpp:
(KJS::resolve):
Modified to signal failure
(KJS::isNotObject):
Wrapper for JSValue::isObject and exception creation (these need
to be merged, lest GCC go off the deep end)
(KJS::Machine::privateExecute):
Adding the many exception and validity checks.
* kjs/JSNotAnObject.cpp: Added.
Stub object used to reduce the need for multiple exception checks
when toObject fails.
(KJS::JSNotAnObject::toPrimitive):
(KJS::JSNotAnObject::getPrimitiveNumber):
(KJS::JSNotAnObject::toBoolean):
(KJS::JSNotAnObject::toNumber):
(KJS::JSNotAnObject::toString):
(KJS::JSNotAnObject::toObject):
(KJS::JSNotAnObject::mark):
(KJS::JSNotAnObject::getOwnPropertySlot):
(KJS::JSNotAnObject::put):
(KJS::JSNotAnObject::deleteProperty):
(KJS::JSNotAnObject::defaultValue):
(KJS::JSNotAnObject::construct):
(KJS::JSNotAnObject::callAsFunction):
(KJS::JSNotAnObject::getPropertyNames):
* kjs/JSNotAnObject.h: Added.
(KJS::JSNotAnObject::JSNotAnObject):
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::toObject):
modified to create an JSNotAnObject rather than throwing an exception
directly.
2008-04-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Pass a function body node its function's scope chain, rather than the
current execution context's scope chain, when compiling it.
This doesn't matter yet, but it will once we start using the scope
chain during compilation.
sunspider --squirrelfish notes a tiny speedup.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fix two bugs when throwing exceptions from re-entrant JS calls:
(1) Don't shrink the register file to 0, since our caller may still
be using it.
(2) In case of exception, return jsNull() instead of 0 because,
surprisingly, some JavaScriptCore clients rely on a function's return
value being safe to operate on even if the function threw an exception.
Also:
- Changed FunctionImp::callAsFunction to honor the new semantics of
exceptions not returning 0.
- Renamed "handlerPC" to "handlerVPC" to match other uses of "VPC".
- Renamed "exceptionData" to "exceptionValue", because "data" seemed to
imply something more than just a JSValue.
- Merged prepareException into throwException, since throwException was
its only caller, and it seemed weird that throwException didn't take
an exception as an argument.
sunspider --squirrelfish does not seem to complain on my machine, but it
complains a little (.6%) on Oliver's.
2008-04-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed op_construct for CallTypeNative to reacquire "r" before setting
its return value, since registerBase can theoretically change during the
execution of arbitrary code. (Not sure if any native constructors
actually make this possible.)
sunspider --squirrelfish does not seem to complain.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt and Sam Weinig.
Re-entrant execution of function code (global code -> built-in function
-> JS function):
Miraculously, sunspider --squirrelfish does not seem to complain.
A re-entrant function call is the same as a normal function call with
one exception: the re-entrant call leaves everything except for
CallerCodeBlock in the call frame header uninitialized, since the call
doesn't need to return to JS code. (It sets CallerCodeBlock to 0, to
indicate that the call shouldn't return to JS code.)
Also fixed a few issues along the way:
- Fixed two bugs in the read-write List implementation that caused
m_size and m_buffer to go stale.
- Changed native call code to update "r" *before* setting the return
value, since the call may in turn call JS code, which changes the value
of "r".
- Migrated initialization of "r" outside of Machine::privateExecute,
because global code and function code initialize "r" differently.
- Migrated a codegen warning from Machine::privateExecute to the wiki.
- Removed unnecessary "r" parameter from slideRegisterWindowForCall
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall):
(KJS::scopeChainForCall):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
* kjs/list.cpp:
(KJS::List::getSlice):
* kjs/list.h:
(KJS::List::clear):
2008-04-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix problem with code generation for return with no argument
3d-cube now runs
* kjs/nodes.cpp:
(KJS::ReturnNode::emitCode):
2008-04-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Implement support for JS constructors
access-binary-trees and access-nbody now run.
Inexplicably a 1% speedup.
* VM/Machine.cpp:
(KJS::initializeCallFrame):
(KJS::Machine::privateExecute):
* VM/Machine.h:
(KJS::Machine::):
2008-04-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- More code cleanup in preparation for JS constructors
Factor the remaining interesting parts of JS function calls into
slideRegisterWindowForCall and scopeChainForCall.
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall):
(KJS::scopeChainForCall):
(KJS::Machine::privateExecute):
2008-04-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- Code cleanup in preparation for JS constructors
- Renamed returnInfo to callFrame.
- Made an enum which defines what goes where in the call frame.
- Factored out initializeCallFrame function from op_call
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCall):
(KJS::CodeGenerator::emitConstruct):
* VM/Machine.cpp:
(KJS::Machine::dumpRegisters):
(KJS::initializeCallFrame):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
(KJS::Machine::):
2008-04-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed two bugs in register allocation for function calls:
(1) op_call used to allocate codeBlock->numVars too many registers for
each call frame, due to duplicated math. Fixing this revealed...
(2) By unconditionally calling resize(), op_call used to truncate the
register file when calling a function whose registers fit wholly within
the register file already allocated by its caller.
sunspider --squirrelfish reports no regression.
I also threw in a little extra formatting to dumpCallFrame, because it
helped me debug these issues.
* VM/Machine.cpp:
(KJS::Machine::dumpRegisters):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/RegisterFile.h:
(KJS::RegisterFile::shrink):
(KJS::RegisterFile::grow):
* VM/RegisterFileStack.cpp:
(KJS::RegisterFileStack::popRegisterFile):
2008-04-09 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Next step toward re-entrant execution of function code (global code ->
built-in function -> JS function):
Made op_ret return from Machine::privateExecute if its calling codeBlock
is NULL.
I'm checking this in by itself to demonstrate that a more clever
mechanism is not necessary for performance.
sunspider --squirrelfish reports no regression.
* ChangeLog:
* VM/Machine.cpp:
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
2008-04-09 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Next step toward re-entrant execution of function code (global code ->
built-in function -> JS function):
Made Machine::execute return a value.
Sketched out some code for Machine::execute for functions -- still
doesn't work yet, though.
sunspider --squirrelfish reports no regression.
* VM/Machine.cpp:
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
* kjs/testkjs.cpp:
(runWithScripts):
2008-04-09 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
First step toward re-entrant execution of function code (global code ->
built-in function -> JS function):
Tiny bit of refactoring in the Machine class.
sunspider --squirrelfish reports no regression.
* VM/Machine.cpp:
(KJS::Machine::dumpRegisters):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::execute):
(KJS::Machine::privateExecute):
* VM/Machine.h:
(KJS::Machine::isGlobalCallFrame):
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
2008-04-08 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Support for re-entrant execution of global code (global code -> built-in
function -> global code).
Keep a stack of register files instead of just one. Globals propogate
between register files as the register files enter and exit the stack.
An activation still uses its own register file's base as its
registerBase, but the global object uses the register file *stack*'s
registerBase, which updates dynamically to match the register file at
the top of the stack.
sunspider --squirrelfish reports no regression.
2008-04-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- initial preparatory work for JS constructors
1) Allocate registers for the returnInfo block and "this" value when generating code for
op_construct. These are not used yet, but the JS branch of op_construct will use them.
2) Adjust argc and argv appropriately for native constructor calls.
3) Assign return value in a more straightforward way in op_ret since this is actually
a bit faster (and makes up for the allocation of extra registers above).
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitConstruct):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed crashing SunSpider tests.
Let's just pretend this never happened, bokay?
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
* VM/CodeGenerator.h:
* VM/RegisterFile.cpp:
(KJS::RegisterFile::addGlobals):
2008-04-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Restored dumping of generated code as a command-line switch:
run-testkjs -d will do it.
2008-04-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Next step toward supporting re-entrant evaluation: Moved register file
maintenance code into a proper "RegisterFile" class.
There's a subtle change to the register file's internal layout: for
global code / the global object, registerOffset is always 0 now. In
other words, all register counting starts at 0, not 0 + (number of
global variables). The helps simplify accounting when the number of
global variables changes.
2008-04-07 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18338: Support exceptions in SquirrelFish <http://bugs.webkit.org/show_bug.cgi?id=18338>
Initial support for exceptions in SquirrelFish, only supports finalisers in the
simple cases (eg. exceptions and non-goto/return across finaliser boundaries).
This doesn't add the required exception checks to existing code, it merely adds
support for throw, catch, and the required stack unwinding.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
(KJS::CodeBlock::getHandlerForVPC):
* VM/CodeBlock.h:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCatch):
(KJS::CodeGenerator::emitThrow):
* VM/CodeGenerator.h:
* VM/JSPropertyNameIterator.cpp:
(KJS::JSPropertyNameIterator::create):
* VM/Machine.cpp:
(KJS::prepareException):
(KJS::Machine::unwindCallFrame):
(KJS::Machine::throwException):
(KJS::Machine::privateExecute):
* VM/Machine.h:
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::ThrowNode::emitCode):
(KJS::TryNode::emitCode):
* kjs/nodes.h:
* kjs/scope_chain.cpp:
(KJS::ScopeChain::depth):
* kjs/scope_chain.h:
2008-04-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
First step toward supporting re-entrant evaluation: Switch register
clients from using "registers", a pointer to a register vector, to
"registerBase", an indirect pointer to the logical first entry in the
register file. (The logical first entry is the first entry that is not
a global variable).
With a vector, offsets into the register file remain good when the
underlying buffer reallocates, but they go bad when the logical
first entry moves. (The logical first entry moves when new global
variables get added to the beginning of the register file.) With an
indirect pointer to the logical first entry, offsets will remain good
regardless.
1.4% speedup on sunspider --squirrelfish. I suspect this is due to
reduced allocation when creating closures, and reduced indirection
through the register vector.
* wtf/Vector.h: Added an accessor for an indirect pointer to the vector's
buffer, which we currently use (incorrectly) for registerBase. This is
temporary scaffolding to allow us to change client code without
changing behavior.
2008-04-06 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Implement codegen for ReadModifyDotNode.
* kjs/nodes.cpp:
(KJS::ReadModifyDotNode::emitCode):
* kjs/nodes.h:
2008-04-06 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Fix codegen for PostIncDotNode and implement codegen for PostIncBracketNode,
PostDecBracketNode and PostDecDotNode.
* kjs/nodes.cpp:
(KJS::PostIncBracketNode::emitCode):
(KJS::PostDecBracketNode::emitCode):
(KJS::PostIncDotNode::emitCode):
(KJS::PostDecDotNode::emitCode):
* kjs/nodes.h:
2008-04-06 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Implement codegen for PreDecResolveNode, PreIncBracketNode, PreDecBracketNode,
PreIncDotNode and PreDecDotNode. This required adding one new op code, op_pre_dec.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitPreDec):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::PreDecResolveNode::emitCode):
(KJS::PreIncBracketNode::emitCode):
(KJS::PreDecBracketNode::emitCode):
(KJS::PreIncDotNode::emitCode):
(KJS::PreDecDotNode::emitCode):
* kjs/nodes.h:
2008-04-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Improved register dumping, plus a liberal smattering of "const". Here's
what the new format looks like:
(gdb) call (void)dumpCallFrame(codeBlock, scopeChain, registers->begin(), r)
4 instructions; 48 bytes at 0x509210; 3 locals (2 parameters); 1 temporaries
[ 0] load lr1, undefined(@k0)
[ 3] load lr1, 2(@k1)
[ 6] add tr0, lr2, lr1
[ 10] ret tr0
Constants:
k0 = undefined
k1 = 2
Register frame:
----------------------------------------
use | address | value
----------------------------------------
[return info] | 0x80ac08 | 0x5081c0
[return info] | 0x80ac0c | 0x508e90
[return info] | 0x80ac10 | 0x504acc
[return info] | 0x80ac14 | 0x2
[return info] | 0x80ac18 | 0x0
[return info] | 0x80ac1c | 0x7
[return info] | 0x80ac20 | 0x0
----------------------------------------
[param] | 0x80ac24 | 0x1
[param] | 0x80ac28 | 0x7
[var] | 0x80ac2c | 0xb
[temp] | 0x80ac30 | 0xf
2008-04-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Support for evaluating multiple scripts in the same global environment.
(Still don't support re-entrant evaluation yet.)
The main changes here are:
(1) Obey the ECMA 10.1.3 rules regarding how to resolve collisions when
a given symbol is declared more than once. (This patch fixes the same
issue for function code, too.)
(2) In the case of var and/or function collisions, reuse the existing
storage slot. For global code, this is required for previously
generated instructions to continue to work. For function code, it's
more of a "nice to have": it makes register layout in the case of
collisions easier to understand, and has the added benefit of saving
memory.
(3) Allocate slots in the CodeGenerator's m_locals vector in parallel
to register indexes in the symbol table. This ensures that, given an
index in the symbol table, we can find the corresponding RegisterID
without hashing, which speeds up codegen.
I moved responsibility for emitting var and function initialization
instructions into the CodeGenerator, because bookkeeping in cases where
var, function, and/or parameter names collide requires a lot of
internal knowledge about the CodeGenerator.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addVar): Removed responsibility for checking whether
a var declaration overwrites "arguments", because the check is
inappropriate for global code, which may not have a pre-existing
"arguments" symbol in scope. Also changed this function to return a
boolean indicating whether addVar actually created a new RegisterID,
or just reused an old one.
(KJS::CodeGenerator::CodeGenerator): Split out the constructors for
function code and global code, since they're quite different now.
(KJS::CodeGenerator::registerForLocal): This function does its job
without any hashing now.
* VM/Machine.cpp: Move old globals and update "r" before executing a
new script. That way, old globals stay at a constant offset from "r",
and previously optimized code still works.
* VM/RegisterID.h: Added the ability to allocate a RegisterID before
initializing its index field. We use this for parameters now.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): Changed the ungettable getter
ASSERT to account for the fact that symbol indexes are all negative.
2008-04-05 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Implement codegen for InNode.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitIn):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::InNode::emitCode):
* kjs/nodes.h:
2008-04-05 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
- Implement codegen for DeleteResolveNode, DeleteBracketNode, DeleteDotNode and DeleteValueNode.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitGetPropId):
(KJS::CodeGenerator::emitPutPropId):
(KJS::CodeGenerator::emitDeletePropId):
(KJS::CodeGenerator::emitDeletePropVal):
(KJS::CodeGenerator::emitPutPropIndex):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::DeleteResolveNode::emitCode):
(KJS::DeleteBracketNode::emitCode):
(KJS::DeleteDotNode::emitCode):
(KJS::DeleteValueNode::emitCode):
* kjs/nodes.h:
2008-04-04 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
- Implement codegen for Switch statements.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::pushJumpContext):
(KJS::CodeGenerator::popJumpContext):
(KJS::CodeGenerator::jumpContextForLabel):
* VM/CodeGenerator.h:
Rename LoopContext to JumpContext now that it used of Switch statements in addition
to loops.
* kjs/nodes.cpp:
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::ForInNode::emitCode):
(KJS::ContinueNode::emitCode):
(KJS::BreakNode::emitCode):
(KJS::CaseBlockNode::emitCodeForBlock):
(KJS::SwitchNode::emitCode):
* kjs/nodes.h:
(KJS::CaseClauseNode::expr):
(KJS::CaseClauseNode::children):
(KJS::CaseBlockNode::):
2008-04-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- fix crash in codegen from new nodes
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitConstruct):
* kjs/nodes.h:
2008-04-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
* kjs/nodes.cpp:
(KJS::ReadModifyResolveNode::emitCode):
(KJS::ReadModifyBracketNode::emitCode):
* kjs/nodes.h:
2008-04-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- take a shot at marking constant pools for global and eval code
Geoff says this won't really work in all cases but is an ok stopgap.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::mark):
2008-04-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- fix 2x perf regression in 3d-morph
* VM/Machine.cpp:
(KJS::Machine::privateExecute): If we subbed in null for the global object,
don't toObject it, since that will throw an exception (very slowly).
2008-04-02 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Geoff
- fix Release build
* kjs/nodes.cpp:
(KJS::getNonLocalSymbol):
2008-04-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed the last vestiges of LocalStorage from JSVariableObject and
JSGlobalObject.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::saveLocalStorage): Save and restore from/to
registers. Use stub isReadOnly and isDontEnum methods for now, until
we really implement attributes in the symbol table.
(KJS::JSGlobalObject::restoreLocalStorage):
(KJS::JSGlobalObject::reset):
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames): Use stub isDontEnum method
for now, as above.
(KJS::JSVariableObject::getPropertyAttributes): ditto
* kjs/JSVariableObject.h: Removed LocalStorage from JSVariableObjectData.
Removed mark method, because subclasses implement different strategies for
marking registers.
(KJS::JSVariableObject::isReadOnly): Stub method
(KJS::JSVariableObject::isDontEnum): ditto
Changed the code below to ASSERT_NOT_REACHED() and return 0, since it
can no longer retrieve LocalStorage from the ExecState. (Eventually,
we'll just remove this code and all its friends, but that's a task for
later.)
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/function.cpp:
(KJS::ActivationImp::markChildren):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::getNonLocalSymbol):
(KJS::ScopeNode::optimizeVariableAccess):
(KJS::ProgramNode::processDeclarations):
2008-04-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Got globals?
To get things working, I had to roll out
http://trac.webkit.org/projects/webkit/changeset/31226 for the time
being.
* VM/CodeBlock.h: Removed obsolete function.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): For the sake of re-entrancy, we track
and restore the global object's old rOffset value. (No way to test this
yet, but I think it will work.)
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- mark the constant pool (at least for function code blocks)
* VM/CodeBlock.cpp:
(KJS::CodeBlock::mark):
* VM/CodeBlock.h:
* kjs/function.cpp:
(KJS::FunctionImp::mark):
* kjs/nodes.cpp:
(KJS::ScopeNode::mark):
* kjs/nodes.h:
(KJS::FuncExprNode::body):
(KJS::FuncDeclNode::body):
2008-04-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Cleaned up a few loose ends.
* JavaScriptCore.exp: Export dumpRegisters, so it's visible to gdb even
if we don't explicitly call it in the source text.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): No need to call dumpRegisters anymore,
since that was just a hack for gdb's sake.
* kjs/JSActivation.h: Removed obsolete comment.
* VM/CodeGenerator.cpp: Added ASSERTs to verify that the localCount
we're given matches the number of locals actually allocated.
* VM/CodeGenerator.h:
(KJS::CodeGenerator::CodeGenerator): Changed "localCount" to include
the parameter count, since we're using the word "local" to mean
parameter, var, function, or "this". Renamed "m_nextLocal" to
"m_nextVar", since "m_nextLocal" doesn't contrast well with
"m_nextParameter".
Also moved tracking of implicit "this" parameter from here...
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::generateCode): ... to here
(KJS::ProgramNode::generateCode): ... and here
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Added missing "\n".
2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
Bug 18274: ResolveNode::emitCode() doesn't make a new temporary when dst
is 0, leading to incorrect codegen
<http://bugs.webkit.org/show_bug.cgi?id=18274>
* kjs/nodes.cpp:
(KJS::FunctionCallBracketNode::emitCode):
(KJS::FunctionCallDotNode::emitCode):
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fix bug in for..in codegen (gotta use ident, not m_ident)
* kjs/nodes.cpp:
(KJS::ForInNode::emitCode):
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Add suport for regexp literals
* VM/CodeBlock.cpp:
(KJS::regexpToSourceString):
(KJS::regexpName):
(KJS::CodeBlock::dump):
* VM/CodeBlock.h:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addRegExp):
(KJS::CodeGenerator::emitNewRegExp):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::RegExpNode::emitCode):
* kjs/nodes.h:
2008-04-01 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff
Add support for for..in nodes
Added two new opcodes to get_pnames and next_pname to handle iterating
over the set of properties on an object. This iterator is explicitly
invalidated and the property name array is released on standard exit
from the loop, otherwise we rely on GC to do the clean up for us.
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitNextPropertyName):
(KJS::CodeGenerator::emitGetPropertyNames):
* VM/CodeGenerator.h:
* VM/JSPropertyNameIterator.cpp: Added.
(KJS::JSPropertyNameIterator::JSPropertyNameIterator):
(KJS::JSPropertyNameIterator::type):
(KJS::JSPropertyNameIterator::toPrimitive):
(KJS::JSPropertyNameIterator::getPrimitiveNumber):
(KJS::JSPropertyNameIterator::toBoolean):
(KJS::JSPropertyNameIterator::toNumber):
(KJS::JSPropertyNameIterator::toString):
(KJS::JSPropertyNameIterator::toObject):
(KJS::JSPropertyNameIterator::mark):
(KJS::JSPropertyNameIterator::next):
(KJS::JSPropertyNameIterator::invalidate):
(KJS::JSPropertyNameIterator::~JSPropertyNameIterator):
(KJS::JSPropertyNameIterator::create):
* VM/JSPropertyNameIterator.h: Added.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* VM/Register.h:
(KJS::Register::):
* kjs/PropertyNameArray.h:
* kjs/nodes.cpp:
(KJS::ForInNode::emitCode):
* kjs/nodes.h:
* kjs/value.h:
2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Change CodeGenerator::emitCall() so it increments the reference count of
registers passed to it, and change its callers so they don't needlessly
increment the reference count of the registers they are passing.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCall):
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::emitCode):
(KJS::FunctionCallDotNode::emitCode):
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- generate call for PostIncDotNode
* kjs/nodes.cpp:
(KJS::PostIncDotNode::emitCode):
* kjs/nodes.h:
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Build fix.
- fix build (not sure how this ever worked?)
* kjs/nodes.cpp:
(KJS::FunctionCallBracketNode::emitCode):
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- generate code for FunctionCallBracketNode
* kjs/nodes.cpp:
(KJS::FunctionCallBracketNode::emitCode):
* kjs/nodes.h:
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Geoff.
- Fix two crashing SunSpider tests
* VM/Machine.cpp:
(KJS::Machine::privateExecute): set up 'this' properly for native calls.
* kjs/list.h:
(KJS::List::List): Fix intialization of buffer and size from
vector, the initialization order was wrong.
2008-04-01 Geoffrey Garen <ggaren@apple.com>
Build fix: marked ASSERT-only variables as UNUSED_PARAMs.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableInitializeVariable):
2008-04-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Next step toward global code: Moved get, put, and initializeVariable
functionality up into JSVariableObject, and changed JSActivation to
rely on it.
* kjs/JSActivation.cpp:
(KJS::JSActivation::JSActivation):
(KJS::JSActivation::getOwnPropertySlot):
(KJS::JSActivation::put):
(KJS::JSActivation::initializeVariable):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::valueAt):
(KJS::JSVariableObject::isReadOnly):
(KJS::JSVariableObject::symbolTableGet):
(KJS::JSVariableObject::symbolTablePut):
(KJS::JSVariableObject::symbolTableInitializeVariable):
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- fix HashTable assertion on some SunSpider tests
Don't use -1 as the deleted value for JSValue*-keyed hashtables,
since it is a valid value (it's the immediate for -1).
* VM/CodeGenerator.h:
(KJS::CodeGenerator::JSValueHashTraits::emptyValue):
(KJS::CodeGenerator::JSValueHashTraits::deletedValue):
* kjs/JSImmediate.h:
(KJS::JSImmediate::impossibleValue):
2008-04-01 Sam Weinig <sam@webkit.org>
Reviewed by Maciej Stachowiak.
Add support for calling Native constructors like new Array().
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitConstruct):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::NewExprNode::emitCode):
* kjs/nodes.h:
2008-04-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- add some missing toOpbject calls to avoid crashing when calling methods on primitives
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-04-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Changed Machine::dumpRegisters to take a pointer instead of a reference,
so gdb understands how to call it.
* VM/Machine.cpp:
(KJS::Machine::dumpRegisters):
(KJS::Machine::privateExecute):
* VM/Machine.h:
2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Fix CodeGenerator::addConstant() so it uses the functionExpressions
counter for function expressions, not the functions counter.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addConstant):
2008-03-31 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Add emitCode support for TypeOfResolveNode and TypeOfValueNode.
Added new opcode op_type_of to handle them.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitNot):
(KJS::CodeGenerator::emitInstanceOf):
(KJS::CodeGenerator::emitTypeOf):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::jsTypeStringForValue):
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::TypeOfResolveNode::emitCode):
(KJS::TypeOfValueNode::emitCode):
* kjs/nodes.h:
2008-03-31 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Fix non-computed goto version of isOpcode. op_end is a valid opcode.
* VM/Machine.cpp:
(KJS::Machine::isOpcode):
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Added op_post_dec.
2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Geoffrey Garen.
Add support for FunctionCallDotNode.
* kjs/nodes.cpp:
(KJS::FunctionCallDotNode::emitCode):
* kjs/nodes.h:
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Next step toward global code: Removed more obsolete API, moved
saveLocalStorage and restoreLocalStorage to JSGlobalObject subclass,
since it's only intended for use there.
* ChangeLog:
* JavaScriptCore.exp:
* kjs/Activation.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::saveLocalStorage):
(KJS::JSGlobalObject::restoreLocalStorage):
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.cpp:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp):
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Next step toward global code: subclass JSActivation + JSActivationData
from JSVariableObject + JSVariableObjectData.
JSActivation now relies on JSVariableObject for access to registers and
symbol table, and for some delete functionality, but not for anything
else yet.
(KJS::JSActivation::mark): Cleaned up the style here a little bit.
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Next step toward global code: store "rOffset" in JSVariableObjectData.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Next steps toward global code:
* Moved access to the register file into JSVariableObject.
* Added more ASSERTs to indicate obsolete APIs there are just hanging
around to stave off build failures.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::registers):
(KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
(KJS::JSVariableObject::JSVariableObject):
2008-03-31 Sam Weinig <sam@webkit.org>
Reviewed by Oliver. Tweaked somewhat by Maciej.
- implement codegen for ReadModifyResolveNode
* kjs/nodes.cpp:
(KJS::emitReadModifyAssignment):
(KJS::ReadModifyResolveNode::emitCode):
* kjs/nodes.h:
2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Geoff.
Fix the build -- r31492 removed activation tear-off, but r31493 used it.
* kjs/nodes.cpp:
(KJS::FuncExprNode::makeFunction):
2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Add support for FuncExprNode to SquirrelFish.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeBlock.h:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::addConstant):
(KJS::CodeGenerator::emitNewFunctionExpression):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::FuncExprNode::emitCode):
(KJS::FuncExprNode::makeFunction):
* kjs/nodes.h:
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
First step toward global code: removed some obsolete JSGlobalObject
APIs, changing clients to ASSERT_NOT_REACHED.
Activation tear-off and scope chain pushing is obsolete because we
statically detect whether an activation + scope node is required.
The variableObject() and activationObject() accessors are obsolete
because they haven't been maintained, and they're mostly used by
node evaluation code, anyway.
The localStorage() accessor is obsolete because everything is in
registers now, and it's mostly used by node evaluation code, anyway.
2008-03-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- implement codegen for bracket accessor and bracket assign
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitGetPropVal):
(KJS::CodeGenerator::emitPutPropVal):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::BracketAccessorNode::emitCode):
(KJS::AssignBracketNode::emitCode):
* kjs/nodes.h:
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Not reviewed.
Removed FIXME that I just fixed.
Added ASSERT to cover an error previously only covered by a FIXME.
* kjs/JSActivation.cpp:
(KJS::JSActivation::getOwnPropertySlot):
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Not reviewed.
Fixed indentation inside op_call. (I had left this code badly indented
to make the behavior-changing diff clearer.)
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed up logging of jump instructions to follow the following style:
jump offset(->absoluteTarget)
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
2008-03-31 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Changed the SymbolTable API to use int instead of size_t. It has been
using int internally for a while now (since squirrelfish symbols can
have negative indices).
2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Add support for FunctionCallValueNode.
* kjs/nodes.cpp:
(KJS::FunctionCallValueNode::emitCode):
* kjs/nodes.h:
2008-03-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
1) Implemented array literals
2) Renamed op_object_get and op_object_put to op_get_prop_id and
op_put_prop_id in preparation for new variants.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitNewArray):
(KJS::CodeGenerator::emitGetPropId):
(KJS::CodeGenerator::emitPutPropId):
(KJS::CodeGenerator::emitPutPropIndex):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::propertyNames):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::ArrayNode::emitCode):
(KJS::PropertyListNode::emitCode):
(KJS::DotAccessorNode::emitCode):
(KJS::PostIncResolveNode::emitCode):
(KJS::PreIncResolveNode::emitCode):
(KJS::AssignResolveNode::emitCode):
(KJS::AssignDotNode::emitCode):
* kjs/nodes.h:
2008-03-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Implemented native function calls. (Re-entering from native code back
to JS doesn't work yet, though.)
0.2% speedup overall, due to some inlining tweaks. 3.6% regression on
function-empty.js, since we're making a new virtual call and taking a
new branch inside every op_call.
I adjusted the JavaScriptCore calling convention to minimize overhead,
like so:
The machine calls a single virtual function, "getCallData", to get all
the data it needs for a function call. Native code still uses the old
"isObject()" check followed by an "implementsCall()" check, which
aliases to "getCallData". (We can optimize native code to use getCallData
at our leisure.)
To supply a list of arguments, the machine calls a new List constructor
that just takes a pointer and a length, without copying. Native code
still appends to the list one argument at a time. (We can optimize
native code to use the new List constructor at our leisure.)
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Changed resize() call to grow() call,
to encourage the compiler to inline the Vector code.
* kjs/CallData.h: Added.
(KJS::): CallData is a union because eventually native calls will stuff
a function pointer into it, to eliminate the callAsFunction virtual call.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Changed this to an ASSERT since
it's not implemented yet.
* kjs/list.h: Made the List class two-faced, to support the old way and
the new way during this transition phase: lists can be made read-only
with just a pointer and a legnth, or you can append to them one item
at a time.
* kjs/value.h:
(KJS::jsUndefined): Marked this function ALWAYS_INLINE for the benefit
of a certain compiler that doesn't know what's best for it.
2008-03-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
Dump code that codegen can't handle yet, so it's easier to prioritize missing nodes.
* kjs/nodes.h:
(KJS::Node::emitCode):
2008-03-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
Improve dumping of bytecode and fix coding style accordingly.
Registers are printed as lr1 for locals, tr1 for temp registers. Identifiers print as
foobar(@id0) and constants print as "foo"(@k1) or 312.4(@k2) or the like. Constant and
identifier tables are dumped for reference.
* VM/CodeBlock.cpp:
(KJS::escapeQuotes):
(KJS::valueToSourceString):
(KJS::registerName):
(KJS::constantName):
(KJS::idName):
(KJS::printUnaryOp):
(KJS::printBinaryOp):
(KJS::CodeBlock::dump):
* VM/Machine.cpp:
(KJS::resolve):
(KJS::resolveBase):
(KJS::Machine::privateExecute):
2008-03-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
Implement StringNode and VoidNode (both pretty trivial).
* kjs/nodes.cpp:
(KJS::StringNode::emitCode):
(KJS::VoidNode::emitCode):
* kjs/nodes.h:
2008-03-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
Implement CommaNode.
* kjs/nodes.cpp:
(KJS::CommaNode::emitCode):
* kjs/nodes.h:
2008-03-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Adds support for dot notation and object literals.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitNewObject):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::ObjectLiteralNode::emitCode):
(KJS::PropertyListNode::emitCode):
(KJS::DotAccessorNode::emitCode):
(KJS::AssignDotNode::emitCode):
* kjs/nodes.h:
2008-03-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Mark the register file.
It's a conservative mark for now, but once registers are typed, we can
do an exact mark.
1.4% regression regardless of whether we actually do the marking.
GCC is is worth every penny.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Most of the changes here are just for
the fact that "registers" is a pointer now.
* kjs/JSGlobalObject.cpp: The global object owns the register file now.
2008-03-28 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18204: SquirrelFish: continue/break do not correctly handle scope popping
<http://bugs.webkit.org/show_bug.cgi?id=18204>
We now track the scope depth as part of a loop context, and add an
extra instruction op_jump_scopes that is used to perform a jump across
dynamic scope boundaries.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpScopes):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::ContinueNode::emitCode):
(KJS::BreakNode::emitCode):
2008-03-28 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Add emitCode support for ConditionalNode.
* kjs/nodes.cpp:
(KJS::ConditionalNode::emitCode):
* kjs/nodes.h:
2008-03-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Responding to feedback, added some comments, fixed up a few names, and
clarified that "locals" always means all local variables, functions,
and parameters.
2008-03-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Added support for "this".
Supply an implicit "this" value as the first argument to every function.
Alias the "this" keyword to that argument.
1% regression overall, 2.5% regression on empty function calls. Seems
like a reasonable cost for now, since we're doing more work.
(Eventually, we might decide to create a version of op_call specialized
for a known null "this" value.)
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitCall):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::CodeGenerator):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* kjs/CommonIdentifiers.cpp:
(KJS::CommonIdentifiers::CommonIdentifiers):
* kjs/CommonIdentifiers.h:
* kjs/nodes.cpp:
(KJS::ThisNode::emitCode):
(KJS::FunctionCallResolveNode::emitCode):
* kjs/nodes.h:
2008-03-28 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 18192: Squirrelfish needs support for break and continue
<http://bugs.webkit.org/show_bug.cgi?id=18192>
Added a loop context stack to the code generator to provide the
correct jump labels for continue and goto. Added logic to the
currently implemented loop constructs to manage entry and exit
from the loop contexts. Finally, implemented codegen for break
and continue (and a pass through for LabelNode)
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::pushLoopContext):
(KJS::CodeGenerator::popLoopContext):
(KJS::CodeGenerator::loopContextForIdentifier):
(KJS::CodeGenerator::labelForContinue):
(KJS::CodeGenerator::labelForBreak):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::ContinueNode::emitCode):
(KJS::BreakNode::emitCode):
(KJS::LabelNode::emitCode):
* kjs/nodes.h:
2008-03-27 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Add emitCode support for UnaryPlusNode, NegateNode, BitwiseNotNode and LogicalNotNode.
* VM/CodeBlock.cpp:
(KJS::printUnaryOp):
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitToJSNumber):
(KJS::CodeGenerator::emitNegate):
(KJS::CodeGenerator::emitBitNot):
(KJS::CodeGenerator::emitNot):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::UnaryPlusNode::emitCode):
(KJS::NegateNode::emitCode):
(KJS::BitwiseNotNode::emitCode):
(KJS::LogicalNotNode::emitCode):
* kjs/nodes.h:
2008-03-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej Stachowiak.
Add support for LogicalAndNode and LogicalOrNode.
* kjs/nodes.cpp:
(KJS::LogicalAndNode::emitCode):
(KJS::LogicalOrNode::emitCode):
* kjs/nodes.h:
2008-03-27 Sam Weinig <sam@webkit.org>
Clean up code and debug output.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-03-27 Geoffrey Garen <ggaren@apple.com>
Moved an ASSERT to a more logical place.
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-03-27 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Add emitCode support for InstanceOfNode.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitInstanceOf):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::InstanceOfNode::emitCode):
* kjs/nodes.h:
2008-03-27 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Bug 18142: squirrelfish needs to support dynamic scoping/with
<http://bugs.webkit.org/show_bug.cgi?id=18142>
Add support for dynamic scoping and add code to handle 'with'
statements.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeBlock.h:
(KJS::CodeBlock::CodeBlock):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::getRegister):
(KJS::CodeGenerator::emitPushScope):
(KJS::CodeGenerator::emitPopScope):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::CodeGenerator):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::WithNode::emitCode):
* kjs/nodes.h:
2008-03-27 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Add emitCode support for NullNode, FalseNode, TrueNode, IfNode, IfElseNode, DoWhileNode and WhileNode
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Dump op_jfalse opcode.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfFalse): Identical to emitJumpIfTrue except it emits the op_jfalse opcode.
(KJS::CodeGenerator::emitLoad): Add and emitLoad override for booleans.
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Adds execution of op_jfalse. It is identical to op_jtrue, except the
the condition is reversed.
* VM/Opcode.h: Add op_jfalse.
* kjs/nodes.cpp:
(KJS::NullNode::emitCode): Added.
(KJS::FalseNode::emitCode): Added.
(KJS::TrueNode::emitCode): Added.
(KJS::IfNode::emitCode): Added.
(KJS::IfElseNode::emitCode): Added.
(KJS::DoWhileNode::emitCode): Added.
(KJS::WhileNode::emitCode): Added.
* kjs/nodes.h:
2008-03-26 Geoffrey Garen <ggaren@apple.com>
Nixed an unused List.
The calm before my stormy war against the List class.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct):
2008-03-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Geoffrey Garen.
Adds support for EqualNode, NotEqualNode, StrictEqualNode, NotStrictEqualNode,
LessEqNode, GreaterNode, GreaterEqNode, MultNode, DivNode, ModNode, SubNode,
LeftShiftNode, RightShiftNode, UnsignedRightShiftNode, BitAndNode, BitXOrNode,
and BitOrNode.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump):
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitEqual):
(KJS::CodeGenerator::emitNotEqual):
(KJS::CodeGenerator::emitStrictEqual):
(KJS::CodeGenerator::emitNotStrictEqual):
(KJS::CodeGenerator::emitLessEq):
(KJS::CodeGenerator::emitMult):
(KJS::CodeGenerator::emitDiv):
(KJS::CodeGenerator::emitMod):
(KJS::CodeGenerator::emitSub):
(KJS::CodeGenerator::emitLeftShift):
(KJS::CodeGenerator::emitRightShift):
(KJS::CodeGenerator::emitUnsignedRightShift):
(KJS::CodeGenerator::emitBitAnd):
(KJS::CodeGenerator::emitBitXOr):
(KJS::CodeGenerator::emitBitOr):
* VM/CodeGenerator.h:
* VM/Machine.cpp:
(KJS::jsLessEq):
(KJS::Machine::privateExecute):
* VM/Opcode.h:
* kjs/nodes.cpp:
(KJS::MultNode::emitCode):
(KJS::DivNode::emitCode):
(KJS::ModNode::emitCode):
(KJS::SubNode::emitCode):
(KJS::LeftShiftNode::emitCode):
(KJS::RightShiftNode::emitCode):
(KJS::UnsignedRightShiftNode::emitCode):
(KJS::GreaterNode::emitCode):
(KJS::LessEqNode::emitCode):
(KJS::GreaterEqNode::emitCode):
(KJS::EqualNode::emitCode):
(KJS::NotEqualNode::emitCode):
(KJS::StrictEqualNode::emitCode):
(KJS::NotStrictEqualNode::emitCode):
(KJS::BitAndNode::emitCode):
(KJS::BitXOrNode::emitCode):
(KJS::BitOrNode::emitCode):
* kjs/nodes.h:
2008-03-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Only print debug dumps in debug builds.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::generate):
* VM/Machine.cpp:
(KJS::Machine::privateExecute):
2008-03-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Moved a few files around in the XCode project.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-03-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Made closures work.
An activation object aliases to the register file until its associated
function returns, at which point it copies the registers for locals and
parameters into an independent storage buffer.
2008-03-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed recent 25% regression on simple for loop test. GCC seems to be
very finicky about the code that gets inlined into
Machine::privateExecute.
Everything in this patch is simply the result of experiment.
The resolve and resolve_base opcodes do not seem to have gotten slower
from this change.
* VM/Machine.cpp:
(KJS::resolve):
(KJS::resolveBase):
(KJS::Machine::privateExecute):
* kjs/nodes.h:
2008-03-24 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff Garen.
Bug 18059: squirrelfish needs to compile on platforms without computed goto
<http://bugs.webkit.org/show_bug.cgi?id=18059>
"Standard" macro style support for conditionalising the use of computed goto.
* JavaScriptCore.xcodeproj/project.pbxproj:
* VM/Machine.cpp:
(KJS::Machine::isOpcode):
(KJS::Machine::privateExecute):
* VM/Machine.h:
(KJS::Machine::getOpcode):
(KJS::Machine::getOpcodeID):
* VM/Opcode.h:
* wtf/Platform.h:
2008-03-24 Geoffrey Garen <ggaren@apple.com>
Moved my notes from nodes.h to the wiki.
* kjs/nodes.h:
2008-03-24 Geoffrey Garen <ggaren@apple.com>
SquirrelFish lives.
Initial check-in of the code I've been carrying around. Lots of stuff
doesn't work. Plus a bunch of empty files.
=== Start merge of squirrelfish ===
2008-05-21 Darin Adler <darin@apple.com>
- try to fix the Windows build
* profiler/Profiler.cpp:
(KJS::Profiler::stopProfiling): Use ptrdiff_t instead of the less-common but incredibly
similar ssize_t type.
* wtf/AVLTree.h:
(KJS::AVLTree::search): Added a typename for a dependent name that's a type.
2008-05-21 Darin Adler <darin@apple.com>
Reviewed by Anders.
- fix <rdar://problem/5952721> bug in JavaScript arguments object property lookup
Test: fast/js/arguments-bad-index.html
* kjs/function.cpp:
(KJS::IndexToNameMap::IndexToNameMap): Use unsigned instead of int.
(KJS::IndexToNameMap::isMapped): Use unsigned instead of int, and also use the
strict version of the numeric conversion function, since we don't want to allow
trailing junk.
(KJS::IndexToNameMap::unMap): Ditto.
(KJS::IndexToNameMap::operator[]): Ditto.
* kjs/function.h: Changed IndexToNameMap::size type from int to unsigned.
2008-05-21 Timothy Hatcher <timothy@apple.com>
Change the Profiler to allow multiple profiles to be running at
the same time. This can happen when you have nested console.profile()
calls. This required two changes. First, the Profiler needed to keep a
Vector of current profiles, instead of one. Second, a Profile needs
to keep track of the global ExecState it started in and the page group
identifier it is tracking.
The stopProfiling call now takes the same arguments as startProfiling.
This makes sure the correct profile is stopped. Passing a null UString
as the title will stop the last profile for the matching ExecState.
<rdar://problem/5951559> Multiple pages profiling can interfere with each other
Reviewed by Kevin McCullough.
* JavaScriptCore.exp: Added new exports. Removed old symbols.
* profiler/Profile.cpp:
(KJS::Profile::Profile): New constructor arguments for the
originatingGlobalExec and pageGroupIdentifier.
(KJS::Profile::stopProfiling): Set the m_originatingGlobalExec to null.
* profiler/Profile.h:
(KJS::Profile::create): Additional arguments.
(KJS::Profile::originatingGlobalExec): Return m_originatingGlobalExec.
(KJS::Profile::pageGroupIdentifier): Return m_pageGroupIdentifier.
* profiler/Profiler.cpp:
(KJS::Profiler::findProfile): Added. Finds a Profile that matches
the ExecState and title.
(KJS::Profiler::startProfiling): Return early if there is already
a Profile with the ExecState and title. If not, create a new profile
and append it to m_currentProfiles.
(KJS::Profiler::stopProfiling): Loops through m_currentProfiles
and find the one matching the ExecState and title. If one is found
call stopProfiling and return the Profile after removing it
from m_currentProfiles.
(KJS::dispatchFunctionToProfiles): Helper inline function to loop through
m_currentProfiles and call a Profile function.
(KJS::Profiler::willExecute): Call dispatchFunctionToProfiles.
(KJS::Profiler::didExecute): Ditto.
* profiler/Profiler.h:
2008-05-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
<rdar://problem/5908520> REGRESSION (3.1.1-r33033): Crash in WebKit when opening or
refreshing page on people.com
The problem was that STL algorithms do not work with non-conformant comparators, and the
site used sort(function() { return 0.5 - Math.random(); } to randomly shuffle an array.
https://bugs.webkit.org/show_bug.cgi?id=18687
REGRESSION(r32220): ecma/Array/15.4.4.5-3.js test now fails in GMT(BST)
Besides relying on sort stability, this test was just broken, and kept failing with the
new stable sort.
Tests: fast/js/sort-randomly.html
fast/js/sort-stability.html
fast/js/comparefn-sort-stability.html
* kjs/avl_tree.h: Added an AVL tree implementation.
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/AVLTree.h: Added.
Added an AVL tree implementation.
* kjs/array_instance.cpp:
(KJS::ArrayInstance::increaseVectorLength):
(KJS::ArrayInstance::sort):
(KJS::AVLTreeAbstractorForArrayCompare::get_less):
(KJS::AVLTreeAbstractorForArrayCompare::set_less):
(KJS::AVLTreeAbstractorForArrayCompare::get_greater):
(KJS::AVLTreeAbstractorForArrayCompare::set_greater):
(KJS::AVLTreeAbstractorForArrayCompare::get_balance_factor):
(KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
(KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
(KJS::AVLTreeAbstractorForArrayCompare::compare_key_node):
(KJS::AVLTreeAbstractorForArrayCompare::compare_node_node):
(KJS::AVLTreeAbstractorForArrayCompare::null):
(KJS::ArrayInstance::compactForSorting):
* kjs/array_instance.h: increaseVectorLength() now returns a bool to indicate whether it was
successful.
* wtf/Vector.h:
(WTF::Vector::Vector):
(WTF::::operator=):
(WTF::::fill):
Make these methods fail instead of crash when allocation fails, matching resize() and
reserveCapacity(), which already had this behavior. Callers need to check for null buffer
after making any Vector call that can try to allocate.
* tests/mozilla/ecma/Array/15.4.4.5-3.js: Fixed the test to use a consistent sort function,
as suggested in comments to a Mozilla bug filed about it (I'll keep tracking the bug to see
what the final resolution is).
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
profile node.
- Implements focus by adding the idea of a profileNode being visible and
adding the ability to reset all of the visible flags.
* profiler/Profile.h:
(KJS::Profile::focus):
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode): Initialize the visible flag.
(KJS::ProfileNode::setTreeVisible): Set the visibility of this node and
all of its descendents.
(KJS::ProfileNode::focus): Determine if this node should be visible when
focusing, if the functionName matches this node's function name or if any
of this node's children are visible.
(KJS::ProfileNode::restoreAll): Restore all nodes' visible flag.
(KJS::ProfileNode::debugPrintData):
* profiler/ProfileNode.h:
(KJS::ProfileNode::visible):
(KJS::ProfileNode::setVisible):
2008-05-20 Timothy Hatcher <timothy@apple.com>
Fixes a couple performance issues with the profiler. Also fixes
a regression where some nodes wouldn't be added to the tree.
Reviewed by Kevin McCullough.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::addChild): Compare callIdentifier instead
of functionName.
* profiler/ProfileNode.h:
(CallIdentifier.operator==): Compare the CallIdentifiers in
an order that fails sooner for non-matches.
(CallIdentifier.callIdentifier): Return the CallIdentifier by
reference to prevent making a new copy each time.
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5950796> JSProfiler: dump functions are in the code
Removed dump and logging functions from the Release version of the code
and renamed them to be obviously for debugging only.
* JavaScriptCore.exp:
* profiler/Profile.cpp:
(KJS::Profile::debugPrintData):
(KJS::Profile::debugPrintDataSampleStyle):
* profiler/Profile.h:
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::debugPrintData):
(KJS::ProfileNode::debugPrintDataSampleStyle):
* profiler/ProfileNode.h:
* profiler/Profiler.cpp:
* profiler/Profiler.h:
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
<rdar://problem/5950538> JSProfiler: Keep track of non-JS execution time
We now have an extra node that represents the excess non-JS time.
- Also changed "SCRIPT" and "anonymous function" to be more consistent
with the debugger.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::stopProfiling): If this ProfileNode is the head node
create a new child that has the excess execution time.
(KJS::ProfileNode::calculatePercentages): Moved calculation of the
percentages into a function since it's called from multiple places.
* profiler/ProfileNode.h: Add the newly needed functions used above.
(KJS::ProfileNode::setTotalTime):
(KJS::ProfileNode::setSelfTime):
(KJS::ProfileNode::setNumberOfCalls):
* profiler/Profiler.cpp: renamed "SCRIPT" and "anonymous function" to be
consistent with the debugger and use constants that can be localized
more easily.
(KJS::getCallIdentifiers):
(KJS::getCallIdentifierFromFunctionImp):
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
Removed only profiler-internal use of currentProfile since that concept
is changing.
* profiler/Profile.h: Now stopProfiling takes a time and bool as
arguments. The time is used to calculate %s from and the bool tells
if this node is the head node and should be the one calculating the time.
(KJS::Profile::stopProfiling):
* profiler/ProfileNode.cpp: Ditto.
(KJS::ProfileNode::stopProfiling):
* profiler/ProfileNode.h: Ditto.
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Accidentally turned on the profiler.
* kjs/config.h:
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
Split function name into 3 parts so that the Web Inspector can link it to
the resource location from whence it came.
* kjs/ustring.cpp: Implemented operator> for UStrings
(KJS::operator>):
* kjs/ustring.h:
* profiler/Profile.cpp:
(KJS::Profile::Profile): Initialize all 3 values.
(KJS::Profile::willExecute): Use CallIdentifier struct.
(KJS::Profile::didExecute): Ditto.
* profiler/Profile.h: Ditto and remove unused function.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode): Use CallIdentifier struct.
(KJS::ProfileNode::willExecute): Ditto and fix an issue where we
restarted the m_startTime even though it was already started.
(KJS::ProfileNode::didExecute): Ditto.
(KJS::ProfileNode::findChild): Ditto.
(KJS::functionNameDescendingComparator): Ditto and use new comparator.
(KJS::functionNameAscendingComparator): Ditto.
(KJS::ProfileNode::printDataInspectorStyle): Use CallIdentifier struct.
(KJS::ProfileNode::printDataSampleStyle): Ditto.
* profiler/ProfileNode.h:
(KJS::CallIdentifier::CallIdentifier): Describe the CallIdentifier struct
(KJS::CallIdentifier::operator== ):
(KJS::ProfileNode::create): Use the CallIdentifier struct.
(KJS::ProfileNode::callIdentifier):
(KJS::ProfileNode::functionName): Now only return the function name, not
the url and line number too.
(KJS::ProfileNode::url):
(KJS::ProfileNode::lineNumber):
* profiler/Profiler.cpp: Use the CallIdentifier struct.
(KJS::Profiler::startProfiling):
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
(KJS::getCallIdentifiers):
(KJS::getCallIdentifierFromFunctionImp):
2008-05-20 Timothy Hatcher <timothy@apple.com>
Rename sortFileName{Ascending,Descending} to
sortFunctionName{Ascending,Descending}.
Reviewed by Kevin McCullough.
* JavaScriptCore.exp:
* kjs/config.h:
* profiler/Profile.h:
* profiler/ProfileNode.cpp:
(KJS::functionNameDescendingComparator):
(KJS::ProfileNode::sortFunctionNameDescending):
(KJS::functionNameAscendingComparator):
(KJS::ProfileNode::sortFunctionNameAscending):
* profiler/ProfileNode.h:
2008-05-19 Timothy Hatcher <timothy@apple.com>
Make the profiler use higher than millisecond resolution time-stamps.
Reviewed by Kevin McCullough.
* kjs/DateMath.cpp:
(KJS::getCurrentUTCTime): Call getCurrentUTCTimeWithMicroseconds and
floor the result.
(KJS::getCurrentUTCTimeWithMicroseconds): Copied from the previous
implementation of getCurrentUTCTime without the floor call.
* kjs/DateMath.h: Addded getCurrentUTCTimeWithMicroseconds.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode): Use getCurrentUTCTimeWithMicroseconds.
2008-05-19 Timothy Hatcher <timothy@apple.com>
Fixes a bug in the profiler where call and apply would show up
and double the time spent in a function. We don't want to show call
and apply at all in the profiles. This change excludes them.
Reviewed by Kevin McCullough.
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::stopProfiling): Remove a second for loop and
calculate self time in the existing loop.
* profiler/Profiler.cpp:
(KJS::shouldExcludeFunction): Helper inline function that returns
true in the current function in an InternalFunctionImp and it is
has the functionName call or apply.
(KJS::Profiler::willExecute): Call shouldExcludeFunction and return
early if if returns true.
(KJS::Profiler::didExecute): Ditto.
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
- Implement sorting by function name.
* JavaScriptCore.exp:
* profiler/Profile.h:
(KJS::Profile::sortFileNameDescending):
(KJS::Profile::sortFileNameAscending):
* profiler/ProfileNode.cpp:
(KJS::fileNameDescendingComparator):
(KJS::ProfileNode::sortFileNameDescending):
(KJS::fileNameAscendingComparator):
(KJS::ProfileNode::sortFileNameAscending):
* profiler/ProfileNode.h:
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
<rdar://problem/5770054> JavaScript profiler (10928)
- Pass the exec state to profiler when calling startProfiling so that if
profiling is started within an execution context that location is
recorded correctly.
* JavaScriptCore.exp:
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::printDataInspectorStyle): Dump more info for debugging
purposes.
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling):
* profiler/Profiler.h:
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Rubberstamped by Geoff.
Turn off the profiler because it is a performance regression.
* kjs/config.h:
2008-05-19 Alp Toker <alp@nuanti.com>
Reviewed by Anders and Beth.
http://bugs.webkit.org/show_bug.cgi?id=16495
[GTK] Accessibility support with ATK/AT-SPI
Initial ATK/AT-SPI accessibility support for the GTK+ port.
* wtf/Platform.h:
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
-In an effort to make the profiler as efficient as possible instead of
prepending to a vector we keep the vector in reverse order and operate
over it backwards.
* profiler/Profile.cpp:
(KJS::Profile::willExecute):
(KJS::Profile::didExecute):
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::didExecute):
(KJS::ProfileNode::endAndRecordCall):
* profiler/ProfileNode.h:
* profiler/Profiler.cpp:
(KJS::getStackNames):
2008-05-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
Implement sorting for the profiler.
I chose to sort the profileNodes in place since there is no reason they
need to retain their original order.
* JavaScriptCore.exp: Export the symbols.
* profiler/Profile.h: Add the different ways a profile can be sorted.
(KJS::Profile::sortTotalTimeDescending):
(KJS::Profile::sortTotalTimeAscending):
(KJS::Profile::sortSelfTimeDescending):
(KJS::Profile::sortSelfTimeAscending):
(KJS::Profile::sortCallsDescending):
(KJS::Profile::sortCallsAscending):
* profiler/ProfileNode.cpp: Implement those ways.
(KJS::totalTimeDescendingComparator):
(KJS::ProfileNode::sortTotalTimeDescending):
(KJS::totalTimeAscendingComparator):
(KJS::ProfileNode::sortTotalTimeAscending):
(KJS::selfTimeDescendingComparator):
(KJS::ProfileNode::sortSelfTimeDescending):
(KJS::selfTimeAscendingComparator):
(KJS::ProfileNode::sortSelfTimeAscending):
(KJS::callsDescendingComparator):
(KJS::ProfileNode::sortCallsDescending):
(KJS::callsAscendingComparator):
(KJS::ProfileNode::sortCallsAscending):
* profiler/ProfileNode.h: No longer use a Deque since it cannot be
sorted by std::sort and there was no reason not to use a Vector. I
previously had though I would do prepending but am not.
(KJS::ProfileNode::selfTime):
(KJS::ProfileNode::totalPercent):
(KJS::ProfileNode::selfPercent):
(KJS::ProfileNode::children):
* profiler/Profiler.cpp: Removed these functions as they can be called
directoy on the Profile object after getting the Vector of them.
(KJS::getStackNames):
* profiler/Profiler.h:
2008-05-15 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
Since WebKitGtk is fully using autotools now, clean-up the .pro/.pri files
from gtk-port.
* JavaScriptCore.pro:
* kjs/testkjs.pro:
2008-05-15 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* JavaScriptCore.exp:
2008-05-15 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
- Cache some values to save on computing them repetitively. This will be
a big savings when we sort since we won't have to walk the tree for
every comparison!
- We cache these values when we end profiling because otherwise we won't
know which profile to get the totalTime for the whole profile from without
retaining a reference to the head profile or looking up the profile from
the list of all profiles.
- Also it's safe to assume we won't be asked for these values while we
are still profiling since the WebInspector only get's profileNodes from
profiles that are in the allProfiles() list and a profile is only added
to that list after it has finished and these values will no longer
change.
* JavaScriptCore.exp:
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::ProfileNode):
(KJS::ProfileNode::stopProfiling):
(KJS::ProfileNode::printDataInspectorStyle):
(KJS::ProfileNode::printDataSampleStyle):
(KJS::ProfileNode::endAndRecordCall):
* profiler/ProfileNode.h:
(KJS::ProfileNode::totalTime):
(KJS::ProfileNode::selfTime):
(KJS::ProfileNode::totalPercent):
(KJS::ProfileNode::selfPercent):
* profiler/Profiler.cpp:
(KJS::Profiler::stopProfiling):
2008-05-15 Simon Hausmann <shausman@trolltech.com>
Reviewed by Holger.
Fix compilation when compiling with MSVC and wchar_t support.
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::foldCase):
(WTF::Unicode::umemcasecmp):
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
- Turn on the profiler.
* kjs/config.h:
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
- Expose the new profiler functions to the WebInspector.
* JavaScriptCore.exp:
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Giving credit where credit is due.
* ChangeLog:
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff and Sam.
<rdar://problem/5770054> JavaScript profiler (10928)
Add the ability to get percentages of total and self time for displaying
in the WebInspector.
* profiler/Profile.h:
(KJS::Profile::totalProfileTime):
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::totalPercent):
(KJS::ProfileNode::selfPercent):
* profiler/ProfileNode.h:
* profiler/Profiler.h:
(KJS::Profiler::currentProfile):
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5770054> JavaScript profiler (10928)
- Rename FunctionCallProfile to ProfileNode.
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* profiler/FunctionCallProfile.cpp: Removed.
* profiler/FunctionCallProfile.h: Removed.
* profiler/Profile.cpp:
(KJS::Profile::Profile):
(KJS::Profile::willExecute):
* profiler/Profile.h:
(KJS::Profile::callTree):
* profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp.
(KJS::ProfileNode::ProfileNode):
(KJS::ProfileNode::willExecute):
(KJS::ProfileNode::didExecute):
(KJS::ProfileNode::addChild):
(KJS::ProfileNode::findChild):
(KJS::ProfileNode::stopProfiling):
(KJS::ProfileNode::selfTime):
(KJS::ProfileNode::printDataInspectorStyle):
(KJS::ProfileNode::printDataSampleStyle):
(KJS::ProfileNode::endAndRecordCall):
* profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h.
(KJS::ProfileNode::create):
(KJS::ProfileNode::children):
* profiler/Profiler.cpp:
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by John.
<rdar://problem/5770054> JavaScript profiler (10928)
- Have each FunctionCallProfile be able to return it's total and self time.
* JavaScriptCore.exp:
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::selfTime):
* profiler/FunctionCallProfile.h:
(KJS::FunctionCallProfile::totalTime):
2008-05-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
<rdar://problem/5934376> REGRESSION: A script fails because of a straw BOM character in it.
<https://bugs.webkit.org/show_bug.cgi?id=4931>
Unicode format characters (Cf) should be removed from JavaScript source
Of all Cf characters, we are only removing BOM, because this is what Firefox trunk has
settled upon, after extensive discussion and investigation.
Based on Darin's work on this bug.
Test: fast/js/removing-Cf-characters.html
* kjs/lexer.cpp:
(KJS::Lexer::setCode): Tweak formatting. Use a call to shift(4) to read in the
first characters, instead of having special case code here.
(KJS::Lexer::shift): Add a loop when reading a character to skip BOM characters.
2008-05-13 Matt Lilek <webkit@mattlilek.com>
Not reviewed, build fix.
* kjs/date_object.cpp:
(KJS::DateObjectFuncImp::callAsFunction):
2008-05-13 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
<rdar://problem/5933644> Implement Date.now
Implement Date.now which returns the number of milliseconds since the epoch.
* kjs/CommonIdentifiers.h:
* kjs/date_object.cpp:
(KJS::DateObjectFuncImp::):
(KJS::DateObjectImp::DateObjectImp):
(KJS::DateObjectFuncImp::callAsFunction):
2008-05-13 Kevin McCullough <kmccullough@apple.com>
Giving credit where credit is due.
* ChangeLog:
2008-05-13 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam and Geoff.
<rdar://problem/5770054> JavaScript profiler (10928)
Use PassRefPtrs instead of RefPtrs when appropriate.
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::addChild):
* profiler/FunctionCallProfile.h:
* profiler/Profile.h:
(KJS::Profile::callTree):
2008-05-13 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5770054> JavaScript profiler (10928)
- Made some functions static (as per Adam) and changed from using raw
pointers to RefPtr for making these JavaScript Objects.
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::addChild):
(KJS::FunctionCallProfile::findChild):
* profiler/FunctionCallProfile.h:
(KJS::FunctionCallProfile::create):
* profiler/Profile.cpp:
(KJS::Profile::Profile):
(KJS::Profile::willExecute):
(KJS::Profile::didExecute):
(KJS::functionNameCountPairComparator):
* profiler/Profile.h:
(KJS::Profile::create):
(KJS::Profile::title):
(KJS::Profile::callTree):
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling):
* profiler/Profiler.h:
(KJS::Profiler::allProfiles):
(KJS::Profiler::clearProfiles):
2008-05-13 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoffrey Garen.
<rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
with ASCII strings
* kjs/ustring.h:
* kjs/ustring.cpp:
(KJS::UString::Rep::createFromUTF8):
Added. Implementation adapted from JSStringCreateWithUTF8CString().
* API/JSStringRef.cpp:
(JSStringCreateWithUTF8CString):
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass):
Use UString::Rep::createFromUTF8().
2008-05-12 Mark Rowe <mrowe@apple.com>
Reviewed by Tim Hatcher.
<rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
Create WebKit availability macros that key off the Mac OS X version being targeted to
determine the WebKit version being targeted. Applications can define
WEBKIT_VERSION_MIN_REQUIRED before including WebKit headers in order to target a specific
version of WebKit.
The availability header is being added to JavaScriptCore rather than WebKit as JavaScriptCore
is the lowest-level portion of the public WebKit API.
* API/WebKitAvailability.h: Added.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-05-12 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej.
https://bugs.webkit.org/show_bug.cgi?id=18828
Reproducible crash with PAC file
Naively moving JavaScriptCore into thread-specific data was inappropriate in the face of
exiting JavaScriptCore API clients, which expect a different therading model. Temporarily
disabling ThreadSpecific implementation until this can be sorted out.
* wtf/ThreadSpecific.h:
(WTF::::ThreadSpecific):
(WTF::::~ThreadSpecific):
(WTF::::get):
(WTF::::set):
2008-05-12 Alexey Proskuryakov <ap@webkit.org>
Roll out recent threading changes (r32807, r32810, r32819, r32822) to simplify
SquirrelFish merging.
* API/JSBase.cpp:
(JSGarbageCollect):
* API/JSCallbackObjectFunctions.h:
(KJS::::staticFunctionGetter):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
* API/JSValueRef.cpp:
(JSValueMakeNumber):
(JSValueMakeString):
* JavaScriptCore.exp:
* kjs/ExecState.h:
* kjs/InitializeThreading.cpp:
(KJS::initializeThreadingOnce):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject):
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::put):
(KJS::JSGlobalObject::reset):
(KJS::JSGlobalObject::tearOffActivation):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::head):
(KJS::JSGlobalObject::perThreadData):
* kjs/JSLock.cpp:
(KJS::JSLock::registerThread):
* kjs/JSLock.h:
(KJS::JSLock::JSLock):
* kjs/array_instance.cpp:
(KJS::ArrayInstance::ArrayInstance):
(KJS::ArrayInstance::lengthGetter):
* kjs/array_object.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
(KJS::ArrayObjectImp::ArrayObjectImp):
(KJS::ArrayObjectImp::construct):
* kjs/bool_object.cpp:
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::BooleanObjectImp::BooleanObjectImp):
(KJS::BooleanObjectImp::construct):
* kjs/collector.cpp:
(KJS::allocateBlock):
(KJS::Collector::recordExtraCost):
(KJS::Collector::heapAllocate):
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
(KJS::Collector::registerAsMainThread):
(KJS::onMainThread):
(KJS::PlatformThread::PlatformThread):
(KJS::getCurrentPlatformThread):
(KJS::Collector::Thread::Thread):
(KJS::destroyRegisteredThread):
(KJS::initializeRegisteredThreadKey):
(KJS::Collector::registerThread):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::markCurrentThreadConservativelyInternal):
(KJS::Collector::markCurrentThreadConservatively):
(KJS::suspendThread):
(KJS::resumeThread):
(KJS::getPlatformThreadRegisters):
(KJS::otherThreadStackPointer):
(KJS::Collector::markOtherThreadConservatively):
(KJS::protectedValues):
(KJS::Collector::protect):
(KJS::Collector::unprotect):
(KJS::Collector::collectOnMainThreadOnly):
(KJS::Collector::markProtectedObjects):
(KJS::Collector::markMainThreadOnlyObjects):
(KJS::Collector::sweep):
(KJS::Collector::collect):
(KJS::Collector::size):
(KJS::Collector::globalObjectCount):
(KJS::Collector::protectedGlobalObjectCount):
(KJS::Collector::protectedObjectCount):
(KJS::Collector::protectedObjectTypeCounts):
(KJS::Collector::isBusy):
(KJS::Collector::reportOutOfMemoryToAllExecStates):
* kjs/collector.h:
(KJS::Collector::cellBlock):
(KJS::Collector::cellOffset):
(KJS::Collector::isCellMarked):
(KJS::Collector::markCell):
(KJS::Collector::reportExtraMemoryCost):
* kjs/date_object.cpp:
(KJS::formatLocaleDate):
(KJS::DatePrototype::DatePrototype):
(KJS::DateObjectImp::DateObjectImp):
(KJS::DateObjectImp::construct):
(KJS::DateObjectImp::callAsFunction):
(KJS::DateObjectFuncImp::DateObjectFuncImp):
(KJS::DateObjectFuncImp::callAsFunction):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::errorProtoFuncToString):
(KJS::ErrorObjectImp::ErrorObjectImp):
(KJS::ErrorObjectImp::construct):
(KJS::NativeErrorPrototype::NativeErrorPrototype):
(KJS::NativeErrorImp::NativeErrorImp):
(KJS::NativeErrorImp::construct):
* kjs/function.cpp:
(KJS::FunctionImp::lengthGetter):
(KJS::FunctionImp::construct):
(KJS::Arguments::Arguments):
(KJS::ActivationImp::createArgumentsObject):
(KJS::encode):
(KJS::decode):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncEscape):
(KJS::globalFuncUnescape):
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
(KJS::functionProtoFuncToString):
(KJS::FunctionObjectImp::FunctionObjectImp):
(KJS::FunctionObjectImp::construct):
* kjs/internal.cpp:
(KJS::StringImp::toObject):
* kjs/internal.h:
(KJS::StringImp::StringImp):
(KJS::NumberImp::operator new):
* kjs/list.cpp:
(KJS::List::markSet):
(KJS::List::markProtectedListsSlowCase):
(KJS::List::expandAndAppend):
* kjs/list.h:
(KJS::List::List):
(KJS::List::~List):
(KJS::List::markProtectedLists):
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::cacheGlobalObject):
* kjs/math_object.cpp:
(KJS::MathObjectImp::getValueProperty):
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/nodes.cpp:
(KJS::ParserRefCounted::ParserRefCounted):
(KJS::ParserRefCounted::ref):
(KJS::ParserRefCounted::deref):
(KJS::ParserRefCounted::refcount):
(KJS::ParserRefCounted::deleteNewObjects):
(KJS::Node::handleException):
(KJS::NumberNode::evaluate):
(KJS::StringNode::evaluate):
(KJS::ArrayNode::evaluate):
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::typeStringForValue):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::TypeOfResolveNode::evaluate):
(KJS::TypeOfValueNode::evaluate):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::PreIncConstNode::evaluate):
(KJS::PreDecConstNode::evaluate):
(KJS::PostIncConstNode::evaluate):
(KJS::PostDecConstNode::evaluate):
(KJS::PreIncBracketNode::evaluate):
(KJS::PreDecBracketNode::evaluate):
(KJS::PreIncDotNode::evaluate):
(KJS::PreDecDotNode::evaluate):
(KJS::NegateNode::evaluate):
(KJS::BitwiseNotNode::evaluate):
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::addSlowCase):
(KJS::add):
(KJS::AddNumbersNode::evaluate):
(KJS::AddStringsNode::evaluate):
(KJS::AddStringLeftNode::evaluate):
(KJS::AddStringRightNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::LeftShiftNode::evaluate):
(KJS::RightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::BitXOrNode::evaluate):
(KJS::BitOrNode::evaluate):
(KJS::valueForReadModifyAssignment):
(KJS::ForInNode::execute):
(KJS::TryNode::execute):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::evaluate):
* kjs/nodes.h:
* kjs/number_object.cpp:
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
(KJS::NumberObjectImp::NumberObjectImp):
(KJS::NumberObjectImp::getValueProperty):
(KJS::NumberObjectImp::construct):
(KJS::NumberObjectImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::call):
(KJS::JSObject::get):
(KJS::JSObject::put):
(KJS::JSObject::defineGetter):
(KJS::JSObject::defineSetter):
(KJS::JSObject::putDirect):
(KJS::Error::create):
* kjs/object.h:
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
(KJS::ObjectObjectImp::ObjectObjectImp):
(KJS::ObjectObjectImp::construct):
* kjs/property_map.h:
(KJS::SavedProperty::SavedProperty):
(KJS::SavedProperty::init):
(KJS::SavedProperty::~SavedProperty):
(KJS::SavedProperty::name):
(KJS::SavedProperty::value):
(KJS::SavedProperty::attributes):
* kjs/protect.h:
(KJS::gcProtect):
(KJS::gcUnprotect):
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::regExpProtoFuncToString):
(KJS::RegExpImp::getValueProperty):
(KJS::RegExpObjectImp::RegExpObjectImp):
(KJS::RegExpObjectImp::arrayOfMatches):
(KJS::RegExpObjectImp::getBackref):
(KJS::RegExpObjectImp::getLastParen):
(KJS::RegExpObjectImp::getLeftContext):
(KJS::RegExpObjectImp::getRightContext):
(KJS::RegExpObjectImp::getValueProperty):
(KJS::RegExpObjectImp::createRegExpImp):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(KJS::StringInstance::StringInstance):
(KJS::StringInstance::lengthGetter):
(KJS::StringInstance::indexGetter):
(KJS::stringInstanceNumericPropertyGetter):
(KJS::StringPrototype::StringPrototype):
(KJS::replace):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
(KJS::StringObjectImp::StringObjectImp):
(KJS::StringObjectImp::construct):
(KJS::StringObjectImp::callAsFunction):
(KJS::StringObjectFuncImp::StringObjectFuncImp):
(KJS::StringObjectFuncImp::callAsFunction):
* kjs/string_object.h:
(KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
* kjs/testkjs.cpp:
(GlobalObject::GlobalObject):
(functionGC):
(functionRun):
(functionReadline):
(kjsmain):
* kjs/ustring.h:
* kjs/value.cpp:
(KJS::JSCell::operator new):
(KJS::jsString):
(KJS::jsOwnedString):
(KJS::jsNumberCell):
* kjs/value.h:
(KJS::jsNaN):
(KJS::jsNumber):
(KJS::jsNumberFromAnd):
(KJS::JSCell::marked):
(KJS::JSCell::mark):
(KJS::JSValue::toJSNumber):
* wtf/ThreadSpecific.h:
(WTF::T):
2008-05-10 Julien Chaffraix <jchaffraix@webkit.org>
Qt & wx build fix.
* JavaScriptCore.pri: Add profiler/Profile.cpp.
* JavaScriptCoreSources.bkl: Ditto.
2008-05-10 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Maciej.
Gtk+ build fix
* GNUmakefile.am: Add Profile.cpp in _sources
2008-05-09 Brady Eidson <beidson@apple.com>
Build Fix. Kevin is an idiot.
("My name is Kevin McCullough and I approve this message.")
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-09 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
-<rdar://problem/5770054> JavaScript profiler (10928)
-Add Profile class so that all profiles can be stored and retrieved by
the WebInspector when that time comes.
* JavaScriptCore.exp: Export the new function signatures.
* JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
project
* profiler/Profile.cpp: Added. This class represents a single run of the
profiler.
(KJS::Profile::Profile):
(KJS::Profile::willExecute):
(KJS::Profile::didExecute):
(KJS::Profile::printDataInspectorStyle):
(KJS::functionNameCountPairComparator):
(KJS::Profile::printDataSampleStyle):
* profiler/Profile.h: Added. Ditto
(KJS::Profile::stopProfiling):
* profiler/Profiler.cpp: Now the profiler keeps track of many profiles
but only runs one at a time.
(KJS::Profiler::startProfiling):
(KJS::Profiler::stopProfiling):
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
(KJS::Profiler::printDataInspectorStyle):
(KJS::Profiler::printDataSampleStyle):
* profiler/Profiler.h: Ditto.
(KJS::Profiler::~Profiler):
(KJS::Profiler::allProfiles):
(KJS::Profiler::clearProfiles):
2008-05-08 Anders Carlsson <andersca@apple.com>
Reviewed by Mark.
Enable NPAPI plug-ins on 64-bit.
* wtf/Platform.h:
2008-05-07 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Adam Roben.
wx & Gtk build fix.
Add SIZE_MAX definition for the wx port.
* os-win32/stdint.h:
2008-05-07 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
Support for isMainThread in the Qt port.
* wtf/ThreadingQt.cpp:
(WTF::initializeThreading): Adjusted.
(WTF::isMainThread): Added.
2008-05-05 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
- fix debug-only leak seen on buildbot
* wtf/HashTable.h:
(WTF::HashTable::checkKey): After writing an empty value in, but before constructing a
deleted value on top of it, call the destructor so the empty value doesn't leak.
2008-05-02 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoffrey Garen.
Get rid of static data in nodes.cpp (well, at least of non-debug one).
No measurable change on SunSpider.
* kjs/InitializeThreading.cpp:
(KJS::initializeThreadingOnce):
* kjs/nodes.cpp:
(KJS::newTrackedObjects):
(KJS::trackedObjectExtraRefCounts):
(KJS::initializeNodesThreading):
(KJS::ParserRefCounted::ParserRefCounted):
(KJS::ParserRefCounted::ref):
(KJS::ParserRefCounted::deref):
(KJS::ParserRefCounted::refcount):
(KJS::ParserRefCounted::deleteNewObjects):
* kjs/nodes.h:
Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
2008-05-02 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Move call stack depth counter to global object.
* kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
per-thread data.
* kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
* kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
* kjs/object.cpp:
(KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now
the only thing in JSObject::call that needs a PIC branch.
(KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth
tracking.
2008-05-02 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
for the sake of non-WebKit clients.
* API/JSBase.cpp:
(JSGarbageCollect):
* API/JSContextRef.cpp:
(JSGlobalContextCreate):
These are the JavaScriptCore API bottlenecks. There are a few other JSStringRef
and JSClassRef functions that can be called earlier, but they do not do anything that
requires initializeThreading.
* kjs/InitializeThreading.cpp:
(KJS::doInitializeThreading):
(KJS::initializeThreading):
On Darwin, make the initialization happen under pthread_once, since there is no guarantee
that non-WebKit clients won't try to call this function re-entrantly.
* kjs/InitializeThreading.h:
* wtf/Threading.h:
Spell out initializeThreading contract.
* wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
Darwin, even if threading was initialized from a secondary thread.
2008-05-02 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoffrey Garen.
https://bugs.webkit.org/show_bug.cgi?id=18826
Make JavaScript heap per-thread
* wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
(replaced "new T" with "new T()").
* kjs/collector.h: Renamed Collector to Heap, made the heap per-thread. Removed support for
multithreaded access to a heap.
(KJS::CollectorBlock): Removed collectOnMainThreadOnly bitmap, added a reference to owner heap.
(KJS::SmallCellCollectorBlock): Ditto.
(KJS::Heap::markListSet): Moved from a static variable in List.cpp to a per-thread one here.
(KJS::Heap::heap): Added a method to find which heap a JSValue is allocated in.
* kjs/collector.cpp: Changed "const size_t" constants to #defines, to avoid a PIC branch
(gcc was using one to access a constant used in std::max(), because it takes a reference,
even though std::max() itself was inlined).
(KJS::Heap::threadHeap): JS heap is now per-thread.
(KJS::Heap::Heap): Zero-initialize the heap.
(KJS::allocateBlock): Added NEVER_INLINE, because this function uses a PIC branch, so
inlining it in Heap::heapAllocate() is bad for performance, now that the latter doesn't
use any global data.
(KJS::Heap::heapAllocate): Initialize Block::heap.
(KJS::Heap::markCurrentThreadConservatively): Moved into markStackObjectsConservatively(),
as GC only works with a current thread's heap now.
(KJS::Heap::sweep): Removed collectOnMainThreadOnly checks.
(KJS::Heap::collect): Ditto.
* kjs/JSLock.cpp:
* kjs/JSLock.h:
(KJS::JSLock::JSLock):
Removed registerThread(), as the heap no longer cares.
* kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
variables in Heap and JSGlobalObject.
* kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
per-thread heap, and an accessor for it.
* kjs/JSGlobalObject.h: Made JSGlobalObject linked list per-thread.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::~JSGlobalObject): Fixed a bug in linked list handling. It only worked
right if the removed object was the head one!
(KJS::JSGlobalObject::head): Return a per-thread list head.
(KJS::JSGlobalObject::init): Store a reference to per-thread heap.
(KJS::JSGlobalObject::reset): Pass ExecState to functions that need it.
(KJS::JSGlobalObject::tearOffActivation): Ditto.
(KJS::JSGlobalObject::operator new): JSGlobalObject allocation cannot use an ExecState,
so it needs a custom operator new that directly accesses per-thread heap.
* kjs/list.h:
(KJS::List::List): Replaced m_isInMarkSet boolean with an actual pointer to the set, since it
is no longer a single static object.
(KJS::List::~List): Ditto.
* kjs/list.cpp:
(KJS::List::markSet): Removed, this is now stored in Heap.
(KJS::List::markProtectedLists): Take a reference to the list.
(KJS::List::expandAndAppend): Ask the current thread heap for a mark set reference.
* kjs/protect.h:
(KJS::gcProtect):
(KJS::gcUnprotect):
Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
belongs to.
* kjs/property_map.h: Removed unused SavedProperty class.
* JavaScriptCore.exp:
* API/JSBase.cpp:
(JSGarbageCollect):
* API/JSCallbackObjectFunctions.h:
(KJS::::staticFunctionGetter):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
* API/JSValueRef.cpp:
(JSValueMakeNumber):
(JSValueMakeString):
* kjs/array_instance.cpp:
(KJS::ArrayInstance::ArrayInstance):
(KJS::ArrayInstance::lengthGetter):
* kjs/array_object.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
(KJS::ArrayObjectImp::ArrayObjectImp):
(KJS::ArrayObjectImp::construct):
* kjs/bool_object.cpp:
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::BooleanObjectImp::BooleanObjectImp):
(KJS::BooleanObjectImp::construct):
* kjs/date_object.cpp:
(KJS::formatLocaleDate):
(KJS::DatePrototype::DatePrototype):
(KJS::DateObjectImp::DateObjectImp):
(KJS::DateObjectImp::construct):
(KJS::DateObjectImp::callAsFunction):
(KJS::DateObjectFuncImp::DateObjectFuncImp):
(KJS::DateObjectFuncImp::callAsFunction):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::errorProtoFuncToString):
(KJS::ErrorObjectImp::ErrorObjectImp):
(KJS::ErrorObjectImp::construct):
(KJS::NativeErrorPrototype::NativeErrorPrototype):
(KJS::NativeErrorImp::NativeErrorImp):
(KJS::NativeErrorImp::construct):
* kjs/function.cpp:
(KJS::FunctionImp::lengthGetter):
(KJS::FunctionImp::construct):
(KJS::Arguments::Arguments):
(KJS::ActivationImp::createArgumentsObject):
(KJS::encode):
(KJS::decode):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncEscape):
(KJS::globalFuncUnescape):
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
(KJS::functionProtoFuncToString):
(KJS::FunctionObjectImp::FunctionObjectImp):
(KJS::FunctionObjectImp::construct):
* kjs/internal.cpp:
(KJS::StringImp::toObject):
* kjs/internal.h:
(KJS::StringImp::StringImp):
(KJS::NumberImp::operator new):
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::cacheGlobalObject):
* kjs/math_object.cpp:
(KJS::MathObjectImp::getValueProperty):
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/nodes.cpp:
(KJS::Node::handleException):
(KJS::NumberNode::evaluate):
(KJS::StringNode::evaluate):
(KJS::ArrayNode::evaluate):
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::typeStringForValue):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::TypeOfResolveNode::evaluate):
(KJS::TypeOfValueNode::evaluate):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::PreIncConstNode::evaluate):
(KJS::PreDecConstNode::evaluate):
(KJS::PostIncConstNode::evaluate):
(KJS::PostDecConstNode::evaluate):
(KJS::PreIncBracketNode::evaluate):
(KJS::PreDecBracketNode::evaluate):
(KJS::PreIncDotNode::evaluate):
(KJS::PreDecDotNode::evaluate):
(KJS::NegateNode::evaluate):
(KJS::BitwiseNotNode::evaluate):
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::addSlowCase):
(KJS::add):
(KJS::AddNumbersNode::evaluate):
(KJS::AddStringsNode::evaluate):
(KJS::AddStringLeftNode::evaluate):
(KJS::AddStringRightNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::LeftShiftNode::evaluate):
(KJS::RightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::BitXOrNode::evaluate):
(KJS::BitOrNode::evaluate):
(KJS::valueForReadModifyAssignment):
(KJS::ForInNode::execute):
(KJS::TryNode::execute):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::evaluate):
* kjs/number_object.cpp:
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
(KJS::NumberObjectImp::NumberObjectImp):
(KJS::NumberObjectImp::getValueProperty):
(KJS::NumberObjectImp::construct):
(KJS::NumberObjectImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::defineGetter):
(KJS::JSObject::defineSetter):
(KJS::JSObject::putDirect):
(KJS::Error::create):
* kjs/object.h:
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
(KJS::ObjectObjectImp::ObjectObjectImp):
(KJS::ObjectObjectImp::construct):
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::regExpProtoFuncToString):
(KJS::RegExpImp::getValueProperty):
(KJS::RegExpObjectImp::RegExpObjectImp):
(KJS::RegExpObjectImp::arrayOfMatches):
(KJS::RegExpObjectImp::getBackref):
(KJS::RegExpObjectImp::getLastParen):
(KJS::RegExpObjectImp::getLeftContext):
(KJS::RegExpObjectImp::getRightContext):
(KJS::RegExpObjectImp::getValueProperty):
(KJS::RegExpObjectImp::createRegExpImp):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(KJS::StringInstance::StringInstance):
(KJS::StringInstance::lengthGetter):
(KJS::StringInstance::indexGetter):
(KJS::stringInstanceNumericPropertyGetter):
(KJS::StringPrototype::StringPrototype):
(KJS::replace):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
(KJS::StringObjectImp::StringObjectImp):
(KJS::StringObjectImp::construct):
(KJS::StringObjectImp::callAsFunction):
(KJS::StringObjectFuncImp::StringObjectFuncImp):
(KJS::StringObjectFuncImp::callAsFunction):
* kjs/string_object.h:
(KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
* kjs/testkjs.cpp:
(GlobalObject::GlobalObject):
(functionGC):
(functionRun):
(functionReadline):
(kjsmain):
* kjs/ustring.h:
* kjs/value.cpp:
(KJS::JSCell::operator new):
(KJS::jsString):
(KJS::jsOwnedString):
(KJS::jsNumberCell):
* kjs/value.h:
(KJS::jsNaN):
(KJS::jsNumber):
(KJS::jsNumberFromAnd):
(KJS::JSCell::marked):
(KJS::JSCell::mark):
(KJS::JSValue::toJSNumber):
Removed collectOnMainThreadOnly, as this is the only way to collect now. Replaced calls to
static Collector methods with calls to per-thread Heap ones.
2008-05-02 Dan Bernstein <mitz@apple.com>
Reviewed by Maciej Stachowiak.
- Mac build fix
* wtf/StrHash.h: Added header guards and removed #include "config.h".
2008-05-01 Ada Chan <adachan@apple.com>
#include <wtf/StrHash.h> in identifier.cpp.
Reviewed by Maciej.
* kjs/identifier.cpp:
2008-05-01 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-01 Sam Weinig <sam@webkit.org>
Fix build.
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-05-01 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5770054> JavaScript profiler (10928)
- Fix "sample" output so that it can be imported into Instruments
- Also keep track of number of times a function is profiled.
* JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed
to be pulled out of identifier.cpp so that it could be used by the
profiler and identifiers.
* kjs/identifier.cpp: Ditto.
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style
printing should show microseconds.
(KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing
now counts the number of times a function is in the stack tree and does
not print microseconds since that does not make sense for a sampler.
* profiler/FunctionCallProfile.h: Keep track of number of times a
function is profiled.
(KJS::FunctionCallProfile::numberOfCalls):
* profiler/Profiler.cpp:
(KJS::functionNameCountPairComparator): Comparator for sort function in
printDataSampleStyle.
(KJS::Profiler::printDataSampleStyle): Print the number of times that a
function is listed in the stack tree in order of most times listed.
* wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is
a more standard way to copy a HashSet to a Vector. I added on variant
that takes a pair as the Vector's type and so the HashCountedSet simply
fills in that pair with its internal pair, and another variant that
takes a Vector of the type of the HashCountedSet and only fills in the
Vector with the first element of the pair.
(WTF::copyToVector):
* wtf/StrHash.h: Added.
(WTF::):
2008-04-29 David Kilzer <ddkilzer@apple.com>
BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
* wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
PLATFORM(MAC) and PLATFORM(WIN). Changed default to 0 for other
ports.
2008-04-29 Greg Bolsinga <bolsinga@apple.com>
Reviewed by Darin.
Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
* wtf/Platform.h:
2008-04-29 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
-<rdar://problem/5770054> JavaScript profiler (10928)
-Keep call count.
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::FunctionCallProfile):
(KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex
of 0 was causing the assert to be hit.
(KJS::FunctionCallProfile::stopProfiling):
(KJS::FunctionCallProfile::endAndRecordCall):
* profiler/FunctionCallProfile.h:
2008-04-29 Simon Hausmann <hausmann@webkit.org>
Qt/Windows build fix. The externally declared hash tables are actually
declared const and the const is mangled in the symbol name, so when
importing they also need to be marked const.
When compiling without MULTIPLE_THREADS use a const HashTable&
instead of a HashTable& in ThreadClassInfoHashTables to avoid
initializing the latter with a const reference.
* kjs/JSGlobalObject.cpp:
2008-04-28 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* kjs/ExecState.h: For whatever reason, MSVC couldn't generate a default constructor for
a struct that had a "const List" member. Removing the const qulifier makes the problem go away.
2008-04-28 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Fix run-webkit-tests --threading
and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
Proxy server issue in Sunday's Nightly
Changed ClassInfo objects for built-in objects to hold a getter function returning
a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
and these are the only ones that need to be shared.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::~Lexer):
* kjs/lexer.h:
Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
* kjs/object.cpp:
(KJS::JSObject::deleteProperty):
(KJS::JSObject::findPropertyHashEntry):
(KJS::JSObject::propertyIsEnumerable):
(KJS::JSObject::getPropertyAttributes):
(KJS::JSObject::getPropertyNames):
* kjs/object.h:
(KJS::ClassInfo::propHashTable):
Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
static table is not used.
* kjs/JSGlobalObject.cpp:
(KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
HashTables for built-in classes. The old static structs are copied to create per-thread
instances.
(KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
(KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
Also, construct globalExec.
(KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
(KJS::JSGlobalObject::mark): Ditto.
(KJS::JSGlobalObject::globalExec): Ditto.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
trying to access half-initialized JSGlobalObject to make its own copy of these table
references, and failed.
(KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
(KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/ExecState.h:
(KJS::ExecState::propertyNames):
(KJS::ExecState::emptyList):
(KJS::ExecState::arrayTable):
(KJS::ExecState::dateTable):
(KJS::ExecState::mathTable):
(KJS::ExecState::numberTable):
(KJS::ExecState::RegExpImpTable):
(KJS::ExecState::RegExpObjectImpTable):
(KJS::ExecState::stringTable):
* kjs/ExecStateInlines.h:
(KJS::ExecState::ExecState):
Each ExecState holds its own reference to per-thread data, for even faster access. Moved
m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
and take less space on the stack.
* kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
added to JSGlobalObject.
* API/JSCallbackConstructor.cpp:
* API/JSCallbackFunction.cpp:
* API/JSCallbackObject.cpp:
* JavaScriptCore.exp:
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyAttributes):
* kjs/JSVariableObject.h:
* kjs/array_instance.cpp:
* kjs/array_object.cpp:
(KJS::ArrayPrototype::getOwnPropertySlot):
* kjs/bool_object.cpp:
* kjs/create_hash_table:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::DateObjectImp::DateObjectImp):
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
* kjs/internal.cpp:
* kjs/lookup.h:
* kjs/math_object.cpp:
(KJS::MathObjectImp::getOwnPropertySlot):
* kjs/number_object.cpp:
(KJS::NumberObjectImp::getOwnPropertySlot):
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::RegExpImp::getOwnPropertySlot):
(KJS::RegExpImp::put):
(KJS::RegExpObjectImp::getOwnPropertySlot):
(KJS::RegExpObjectImp::put):
* kjs/string_object.cpp:
(KJS::StringPrototype::getOwnPropertySlot):
Adjust for the above changes.
2008-04-28 Darin Adler <darin@apple.com>
Reviewed by Adam.
- make sure RefPtr's default hash doesn't ref/deref when computing the hash
- remove remnants of the hash table storage type optimization
* wtf/HashFunctions.h: Used "using" to get the hash and equal functions
from PtrHash<P*> into PtrHash<RefPtr<P>>.
* wtf/HashMap.h: Replaced uses of PairBaseHashTraits with PairHashTraits.
Eliminated storage-related typedefs. Removed constructor, destructor,
copy constructor, and destructor since the compiler-generated ones are
fine. Removed refAll and derefAll. Took out unnnecessary typecasts.
Removed use of RefCounter.
* wtf/HashSet.h: Eliminated storage-related typedefs. Removed constructor,
destructor, copy constructor, and destructor since the compiler-generated
ones are fine. Removed refAll and derefAll. Removed unneeded template
arguents from HashSetTranslatorAdapter. Eliminated unneeded HashSetTranslator
template.
* wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
class templates.
* wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
and HashKeyStorageTraits.
* wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
the corresponding changes to RefPtrHashMapRawKeyTranslator.
2008-04-28 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix assertion hit every time you view www.apple.com
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::add): Changed assertion to allow null and empty strings.
Now to find out why we have a property named "" and if that's a bug!
2008-04-27 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Fix crash inside PtrHash::hash when loading a page.
* wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
2008-04-27 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
GCC 4.2 due to pointer aliasing warnings
Fix this by removing the HashTable optimizations that allowed us to share a back end
implementation between hash tables with integers, pointers, RefPtr, and String objects
as keys. The way it worked was incompatible with strict aliasing.
This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
slowing down Safari startup times.
This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
- speed up array put slightly by moving a branch (was already done for get)
- speed up symbol table access by adding a function named inlineGet to HashMap
and using that in symbolTableGet/Put
- speed up PropertyNameArray creation by reducing the amount of reference count
churn and uniqueness checking when adding names and not doing any allocation at
all when building small arrays
- speed up conversion of strings to floating point numbers by eliminating the
malloc/free of the buffer for the ASCII copy of the string; a way to make
things even faster would be to change strtod to take a UTF-16 string
Note that there is considerable unused complexity now in HashSet/Map/Table to support
"storage types", which is no longer used. Will do in a separate patch.
* API/JSCallbackObjectFunctions.h:
(KJS::JSCallbackObject<Base>::getPropertyNames): Removed explicit cast to Identifier to
take advantage of the new PropertyNameArray::add overload and avoid reference count churn.
* API/JSObjectRef.cpp:
(JSPropertyNameAccumulatorAddName): Ditto.
* JavaScriptCore.exp: Updated PropertyNameArray::add entry point name.
* kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
definition (see below).
(KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): Use inlineGet for speed. Also changed to do
early exit instead of nesting the body inside an if.
(KJS::JSVariableObject::symbolTablePut): Ditto.
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::add): Changed implementation to take a raw pointer instead of
a reference to an identifier. Do uniqueness checking by searching the vector when the
vector is short, only building the set once the vector is large enough.
* kjs/PropertyNameArray.h: Added an overload of add for a raw pointer, and made the old
add function call that one. Added an addKnownUnique function for use when the new
name is known to be different from any other in the array. Changed the vector to have
an inline capacity of 20.
* kjs/SymbolTable.h: Changed IdentifierRepHash to inherit from the default hash for
a RefPtr so we don't have to define so much. Added an overload of the hash function for
a raw pointer as required by the new RefPtrHashMap. Got rid of the now-unneeded
IdentifierRepHashTraits -- the default traits now work fine. Added a definition of
empthValueIsZero to SymbolTableIndexHashTraits; not having it was incorrect, but harmless.
* kjs/array_instance.cpp:
(KJS::ArrayInstance::put): Move the maxArrayIndex check inside the branch that checks
the index against the length, as done in the get function.
* kjs/function.cpp:
(KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
* kjs/internal.cpp: Removed printInfo debugging function, a client of cstring.
If we need a debugging function we can easily make a better one and we haven't
used this one in a long time.
* kjs/internal.h: Ditto.
* kjs/object.cpp:
(KJS::JSObject::getPropertyNames): Removed explicit cast to Identifier.
* kjs/property_map.cpp:
(KJS::PropertyMap::getEnumerablePropertyNames): Ditto. Also added a special case for
the case where the propertyNames array is empty -- in that case we know we're adding
a set of names that are non-overlapping so we can use addKnownUnique.
* kjs/ustring.cpp:
(KJS::UString::getCString): Replaces cstring. Puts the C string into a CStringBuffer,
which is a char Vector with an inline capacity. Also returns a boolean to indicate if
the converion was lossy, which eliminates the need for a separate is8Bit call.
(KJS::UString::toDouble): Changed to call getCString instead of cstring.
* kjs/ustring.h: Ditto.
* wtf/HashFunctions.h: Overload the hash and equal functions for RefPtr's default
hash to take raw pointers. This works with the changes to RefPtrHashMap to avoid
introducing refcount churn.
* wtf/HashMap.h: Removed special code to convert the deleted value to the empty value
when writing a new value into the map. This is now handled elsewhere.
(WTF::HashMap::get): Removed code that checks for an empty hash table before calling
HashTable::lookup; it's slightly more efficient to do this check inside lookup.
* wtf/HashTable.h:
(WTF::HashTable::isDeletedBucket): Changed to use isDeletedValue instead of using
deletedValue and the equality operator.
(WTF::HashTable::deleteBucket): Changed to use constructDeletedValue instead of
using deletedValue and the assignment operator.
(WTF::HashTable::checkKey): Added. Factors out the check for values that are empty
or deleted keys that's used in various functions below.
(WTF::HashTable::lookup): Changed to use checkKey, check for a 0 table, and also
made public for use by RefPtrHashMap.
(WTF::HashTable::lookupForWriting): Changed to use checkKey.
(WTF::HashTable::fullLookupForWriting): Changed to use checkKey.
(WTF::HashTable::add): Changed to use checkKey, and call initializeBucket on a
deleted bucket before putting a new entry into it.
(WTF::HashTable::addPassingHashCode): Ditto.
(WTF::HashTable::deallocateTable): Check isDeletedBucket before calling ~ValueType.
* wtf/HashTraits.h: Got ridd of all the HashTraits specialization for the integer
types, since GeneicHashTraitsBase already deals with integers separately. Put the
deleted value support into GenericHashTraitsBase. Changed FloatHashTraits to
inherit from GenericHashTraits, and define construct/isDeletedValue rather than
deletedValue. Removed the ref and deref functions from RefPtr's HashTraits, and
defined construct/isDeletedValue. Eliminated DeletedValueAssigner. Changed
PairHashTraits to define construct/isDeletedValue, and also merged
PairBaseHashTraits in with PairHashTraits. Got rid of all specialization of
HashKeyStorageTraits. We'll remove that, and the needsRef data member, later.
* wtf/RefPtr.h: Added HashTableDeletedValueType, an enum type with a single value,
HashTableDeletedValue. Used that type to make a new constructor to construct
deleted values and also added an isHashTableDeletedValue function.
* wtf/RefPtrHashMap.h: Added RefPtrHashMapRawKeyTranslator and used it to implement
the raw pointer functions. This is a way to continue to avoid refcount thrash. We
can't use the old way because it depended on the underlying map using a non-RefPtr
type.
(WTF::HashMap::find): Use find with RefPtrHashMapRawKeyTranslator.
(WTF::HashMap::contains): Use contains with RefPtrHashMapRawKeyTranslator.
(WTF::HashMap::inlineAdd): Use add with RefPtrHashMapRawKeyTranslator.
(WTF::HashMap::get): Removed code that checks for an empty hash table before calling
HashTable::lookup; it's slightly more efficient to do this check inside lookup.
(WTF::HashMap::inlineGet): Added. Just like get, but marked inline for use in the
symbol table code.
2008-04-25 Sam Weinig <sam@webkit.org>
Rubber-stamped by Mark Rowe.
Remove SavedBuiltins and SavedProperties classes and the methods used to
save data to them. The CachedPage now stores a the JSGlobalObject in full.
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/JSGlobalObject.cpp:
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.cpp:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::localStorage):
* kjs/SavedBuiltins.h: Removed.
* kjs/object.h:
* kjs/property_map.cpp:
* kjs/property_map.h:
2008-04-25 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Sam Weinig.
Add some content to an empty ICU header file to prevent verification errors.
* icu/unicode/utf_old.h:
2008-04-25 David Kilzer <ddkilzer@apple.com>
<rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
Patch by George Dicker and Michael Kahl. Reviewed by Darin.
When -[NSObject(WebScriptDebugDelegate) webView:willLeaveCallFrame:sourceId:line:forWebFrame:]
is invoked, the first line number of the function is returned instead of the last
line number. This regressed in r28458.
* kjs/nodes.cpp:
(KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
when calling Debugger::returnEvent().
2008-04-25 Darin Adler <darin@apple.com>
Done with Stephanie Lewis.
* JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
adding -fno-strict-aliasing to CollatorICU.cpp.
2008-04-24 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Add a #define to easily enable collecting on every allocation to aid
debugging GC bugs.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2008-04-24 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam and Sam.
-<rdar://problem/5770054> JavaScript profiler (10928)
-Only profile the page group that starts profiling to avoid profiling
tools that shouldn't be profiled unless explicitly requested to.
* JavaScriptCore.exp: Export new signature.
* kjs/JSGlobalObject.cpp: Add unique identifiers to the JSGlobalObject.
(KJS::JSGlobalObject::init):
* kjs/JSGlobalObject.h: Ditto.
(KJS::JSGlobalObject::setPageGroupIdentifier):
(KJS::JSGlobalObject::pageGroupIdentifier):
* profiler/Profiler.cpp: Check the identifier of the page group of the
lexical global exec state and only profile if it matches the given page
group identifier.
(KJS::Profiler::startProfiling):
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
* profiler/Profiler.h: Ditto.
(KJS::Profiler::Profiler):
2008-04-24 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Simon.
Bug 15940: Implement threading API for Qt
https://bugs.webkit.org/show_bug.cgi?id=15940
Original patch by Justin Haygood, tweaked by me.
* JavaScriptCore.pri:
* wtf/ThreadingQt.cpp: Added.
(WTF::threadMapMutex):
(WTF::threadMap):
(WTF::establishIdentifierForThread):
(WTF::clearThreadForIdentifier):
(WTF::threadForIdentifier):
(WTF::initializeThreading):
(WTF::ThreadPrivate::getReturnValue):
(WTF::ThreadPrivate::ThreadPrivate):
(WTF::ThreadPrivate::run):
(WTF::createThread):
(WTF::waitForThreadCompletion): return !res to return
0 on success (to match the pthreads implementation).
(WTF::detachThread):
(WTF::identifierByQthreadHandle):
(WTF::currentThread):
(WTF::Mutex::Mutex):
(WTF::Mutex::~Mutex):
(WTF::Mutex::lock):
(WTF::Mutex::tryLock):
(WTF::Mutex::unlock):
(WTF::ThreadCondition::ThreadCondition):
(WTF::ThreadCondition::~ThreadCondition):
(WTF::ThreadCondition::wait):
(WTF::ThreadCondition::timedWait):
(WTF::ThreadCondition::signal):
2008-04-22 Darin Adler <darin@apple.com>
Reviewed by Anders.
- simplify use of HashTraits to prepare for some upcoming hash table changes
* kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
and specialize only the empty value.
2008-04-23 Holger Hans Peter Freyther <zecke@selfish.org>
Reviewed by Simon.
Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
already.
* wtf/Platform.h:
2008-04-21 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
<rdar://problem/5770054> JavaScript profiler (10928)
- When stop profiling is called we need to stop the timers on all the
functions that are still running.
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::didExecute):
(KJS::FunctionCallProfile::stopProfiling):
* profiler/FunctionCallProfile.h:
* profiler/Profiler.cpp:
(KJS::Profiler::stopProfiling):
2008-04-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
* kjs/InitializeThreading.cpp:
(KJS::initializeThreading):
2008-04-21 Adam Roben <aroben@apple.com>
MSVC build fix
Reviewed by Alexey Proskuryakov.
* kjs/ustring.h:
(KJS::UString::cost): Disable a warning about assigning a 32-bit
size_t into a 31-bit size_t.
2008-04-21 Simon Hausmann <hausmann@webkit.org>
Reviewed by Lars.
Made convertValueToQVariant accessible from within WebKit/qt/Api
* bindings/qt/qt_runtime.h:
2008-04-21 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
Reviewed by Simon.
Build fix for Qt 4.3
* When building WebCore/internal make sure the QT_[BEGIN,END]_NAMESPACE is
always defined. Do this by adding defines to the compiler line
* For users of our API this is not feasible. Every public header file should
include qwebkitglobal.h. Define the QT_BEGIN_NAMESPACE and QT_END_NAMESPACE
when we are building everything < 4.4.0 and don't have them defined.
* kjs/testkjs.pro:
2008-04-19 Matt Lilek <webkit@mattlilek.com>
Not reviewed, Windows build fix - copy the profiler headers in all
configurations, not just Debug_Internal.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-04-19 Mike Hommey <glandium@debian.org>
Reviewed by Alp Toker.
Don't build testkjs with rpath.
* GNUmakefile.am:
2008-04-18 Kevin Ollivier <kevino@theolliviers.com>
wx build fixes. Rename LocalStorage.h to LocalStorageEntry.h
to avoid header detection issues between WebCore/storage/LocalStorage.h
and it, and add $(PROFILER_SOURCES) to the wx JSCore build.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* jscore.bkl:
* kjs/ExecState.h:
* kjs/JSVariableObject.h:
* kjs/LocalStorage.h: Removed.
* kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
* kjs/function.h:
2008-04-18 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16620
[GTK] Autotools make dist and make check support
Cleanups.
* GNUmakefile.am:
2008-04-18 Jon Honeycutt <jhoneycutt@apple.com>
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
build fix.
2008-04-11 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Antti Koivisto.
Silence GCC 4.3 warnings by removing extraneous consts.
* kjs/ustring.cpp:
* kjs/ustring.h:
2008-04-18 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
-<rdar://problem/5770054> JavaScript profiler (10928)
- Use Deque instead of Vector since the profiler uses prepend a lot
and deque is faster at that.
* profiler/FunctionCallProfile.h:
(KJS::FunctionCallProfile::milliSecs): Corrected the name to match
its output.
* wtf/Deque.h:
(WTF::deleteAllValues):
2008-04-18 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam and Adam.
-<rdar://problem/5770054> JavaScript profiler (10928)
- Cleaned up the header file and made some functions static, added
a new, sane, printing function, and fixed a few minor bugs.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::didExecute): Removed assertion that time is
> 0 because at ms resolution that may not be true and only cross-
platform way to get time differences is in ms.
(KJS::FunctionCallProfile::printDataInspectorStyle): Added a new
printing function for dumping data in a sane style.
(KJS::FunctionCallProfile::printDataSampleStyle): Fixed a bug where we
displayed too much precision when printing our floats. Also added logic
to make sure we don't display 0 because that doesn't make sense for a
sampling profile.
* profiler/FunctionCallProfile.h:
* profiler/Profiler.cpp: Moved functions that could be static into the
implementation, and chaned the ASSERTs to early returns. I did this
because console.profile() is a JS function and so was being profiled
but asserting because the profiler had not been started! In the future
I would like to put the ASSERTs back and not profile the calls to
console.profile() and console.profileEnd().
(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):
(KJS::getStackNames): Fixed a bug where the wrong ExecState was being
used.
(KJS::getFunctionName):
(KJS::Profiler::printDataInspectorStyle):
* profiler/Profiler.h:
2008-04-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Fix leaks during plugin tests (which actually excercise background JS), and potential
PAC brokenness that was not reported, but very likely.
The leaks shadowed a bigger problem with Identifier destruction. Identifier::remove involves
an IdentifierTable lookup, which is now a per-thread instance. Since garbage collection can
currently happen on a different thread than allocation, a wrong table was used.
No measurable change on SunSpider total, ~1% variation on individual tests.
* kjs/ustring.cpp:
(KJS::UString::Rep::create):
(KJS::UString::Rep::destroy):
* kjs/ustring.h:
Replaced isIdentifier with a pointer to IdentifierTable, so that destruction can be done
correctly. Took one bit from reportedCost, to avoid making UString::Rep larger (performance
effect was measurable on SunSpider).
* kjs/identifier.cpp:
(KJS::IdentifierTable::IdentifierTable):
(KJS::IdentifierTable::~IdentifierTable):
(KJS::IdentifierTable::add):
(KJS::IdentifierTable::remove):
Make IdentifierTable a real class. Its destructor needs to zero out outstanding references,
because some identifiers may briefly outlive it during thread destruction, and we don't want
them to use their stale pointers.
(KJS::LiteralIdentifierTable):
(KJS::Identifier::add):
Now that LiteralIdentifierTable is per-thread and can be destroyed not just during application
shutdown, it is not appropriate to simply bump refcount for strings that get there; changed
the table to hold RefPtrs.
(KJS::CStringTranslator::translate):
(KJS::UCharBufferTranslator::translate):
(KJS::Identifier::addSlowCase):
(KJS::Identifier::remove):
* kjs/identifier.h:
(KJS::Identifier::add):
Use and update UString::Rep::identifierTable as appropriate. Updating it is now done in
IdentifierTable::add, not in translators.
2008-04-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
No change on SunSpider, CelticKane or iBench JavaScript. It is probable that in some cases,
merge sort is still faster, but more investigation is needed to determine a new cutoff.
Or possibly, it would be better to do what FIXME says (change to tree sort).
Also, made arguments a local variable - not sure why it was a member of
CompareWithCompareFunctionArguments.
* kjs/array_instance.cpp:
(KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
(KJS::CompareWithCompareFunctionArguments::operator()):
(KJS::ArrayInstance::sort):
2008-04-18 Simon Hausmann <hausmann@webkit.org>
Build fix for gcc 4.3. Include stdio.h for printf.
* profiler/FunctionCallProfile.cpp:
* profiler/Profiler.cpp:
2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
Reviewed by mrowe.
* wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
2008-04-17 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej.
Thread static data destructors are not guaranteed to be called in any particular order;
turn ThreadSpecific into a phoenix-style singleton to avoid accessing freed memory when
deleted objects are interdependent (e.g. CommonIdentifiers and internal identifier tables).
No change on SunSpider.
* wtf/ThreadSpecific.h:
(WTF::ThreadSpecific::Data::Data):
(WTF::::get):
(WTF::::set):
(WTF::::destroy):
2008-04-15 Srinivas Rao. M Hamse <msrinirao@gmail.com>
Reviewed by Maciej Stachowiak.
- gcc 3.x build fix
* kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
2008-04-16 Brady Eidson <beidson@apple.com>
Reviewed by Sam Weinig
Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
* wtf/Threading.h:
(WTF::ThreadSafeShared::ThreadSafeShared):
2008-04-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
- To keep the behavior of the WebKit and JavaScriptCore API's the same,
we need to hide the fact that the global object and the window object
are no longer the same thing, and the the global object now changes on
navigations. To do this, only the wrapper should ever be exposed. This
fixes the two remaining spots where the internal global object is exposed,
the windowScriptObject returned from [WebFrame windowObject] and the object
return by calling JSContextGetGlobalObject on [WebFrame globalContext].
* API/JSContextRef.cpp:
(JSContextGetGlobalObject):
This is a bit of a hack, this returns the "this" representation of the globalObject
which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
* API/JSObjectRef.cpp:
(JSObjectSetProperty):
Call the new putWithAttributes method instead of relying on lower-level calls.
This is needed so that the window wrapper can forward the calls.
* JavaScriptCore.exp:
* kjs/Activation.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::putWithAttributes):
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePutWithAttributes):
* kjs/function.cpp:
(KJS::ActivationImp::putWithAttributes):
* kjs/nodes.cpp:
(KJS::ConstDeclNode::handleSlowCase):
(KJS::ConstDeclNode::evaluateSingle):
(KJS::EvalNode::processDeclarations):
* kjs/object.cpp:
(KJS::JSObject::putWithAttributes):
* kjs/object.h:
Rename initializeVariable to putWithAttributes and move it down to JSObject so it
can be used for JSObjectSetProperty.
2008-04-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam and Geoff.
-<rdar://problem/5770054> JavaScript profiler (10928)
Inital profiler prototype
* GNUmakefile.am: Added new files to project
* JavaScriptCore.pri: Ditto
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto
* JavaScriptCoreSources.bkl: Ditto
* kjs/config.h: Put compiling flag in here.
* kjs/function.cpp: Instrument calling the function eval().
(KJS::eval):
* kjs/interpreter.cpp: Instrument evaluating global scopes.
(KJS::Interpreter::evaluate):
* kjs/object.cpp: Instrument JS function calls.
(KJS::JSObject::call):
* profiler: Added.
* profiler/FunctionCallProfile.cpp: Added.
(KJS::FunctionCallProfile::FunctionCallProfile):
(KJS::FunctionCallProfile::~FunctionCallProfile):
(KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer.
(KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer.
(KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile.
(KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one.
(KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
* profiler/FunctionCallProfile.h: Added.
(KJS::FunctionCallProfile::FunctionCallProfile):
(KJS::FunctionCallProfile::~FunctionCallProfile):
(KJS::FunctionCallProfile::functionName):
(KJS::FunctionCallProfile::microSecs):
* profiler/Profiler.cpp: Added.
(KJS::Profiler::profiler):
(KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns)
(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.
(KJS::Profiler::stopProfiling): Stop collecting profile information.
(KJS::Profiler::willExecute): Same as above.
(KJS::Profiler::didExecute): Same as above.
(KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it.
(KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack.
(KJS::Profiler::getFunctionName): Get the function name from the given parameter.
(KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
(KJS::Profiler::debugLog):
* profiler/Profiler.h: Added.
(KJS::Profiler::Profiler):
2008-04-16 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
- Remove kjs_ prefix from strtod, dtoa, and freedtoa and put it
in the KJS namespace.
- Make strtod, dtoa, and freedtoa c++ functions instead of extern "C".
- Remove mode switching from dtoa. ~2% improvement on test 26.
- Removes all unnecessary #defines from dtoa code.
* JavaScriptCore.exp:
* kjs/dtoa.cpp:
(KJS::ulp):
(KJS::b2d):
(KJS::d2b):
(KJS::ratio):
(KJS::strtod):
(KJS::freedtoa):
(KJS::dtoa):
* kjs/dtoa.h:
* kjs/function.cpp:
(KJS::parseInt):
* kjs/lexer.cpp:
(KJS::Lexer::lex):
* kjs/number_object.cpp:
(KJS::integer_part_noexp):
(KJS::numberProtoFuncToExponential):
* kjs/ustring.cpp:
(KJS::UString::from):
(KJS::UString::toDouble):
2008-04-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Get rid of static execForCompareByStringForQSort in array_instance.cpp.
No change on SunSpider, CelticKane or iBench JavaScript.
* kjs/array_instance.cpp:
(KJS::ArraySortComparator::ArraySortComparator):
(KJS::ArraySortComparator::operator()):
(KJS::ArrayInstance::sort):
Switch slow case to std::sort, so that ExecState can be passed in a comparator.
2008-04-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Adam Roben.
MSVC build fix.
* kjs/CommonIdentifiers.cpp:
* kjs/CommonIdentifiers.h:
* kjs/Parser.cpp:
* kjs/Parser.h:
* kjs/identifier.cpp:
* kjs/lexer.h:
* wtf/ThreadSpecific.h:
2008-04-16 Alexey Proskuryakov <ap@webkit.org>
Build fix.
* kjs/date_object.cpp:
* kjs/date_object.h:
Don't include DateMath.h from date_object.h, as the latter is used from WebCore, while
where the former is not available.
2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
Unreviewed build fix for MSVC. It does not want to have
WTF in the KJS namespace.
* kjs/CommonIdentifiers.h:
2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
Unreviewed build fix for gcc.
::msToGregorianDateTime is not known to it.
* kjs/date_object.cpp:
(KJS::DateInstance::msToGregorianDateTime):
2008-04-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Oliver Hunt.
Initialize threadMapMutex safely (as already done in ThreadingWin).
* wtf/ThreadingGtk.cpp:
(WTF::threadMapMutex):
(WTF::initializeThreading):
* wtf/ThreadingPthreads.cpp:
(WTF::threadMapMutex):
(WTF::initializeThreading):
2008-04-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Adam Roben.
Cache Gregorian date/time structure on DateInstance objects for 1.027x SunSpider speedup
(1.65x on date-format-xparb, 1.13x on date-format-tofte).
* kjs/DateMath.h:
(KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
Noncopyable, so it's not just operator=.
* kjs/date_object.h: Added a per-object cache.
* kjs/date_object.cpp:
(KJS::DateInstance::DateInstance):
(KJS::DateInstance::msToGregorianDateTime):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
Use the cache when converting.
2008-04-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
SunSpider results were not conclusive, possibly up to 0.2% slowdown.
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
Added ThreadSpecific.h
* wtf/ThreadSpecific.h: Added.
(WTF::::ThreadSpecific):
(WTF::::~ThreadSpecific):
(WTF::::get):
(WTF::::set):
(WTF::::destroy):
(WTF::T):
(WTF::::operator):
Only implemented for platforms that use pthreads.
* kjs/CommonIdentifiers.cpp:
(KJS::CommonIdentifiers::shared):
* kjs/CommonIdentifiers.h:
* kjs/InitializeThreading.cpp:
(KJS::initializeThreading):
* kjs/Parser.cpp:
(KJS::parser):
* kjs/Parser.h:
* kjs/identifier.cpp:
(KJS::identifierTable):
(KJS::literalIdentifierTable):
(KJS::Identifier::initializeIdentifierThreading):
* kjs/identifier.h:
* kjs/lexer.cpp:
(KJS::lexer):
* kjs/lexer.h:
Make static instances per-thread.
2008-04-15 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
* Configurations/JavaScriptCore.xcconfig:
2008-04-15 Andre Poenitz <andre.poenitz@trolltech.com>
Reviewed by Simon.
Fix compilation with Qt namespaces
Qt can be configured to have all of its classes inside a specified namespaces.
This is for example used in plugin/component environments like Eclipse.
This change makes it possible to let the Qt port compile against a namespaced
Qt by the use of macros Qt provides to properly forward declare Qt classes in
the namespace.
* wtf/unicode/qt4/UnicodeQt4.h:
2008-04-14 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Don't leak the prototype class.
* API/JSClassRef.cpp:
(OpaqueJSClass::create):
2008-04-14 Steve Falkenburg <sfalken@apple.com>
Fix build.
* wtf/ThreadingWin.cpp:
2008-04-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Adam Roben.
https://bugs.webkit.org/show_bug.cgi?id=18488
FastMalloc doesn't release thread-specific data on Windows
* wtf/ThreadingWin.cpp:
(WTF::threadMapMutex): (WTF::initializeThreading): Call threadMapMutex once to initialize the static safely.
(WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): Added a structure to wrap thread entry point and arguments.
(WTF::wtfThreadEntryPoint): Make sure to end all WTF threads with pthread_exit(), to give pthreads-win32 a chance to call
destructors of thread-specific data.
(WTF::createThread): Use _beginthreadex instead of CreateThread, because MSDN says so. Also removed a call to CreateEvent,
for which I could see no reason at all.
2008-04-14 Alexey Proskuryakov <ap@webkit.org>
Touched a file to make JavaScriptCore.vcproj rebuild.
* wtf/MathExtras.h:
2008-04-14 Adam Roben <aroben@apple.com>
Windows build fix
Rubberstamped by Alexey Proskuryakov.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
the "potentially uninitialized variable" warning for grammar.cpp, as
it seems to be incorrect. yylval gets initialized by the lexer, but
MSVC doesn't seem to understand this.
2008-04-11 Antti Koivisto <antti@apple.com>
Reviewed by Maciej.
Add default hash for pairs of hashable types.
* wtf/HashFunctions.h:
(WTF::PairHash::hash):
(WTF::PairHash::equal):
(WTF::):
2008-04-11 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Make DateMath.cpp thread safe.
No measurable change on SunSpider (should be a very small speedup).
* kjs/DateMath.cpp:
(KJS::mimimumYearForDST): (KJS::equivalentYearForDST): Got rid of double caching of the
same precomputed value.
(KJS::calculateUTCOffset): (KJS::getUTCOffset): Factored actual UTC offset calculation code
out of getUTCOffset(), and notification setup into initDateMath().
(KJS::initDateMath): Added.
* kjs/DateMath.h:
* kjs/InitializeThreading.cpp:
(KJS::initializeThreading):
Added initDateMath().
2008-04-11 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* kjs/grammar.y:
2008-04-11 Alexey Proskuryakov <ap@webkit.org>
Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
parameters void*.
* kjs/grammar.y:
* kjs/lexer.cpp:
(kjsyylex):
(KJS::Lexer::lex):
* kjs/lexer.h:
2008-04-11 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Generate a pure (re-entrant) parser with Bison.
No change on SunSpider.
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/lexer.cpp:
(kjsyylex):
(KJS::Lexer::lex):
* kjs/lexer.h:
Pass state as function arguments, instead of global data. Don't call lexer() as often as
before, as this function is about to become slower due to thread-specific storage.
* kjs/function.cpp:
(KJS::isStrWhiteSpace): Don't call isSeparatorSpace() for 8-bit characters, as these are
already taken care of. This is a small speedup, compensating for a small slowdown caused
by switching Bison mode.
2008-04-10 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
https://bugs.webkit.org/show_bug.cgi?id=18402
REGRESSION: visited element handling is incorrect in nested join/toString calls
No change on SunSpider total, possibly a tiny improvement (about 0.1%).
Test: fast/js/array-tostring-and-join.html
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
common to toString/toLocalizedString/join again.
* kjs/array_object.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
Got rid of static variables. Replaced UString with Vector to avoid O(n^2) behavior and
regain performance.
* wtf/Vector.h:
(WTF::::resize):
(WTF::::grow):
(WTF::::reserveCapacity):
(WTF::::append):
(WTF::::insert):
Added null checks, so that Vector methods don't crash when out of memory. The caller should
check that data pointer is not null before proceeding.
2008-04-10 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Fix https://bugs.webkit.org/show_bug.cgi?id=18367 and the many dupes.
Bug 18367: Crash during celtic kane js speed 2007 test
GCC 4.2 on x86_64 Linux decided to reorder the local variables in markCurrentThreadConservatively's
stack frame. This lead to the range of addresses the collector treated as stack to exclude the
contents of volatile registers that markCurrentThreadConservatively forces onto the stack. This was
leading to objects being prematurely collected if the only reference to them was via a register at
the time a collection occurred.
The fix for this is to move the calculation of the top of the stack into a NEVER_INLINE function
that is called from markCurrentThreadConservatively. This forces the dummy variable we use for
determining the top of stack to be in a different stack frame which prevents the compiler from
reordering it relative to the registers that markCurrentThreadConservatively forces onto the stack.
* kjs/collector.cpp:
(KJS::Collector::markCurrentThreadConservativelyInternal):
(KJS::Collector::markCurrentThreadConservatively):
* kjs/collector.h:
2008-04-10 Adam Roben <aroben@apple.com>
VC++ Express build fix
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
that anyone who links against WTF.lib will get user32.lib
automatically.
2008-04-09 Adam Roben <aroben@apple.com>
VC++ Express build fix
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
user32.lib.
2008-04-09 Adam Roben <aroben@apple.com>
Build fix
* JavaScriptCore.exp: Export isMainThread.
2008-04-09 Adam Roben <aroben@apple.com>
Build fix
* wtf/AlwaysInline.h: Make sure to #include Platform.h before using
the macros it defines.
2008-04-08 Mark Rowe <mrowe@apple.com>
Export WTF::initializeThreading() from JavaScriptCore.
* JavaScriptCore.exp:
2008-04-04 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
First step in implementing the "split window"
- Add a GlobalThisValue to ExecState which should be used
in places that used to implement the "use the global object
as this if null" rule.
- Factor out lookupGetter/lookupSetter into virtual methods
on JSObject so that they can be forwarded.
- Make defineGetter/defineSetter virtual methods for the same
reason.
- Have PrototypeReflexiveFunction store the globalObject used
to create it so that it can be used to get the correct thisObject
for eval.
* API/JSObjectRef.cpp:
(JSObjectCallAsFunction):
* JavaScriptCore.exp:
* kjs/Activation.h:
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::GlobalExecState::GlobalExecState):
* kjs/ExecState.h:
(KJS::ExecState::globalThisValue):
* kjs/ExecStateInlines.h:
(KJS::ExecState::ExecState):
(KJS::FunctionExecState::FunctionExecState):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
(KJS::JSGlobalObject::toGlobalObject):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
(KJS::JSGlobalObject::JSGlobalObject):
* kjs/array_instance.cpp:
(KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
(KJS::compareWithCompareFunctionForQSort):
* kjs/array_object.cpp:
(KJS::arrayProtoFuncSort):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::ActivationImp::toThisObject):
(KJS::globalFuncEval):
(KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
(KJS::PrototypeReflexiveFunction::mark):
* kjs/function.h:
(KJS::PrototypeReflexiveFunction::cachedGlobalObject):
* kjs/function_object.cpp:
(KJS::functionProtoFuncApply):
(KJS::functionProtoFuncCall):
* kjs/nodes.cpp:
(KJS::ExpressionNode::resolveAndCall):
(KJS::FunctionCallValueNode::evaluate):
(KJS::LocalVarFunctionCallNode::inlineEvaluate):
(KJS::ScopedVarFunctionCallNode::inlineEvaluate):
(KJS::FunctionCallBracketNode::evaluate):
(KJS::FunctionCallDotNode::inlineEvaluate):
* kjs/object.cpp:
(KJS::JSObject::call):
(KJS::JSObject::put):
(KJS::tryGetAndCallProperty):
(KJS::JSObject::lookupGetter):
(KJS::JSObject::lookupSetter):
(KJS::JSObject::toThisObject):
(KJS::JSObject::toGlobalObject):
(KJS::JSObject::fillGetterPropertySlot):
* kjs/object.h:
* kjs/object_object.cpp:
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
* kjs/string_object.cpp:
(KJS::replace):
2008-04-08 Brady Eidson <beidson@apple.com>
Encourage Windows to rebuild - AGAIN...
* kjs/DateMath.cpp:
2008-04-08 Adam Roben <aroben@apple.com>
Mac build fix
* JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
2008-04-08 Brady Eidson <beidson@apple.com>
Rubberstamped by Adam Roben
Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
* kjs/DateMath.cpp:
2008-04-08 Adam Roben <aroben@apple.com>
Move callOnMainThread to WTF
Reviewed by Alexey Proskuryakov.
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
Added new files.
* wtf/MainThread.cpp:
* wtf/MainThread.h:
* wtf/gtk/MainThreadGtk.cpp:
* wtf/mac/MainThreadMac.mm:
* wtf/qt/MainThreadQt.cpp:
* wtf/win/MainThreadWin.cpp:
* wtf/wx/MainThreadWx.cpp:
Moved here from WebCore/platform. Replaced all instances of "WebCore"
with "WTF".
* kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
build.
to the WTF namespace.
* wtf/ThreadingWin.cpp:
(WTF::initializeThreading): Call initializeMainThread.
2008-04-07 Brady Eidson <beidson@apple.com>
Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
* Configurations/JavaScriptCore.xcconfig:
2008-04-07 Adam Roben <aroben@apple.com>
Windows build fix
* wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
2008-04-07 Adam Roben <aroben@apple.com>
Add WTF::isMainThread
Reviewed by Alexey Proskuryakov.
* wtf/Threading.h: Declare the new function.
* wtf/ThreadingGtk.cpp:
(WTF::initializeThreading): Initialize the main thread identifier.
(WTF::isMainThread): Added.
* wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp.
(WTF::initializeThreading):
(WTF::isMainThread):
* wtf/ThreadingPthreads.cpp: Ditto.
(WTF::initializeThreading):
(WTF::isMainThread):
* wtf/ThreadingWin.cpp: Ditto.
(WTF::initializeThreading):
(WTF::isMainThread):
2008-04-06 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Make UString thread-safe.
No change on SunSpider total, although individual tests have changed a lot, up to 3%.
* kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
a static.
* kjs/identifier.cpp:
(KJS::CStringTranslator::translate):
(KJS::UCharBufferTranslator::translate):
Use "true" for a boolean value instead of 1, because it's C++.
* kjs/ustring.h:
(KJS::CString::adopt): Added a method to create from a char* buffer without copying.
(KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
necessary to hold JSLock when working with strings.
(KJS::UString::Rep::deref): Ditto.
(KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
or null static string.
* kjs/ustring.cpp:
(KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
about UChar.
(KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
(KJS::UString::Rep::create): Ditto.
(KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
apparently this functiton is hot enough for SunSpider to see an effect from this!
(KJS::UString::null): Moved a star, added a comment.
(KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
(KJS::UString::ascii): Simplified statBuffer handling logic.
(KJS::UString::toDouble): Use cstring() instead of ascii().
2008-04-02 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Ensure that debug symbols are generated for x86_64 and ppc64 builds.
* Configurations/Base.xcconfig:
2008-04-01 Christian Dywan <christian@imendio.com>
Build fix for GCC 4.3.
* wtf/unicode/icu/CollatorICU.cpp: include string.h
2008-04-01 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Darin.
Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
compiler-provided emulation.
1% speedup on Acid3 test 26.
* kjs/dtoa.cpp:
2008-04-01 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Make MathExtras.h thread safe.
* kjs/math_object.cpp:
(KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
wtf_random_init().
* wtf/Threading.h:
* wtf/ThreadingGtk.cpp:
(WTF::initializeThreading):
* wtf/ThreadingNone.cpp:
(WTF::initializeThreading):
* wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading):
* wtf/ThreadingWin.cpp:
(WTF::initializeThreading):
Call wtf_random_init(); made the function non-inline to avoid having to include too many
headers in Threading.h.
2008-03-31 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Make matching of regexps using ^ much faster
http://bugs.webkit.org/show_bug.cgi?id=18086
* pcre/pcre_compile.cpp:
(compileBranch):
(branchNeedsLineStart):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2008-03-29 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Oliver Hunt.
<rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
* kjs/InitializeThreading.cpp: (KJS::initializeThreading): There is no guarantee that
initializeThreading() is called only once; check that the mutex hasn't been already allocated.
2008-03-29 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Bug 17924: Crash in KJS::ConstDeclNode::evaluate with |with| and |const|
<http://bugs.webkit.org/show_bug.cgi?id=17924>
<rdar://problem/5806933>
It turns out this is trivially avoidable if we just match firefox's
semantics and ensure that an assignment in a const declaration always
writes to the variable object.
* kjs/nodes.cpp:
(KJS::ConstDeclNode::handleSlowCase):
2008-03-28 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Sam Weinig.
Fix a dtoa thread safety issue.
WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
compiled in for dtoa.
This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
his recent improvement.
* kjs/dtoa.cpp:
(Bigint::Balloc):
(Bigint::Bfree):
Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
in the presence of locking (but somewhat slower in single-threaded case).
(Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
restructure the code to avoid significant performance implications).
(Bigint::lshift): Rewrote to avoid an allocation, if possible.
(Bigint::rv_alloc):
(Bigint::kjs_freedtoa):
(Bigint::kjs_dtoa):
Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
* kjs/InitializeThreading.cpp: Added.
(KJS::initializeThreading):
* kjs/InitializeThreading.h: Added.
Initialize threading at KJS level, if enabled.
* kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
* kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
* JavaScriptCore.exp: Export KJS::initializeThreading.
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCoreSources.bkl:
* JavaScriptCore.xcodeproj/project.pbxproj:
Added InitializeThreading.{h,cpp}.
* wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
to be called from KJS::initializeThreading, and having it in the global namespace is useless.
2008-03-28 Brady Eidson <beidson@apple.com>
Reviewed by Darin
Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-03-27 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
<rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
compiled length calculated incorrectly.
* pcre/pcre_compile.cpp:
(multiplyWithOverflowCheck):
(calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
and bail with an error rather than returning incorrect results.
2008-03-26 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Brady Eidson.
Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
* Configurations/JavaScriptCore.xcconfig:
2008-03-26 Adam Roben <aroben@apple.com>
Fix Bug 18060: Assertion failure (JSLock not held) beneath
JSCallbackObject<Base>::toString
<http://bugs.webkit.org/show_bug.cgi?id=18060>
Reviewed by Geoff Garen.
Bug fix:
* API/JSCallbackObjectFunctions.h:
(KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
instance only be in scope while calling convertToType.
Test:
* API/testapi.c:
(MyObject_convertToType): Implement type conversion to string.
* API/testapi.js: Add a test for type conversion to string.
2008-03-26 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/array_instance.cpp: Touched this.
* wtf/HashFunctions.h:
(WTF::intHash): Added 8- and 16-bit versions of intHash.
2008-03-26 Adam Roben <aroben@apple.com>
Force JSC headers to be copied by touching a file
* kjs/array_instance.cpp:
(KJS::ArrayInstance::getPropertyNames):
2008-03-26 Adam Roben <aroben@apple.com>
Windows build fix after r31324
Written with Darin.
Added HashTable plumbing to support using wchar_t as a key type.
* wtf/HashFunctions.h:
* wtf/HashTraits.h:
(WTF::):
2008-03-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- JSC part of fix for "SVG multichar glyph matching matches longest instead of first (affects Acid3 test 79)"
http://bugs.webkit.org/show_bug.cgi?id=18118
* wtf/HashFunctions.h:
(WTF::):
* wtf/HashTraits.h:
(WTF::):
2008-03-26 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Cache C string identifiers by address, not value, assuming that C strings can only
be literals.
1% speedup on Acid3 test 26.
* kjs/identifier.cpp:
(KJS::literalIdentifierTable):
(KJS::Identifier::add):
Added a new table to cache UString::Reps created from C strings by address. Elements are
never removed from this cache, as only predefined identifiers can get there.
* kjs/identifier.h:
(KJS::Identifier::Identifier): Added a warning.
2008-03-26 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Maciej.
An assertion was failing in function-toString-object-literals.html when parsing 1e-500.
The condition existed before, and got uncovered by turning compiled-out dtoa checks into
ASSERTs.
The assertion was verifying that the caller wasn't constructing a Bigint from 0.
This might have had some reason behind it originally, but I couldn't find any,
and this doesn't look like a reasonable requirement.
* kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
2008-03-25 Adam Roben <aroben@apple.com>
Fix Bug 18077: Integrate testapi.c into the Windows build
<http://bugs.webkit.org/show_bug.cgi?id=18077>
Reviewed by Steve Falkenburg.
* JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
2008-03-25 Adam Roben <aroben@apple.com>
Make testapi.c compile under MSVC
Currently you must compile testapi.c as C++ code since MSVC does not
support many C features that GCC does.
Reviewed by Steve Falkenburg.
* API/testapi.c:
(nan): Added an implementation of this for MSVC.
(assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
stack arrays.
(assertEqualsAsCharactersPtr): Ditto.
(print_callAsFunction): Ditto.
(main): Ditto, and explicitly cast from UniChar* to JSChar*.
2008-03-25 Adam Roben <aroben@apple.com>
Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
We can't remove the os-win32 directory yet because other ports (at
least wx) are still relying on it.
Reviewed by Steve Falkenburg.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
- Made all the include paths match the one for the Debug
configuration (these got out of sync in r30797)
- Removed os-win32 from the include path
- Removed os-win32 from the directories we copy to $WebKitOutputDir.
- Removed stdint.h from the project
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Delete the files that we may have previously copied from the os-win32
directory.
2008-03-25 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* kjs/dtoa.cpp: Include stdint.h.
2008-03-25 Alexey Proskuryakov <ap@webkit.org>
Rubber-stamped by Darin.
Cleanup dtoa.cpp style.
* kjs/dtoa.cpp:
(Bigint::Balloc):
(Bigint::Bfree):
(Bigint::multadd):
(Bigint::s2b):
(Bigint::hi0bits):
(Bigint::lo0bits):
(Bigint::i2b):
(Bigint::mult):
(Bigint::pow5mult):
(Bigint::lshift):
(Bigint::cmp):
(Bigint::diff):
(Bigint::ulp):
(Bigint::b2d):
(Bigint::d2b):
(Bigint::ratio):
(Bigint::):
(Bigint::match):
(Bigint::hexnan):
(Bigint::kjs_strtod):
(Bigint::quorem):
(Bigint::rv_alloc):
(Bigint::nrv_alloc):
(Bigint::kjs_freedtoa):
(Bigint::kjs_dtoa):
* kjs/dtoa.h:
2008-03-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- convert a JavaScript immediate number to a string more efficiently
2% speedup of Acid3 test 26
* kjs/JSImmediate.cpp:
(KJS::JSImmediate::toString): Take advantage of the fact that all immediate
numbers are integers, and use the faster UString function for formatting integers
instead of the slower one that works for floating point. I think this is a leftover
from when immediate numbers were floating point.
2008-03-23 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Fix http://bugs.webkit.org/show_bug.cgi?id=18048
The "thisObject" parameter to JSEvaluateScript is not used properly
Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
ExecState.
* API/testapi.c:
(main): Add tests for setting the thisObject when calling JSEvaluateScript.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment.
2008-03-22 Jesse Ruderman <jruderman@gmail.com>
Reviewed by Sam Weinig. Landed by eseidel.
Make testkjs flush stdout after printing.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/testkjs.cpp:
(functionPrint):
2008-03-21 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Optimise lookup of Math, undefined, NaN and Infinity
Added a method to JSVariableObject to allow us to inject DontDelete properties
into the symbol table and localStorage. This results in a 0.4% progression in
SunSpider, with a 8% gain in math-partial-sums.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableInsert):
2008-03-21 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff Garen.
Global properties that use LocalStorage are not correctly listed as enumerable.
The problem was caused by JSObject::getPropertyAttributes not being aware
of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes
virtual and override in JSVariableObject. This does not produce any performance
regression.
* JavaScriptCore.exp:
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames):
(KJS::JSVariableObject::getPropertyAttributes):
* kjs/JSVariableObject.h:
* kjs/object.h:
2008-03-21 Arkadiusz Miskiewicz <arekm@maven.pl>
Webkit does not build on linux powerpc
<http://bugs.webkit.org/show_bug.cgi?id=17019>
Reviewed by David Kilzer.
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Unlock):
2008-03-21 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Holger.
http://bugs.webkit.org/show_bug.cgi?id=17981
Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
* GNUmakefile.am:
2008-03-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Oliver Hunt.
Consolidate static identifier initializers within CommonIdentifiers.
No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
* kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
throughout the code.
* kjs/date_object.cpp:
(KJS::DateObjectImp::DateObjectImp):
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
Use the values from CommonIdentifiers.
* kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
* kjs/value.h:
(KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
* wtf/MathExtras.h:
(wtf_atan2): Having local variables for numeric_limits constants is good for readability,
but there is no reason to keep them static.
* JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
2008-03-20 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix for leak introduced by inline ScopeChainNode use
To avoid any extra branches when managing an inline ScopeChainNode
in the ScopeChain the inline node gets inserted with a refcount of
2. This meant than when the ScopeChain was destroyed the ScopeChainNodes
above the inline node would be leaked.
We resolve this by manually popping the inline node in the
FunctionExecState destructor.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/ExecStateInlines.h:
(KJS::FunctionExecState::~FunctionExecState):
* kjs/scope_chain.h:
(KJS::ScopeChain::popInlineScopeNode):
2008-03-20 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Ensure that the defines in FEATURE_DEFINES are sorted so that they will match the default settings of build-webkit.
This will prevent the world from being rebuilt if you happen to switch between building in Xcode and with build-webkit on the
command-line.
* Configurations/JavaScriptCore.xcconfig:
2008-03-20 David Krause <david.krause@gmail.com>
Reviewed by David Kilzer.
Fix http://bugs.webkit.org/show_bug.cgi?id=17923
Bug 17923: ARM platform endian defines inaccurate
* wtf/Platform.h:
Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
for PLATFORM(MIDDLE_ENDIAN)
2008-03-20 Maciej Stachowiak <mjs@apple.com>
- fix build
* JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
2008-03-20 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- reduce function call overhead for 1.014x speedup on SunSpider
I moved some functions from ExecState.cpp to ExecStateInline.h and
from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
inline; machine function call overhead for these was hurting JS
funcion call overhead.
* kjs/ExecState.cpp:
* kjs/ExecStateInlines.h: Added.
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
(KJS::FunctionExecState::FunctionExecState):
(KJS::FunctionExecState::~FunctionExecState):
* kjs/JSGlobalObject.cpp:
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::pushActivation):
(KJS::JSGlobalObject::checkActivationCount):
(KJS::JSGlobalObject::popActivation):
* kjs/function.cpp:
2008-03-19 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Avoid heap allocating the root scope chain node for eval and closure free functions
Maciej suggested using an inline ScopeChainNode for functions that don't use eval
or closures as they are unable to ever capture the scope chain. This gives us a 2.4%
win in sunspider, a 15% win in controlflow-recursive, and big (>5%) wins in a number
of other tests.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/ExecState.h:
* kjs/scope_chain.h:
(KJS::ScopeChain::push):
2008-03-19 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Fix release build.
* kjs/JSGlobalObject.cpp: Add missing #include.
2008-03-19 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for <rdar://problem/5785694>
Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
Make the activeExecStates stack per JSGlobalObject instead of static to ensure
thread safety.
* JavaScriptCore.exp:
* kjs/ExecState.cpp:
(KJS::InterpreterExecState::InterpreterExecState):
(KJS::InterpreterExecState::~InterpreterExecState):
(KJS::EvalExecState::EvalExecState):
(KJS::EvalExecState::~EvalExecState):
(KJS::FunctionExecState::FunctionExecState):
(KJS::FunctionExecState::~FunctionExecState):
* kjs/ExecState.h:
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::mark):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::activeExecStates):
* kjs/collector.cpp:
(KJS::Collector::collect):
(KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report
the OutOfMemory condition to all the ExecStates in each.
2008-03-19 Jasper Bryant-Greene <jasper@unix.geek.nz>
Reviewed by Maciej Stachowiak.
Fix http://bugs.webkit.org/show_bug.cgi?id=17941
Bug 17941: C++-style comments in JavaScriptCore API
* API/JSBase.h:
Remove C++-style comments from public JavaScriptCore API, replacing
with standard C90 block comments.
2008-03-19 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Fix http://bugs.webkit.org/show_bug.cgi?id=17939
Bug 17939: Crash decompiling "const a = 1, b;"
* kjs/nodes2string.cpp:
(KJS::ConstDeclNode::streamTo): Null-check the correct variable.
2008-03-18 Oliver Hunt <oliver@apple.com>
Reviewed by Mark Rowe.
Bug 17929: Incorrect decompilation with |const|, comma
http://bugs.webkit.org/show_bug.cgi?id=17929
There were actually two bugs here. First we weren't correctly handling const
nodes with multiple declarations. The second issue was caused by us not
giving the correct precedence to the initialisers.
* kjs/nodes2string.cpp:
(KJS::ConstDeclNode::streamTo):
2008-03-18 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- Speed up JavaScript built-in properties by changing the
hash table to take advantage of the identifier objects
5% speedup for Acid3 test 26
* JavaScriptCore.exp: Updated.
* kjs/create_hash_table: Compute size of hash table large enough so that there
are no collisions, but don't generate the hash table.
* kjs/identifier.h: Made the add function that returns a PassRefPtr public.
* kjs/lexer.cpp:
(KJS::Lexer::lex): Updated for change to HashTable interface.
* kjs/lookup.cpp:
(KJS::HashTable::changeKeysToIdentifiers): Added. Finds the identifier for
each property so the equality comparision can be done with pointer comparision.
* kjs/lookup.h: Made the key be a union of char* with UString::Rep* so it can
hold identifiers. Added a keysAreIdentifiers flag to the HashTable. Changed
the Lookup functions to be member functions of HashTable instead.
* kjs/object.cpp:
(KJS::JSObject::deleteProperty): Update for change to HashTable.
(KJS::JSObject::findPropertyHashEntry): Ditto.
(KJS::JSObject::getPropertyAttributes): Ditto.
(KJS::JSObject::getPropertyNames): Ditto.
2008-03-18 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Fix http://bugs.webkit.org/show_bug.cgi?id=17925 and http://bugs.webkit.org/show_bug.cgi?id=17927.
- Bug 17925: Crash in KJS::JSObject::put after setting this.__proto__
- Bug 17927: Hang after attempting to create circular __proto__
* kjs/object.cpp:
(KJS::JSObject::put): Silently ignore attempts to set __proto__ to a non-object, non-null value.
Return after setting the exception when an attempt to set a cyclic __proto__ is detected so that
the cyclic value is not set.
2008-03-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- inline ActivationImp::init for 0.8% SunSpider speedup
* kjs/Activation.h:
(KJS::ActivationImp::init): Moved here from function.cpp
* kjs/function.cpp:
2008-03-18 Simon Hausmann <hausmann@webkit.org>
Fix the Qt build.
Including config.h like in the other .cpp files gets the #ifdeffery
correct for rand_s.
* kjs/JSWrapperObject.cpp:
2008-03-17 Darin Adler <darin@apple.com>
Reviewed by Maciej.
JavaScriptCore changes to support a WebCore speedup.
* JavaScriptCore.exp: Export the UString::Rep::computeHash function.
* wtf/HashSet.h: Added a find and contains function that take a translator,
like the add function.
2008-03-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- a few micro-optimizations for 1.2% SunSpider speedup
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
it is more likely.
* kjs/object.cpp:
(KJS::JSObject::put): When walking prototype chain, instead of
checking isObject (a virtual call), compare to jsNull (compare to
a constant) since null is the only non-object that can be in a
prototype chain.
2008-03-17 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Optimise multi-scope function call resolution
Refactor multiscope variable resolution and use to add
optimised FunctionCallResolveNode subclasses.
2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
* kjs/nodes.cpp:
(KJS::getSymbolTableEntry):
(KJS::ResolveNode::optimizeVariableAccess):
(KJS::getNonLocalSymbol):
(KJS::ExpressionNode::resolveAndCall):
(KJS::FunctionCallResolveNode::optimizeVariableAccess):
(KJS::FunctionCallResolveNode::inlineEvaluate):
(KJS::ScopedVarFunctionCallNode::inlineEvaluate):
(KJS::ScopedVarFunctionCallNode::evaluate):
(KJS::ScopedVarFunctionCallNode::evaluateToNumber):
(KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
(KJS::ScopedVarFunctionCallNode::evaluateToInt32):
(KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
(KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
(KJS::NonLocalVarFunctionCallNode::evaluate):
(KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
(KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
(KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
(KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
* kjs/nodes.h:
(KJS::ScopedVarFunctionCallNode::):
(KJS::NonLocalVarFunctionCallNode::):
2008-03-17 David Kilzer <ddkilzer@apple.com>
Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
Reviewed by Darin.
See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
* wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
PLATFORM(MIDDLE_ENDIAN).
2008-03-17 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff, Darin and Weinig.
Add fast multi-level scope lookup
Add logic and AST nodes to provide rapid variable resolution across
static scope boundaries. This also adds logic that allows us to skip
any static scopes that do not contain the variable to be resolved.
This results in a ~2.5% speedup in SunSpider, and gives a 25-30% speedup
in some simple and ad hoc closure and global variable access tests.
* JavaScriptCore.exp:
* kjs/Activation.h:
* kjs/JSGlobalObject.cpp:
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.cpp:
* kjs/JSVariableObject.h:
* kjs/function.cpp:
(KJS::ActivationImp::isDynamicScope):
* kjs/nodes.cpp:
(KJS::ResolveNode::optimizeVariableAccess):
(KJS::ScopedVarAccessNode::inlineEvaluate):
(KJS::ScopedVarAccessNode::evaluate):
(KJS::ScopedVarAccessNode::evaluateToNumber):
(KJS::ScopedVarAccessNode::evaluateToBoolean):
(KJS::ScopedVarAccessNode::evaluateToInt32):
(KJS::ScopedVarAccessNode::evaluateToUInt32):
(KJS::NonLocalVarAccessNode::inlineEvaluate):
(KJS::NonLocalVarAccessNode::evaluate):
(KJS::NonLocalVarAccessNode::evaluateToNumber):
(KJS::NonLocalVarAccessNode::evaluateToBoolean):
(KJS::NonLocalVarAccessNode::evaluateToInt32):
(KJS::NonLocalVarAccessNode::evaluateToUInt32):
(KJS::IfElseNode::optimizeVariableAccess):
(KJS::ScopeNode::optimizeVariableAccess):
* kjs/nodes.h:
(KJS::ScopedVarAccessNode::):
(KJS::NonLocalVarAccessNode::):
* kjs/object.h:
2008-03-16 weihongzeng <weihong.zeng@hotmail.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15416
Add support for mixed-endian processors
* kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
2008-03-16 Kevin Ollivier <kevino@theolliviers.com>
Rubber stamped by Darin.
Add set-webkit-configuration support for wx port, and centralize
build dir location setting.
http://bugs.webkit.org/show_bug.cgi?id=17790
* jscore.bkl:
2008-03-14 Steve Falkenburg <sfalken@apple.com>
PGO build fixes.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-03-14 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Add logic to track whether a function uses a locally scoped eval or requires a closure
Now that we limit eval we can track those uses of eval that operate
in the local scope and functions that require a closure. We track
this information during initial parsing to avoid yet another tree
walk.
* JavaScriptCore.exp:
* kjs/NodeInfo.h:
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing):
* kjs/Parser.h:
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::ProgramNode::create):
(KJS::EvalNode::EvalNode):
(KJS::EvalNode::create):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::create):
* kjs/nodes.h:
(KJS::ScopeNode::):
(KJS::ScopeNode::usesEval):
(KJS::ScopeNode::needsClosure):
2008-03-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Fixed another problem with Vector::shrinkCapacity.
moveOverlapping isn't good enough for the case where the buffer hasn't
changed, because it still destroys the contents of the buffer.
* wtf/Vector.h:
(WTF::::shrinkCapacity): Changed to explicitly check whether the call
to allocateBuffer produced a new buffer. If it didn't, there's no need
to move.
2008-03-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Fixed a few problems with Vector::shrinkCapacity that I noticed in testing.
* wtf/Vector.h:
(WTF::VectorBufferBase::deallocateBuffer): Clear our m_buffer pointer
when we deallocate m_buffer, in case we're not asked to reallocate a new
buffer. (Otherwise, we would use a stale m_buffer if we were asked to
perform any operations after shrinkCapacity was called.)
(WTF::VectorBuffer::allocateBuffer): Made VectorBuffer with inline
capacity aware that calls to allocateBuffer might be shrinks, rather
than grows, so we shouldn't allocate a new buffer on the heap unless
our inline buffer is too small.
(WTF::::shrinkCapacity): Call resize() instead of just setting m_size,
so destructors run. Call resize before reallocating the buffer to make
sure that we still have access to the objects we need to destroy. Call
moveOverlapping instead of move, since a call to allocateBuffer on an
inline buffer may produce identical storage.
2008-03-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Get rid of a localime() call on platforms that have better alternatives.
* kjs/DateMath.h: Added getLocalTime();
* kjs/DateMath.cpp:
(KJS::getLocalTime):
(KJS::getDSTOffsetSimple):
Implementation moved from getDSTOffsetSimple().
* kjs/date_object.cpp:
(KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
2008-03-14 David D. Kilzer <ddkilzer@apple.com>
Unify concept of enabling the Mac Java bridge.
Reviewed by Darin and Anders.
* wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
2008-03-13 Mark Mentovai <mark@moxienet.com>
Reviewed by eseidel. Landed by eseidel.
* wtf/FastMalloc.cpp: #include <wtf/HashSet.h> outside of any
namespaces.
2008-03-13 Mark Mentovai <mark@moxienet.com>
Reviewed by eseidel. Landed by eseidel.
* pcre/pcre_exec.cpp: Fix misnamed variable, allowing -DDEBUG build
to succeed.
* wtf/ThreadingPthreads.cpp: #include <sys/time.h> for gettimeofday
in non-pch build.
2008-03-13 Steve Falkenburg <sfalken@apple.com>
PGO build fixes.
Disable PGO for normal release builds.
Added work-in-progress Release_PGOInstrument/Release_PGOOptimize targets.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-03-13 Beth Dakin <bdakin@apple.com>
Reviewed by Geoff.
Adding new functionality to Vector. Currently all of the shrink and
resize functions on Vector only shrink the size of the Vector, not
the capacity. For the Vector to take up as little memory as
possible, though, it is necessary to be able to shrink the capacity
as well. So this patch adds that functionality.
I need this for a speed up I am working on, and Geoff wants to use
it in a speed up he is working on also, so he asked me to commit it
now.
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::::shrinkCapacity):
2008-03-13 Simon Hausmann <hausmann@webkit.org>
Reviewed by Adam Roben.
Attempt at fixing the Qt/Windows build bot. Quote using double-quotes
instead of single quotes.
* pcre/dftables:
2008-03-12 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
2008-03-12 Alp Toker <alp@atoker.com>
Another autotools testkjs build fix attempt.
* GNUmakefile.am:
2008-03-12 Alp Toker <alp@atoker.com>
Attempt to fix the autotools testkjs build on systems with
non-standard include paths.
* GNUmakefile.am:
2008-03-11 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
<rdar://problem/5787743> REGRESSION: Crash at WTF::Collator::CreateCollator() running fast/js/kde/StringObject.html on Windows
* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::createCollator): Check for null (== user default) m_locale before calling strcmp.
2008-03-11 Steve Falkenburg <sfalken@apple.com>
Disable LTCG/PGO for grammar.cpp and nodes.cpp.
PGO on these files causes us to hang.
Copy newer vsprops files from relative WebKitLibraries path to environment variable based path.
Reviewed by Oliver.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
2008-03-10 Darin Adler <darin@apple.com>
- Windows build fix
* kjs/function.cpp: (KJS::decode): Initialize variable.
2008-03-10 Brent Fulgham <bfulgham@gmail.com>
Windows build fix
Reviewed by Adam.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Set the PATH to include Cygwin before running touch.
2008-03-10 Eric Seidel <eric@webkit.org>
Build fix for JSC on windows.
* API/JSStringRefCF.cpp:
(JSStringCreateWithCFString):
* kjs/function.cpp:
(KJS::decode):
* kjs/nodes2string.cpp:
(KJS::escapeStringForPrettyPrinting):
2008-03-10 Eric Seidel <eric@webkit.org>
No review, build fix only.
Attempt to fix the windows build?
* kjs/ustring.h: change unsigned short to UChar
2008-03-10 Eric Seidel <eric@webkit.org>
Reviewed by Darin.
Remove KJS::UChar, use ::UChar instead
http://bugs.webkit.org/show_bug.cgi?id=17017
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters):
(JSStringCreateWithUTF8CString):
* API/JSStringRefCF.cpp:
(JSStringCreateWithCFString):
* JavaScriptCore.exp:
* kjs/Parser.h:
* kjs/function.cpp:
(KJS::decode):
(KJS::parseInt):
(KJS::parseFloat):
(KJS::globalFuncEscape):
(KJS::globalFuncUnescape):
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct):
* kjs/identifier.cpp:
(KJS::Identifier::equal):
(KJS::CStringTranslator::translate):
* kjs/interpreter.h:
* kjs/lexer.cpp:
(KJS::Lexer::setCode):
(KJS::Lexer::shift):
(KJS::Lexer::lex):
(KJS::Lexer::convertUnicode):
(KJS::Lexer::makeIdentifier):
* kjs/lookup.cpp:
(KJS::keysMatch):
* kjs/nodes2string.cpp:
(KJS::escapeStringForPrettyPrinting):
(KJS::SourceStream::operator<<):
* kjs/regexp.cpp:
(KJS::RegExp::RegExp):
(KJS::RegExp::match):
* kjs/string_object.cpp:
(KJS::substituteBackreferences):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
* kjs/ustring.cpp:
(KJS::UString::Rep::computeHash):
(KJS::UString::UString):
(KJS::UString::append):
(KJS::UString::ascii):
(KJS::UString::operator=):
(KJS::UString::is8Bit):
(KJS::UString::toStrictUInt32):
(KJS::UString::find):
(KJS::operator==):
(KJS::operator<):
(KJS::compare):
(KJS::UString::UTF8String):
* kjs/ustring.h:
* pcre/pcre.h:
2008-03-09 Steve Falkenburg <sfalken@apple.com>
Stop Windows build if an error occurs in a prior project.
Rubber stamped by Darin.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-03-09 J¸rg Billeter <j@bitron.ch>
Reviewed by Alp Toker.
Conditionalise ICU for Unicode in the GTK+ port.
* wtf/Platform.h:
2008-03-07 David D. Kilzer <ddkilzer@apple.com>
Unify concept of enabling Netscape Plug-in API (NPAPI).
Reviewed by Darin.
* wtf/Platform.h: Define ENABLE_NETSCAPE_PLUGIN_API here.
2008-03-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed <rdar://problem/5689093> Stricter (ES4) eval semantics
The basic rule is:
- "eval(s)" is treated as an operator that gives the ES3 eval behavior.
... but only if there is no overriding declaration of "eval" in scope.
- All other invocations treat eval as a function that evaluates a
script in the context of its "this" object.
... but if its "this" object is not the global object it was
originally associated with, eval throws an exception.
Because only expressions of the form "eval(s)" have access to local
scope, the compiler can now statically determine whether a function
needs local scope to be dynamic.
* kjs/nodes.h: Added FunctionCallEvalNode. It works just like
FuncationCallResolveNode, except it statically indicates that the node
may execute eval in the ES3 way.
* kjs/nodes.cpp:
* kjs/nodes2string.cpp:
* tests/mozilla/expected.html: This patch happens to fix a Mozilla JS
test, but it's a bit of a pyrrhic victory. The test intends to test
Mozilla's generic API for calling eval on any object, but, in reality,
we only support calling eval on the global object.
2008-03-06 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-03-06 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
2008-03-06 Alp Toker <alp@atoker.com>
Fix the build fix in r30845 to support out-of-tree builds.
* GNUmakefile.am:
2008-03-06 Steve Falkenburg <sfalken@apple.com>
Build fix.
* wtf/ThreadingWin.cpp:
(WTF::ThreadCondition::timedWait):
2008-03-06 Darin Adler <darin@apple.com>
- another small step towards fixing the Qt build
* JavaScriptCore.pri: Remove more references to the now-obsolete bindings directory.
2008-03-06 Darin Adler <darin@apple.com>
- a small step towards fixing the Qt build
* JavaScriptCore.pri: Remove references to files no longer present in JavaScriptCore/bindings.
2008-03-06 Brady Eidson <beidson@apple.com>
Gtk Build fix
* wtf/ThreadingGtk.cpp:
(WTF::ThreadCondition::timedWait):
2008-03-06 Alexey Proskuryakov <ap@webkit.org>
Wx build fix.
* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::userDefault): Put ICU workaround under both PLATFORM(DARWIN) and
PLATFORM(CF) checks, so that each port can decide if it wants to use CF on Mac for it.
2008-03-06 Brady Eidson <beidson@apple.com>
Reviewed by Darin
Add a timedWait() method to ThreadCondition
* JavaScriptCore.exp:
* wtf/Threading.h:
* wtf/ThreadingGtk.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/ThreadingNone.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/ThreadingPthreads.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/ThreadingWin.cpp:
(WTF::ThreadCondition::timedWait): Needs implementation
2008-03-06 Alexey Proskuryakov <ap@webkit.org>
More build fixes.
* jscore.bkl: Add the wtf/unicode directory.
* wtf/unicode/CollatorDefault.cpp:
(WTF::Collator::userDefault): Use a constructor that does exist.
* wtf/unicode/icu/CollatorICU.cpp: Mac build fix for case-sensitive file systems.
2008-03-06 Darin Adler <darin@apple.com>
- try to fix the Qt build
* JavaScriptCore.pri: Add the wtf/unicode directory.
2008-03-06 Darin Adler <darin@apple.com>
- try to fix the GTK build
* GNUmakefile.am: Add a -I for the wtf/unicode directory.
2008-03-06 Darin Adler <darin@apple.com>
- try to fix the Mac build
* icu/unicode/parseerr.h: Copied from ../WebCore/icu/unicode/parseerr.h.
* icu/unicode/ucol.h: Copied from ../WebCore/icu/unicode/ucol.h.
* icu/unicode/uloc.h: Copied from ../WebCore/icu/unicode/uloc.h.
* icu/unicode/unorm.h: Copied from ../WebCore/icu/unicode/unorm.h.
* icu/unicode/uset.h: Copied from ../WebCore/icu/unicode/uset.h.
2008-03-06 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
<rdar://problem/5687269> Need to create a Collator abstraction for WebCore and JavaScriptCore
* wtf/Threading.h:
(WTF::initializeThreading):
* wtf/ThreadingGtk.cpp:
(WTF::initializeThreading):
* wtf/ThreadingNone.cpp:
* wtf/ThreadingPthreads.cpp:
* wtf/ThreadingWin.cpp:
Added AtomicallyInitializedStatic.
* kjs/string_object.cpp: (KJS::localeCompare): Changed to use Collator.
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
Added new fiiles to projects.
* wtf/unicode/Collator.h: Added.
(WTF::Collator::):
* wtf/unicode/CollatorDefault.cpp: Added.
(WTF::Collator::Collator):
(WTF::Collator::~Collator):
(WTF::Collator::setOrderLowerFirst):
(WTF::Collator::collate):
* wtf/unicode/icu/CollatorICU.cpp: Added.
(WTF::cachedCollatorMutex):
(WTF::Collator::Collator):
(WTF::Collator::~Collator):
(WTF::Collator::setOrderLowerFirst):
(WTF::Collator::collate):
(WTF::Collator::createCollator):
(WTF::Collator::releaseCollator):
2008-03-05 Kevin Ollivier <kevino@theolliviers.com>
Fix the wx build after the bindings move.
* JavaScriptCoreSources.bkl:
* jscore.bkl:
2008-03-05 Alp Toker <alp@atoker.com>
GTK+ build fix for breakage introduced in r30800.
Track moved bridge sources from JavaScriptCore to WebCore.
* GNUmakefile.am:
2008-03-05 Brent Fulgham <bfulgham@gmail.com>
Reviewed by Adam Roben.
Remove definition of WTF_USE_SAFARI_THEME from wtf/Platform.h
because the PLATFORM(CG) flag is not set until config.h has
already included this file.
* wtf/Platform.h: Remove useless definition of WTF_USE_SAFARI_THEME
2008-03-05 Brady Eidson <beidson@apple.com>
Reviewed by Alexey and Mark Rowe
Fix for <rdar://problem/5778247> - Reproducible crash on storage/execute-sql-args.html
DatabaseThread::unscheduleDatabaseTasks() manually filters through a MessageQueue,
removing particular items for Databases that were shutting down.
This filtering operation is not atomic, and therefore causes a race condition with the
MessageQueue waking up and reading from the message queue.
The end result was an attempt to dereference a null DatabaseTask. Timing-wise, this never
seemed to happen in a debug build, otherwise an assertion would've caught it. Replacing that
assertion with a crash in a release build is what revealed this bug.
* wtf/MessageQueue.h:
(WTF::::waitForMessage): Tweak the waiting logic to check the queue's empty state then go back
to sleep if the queue was empty - checking m_killed each time it wakes up.
2008-03-05 David D. Kilzer <ddkilzer@apple.com>
Remove unused header includes from interpreter.cpp.
Reviewed by Darin.
* kjs/interpreter.cpp: Remove unused header includes.
2008-03-05 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
Remove bindings/.
* bindings: Removed.
2008-03-05 Anders Carlsson <andersca@apple.com>
Don't build bindings/ anymore.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-03-05 Anders Carlsson <andersca@apple.com>
Reviewed by Geoff.
Don't build JavaScriptCore/bindings.
* JavaScriptCore.exp:
Export a couple of new functions.
* JavaScriptCore.xcodeproj/project.pbxproj:
Remove bindings/
* kjs/config.h:
No need to define HAVE_JNI anymore.
* kjs/interpreter.cpp:
Remove unnecessary include.
2008-03-05 David D. Kilzer <ddkilzer@apple.com>
Allow override of default script file name using command-line argument.
Reviewed by Adele.
* API/minidom.c:
(main): Allow first command-line argument to override the default script
file name of "minidom.js".
* API/testapi.c:
(main): Allow first command-line argument to override the default script
file name of "testapi.js".
2008-03-04 Mark Rowe <mrowe@apple.com>
Mac build fix.
* JavaScriptCore.exp: Add new symbol to exports file.
2008-03-03 Oliver Hunt <oliver@apple.com>
Reviewed by Anders.
Make ForInNode check for the timeout interrupt
* kjs/nodes.cpp:
(KJS::ForInNode::execute):
2008-03-02 Brent Fulgham <bfulgham@gmail.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=17415
GTK Build (using autotools) on Mac OS (DarwinPorts) Fails
Add -lstdc++ to link flags for minidom program. This corrects
a build error for the GTK+ on Mac OS.
* GNUmakefile.am:
2008-03-01 Mark Rowe <mrowe@apple.com>
Reviewed by Tim Hatcher.
Update Xcode configuration to support building debug and release from the mysterious future.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
2008-02-29 Brent Fulgham <bfulgham@gmail.com>
http://bugs.webkit.org/show_bug.cgi?id=17483
Implement scrollbars on Windows (Cairo)
Reviewed by Adam Roben.
* wtf/Platform.h:
2008-02-29 Adam Roben <aroben@apple.com>
Remove unused DebuggerImp::abort and DebuggerImp::aborted
Reviewed by Tim and Sam.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct):
* kjs/internal.h:
(KJS::DebuggerImp::DebuggerImp):
* kjs/nodes.cpp:
(KJS::Node::handleException):
(KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2008-02-28 Eric Christopher <echristo@apple.com>
Reviewed by Geoffrey Garen.
** TOTAL **: 1.005x as fast 2867.6ms +/- 0.4% 2853.2ms +/- 0.3% significant
* kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
the sake of branch prediction and code organization).
2008-02-27 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Sam Weinig.
http://bugs.webkit.org/show_bug.cgi?id=17030
Small buffer overflow within initialization
* kjs/date_object.cpp:
(KJS::DateObjectFuncImp::callAsFunction):
(KJS::parseDate):
Remove unnecessary and incorrect memset() calls - GregorianDateTime can initialize itself.
2008-02-25 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
- Add a variant of remove that takes a position and a length.
* wtf/Vector.h:
(WTF::Vector::remove):
2008-02-25 Mark Mentovai <mark@moxienet.com>
Reviewed by Mark Rowe.
Enable CollectorHeapIntrospector to build by itself, as well as in an AllInOneFile build.
http://bugs.webkit.org/show_bug.cgi?id=17538
* kjs/CollectorHeapIntrospector.cpp: Provide "using" declaration for
WTF::RemoteMemoryReader.
* kjs/collector.h: Move CollectorHeap declaration here...
* kjs/collector.cpp: ... from here.
2008-02-25 Darin Adler <darin@apple.com>
Reviewed by Adam.
* JavaScriptCore.exp: Sort the contents of this file.
2008-02-25 Adam Roben <aroben@apple.com>
MSVC build fix
* kjs/testkjs.cpp:
(functionQuit): Don't add a return statement after exit(0) for MSVC.
2008-02-24 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
http://bugs.webkit.org/show_bug.cgi?id=17529
Add support for reading from stdin from testkjs
* kjs/testkjs.cpp:
(GlobalObject::GlobalObject): Add readline function to global object.
(functionReadline): Added. Reads characters from stdin until a '\n' or
EOF is encountered. The input is returned as a String to the caller.
2008-02-24 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
http://bugs.webkit.org/show_bug.cgi?id=17528
Give testkjs a bath
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj: Make the testkjs.cpp use 4 space indentation.
* kjs/testkjs.cpp:
(StopWatch::getElapsedMS):
(GlobalObject::className):
(GlobalObject::GlobalObject):
Rename GlobalImp to GlobalObject and setup the global functions
in the GlobalObject's constructor. Also, use static functions for
the implementation so we can use the standard PrototypeFunction
class and remove TestFunctionImp.
(functionPrint): Move print() functionality here.
(functionDebug): Move debug() functionality here.
(functionGC): Move gc() functionality here.
(functionVersion): Move version() functionality here.
(functionRun): Move run() functionality here.
(functionLoad): Move load() functionality here.
(functionQuit): Move quit() functionality here.
(prettyPrintScript): Fix indentation.
(runWithScripts): Since all the functionality of createGlobalObject is
now in the GlobalObject constructor, just call new here.
(parseArguments): Fix indentation.
(kjsmain): Ditto
(fillBufferWithContentsOfFile): Ditto.
2008-02-24 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt and Mark Rowe.
http://bugs.webkit.org/show_bug.cgi?id=17505
Add support for getting command line arguments in testkjs
- This slightly changes the behavior of parsing arguments by requiring
a '-f' before all files.
* kjs/testkjs.cpp:
(createGlobalObject): Add a global property called 'arguments' which
contains an array with the parsed arguments as strings.
(runWithScripts): Pass in the arguments vector so that it can be passed
to the global object.
(parseArguments): Change parsing rules to require a '-f' before any script
file. After all '-f' and '-p' arguments have been parsed, the remaining
are added to the arguments vector and exposed to the script. If there is a
chance of ambiguity (the user wants to pass the string '-f' to the script),
the string '--' can be used separate the options from the pass through
arguments.
(kjsmain):
2008-02-24 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix http://bugs.webkit.org/show_bug.cgi?id=17511
REGRESSION: Reproducible crash in SegmentedSubstring::SegmentedSubstring(SegmentedSubstring const&)
* wtf/Deque.h:
(WTF::::expandCapacityIfNeeded): Fixed the case where m_start and m_end
are both zero but the buffer capacity is non-zero.
(WTF::::prepend): Added validity checks.
2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Rubber stamped by Darin.
Add separator '\' after libJavaScriptCore_la_LIBADD and cleanup
whitespaces introduced in the previous commit.
* GNUmakefile.am:
2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
* GNUmakefile.am: Add GLOBALDEPS for testkjs and minidom.
2008-02-23 Darin Adler <darin@apple.com>
Reviewed by Anders.
- http://bugs.webkit.org/show_bug.cgi?id=17496
make Deque use a circular array; add iterators
* wtf/Deque.h: Wrote an all-new version of this class that uses a circular
buffer. Growth policy is identical to vector. Added iterators.
* wtf/Vector.h: Made two small refinements while using this to implement
Deque: Made VectorBufferBase derive from Noncopyable, which would have
saved me some debugging time if it had been there. Renamed Impl and
m_impl to Buffer and m_buffer.
2008-02-23 Darin Adler <darin@apple.com>
Reviewed by Anders.
- http://bugs.webkit.org/show_bug.cgi?id=17067
eliminate attributes parameter from JSObject::put for speed/clarity
* API/JSCallbackObject.h: Removed attribute arguments.
* API/JSCallbackObjectFunctions.h:
(KJS::JSCallbackObject<Base>::put): Ditto.
* API/JSObjectRef.cpp:
(JSObjectSetProperty): Use initializeVariable or putDirect when necessary
to set attribute values.
* JavaScriptCore.exp: Updated.
* bindings/objc/objc_runtime.h: Removed attribute arguments.
* bindings/objc/objc_runtime.mm:
(ObjcFallbackObjectImp::put): Ditto.
* bindings/runtime_array.cpp:
(RuntimeArray::put): Ditto.
* bindings/runtime_array.h: Ditto.
* bindings/runtime_object.cpp:
(RuntimeObjectImp::put): Ditto.
* bindings/runtime_object.h: Ditto. Also removed canPut which was only
called from one place in WebCore that can use hasProperty instead.
* kjs/Activation.h: Removed attribute argument from put and added the new
initializeVariable function that's used to put variables in variable objects.
Also made isActivationObject a const member.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::put): Removed attribute argument.
(KJS::JSGlobalObject::initializeVariable): Added. Used to give variables
their initial values, which can include the read-only property.
(KJS::JSGlobalObject::reset): Removed obsolete comments about flags.
Removed Internal flag, which is no longer needed.
* kjs/JSGlobalObject.h: More of the same.
* kjs/JSVariableObject.h: Added pure virtual initializeVariable function.
(KJS::JSVariableObject::symbolTablePut): Removed checkReadOnly flag; we always
check read-only.
(KJS::JSVariableObject::symbolTableInitializeVariable): Added.
* kjs/array_instance.cpp:
(KJS::ArrayInstance::put): Removed attribute argument.
* kjs/array_instance.h: Ditto.
* kjs/function.cpp:
(KJS::FunctionImp::put): Ditto.
(KJS::Arguments::put): Ditto.
(KJS::ActivationImp::put): Ditto.
(KJS::ActivationImp::initializeVariable): Added.
* kjs/function.h: Removed attribute arguments.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct): Removed Internal flag.
* kjs/lookup.h:
(KJS::lookupPut): Removed attributes argument. Also changed to use putDirect
instead of calling JSObject::put.
(KJS::cacheGlobalObject): Ditto.
* kjs/nodes.cpp:
(KJS::ConstDeclNode::handleSlowCase): Call initializeVariable to initialize
the constant.
(KJS::ConstDeclNode::evaluateSingle): Ditto.
(KJS::TryNode::execute): Use putDirect to set up the new object.
(KJS::FunctionBodyNode::processDeclarations): Removed Internal.
(KJS::ProgramNode::processDeclarations): Ditto.
(KJS::EvalNode::processDeclarations): Call initializeVariable to initialize
the variables and functions.
(KJS::FuncDeclNode::makeFunction): Removed Internal.
(KJS::FuncExprNode::evaluate): Ditto.
* kjs/object.cpp: Removed canPut, which was only being used in one code path,
not the normal high speed one.
(KJS::JSObject::put): Removed attribute argument. Moved the logic from
canPut here, in the one code ath that was still using it.
* kjs/object.h: Removed Internal attribute, ad canPut function. Removed the
attributes argument to the put function. Made isActivationObject const.
* kjs/regexp_object.cpp:
(KJS::RegExpImp::put): Removed attributes argument.
(KJS::RegExpImp::putValueProperty): Ditto.
(KJS::RegExpObjectImp::put): Ditto.
(KJS::RegExpObjectImp::putValueProperty): Ditto.
* kjs/regexp_object.h: Ditto.
* kjs/string_object.cpp:
(KJS::StringInstance::put): Removed attributes argument.
* kjs/string_object.h: Ditto.
2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Not reviewed, Gtk build fix.
* kjs/testkjs.pro:
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Windows build fix - move ThreadCondition implementation from WebCore to WTF.
* wtf/ThreadingWin.cpp:
(WTF::ThreadCondition::ThreadCondition):
(WTF::ThreadCondition::~ThreadCondition):
(WTF::ThreadCondition::wait):
(WTF::ThreadCondition::signal):
(WTF::ThreadCondition::broadcast):
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Touch some files, hoping that Windows build bot will create JSC headers.
* kjs/AllInOneFile.cpp:
* kjs/array_instance.cpp:
* wtf/HashTable.cpp:
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Qt/Wx build fix - this file was still in a wrong namespace, too.
* wtf/ThreadingNone.cpp:
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
More build fixing - fix mismatched braces.
* JavaScriptCore.pri:
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Wx and Gtk build fixes.
* JavaScriptCore.pri: Don't try to compile ThreadingPthreads.
* wtf/ThreadingGtk.cpp: Use a correct namespace.
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Move basic threading support from WebCore to WTF.
Added mutex protection to MessageQueue::killed() for paranoia sake.
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* wtf/Locker.h: Copied from WebCore/platform/Locker.h.
* wtf/MessageQueue.h: Copied from WebCore/platform/MessageQueue.h.
(WTF::::killed):
* wtf/Threading.h: Copied from WebCore/platform/Threading.h.
* wtf/ThreadingGtk.cpp: Copied from WebCore/platform/gtk/ThreadingGtk.cpp.
(WebCore::createThread):
* wtf/ThreadingNone.cpp: Copied from WebCore/platform/ThreadingNone.cpp.
* wtf/ThreadingPthreads.cpp: Copied from WebCore/platform/pthreads/ThreadingPthreads.cpp.
(WTF::createThread):
* wtf/ThreadingWin.cpp: Copied from WebCore/platform/win/ThreadingWin.cpp.
(WTF::createThread):
(WTF::Mutex::Mutex):
(WTF::Mutex::~Mutex):
(WTF::Mutex::lock):
(WTF::Mutex::tryLock):
(WTF::Mutex::unlock):
2008-02-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
I'm removing KJS_MEM_LIMIT for the following reasons:
- We have a few reports of KJS_MEM_LIMIT breaking important web
applications, like GMail and Google Reader. (For example, if you
simply open 12 GMail tabs, tab #12 will hit the limit.)
- Firefox has no discernable JS object count limit, so any limit, even
a large one, is a potential compatibility problem.
- KJS_MEM_LIMIT does not protect against malicious memory allocation,
since there are many ways to maliciously allocate memory without
increasing the JS object count.
- KJS_MEM_LIMIT is already mostly broken, since it only aborts the
script that breaches the limit, not any subsequent scripts.
- We've never gotten bug reports about websites that would have
benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
needed it.
- Any website that brings you anywhere close to crashing due to the
number of live JS objects will almost certainly put up the "slow
script" dialog at least 20 times beforehand.
* kjs/collector.cpp:
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/nodes.cpp:
(KJS::TryNode::execute):
2008-02-22 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey P.
<rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
Fix yet another case where we incorrectly relied on implicit double
to bool coercion.
* kjs/nodes.cpp:
(KJS::PostDecLocalVarNode::evaluateToBoolean):
2008-02-20 Michael Knaup <michael.knaup@mac.com>
Reviewed by Darin.
Fix for Bug 16753: date set methods with no args should result in NaN (Acid3 bug)
The set values result in NaN now when called with no args, NaN or +/- inf values.
The setYear, setFullYear and setUTCFullYear methods used on NaN dates work as
descripted in the standard.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs):
(KJS::fillStructuresUsingDateArgs):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::dateProtoFuncSetYear):
2008-02-19 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
Change OpaqueJSClass and RootObject to start with a ref count of 1.
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass):
(OpaqueJSClass::createNoAutomaticPrototype):
(OpaqueJSClass::create):
* API/JSClassRef.h:
* API/JSObjectRef.cpp:
(JSClassCreate):
* bindings/runtime_root.cpp:
(KJS::Bindings::RootObject::create):
(KJS::Bindings::RootObject::RootObject):
2008-02-19 Darin Adler <darin@apple.com>
Rubber stamped by Anders.
- removed explicit initialization to 1 for RefCounted; that's now the default
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Removed RefCounted initializer.
2008-02-19 Darin Adler <darin@apple.com>
Reviewed by Anders.
- next step for http://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* wtf/RefCounted.h:
(WTF::RefCounted::RefCounted): Have refcounts default to 1. This allows us to start
removing the explicit initialization of RefCounted from classes and eventually we
can remove the ability to have the initial count of 0 entirely.
2008-02-18 Samuel Weinig <sam@webkit.org>
Reviewed by Geoff Garen.
Fix for http://bugs.webkit.org/show_bug.cgi?id=17419
Remove CompatMode from JavaScriptCore as it is never set to anything other than NativeMode
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::setDebugger):
* kjs/date_object.cpp:
(KJS::dateProtoFuncGetYear):
2008-02-18 Darin Adler <darin@apple.com>
Reviewed by Sam.
* wtf/ASCIICType.h:
(WTF::toASCIIHexValue): Added.
2008-02-17 Darin Adler <darin@apple.com>
* wtf/ListHashSet.h: (WTF::swap): Removed stray return statement.
2008-02-15 Adam Roben <aroben@apple.com>
Make JavaScriptCore's FEATURE_DEFINES match WebCore's
Reviewed by Mark.
* Configurations/JavaScriptCore.xcconfig:
2008-02-14 Stephanie Lewis <slewis@apple.com>
Reviewed by Geoff.
Update order files.
* JavaScriptCore.order:
2008-02-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
Don't reset the "activations" stack in JSGlobalObject::reset, since we
might be executing a script during the call to reset, and the script
needs to safely run to completion.
Instead, initialize the "activations" stack when the global object is
created, and subsequently rely on pushing and popping during normal
execution to maintain the stack's state.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::reset):
2008-02-13 Bernhard Rosenkraenzer <bero@arklinux.org>
Reviewed by Darin.
- http://bugs.webkit.org/show_bug.cgi?id=17339
JavaScriptCore does not build with gcc 4.3
* kjs/interpreter.cpp: Add include of <unistd.h>, since that's where
getpid() comes from.
2008-02-13 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey P.
<rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
When converting numeric values to booleans we need to account for NaN
* kjs/nodes.cpp:
(KJS::MultNode::evaluateToBoolean):
(KJS::ModNode::evaluateToBoolean):
2008-02-08 Samuel Weinig <sam@webkit.org>
Reviewed by Brady Eidson.
<rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
- Tweak the statements in isASCIISpace to account for the statistical distribution of
usage in the PLT.
.4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
* wtf/ASCIICType.h:
(WTF::isASCIISpace):
2008-02-11 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fixes for:
<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
<rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
- Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
toString calling.
* JavaScriptCore.exp:
* kjs/object_object.cpp:
* kjs/object_object.h:
2008-02-10 Darin Adler <darin@apple.com>
Rubber stamped by Eric.
* kjs/ExecState.h:
(KJS::ExecState::takeException): Added.
2008-02-10 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=17256
eliminate default ref. count of 0 in RefCounted class
* wtf/RefCounted.h:
(WTF::RefCounted::RefCounted): Remove default of 0.
2008-02-10 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=17256
Make clients of RefCounted explicitly set the count to 0.
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass):
* bindings/runtime_root.cpp:
(KJS::Bindings::RootObject::RootObject):
2008-02-09 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- http://bugs.webkit.org/show_bug.cgi?id=17256
Change RegExp to start its ref count at 1, not 0
We'll want to do this to every RefCounted class, one at a time.
* kjs/nodes.h:
(KJS::RegExpNode::RegExpNode): Use RegExp::create instead of new RegExp.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Marked inline, set initial ref count to 1.
(KJS::RegExp::create): Added. Calls new RegExp then adopts the initial ref.
* kjs/regexp.h: Reformatted. Made the constructors private. Added static
create functions that return objects already wrapped in PassRefPtr.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncCompile): Use RegExp::create instead of new RegExp.
(KJS::RegExpObjectImp::construct): Ditto.
* kjs/string_object.cpp:
(KJS::stringProtoFuncMatch): Ditto.
(KJS::stringProtoFuncSearch): Ditto.
2008-02-08 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
<rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
https://bugs.webkit.org/show_bug.cgi?id=17214
Make a subclass of CommaNode to provide the correct precedence for each expression in
a variable declaration list.
* kjs/grammar.y:
* kjs/nodes.h:
(KJS::VarDeclCommaNode::):
2008-02-08 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17247
Labelled continue/break can fail in some cases
Test: fast/js/continue-break-multiple-labels.html
* kjs/nodes.h:
(KJS::StatementNode::pushLabel): Made this virtual.
(KJS::LabelNode::pushLabel): Forward pushLabel calls to the statement inside.
2008-02-08 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix http://bugs.webkit.org/show_bug.cgi?id=15003
Function.prototype.constructor should not be DontDelete/ReadOnly (Acid3 bug)
Test: fast/js/constructor-attributes.html
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset): Remove unwanted attributes from "constructor".
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct): Ditto.
* kjs/nodes.cpp:
(KJS::FuncDeclNode::makeFunction): Ditto.
(KJS::FuncExprNode::evaluate): Ditto.
2008-02-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Added an ASSERT to catch refCount underflow, since it caused a leak in
my last check-in.
* wtf/RefCounted.h:
(WTF::RefCounted::deref):
2008-02-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
slower due to r28884 (global variable symbol table optimization)
Tweaked RefCounted::deref() to be a little more efficient.
1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
* wtf/RefCounted.h:
(WTF::RefCounted::deref): Don't modify m_refCount if we're just going
to delete the object anyway. Also, use a simple == test, which might be
faster than <= on some hardware.
2008-02-06 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=17094
Array.prototype functions create length properties with DontEnum/DontDelete
Test results match Gecko with very few obscure exceptions that seem to be
bugs in Gecko.
Test: fast/js/array-functions-non-arrays.html
* kjs/array_object.cpp:
(KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
to set length.
(KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
which is not needed for real arrays, but is needed for non-arrays.
(KJS::arrayProtoFuncPush): Ditto.
(KJS::arrayProtoFuncShift): Ditto.
(KJS::arrayProtoFuncSlice): Ditto.
(KJS::arrayProtoFuncSort): Removed incorrect call to set length when
the array has no elements.
(KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
to set length.
(KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
make behavior match the specification in that case.
* kjs/nodes.cpp:
(KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
to set length.
2008-02-06 Darin Adler <darin@apple.com>
Reviewed by Sam.
- replace calls to put to set up properties with calls to putDirect, to
prepare for a future change where put won't take attributes any more,
and for a slight performance boost
* API/JSObjectRef.cpp:
(JSObjectMakeConstructor): Use putDirect instead of put.
* kjs/CommonIdentifiers.h: Removed lastIndex.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset): Use putDirect instead of put.
* kjs/array_object.cpp:
(KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
(KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
* kjs/function.cpp:
(KJS::Arguments::Arguments): Use putDirect instead of put.
(KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct): Use putDirect instead of put.
* kjs/nodes.cpp:
(KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
(KJS::FuncExprNode::evaluate): Use putDirect instead of put.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
(KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
calling get and put.
* kjs/regexp_object.h:
(KJS::RegExpImp::setLastIndex): Added.
* kjs/string_object.cpp:
(KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
2008-02-05 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
NodeList (and other DOM lists) items are not enumeratable using for..in
* JavaScriptCore.exp:
2008-02-05 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Update versioning to support the mysterious future.
* Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
<http://bugs.webkit.org/show_bug.cgi?id=16889>
<rdar://problem/5696255>
<http://bugs.webkit.org/show_bug.cgi?id=17015>
<http://bugs.webkit.org/show_bug.cgi?id=17164>
<rdar://problem/5720947>
The ActivationImp tear-off (r29425) introduced a problem with ReadModify
nodes that first resolve a slot, call valueForReadModifyNode(), and then
store a value in the previously resolved slot. Since valueForReadModifyNode()
may cause a tear-off, the slot needs to be resolved again, but this was
not happening with the existing code.
* kjs/nodes.cpp:
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
2008-02-04 Cameron McCormack <cam@mcc.id.au>
Reviewed by Geoff Garen.
Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
* API/JSNode.c:
(JSNode_appendChild):
(JSNode_removeChild):
(JSNode_replaceChild):
(JSNode_getNodeType):
(JSNode_getFirstChild):
* API/JSNodeList.c:
(JSNodeList_length):
* API/JSObjectRef.h:
2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Alp Toker and Mark Rowe.
Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
Bug 17175: Use of C++ compiler flags in CFLAGS
* GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
2008-02-04 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
Remove all trailing whitespace in the GTK+ port and related
components.
* GNUmakefile.am:
2008-02-02 Darin Adler <darin@apple.com>
Reviewed by Geoff Garen.
PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
slower due to r28884 (global variable symbol table optimization)
Geoff's theory is that the slowdown was due to copying hash tables when
putting things into the back/forward cache. If that's true, then this
should fix the problem.
(According to Geoff's measurements, in a PLT that exaggerates the
importance of symbol table saving during cached page creation, this
patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
* JavaScriptCore.exp: Updated.
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
which has been revised to avoid initializing each SavedProperty twice when building
the array. Store the property names too, so we don't have to store the symbol table
separately. Do this by iterating the symbol table instead of the local storage vector.
(KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
well as the local storage vector.
* kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
that takes a const reference to a SavedProperties object.
* kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
other declarations of attributes elsewhere.
* kjs/property_map.cpp:
(KJS::SavedProperties::SavedProperties): Updated for data member name change.
(KJS::PropertyMap::save): Updated for data member name change and to use the new
inline init function instead of setting the fields directly. This allows us to
skip initializing the SavedProperty objects when first allocating the array, and
just do it when we're actually setting up the individual elements.
(KJS::PropertyMap::restore): Updated for SavedProperty changes.
* kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
it does not get initialized at construction time to avoid initializing twice when
creating an array of SavedProperty. Removed the m_ prefixes from the members of
the SavedProperties struct. Generally we use m_ for class members and not struct.
2008-02-02 Tony Chang <idealisms@gmail.com>
Reviewed by darin. Landed by eseidel.
Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
* kjs/config.h:
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
2008-01-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
- Fix whitespace in nodes.h/cpp and nodes2string.cpp.
(NOTE: Specific changed functions elided for space and clarity)
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-01-27 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
nodes.h/cpp has been rolling around in the mud - lets hose it down
- Rename member variables to use the m_ prefix.
(NOTE: Specific changed functions elided for space and clarity)
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-01-27 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix <rdar://problem/5657450> REGRESSION: const is broken
Test: fast/js/const.html
SunSpider said this was 0.3% slower. And I saw some Shark samples in
JSGlobalObject::put -- not a lot but a few. We may be able to regain the
speed, but for now we will take that small hit for correctness sake.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
instead of passing attributes.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
here, since we only set attributes when creating a property. Added the code
to check read-only here, since we need that to implement const!
* kjs/function.cpp:
(KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
instead of passing attributes.
* kjs/nodes.cpp:
(KJS::isConstant): Added.
(KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
if optimizing for a local variable and the variable is constant.
(KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
(KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
(KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
(KJS::PreIncConstNode::evaluate): Return the value + 1.
(KJS::PreDecConstNode::evaluate): Return the value - 1.
(KJS::PostIncConstNode::evaluate): Return the value converted to a number.
(KJS::PostDecConstNode::evaluate): Ditto.
(KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
if optimizing for a local variable and the variable is constant.
(KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
(KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
node optimizeVariableAccess functions, since that's where we need to look to
figure out if a variable is constant.
(KJS::FunctionBodyNode::processDeclarations): Moved the call to
optimizeVariableAccess until after localStorage is set up.
(KJS::ProgramNode::processDeclarations): Ditto.
* kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
as flag masks, so a value of 0 will not work for IsConstant. Changed the
first parameter to optimizeVariableAccess to be a const reference to a symbol
table and added a const reference to local storage. Added classes for const
versions of local variable access: PostIncConstNode, PostDecConstNode,
PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
* kjs/object.cpp:
(KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
expression to match the form used at the two other call sites.
2008-01-27 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=16498
''.constructor.toString() gives [function]
Test: fast/js/function-names.html
* kjs/array_object.cpp:
(KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
* kjs/bool_object.cpp:
(KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
* kjs/date_object.cpp:
(KJS::DateObjectImp::DateObjectImp): Ditto.
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
(KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
(KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
(KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
name.
* kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
* kjs/function.h: Removed unneeded constructor for internal functions without names.
We want to avoid those!
* kjs/function_object.cpp:
(KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
that have no names. There's no reason to do that.
(KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
function name.
* kjs/internal.cpp: Removed the unused constructor.
* kjs/number_object.cpp:
(KJS::fractionalPartToString): Marked static for internal linkage.
(KJS::exponentialPartToString): Ditto.
(KJS::numberProtoFuncToPrecision): Removed an unneeded else.
(KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
function name.
(KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
* kjs/object_object.cpp:
(KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
* kjs/string_object.cpp:
(KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
function name.
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17027
Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
Test: fast/js/function-toString-parentheses.html
The problem here was that a NumberNode with a negative number in it had the wrong
precedence. It's not a primary expression, it's a unary operator with a primary
expression after it.
Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
The reason we handle numbers before dot nodes specially is that the dot is a
legal character in a number. The same is not true of a bracket. Eventually we
could get smarter, and only add the parentheses when there is actual ambiguity.
There is none if the string form of the number already has a dot in it, or if
it's a number with a alphabetic name like infinity or NAN.
* kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
(KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
they serialize as a unary operator, not a primary expression.
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
parens; one set is enough.
(KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
operator precedence suffices.
(KJS::NewExprNode::streamTo): Ditto.
2008-01-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej and Darin.
Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
Function.toString does not parenthesise numbers for the bracket accessor
It turns out that logic was there for all of the dot accessor nodes to make numbers be
parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
I renamed the enum type to reflect the fact that it is now used for both dot and bracket
accessors.
* kjs/nodes2string.cpp:
(KJS::bracketNodeStreamTo):
(KJS::BracketAccessorNode::streamTo):
2008-01-26 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
Don't quote getter and setter names during output, as that is simply wrong.
* kjs/nodes2string.cpp:
(KJS::PropertyNode::streamTo):
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- http://bugs.webkit.org/show_bug.cgi?id=16860
a bit of cleanup after the Activation optimization
* JavaScriptCore.exp: Export the GlobalExecState constructor instead of
the global flavor of the ExecState constructor. It'd probably be cleaner
to not export either one, but JSGlobalObject inlines the code that
constructs the ExecState. If we changed that, we could remove this export.
* JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
put the new source files into the kjs group rather than at the top level.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState): Marked inline and updated for data member
name changes. This is now only for use for the derived classes. Also removed
code that sets the unused m_savedExec data member for the global case. That
data member is only used for the other two types.
(KJS::ExecState::~ExecState): Marked inline and removed all the code.
The derived class destructors now inclde the appropriate code.
(KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
an empty scope chain. The bottom function already returns 0 for that case,
so the general case code handles it fine. Also changed to use data members
directly rather than calling functions.
(KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
class constructor.
(KJS::GlobalExecState::~GlobalExecState): Added.
(KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
manipulate activeExecStates here since we don't want to have to check for the
special case of globalExec.
(KJS::InterpreterExecState::~InterpreterExecState): Added.
(KJS::EvalExecState::EvalExecState): Added.
(KJS::EvalExecState::~EvalExecState): Added.
(KJS::FunctionExecState::FunctionExecState): Added.
(KJS::FunctionExecState::~FunctionExecState): Added.
* kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
Made ExecState inherit from Noncopyable. Reformatted some comments and
made them a bit more brief. Rearranged declarations a little bit and removed
unused savedExec function. Changed seenLabels function to return a reference
rather than a pointer. Made constructors and destructor protected, and also
did the same with all data members. Renamed m_thisVal to m_thisValue and
ls to m_labelStack. Added three new derived classes for each of the
types of ExecState. The primary goal here was to remove a branch from the
code in the destructor, but it's also clearer than overloading the arguments
to the ExecState constructor.
* kjs/JSGlobalObject.cpp:
(KJS::getCurrentTime): Fixed formatting.
(KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
the expression clearer -- other similar sites didn't have these parentheses,
even the one a couple lines earlier that sets stackEntry.
(KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
(I think I mentioned this during patch review) and used an early exit so that
the entire contents of the function aren't nested inside an if statement.
Also removed the check of codeType, instead checking Activation for 0.
For now, I kept the codeType check, but inside an assertion.
* kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
(KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate): Changed type to GlobalExecState.
* kjs/nodes.cpp:
(KJS::ContinueNode::execute): Changed code since seenLabels() returns a
reference now instead of a pointer.
(KJS::BreakNode::execute): Ditto.
(KJS::LabelNode::execute): Ditto.
2008-01-26 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
Cleanup node2string a little.
- Remove some unnecessary branching.
- Factor out bracket and dot streaming into static inline functions.
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::bracketNodeStreamTo):
(KJS::dotNodeStreamTo):
(KJS::FunctionCallBracketNode::streamTo):
(KJS::FunctionCallDotNode::streamTo):
(KJS::PostIncBracketNode::streamTo):
(KJS::PostDecBracketNode::streamTo):
(KJS::PostIncDotNode::streamTo):
(KJS::PostDecDotNode::streamTo):
(KJS::DeleteBracketNode::streamTo):
(KJS::DeleteDotNode::streamTo):
(KJS::PreIncBracketNode::streamTo):
(KJS::PreDecBracketNode::streamTo):
(KJS::PreIncDotNode::streamTo):
(KJS::PreDecDotNode::streamTo):
(KJS::ReadModifyBracketNode::streamTo):
(KJS::AssignBracketNode::streamTo):
(KJS::ReadModifyDotNode::streamTo):
(KJS::AssignDotNode::streamTo):
(KJS::WhileNode::streamTo):
2008-01-26 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
Fix http://bugs.webkit.org/show_bug.cgi?id=17001
Bug 17001: Build error with Gtk port on Mac OS X
If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
in this instance.
* bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17013
JSC can't round trip certain for-loops
Test: fast/js/toString-for-var-decl.html
* kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
for loops without injecting the word "true" into them (nice, but not
the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
only when there is an expression, since it's common for the actual
variable declaration to be moved by the parser.
* kjs/nodes2string.cpp:
(KJS::PlaceholderTrueNode::streamTo): Added. Empty.
2008-01-25 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
Add logic to ensure that object literals and function expressions get
parentheses when necessary.
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<):
2008-01-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCore.sln:
2008-01-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Fix QDateTime to JS Date conversion.
Several conversion errors (some UTC related, some month
offset related) and the conversion distance for Date
to DateTime conversion weights were fixed (it should never
be better to convert a JS Number into a Date rather than
an int).
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::convertQVariantToValue):
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Add support for calling QObjects.
Add support for invokeDefaultMethod (via a call to
a specific slot), and also allow using it as a
constructor, like QtScript.
* bindings/qt/qt_class.cpp:
(KJS::Bindings::QtClass::fallbackObject):
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::construct):
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::implementsCall):
(KJS::Bindings::QtInstance::invokeDefaultMethod):
* bindings/qt/qt_instance.h:
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::findMethodIndex):
(KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
* bindings/qt/qt_runtime.h:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Code style cleanups.
Add spaces before/after braces in inline function.
* bindings/qt/qt_instance.h:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Code style cleanups.
Remove spaces and unneeded declared parameter names.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Clear stale RuntimeObjectImps.
Since other objects can have refs to the QtInstance,
we can't rely on the QtInstance being deleted when the
RuntimeObjectImp is invalidate or deleted. This
could result in a stale JSObject being returned for
a valid Instance.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::invalidate):
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
(KJS::Bindings::QtInstance::getRuntimeObject):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createRuntimeObject):
* bindings/runtime.h:
2008-01-23 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
Remove whitespace after -I in automake include lists.
* GNUmakefile.am:
2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Lars Knoll <lars@trolltech.com>.
Reworked the JavaScriptCore Qt bindings:
* Add initial support for string and variant arrays, as well
as sub QObjects in the JS bindings.
* Don't expose fields marked as not scriptable by moc.
* Add support for dynamic properties and accessing named
QObject children of an object (like QtScript and older
IE DOM style JS).
* Add support for custom toString methods.
* Fine tune some bindings to be closer to QtScript.
Make void functions return undefined, and empty/
null QStrings return a zero length string.
* Create framework for allowing more direct method calls.
Since RuntimeMethod doesn't allow us to add additional
methods/properties to a function, add these classes.
Start prototyping object.signal.connect(...).
* Add signal support to the Qt bindings.
Allow connecting to signals (object.signal.connect(slot)),
disconnecting, and emitting signals. Currently chooses
the first signal that matches the name, so this will need
improvement.
* Add property names, and resolve signals closer to use.
Enumerating properties now returns some of the Qt properties
and signals. Slots and methods aren't quite present. Also,
resolve signal connections etc. closer to the time of use, so
we can do more dynamic resolution based on argument type etc.
Still picks the first one with the same name, at the moment.
* Make signature comparison code consistent.
Use the same code for checking meta signatures in
the method and fallback getters, and avoid a
QByteArray construction when we can.
* Fix minor memory leak, and handle pointers better.
Delete the private object in the dtors, and use RefPtrs
for holding Instances etc.
* Handle method lookup better.
Allow invocation time method lookup based on the arguments,
which is closer to QtScript behaviour. Also, cache the
method lists and delete them in the QtClass dtor (stops
a memory leak).
* Improve JS to Qt data type conversions.
Add some support for Date & RegExp JS objects,
and provide some metrics on the quality of the
conversion.
* A couple of fixes for autotest failures.
Better support for converting lists, read/write only
QMetaProperty support, modified slot search order...)
* bindings/qt/qt_class.cpp:
(KJS::Bindings::QtClass::QtClass):
(KJS::Bindings::QtClass::~QtClass):
(KJS::Bindings::QtClass::name):
(KJS::Bindings::QtClass::fallbackObject):
(KJS::Bindings::QtClass::methodsNamed):
(KJS::Bindings::QtClass::fieldNamed):
* bindings/qt/qt_class.h:
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::getRuntimeObject):
(KJS::Bindings::QtInstance::getClass):
(KJS::Bindings::QtInstance::implementsCall):
(KJS::Bindings::QtInstance::getPropertyNames):
(KJS::Bindings::QtInstance::invokeMethod):
(KJS::Bindings::QtInstance::invokeDefaultMethod):
(KJS::Bindings::QtInstance::stringValue):
(KJS::Bindings::QtInstance::booleanValue):
(KJS::Bindings::QtInstance::valueOf):
(KJS::Bindings::QtField::name):
(KJS::Bindings::QtField::valueFromInstance):
(KJS::Bindings::QtField::setValueToInstance):
* bindings/qt/qt_instance.h:
(KJS::Bindings::QtInstance::getBindingLanguage):
(KJS::Bindings::QtInstance::getObject):
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::QWKNoDebug::QWKNoDebug):
(KJS::Bindings::QWKNoDebug::~QWKNoDebug):
(KJS::Bindings::QWKNoDebug::operator<<):
(KJS::Bindings::):
(KJS::Bindings::valueRealType):
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::convertQVariantToValue):
(KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
(KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
(KJS::Bindings::QtRuntimeMethod::codeType):
(KJS::Bindings::QtRuntimeMethod::execute):
(KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
(KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
(KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
(KJS::Bindings::QtMethodMatchType::):
(KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
(KJS::Bindings::QtMethodMatchType::kind):
(KJS::Bindings::QtMethodMatchType::isValid):
(KJS::Bindings::QtMethodMatchType::isVariant):
(KJS::Bindings::QtMethodMatchType::isMetaType):
(KJS::Bindings::QtMethodMatchType::isUnresolved):
(KJS::Bindings::QtMethodMatchType::isMetaEnum):
(KJS::Bindings::QtMethodMatchType::enumeratorIndex):
(KJS::Bindings::QtMethodMatchType::variant):
(KJS::Bindings::QtMethodMatchType::metaType):
(KJS::Bindings::QtMethodMatchType::metaEnum):
(KJS::Bindings::QtMethodMatchType::unresolved):
(KJS::Bindings::QtMethodMatchType::typeId):
(KJS::Bindings::QtMethodMatchType::name):
(KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
(KJS::Bindings::QtMethodMatchData::isValid):
(KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
(KJS::Bindings::indexOfMetaEnum):
(KJS::Bindings::findMethodIndex):
(KJS::Bindings::findSignalIndex):
(KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(KJS::Bindings::QtRuntimeMetaMethod::mark):
(KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
(KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
(KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
(KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
(KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
(KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
(KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
(KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
(KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
(KJS::Bindings::QtConnectionObject::QtConnectionObject):
(KJS::Bindings::QtConnectionObject::~QtConnectionObject):
(KJS::Bindings::QtConnectionObject::metaObject):
(KJS::Bindings::QtConnectionObject::qt_metacast):
(KJS::Bindings::QtConnectionObject::qt_metacall):
(KJS::Bindings::QtConnectionObject::execute):
(KJS::Bindings::QtConnectionObject::match):
(KJS::Bindings::::QtArray):
(KJS::Bindings::::~QtArray):
(KJS::Bindings::::rootObject):
(KJS::Bindings::::setValueAt):
(KJS::Bindings::::valueAt):
* bindings/qt/qt_runtime.h:
(KJS::Bindings::QtField::):
(KJS::Bindings::QtField::QtField):
(KJS::Bindings::QtField::fieldType):
(KJS::Bindings::QtMethod::QtMethod):
(KJS::Bindings::QtMethod::name):
(KJS::Bindings::QtMethod::numParameters):
(KJS::Bindings::QtArray::getLength):
(KJS::Bindings::QtRuntimeMethod::d_func):
(KJS::Bindings::QtRuntimeMetaMethod::d_func):
(KJS::Bindings::QtRuntimeConnectionMethod::d_func):
(KJS::Bindings::):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createBindingForLanguageInstance):
(KJS::Bindings::Instance::createRuntimeObject):
(KJS::Bindings::Instance::reallyCreateRuntimeObject):
* bindings/runtime.h:
2008-01-22 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Adam.
<rdar://problem/5688975>
div element on microsoft site has wrong left offset.
Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
(and is what the Silverlight plug-in expects).
* bindings/NP_jsobject.cpp:
(_NPN_GetProperty):
2008-01-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
REGRESSION: Amazon.com crash (ActivationImp)
(and a bunch of other crashes)
Plus, a .7% SunSpider speedup to boot.
Replaced the buggy currentExec and savedExec mechanisms with an
explicit ExecState stack.
* kjs/collector.cpp:
(KJS::Collector::collect): Explicitly mark the ExecState stack.
(KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
behavior: We no longer throw an exception in any global ExecStates,
since global ExecStates are more like pseudo-ExecStates, and aren't
used for script execution. (It's unclear what would happen if you left
an exception waiting around in a global ExecState, but it probably
wouldn't be good.)
2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16955
Get errors when cross-compile webkit-gtk
* GNUmakefile.am: removed ICU_CFLAGS
2008-01-18 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* kjs/ustring.h:
2008-01-18 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* kjs/ustring.cpp:
* kjs/ustring.h:
(KJS::UString::cost):
2008-01-18 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
- Correctly report cost of appended strings to trigger GC.
* kjs/ustring.cpp:
(KJS::UString::Rep::create):
(KJS::UString::UString): Don't create unnecssary objects.
(KJS::UString::cost): Report cost if necessary but also keep track of
reported cost.
* kjs/ustring.h:
2008-01-18 Simon Hausmann <hausmann@webkit.org>
Reviewed by Holger.
Fix return type conversions from Qt slots to JS values.
This also fixes fast/dom/open-and-close-by-DOM.html, which called
layoutTestController.windowCount().
When constructing the QVariant that holds the return type we cannot
use the QVarian(Type) constuctor as that will create a null variant.
We have to use the QVariant(Type, void *) constructor instead, just
like in QMetaObject::read() for example.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::getRuntimeObject):
2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
Reviewed by Simon Hausmann <hausmann@webkit.org>.
Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
Reviewed by Simon Hausmann <hausmann@webkit.org>.
Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
* wtf/Platform.h:
2008-01-17 Antti Koivisto <antti@apple.com>
Fix Windows build.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncToString):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
Convert remaining JS function objects to use the new PrototypeFunction class
- Moves Boolean, Function, RegExp, Number, Object and Global functions to their
own static function implementations so that they can be used with the
PrototypeFunction class. SunSpider says this is 1.003x as fast.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(KJS::BooleanInstance::BooleanInstance):
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::booleanProtoFuncValueOf):
(KJS::BooleanObjectImp::BooleanObjectImp):
(KJS::BooleanObjectImp::implementsConstruct):
(KJS::BooleanObjectImp::construct):
(KJS::BooleanObjectImp::callAsFunction):
* kjs/bool_object.h:
(KJS::BooleanInstance::classInfo):
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::errorProtoFuncToString):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::globalFuncEval):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncIsNaN):
(KJS::globalFuncIsFinite):
(KJS::globalFuncDecodeURI):
(KJS::globalFuncDecodeURIComponent):
(KJS::globalFuncEncodeURI):
(KJS::globalFuncEncodeURIComponent):
(KJS::globalFuncEscape):
(KJS::globalFuncUnEscape):
(KJS::globalFuncKJSPrint):
(KJS::PrototypeFunction::PrototypeFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
(KJS::functionProtoFuncToString):
(KJS::functionProtoFuncApply):
(KJS::functionProtoFuncCall):
* kjs/function_object.h:
* kjs/number_object.cpp:
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncValueOf):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
* kjs/number_object.h:
(KJS::NumberInstance::classInfo):
(KJS::NumberObjectImp::classInfo):
(KJS::NumberObjectImp::):
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
(KJS::objectProtoFuncValueOf):
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncIsPrototypeOf):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
* kjs/object_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::regExpProtoFuncTest):
(KJS::regExpProtoFuncExec):
(KJS::regExpProtoFuncCompile):
(KJS::regExpProtoFuncToString):
* kjs/regexp_object.h:
2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej & Darin.
Fixes Bug 16868: Gmail crash
and Bug 16871: Crash when loading apple.com/startpage
<http://bugs.webkit.org/show_bug.cgi?id=16868>
<rdar://problem/5686108>
<http://bugs.webkit.org/show_bug.cgi?id=16871>
<rdar://problem/5686670>
Adds ActivationImp tear-off for cross-window eval() and fixes an
existing garbage collection issue exposed by the ActivationImp tear-off
patch (r29425) that can occur when an ExecState's m_callingExec is
different than its m_savedExec.
* kjs/ExecState.cpp:
(KJS::ExecState::mark):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Oliver.
Clean up MathObjectImp, it needed a little scrubbing.
* kjs/math_object.cpp:
(KJS::MathObjectImp::MathObjectImp):
(KJS::MathObjectImp::getOwnPropertySlot):
(KJS::MathObjectImp::getValueProperty):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/math_object.h:
(KJS::MathObjectImp::classInfo):
(KJS::MathObjectImp::):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Rename Lexer variable bol to atLineStart.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::setCode):
(KJS::Lexer::nextLine):
(KJS::Lexer::lex):
* kjs/lexer.h:
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen and Anders Carlsson.
Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
and we have many features that are not included in the ECMA spec.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::setCode):
(KJS::Lexer::nextLine):
(KJS::Lexer::lex):
* kjs/lexer.h:
* kjs/string_object.cpp:
* kjs/string_object.h:
2008-01-15 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
- This changes the way JS functions that use Lookup tables are handled. Instead of using
one class per function, which allowed specialization of the virtual callAsFunction
method, we now use one class, PrototypeFunction, which takes a pointer to a static
function to use as the implementation. This significantly decreases the binary size
of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
wiggle room from the original 1% speedup) and keeps the functions implementations in separate
functions to help with optimizations.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/array_object.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncReverse):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSort):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
* kjs/array_object.h:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::dateProtoFuncSetMilliSeconds):
(KJS::dateProtoFuncSetUTCMilliseconds):
(KJS::dateProtoFuncSetSeconds):
(KJS::dateProtoFuncSetUTCSeconds):
(KJS::dateProtoFuncSetMinutes):
(KJS::dateProtoFuncSetUTCMinutes):
(KJS::dateProtoFuncSetHours):
(KJS::dateProtoFuncSetUTCHours):
(KJS::dateProtoFuncSetDate):
(KJS::dateProtoFuncSetUTCDate):
(KJS::dateProtoFuncSetMonth):
(KJS::dateProtoFuncSetUTCMonth):
(KJS::dateProtoFuncSetFullYear):
(KJS::dateProtoFuncSetUTCFullYear):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/date_object.h:
* kjs/function.cpp:
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeFunction::callAsFunction):
* kjs/function.h:
* kjs/lookup.h:
(KJS::HashEntry::):
(KJS::staticFunctionGetter):
* kjs/math_object.cpp:
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/math_object.h:
* kjs/string_object.cpp:
(KJS::stringProtoFuncToString):
(KJS::stringProtoFuncValueOf):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
* kjs/string_object.h:
2008-01-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Some tweaks to our headerdoc, suggested by David Gatwood on the docs
team.
* API/JSBase.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSValueRef.h:
2008-01-15 Alp Toker <alp@atoker.com>
Rubber-stamped by Anders.
Make the HTTP backend configurable in the GTK+ port. curl is currently
the only option.
* wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
2008-01-15 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Remove unneeded variable.
* kjs/string_object.cpp:
(KJS::StringProtoFuncSubstr::callAsFunction):
2008-01-14 Steve Falkenburg <sfalken@apple.com>
Use shared vsprops for most vcproj properties.
Reviewed by Darin.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-01-14 Adam Roben <aroben@apple.com>
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
some headers that were missing from the vcproj so their contents will
be included in Find in Files.
2008-01-14 Adam Roben <aroben@apple.com>
Fix Bug 16871: Crash when loading apple.com/startpage
<http://bugs.webkit.org/show_bug.cgi?id=16871>
<rdar://problem/5686670>
Patch written by Darin, reviewed by me.
* kjs/ExecState.cpp:
(KJS::ExecState::mark): Call ActivationImp::markChildren if our
m_activation is on the stack. This is what ScopeChain::mark also does,
but apparently in some cases it's possible for an ExecState's
ActivationImp to not be in any ScopeChain.
2008-01-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Oliver.
-<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
trying to view techreport.com comments
- We need to set values in the map, because if they are already in the
map they will not be reset when we use add().
* kjs/array_instance.cpp:
(KJS::ArrayInstance::put):
2008-01-14 Darin Adler <darin@apple.com>
Reviewed by Adam.
- re-speed-up the page load test (my StringImpl change slowed it down)
* wtf/RefCounted.h:
(WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
count other than 0. Eventually everyone will want to start with a 1. This is a
staged change. For now, there's a default of 0, and you can specify 1. Later,
there will be no default and everyone will have to specify. And then later, there
will be a default of 1. Eventually, we can take away even the option of starting
with 0!
* wtf/Vector.h:
(WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
overhead of first constructing something empty and then calling resize.
(WTF::Vector::clear): Sped up the common case of calling clear on an empty
vector by adding a check for that case.
(WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
in the case of vectors with no inline capacity (normal vectors) by leaving out
the code to copy the inline buffer in that case.
2008-01-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by David Kilzer.
http://bugs.webkit.org/show_bug.cgi?id=16787
array.splice() with 1 element not working
Test: fast/js/array-splice.html
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
some other edge cases.
2008-01-13 Steve Falkenburg <sfalken@apple.com>
Share common files across projects.
Unify vsprops files
Debug: common.vsprops, debug.vsprops
Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
Release: common.vsprops, release.vsprops
Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
Reviewed by Adam Roben.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.vcproj/debug.vsprops: Removed.
* JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
* JavaScriptCore.vcproj/release.vsprops: Removed.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
Contributions and review by Adriaan de Groot,
Simon Hausmann, Eric Seidel, and Darin Adler.
- http://bugs.webkit.org/show_bug.cgi?id=16590
Compilation fixes for Solaris.
* kjs/DateMath.h:
(KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
fields.
(KJS::GregorianDateTime::operator tm): Ditto.
* kjs/collector.cpp:
(KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
* wtf/MathExtras.h:
(isfinite): Implement for Solaris.
(isinf): Ditto.
(signbit): Ditto. But this one is wrong, so I added a FIXME.
* wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Anders Carlsson.
Add binding language type to Instance.
Allows runtime determination of the type of an
Instance, to allow safe casting. Doesn't actually
add any safe casting yet, though.
Add a helper function to get an Instance from a JSObject*.
Given an object and the expected binding language, see if
the JSObject actually wraps an Instance of the given type
and return it. Otherwise return 0.
Move RuntimeObjectImp creations into Instance.
Make the ctor protected, and Instance a friend class, so
that all creation of RuntimeObjectImps goes through
one place.
Remove copy ctor/assignment operator for QtInstance.
Instance itself is Noncopyable, so QtInstance doesn't
need to have these.
Add caching for QtInstance and associated RuntimeObjectImps.
Push any dealings with QtLanguage bindings into QtInstance,
and cache them there, rather than in the Instance layer. Add
a QtRuntimeObjectImp to help with caching.
* JavaScriptCore.exp:
* bindings/c/c_instance.h:
* bindings/jni/jni_instance.h:
* bindings/objc/objc_instance.h:
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::invalidate):
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::getQtInstance):
(KJS::Bindings::QtInstance::getRuntimeObject):
* bindings/qt/qt_instance.h:
(KJS::Bindings::QtInstance::getBindingLanguage):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createBindingForLanguageInstance):
(KJS::Bindings::Instance::createRuntimeObject):
(KJS::Bindings::Instance::getInstance):
* bindings/runtime.h:
* bindings/runtime_object.h:
(KJS::RuntimeObjectImp::getInternalInstance):
2008-01-12 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Hide non-public symbols in GTK+/autotools release builds.
* GNUmakefile.am:
2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Mark Rowe.
Fix http://bugs.webkit.org/show_bug.cgi?id=16852
Fixes leaking of ActivationStackNode objects.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::deleteActivationStack):
(KJS::JSGlobalObject::~JSGlobalObject):
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::reset):
* kjs/JSGlobalObject.h:
2008-01-12 Darin Adler <darin@apple.com>
- try to fix Qt Windows build
* pcre/dftables: Remove reliance on the list form of Perl pipes.
2008-01-12 Darin Adler <darin@apple.com>
- try to fix Qt build
* kjs/function.cpp: Added include of scope_chain_mark.h.
* kjs/scope_chain_mark.h: Added multiple-include guards.
2008-01-12 Mark Rowe <mrowe@apple.com>
Another Windows build fix.
* kjs/Activation.h:
2008-01-12 Mark Rowe <mrowe@apple.com>
Attempted Windows build fix. Use struct consistently when forward-declaring
ActivationStackNode and StackActivation.
* kjs/Activation.h:
* kjs/JSGlobalObject.h:
2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Fixes a problem with the ActivationImp tear-off patch (r29425) where
some of the calls to JSGlobalObject::tearOffActivation() were using
the wrong test to determine whether it should leave a relic behind.
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::ActivationImp::getOwnPropertySlot):
2008-01-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
variable access (16644)
This bug was caused by var declarations shadowing built-in properties of
the global object.
To match Firefox, we've decided that var declarations will never shadow
built-in properties of the global object or its prototypes. We used to
behave more like IE, which allows shadowing, but walking that line got
us into trouble with websites that sent us down the Firefox codepath.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): New code to support calling
hasProperty before the variable object is fully initialized (so you
can call it during initialization).
* kjs/nodes.cpp:.
(KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
check when looking for duplicates, not getDirect, since it only checks
the property map, and not hasOwnProperty, since it doesn't check
prototypes.
(KJS::EvalNode::processDeclarations): ditto
* kjs/property_slot.h:
(KJS::PropertySlot::ungettableGetter): Best function name evar.
2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Optimized ActivationImp allocation, so that activation records are now
first allocated on an explicitly managed stack and only heap allocated
when necessary. Roughly a 5% improvement on SunSpider, and a larger
improvement on benchmarks that use more function calls.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Activation.h: Added.
(KJS::ActivationImp::ActivationData::ActivationData):
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::classInfo):
(KJS::ActivationImp::isActivationObject):
(KJS::ActivationImp::isOnStack):
(KJS::ActivationImp::d):
(KJS::StackActivation::StackActivation):
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
* kjs/ExecState.h:
(KJS::ExecState::replaceScopeChainTop):
(KJS::ExecState::setActivationObject):
(KJS::ExecState::setLocalStorage):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
(KJS::JSGlobalObject::pushActivation):
(KJS::JSGlobalObject::checkActivationCount):
(KJS::JSGlobalObject::popActivationHelper):
(KJS::JSGlobalObject::popActivation):
(KJS::JSGlobalObject::tearOffActivation):
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
(KJS::JSVariableObject::JSVariableObject):
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::~ActivationImp):
(KJS::ActivationImp::init):
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::markHelper):
(KJS::ActivationImp::mark):
(KJS::ActivationImp::ActivationData::ActivationData):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::WithNode::execute):
(KJS::TryNode::execute):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FuncExprNode::evaluate):
* kjs/object.h:
* kjs/scope_chain.h:
(KJS::ScopeChain::replace):
* kjs/scope_chain_mark.h: Added.
(KJS::ScopeChain::mark):
2008-01-11 Simon Hausmann <hausmann@webkit.org>
Reviewed by Mark Rowe.
Fix the (clean) qmake build. For generating chartables.c we don't
depend on a separate input source file anymore, the dftables perl
script is enough. So use that instead as value for the .input
variable, to ensure that qmake also generates a rule to call dftables.
* pcre/pcre.pri:
2008-01-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by John Sullivan.
Fixed some world leak reports:
* <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
Interpreter after running cvs-base suite
* <rdar://problem/5669423> PLT complains about world leak if browser
window is open when PLT starts
* kjs/collector.h: Added the ability to distinguish between global
objects and GC-protected global objects, since we only consider the
latter to be world leaks.
* kjs/collector.cpp:
2008-01-11 Mark Rowe <mrowe@apple.com>
Silence qmake warning about ctgen lacking input.
Rubber-stamped by Alp Toker.
* pcre/pcre.pri:
2008-01-10 David Kilzer <ddkilzer@apple.com>
dftables should be rewritten as a script
<http://bugs.webkit.org/show_bug.cgi?id=16818>
<rdar://problem/5681463>
Reviewed by Darin.
Rewrote the dftables utility in Perl. Attempted to switch all
build systems to call the script directly instead of building
a binary first. Only the Xcode build was able to be tested.
* DerivedSources.make: Added pcre directory to VPATH and changed
to invoke dftables directly.
* GNUmakefile.am: Removed build information and changed to invoke
dftables directly.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
dftables project.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
* JavaScriptCore.vcproj/dftables: Removed.
* JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
* JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
* jscore.bkl: Removed dftables executable definition.
* pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
* pcre/dftables.cpp: Removed.
* pcre/dftables.pro: Removed.
* pcre/pcre.pri: Removed references to dftables.cpp and changed to
invoke dftables directly.
2008-01-10 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix http://bugs.webkit.org/show_bug.cgi?id=16782
<rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
The crash resulted from a native object (DumpRenderTree's
EventSender) causing its wrapper to be invalidated (by clicking a
link that replaced the document in the window) and consequently
deallocated. The fix is to use RefPtrs to protect the native object
from deletion by self-invalidation.
* bindings/runtime_method.cpp:
(RuntimeMethod::callAsFunction):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
(RuntimeObjectImp::put):
(RuntimeObjectImp::defaultValue):
(RuntimeObjectImp::callAsFunction):
2008-01-07 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
where possible.
* kjs/testkjs.cpp:
* wtf/HashTraits.h:
2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Mark.
Enable SVG_FONTS by default.
* Configurations/JavaScriptCore.xcconfig:
2008-01-07 Darin Adler <darin@apple.com>
Rubber stamped by David Kilzer.
- get rid of empty fpconst.cpp
* GNUmakefile.am: Remove fpconst.cpp.
* JavaScriptCore.pri: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* JavaScriptCoreSources.bkl: Ditto.
* kjs/fpconst.cpp: Removed.
2008-01-07 Darin Adler <darin@apple.com>
Reviewed by David Kilzer.
- fix alignment problem with NaN and Inf globals
* kjs/fpconst.cpp: Move the contents of this file from here back to
value.cpp. The reason this was in a separate file is that the DARWIN
version of this used a declaration of the globals with a different
type to avoid creating "init routines". That's no longer necessary for
DARWIN and was never necessary for the non-DARWIN code path.
To make this patch easy to merge, I didn't actually delete this file
yet. We'll do that in a separate changeset.
* kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
othrewise use the union trick from fpconst.cpp. I think it would be
better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
directly or std::numeric_limits<double>::quiet_nan() and
std::numeric_limits<double>::infinity(). But when I tried that, it
slowed down SunSpider. Someone else could do that cleanup if they
could do it without slowing down the engine.
2008-01-07 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
JavaScript.h to the project.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Copy JavaScript.h to WEBKITOUTPUTDIR.
2008-01-07 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
Fix Mac build.
* API/JSNode.c:
* API/JSNode.h:
* API/JSNodeList.c:
* API/JSNodeList.h:
* API/JavaScript.h:
* API/JavaScriptCore.h:
* API/minidom.c:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-01-07 Alp Toker <alp@atoker.com>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=16029
JavaScriptCore.h is not suitable for platforms other than Mac OS X
Introduce a new JavaScriptCore/JavaScript.h public API header. This
should be used by all new portable code using the JavaScriptCore API.
JavaScriptCore/JavaScriptCore.h will remain for compatibility with
existing applications that depend on it including JSStringRefCF.h
which isn't portable.
Also add minidom to the GTK+/autotools build since we can now support
it on all platforms.
* API/JSNode.h:
* API/JSNodeList.h:
* API/JavaScript.h: Added.
* API/JavaScriptCore.h:
* ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
* GNUmakefile.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-01-06 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract all DateObject.set* functions in preparation for fixing:
http://bugs.webkit.org/show_bug.cgi?id=16753
SunSpider had random changes here and there but was overall a wash.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncSetSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncSetMinutes::callAsFunction):
(KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncSetHours::callAsFunction):
(KJS::DateProtoFuncSetUTCHours::callAsFunction):
(KJS::DateProtoFuncSetDate::callAsFunction):
(KJS::DateProtoFuncSetUTCDate::callAsFunction):
(KJS::DateProtoFuncSetMonth::callAsFunction):
(KJS::DateProtoFuncSetUTCMonth::callAsFunction):
(KJS::DateProtoFuncSetFullYear::callAsFunction):
(KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Dan.
Add new helper function isArabicChar - SVG Fonts support needs it.
* wtf/unicode/icu/UnicodeIcu.h:
(WTF::Unicode::isArabicChar):
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::isArabicChar):
2008-01-06 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
build. (This is already done correctly in DerivedSources.make.) Issue
noticed by Mikkel when building in Cygwin.
Add a missing slash. This was a hack from the qmake build system that
isn't necessary with autotools.
* GNUmakefile.am:
2008-01-05 Darin Adler <darin@apple.com>
* API/JSRetainPtr.h: One more file that needed the change below.
2008-01-05 Darin Adler <darin@apple.com>
* wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
2008-01-05 Adam Roben <aroben@apple.com>
Build fix.
Reviewed by Maciej.
* wtf/RetainPtr.h: Use PtrType instead of T* because of the
RemovePointer magic.
2008-01-05 Darin Adler <darin@apple.com>
Rubber stamped by Maciej Stachowiak.
- cut down own PIC branches by using a pointer-to-member-data instead of a
pointer-to-member-function in WTF smart pointers
* wtf/OwnArrayPtr.h:
* wtf/OwnPtr.h:
* wtf/PassRefPtr.h:
* wtf/RefPtr.h:
* wtf/RetainPtr.h:
Use a pointer to the m_ptr member instead of the get member.
The GCC compiler generates better code for this idiom.
2008-01-05 Henry Mason <hmason@mac.com>
Reviewed by Maciej Stachowiak.
http://bugs.webkit.org/show_bug.cgi?id=16738
Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
Gives a 0.4% SunSpider boost and prettier code.
* kjs/collector.cpp: Switched to cell offsets from byte offsets
(KJS::Collector::heapAllocate):
(KJS::Collector::sweep):
2008-01-04 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
was not allocated by any registered malloc zone on the system.
* kjs/CollectorHeapIntrospector.h:
* wtf/FastMalloc.cpp:
2008-01-04 Alp Toker <alp@atoker.com>
GTK+ autotools build fix. Terminate empty rules.
* GNUmakefile.am:
2008-01-03 Simon Hausmann <hausmann@webkit.org>
Reviewed by Mark Rowe.
Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
* pcre/pcre_exec.cpp:
2008-01-03 Darin Adler <darin@apple.com>
* tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
that test to succeed.
2008-01-02 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16696
JSCRE fails fails to match Acid3 regexp
Test: fast/regex/early-acid3-86.html
The problem was with the cutoff point between backreferences and octal
escape sequences. We need to determine the cutoff point by counting the
total number of capturing brackets, which requires an extra pass through
the expression when compiling it.
* pcre/pcre_compile.cpp:
(CompileData::CompileData): Added numCapturingBrackets. Removed some
unused fields.
(compileBranch): Use numCapturingBrackets when calling checkEscape.
(calculateCompiledPatternLength): Use numCapturingBrackets when calling
checkEscape, and also store the bracket count at the end of the compile.
(jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
count the number of brackets and then a second time to calculate the length.
2008-01-02 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16696
JSCRE fails fails to match Acid3 regexp
Test: fast/regex/early-acid3-86.html
The problem was with the cutoff point between backreferences and octal
escape sequences. We need to determine the cutoff point by counting the
total number of capturing brackets, which requires an extra pass through
the expression when compiling it.
* pcre/pcre_compile.cpp:
(CompileData::CompileData): Added numCapturingBrackets. Removed some
unused fields.
(compileBranch): Use numCapturingBrackets when calling checkEscape.
(calculateCompiledPatternLength): Use numCapturingBrackets when calling
checkEscape, and also store the bracket count at the end of the compile.
(jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
count the number of brackets and then a second time to calculate the length.
2008-01-02 David Kilzer <ddkilzer@webkit.org>
Reviewed and landed by Darin.
* kjs/nodes.cpp:
(KJS::DoWhileNode::execute): Added a missing return.
2008-01-02 Darin Adler <darin@apple.com>
- try to fix Qt build
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::foldCase): Add some missing const.
2008-01-02 Alice Liu <alice.liu@apple.com>
Reviewed by Sam Weinig.
need to export ASCIICType.h for use in DRT
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* wtf/ASCIICType.h:
(WTF::isASCIIUpper):
2008-01-02 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Cleanup error_object.h/cpp.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/error_object.cpp:
(KJS::ErrorInstance::ErrorInstance):
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
(KJS::ErrorProtoFuncToString::callAsFunction):
(KJS::ErrorObjectImp::ErrorObjectImp):
(KJS::ErrorObjectImp::implementsConstruct):
(KJS::ErrorObjectImp::construct):
(KJS::ErrorObjectImp::callAsFunction):
(KJS::NativeErrorPrototype::NativeErrorPrototype):
(KJS::NativeErrorImp::NativeErrorImp):
(KJS::NativeErrorImp::implementsConstruct):
(KJS::NativeErrorImp::construct):
(KJS::NativeErrorImp::callAsFunction):
(KJS::NativeErrorImp::mark):
* kjs/error_object.h:
(KJS::ErrorInstance::classInfo):
(KJS::NativeErrorImp::classInfo):
2008-01-02 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Alp Toker.
* GNUmakefile.am: Add missing dependency on grammar.y.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix for http://bugs.webkit.org/show_bug.cgi?id=16695
JSC allows non-identifier codepoints in identifiers (affects Acid3)
Test: fast/js/kde/parse.html
* kjs/lexer.cpp:
(KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
start of identifiers from ones inside identifiers. Rejected characters that don't pass
the isIdentStart and isIdentPart tests.
(KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
* kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
from \u escapes inside identifiers.
2008-01-01 Darin Adler <darin@apple.com>
- rolled scope chain optimization out; it was breaking the world
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- http://bugs.webkit.org/show_bug.cgi?id=16685
eliminate List::empty() to cut down on PIC branches
Also included one other speed-up -- remove the call to reserveCapacity from
FunctionBodyNode::processDeclarations in all but the most unusual cases.
Together these make SunSpider 1.016x as fast.
* JavaScriptCore.exp: Updated.
* kjs/ExecState.cpp:
(KJS::globalEmptyList): Added. Called only when creating global ExecState
instances.
(KJS::ExecState::ExecState): Broke constructor up into three separate functions,
for the three separate node types. Also went through each of the three and
streamlined as much as possible, removing dead code. This prevents us from having
to access the global in the function body version of the constructor.
* kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
three that are specific to the different node types that can create new execution
state objects.
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
of List::empty().
(KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
(KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
(KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
(KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
(KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
* kjs/function_object.cpp:
(FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
* kjs/list.cpp: Removed List::empty.
* kjs/list.h: Ditto.
* kjs/nodes.cpp:
(KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
(KJS::ArrayNode::evaluate): Ditto.
(KJS::ObjectLiteralNode::evaluate): Ditto.
(KJS::PropertyListNode::evaluate): Ditto.
(KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
before calling reserveCapacity, because it doesn't get inlined the local storage
vector is almost always big enough -- saving the function call overhead is a big
deal.
(KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
(KJS::FuncExprNode::evaluate): Ditto.
* kjs/object.cpp:
(KJS::tryGetAndCallProperty): Ditto.
* kjs/property_slot.cpp:
(KJS::PropertySlot::functionGetter): Ditto.
* kjs/string_object.cpp:
(KJS::StringProtoFuncSplit::callAsFunction): Ditto.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16648
REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
<rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
Fixes 34 failing test cases in the fast/regex/test1.html test.
Restored the stack which prevents infinite loops for brackets that match the empty
string; it had been removed as an optimization.
Unfortunately, restoring this stack causes the regular expression test in SunSpider
to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
a correct optimization to restore the speed!
It's possible the original change was on the right track but just off by one.
* pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
(MatchStack::pushNewFrame): Add back the logic needed here.
(startNewGroup): Ditto.
(match): Ditto.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- http://bugs.webkit.org/show_bug.cgi?id=16683
speed up function calls by making ScopeChain::push cheaper
This gives a 1.019x speedup on SunSpider.
After doing this, I realized this probably will be obsolete when the optimization
to avoid creating an activation object is done. When we do that one we should check
if rolling this out will speed things up, since this does add overhead at the time
you copy the scope chain.
* kjs/object.h: Removed the ScopeChain::release function. It was
marked inline, and called in exactly one place, so moved it there.
No idea why it was in this header file!
* kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
function that takes another ScopeChain. It was unused. I think we used
it over in WebCore at one point, but not any more.
* kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
a class, got rid of its constructor so we can have one that's uninitialized,
and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
mutable so it can be changed in the moveToHeap function. Changed the copy
constructor and assignment operator to call moveToHeap, since the top node
can't be shared when it's embedded in another ScopeChain object. Updated
functions as needed to handle the case where the first object isn't on the
heap or to add casts for cases where it's guaranteed to be. Changed the push
function to always put the new node into the ScopeChain object; it will get
put onto the heap when needed later.
2008-01-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed slight logic error in reserveCapacity, where we would reallocate
the storage buffer unnecessarily.
* wtf/Vector.h:
(WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
equal to capacity().
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- http://bugs.webkit.org/show_bug.cgi?id=16684
eliminate debugger overhead from function body execution
Speeds SunSpider up 1.003x. That's a small amount, but measurable.
* JavaScriptCore.exp: Updated.
* kjs/Parser.h:
(KJS::Parser::parse): Create the node with a static member function named create() instead
of using new explicitly.
* kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
* kjs/nodes.cpp:
(KJS::ProgramNode::create): Added. Calls new.
(KJS::EvalNode::create): Ditto.
(KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
when a debugger is present.
(KJS::FunctionBodyNode::execute): Removed debugger hooks.
(KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
(KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
then the debugger again.
* kjs/nodes.h: Added create functions, made the constructors private and protected.
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small cleanup to array_object.cpp
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncToString::callAsFunction):
(KJS::ArrayProtoFuncToLocaleString::callAsFunction):
(KJS::ArrayProtoFuncJoin::callAsFunction):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Apply wkstyle to array_object.cpp
* kjs/array_object.cpp:
(KJS::ArrayPrototype::ArrayPrototype):
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncPop::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
(KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
(KJS::ArrayObjectImp::ArrayObjectImp):
(KJS::ArrayObjectImp::implementsConstruct):
(KJS::ArrayObjectImp::construct):
(KJS::ArrayObjectImp::callAsFunction):
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove maxInt/minInt, replacing with std:max/min<int>()
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncSplice::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Update Number.toString to properly throw exceptions.
Cleanup code in Number.toString implementation.
* kjs/number_object.cpp:
(KJS::numberToString):
* kjs/object.cpp:
(KJS::Error::create): Remove bogus debug lines.
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
ASSERT when debugging via Drosera due to missed var lookup optimization.
http://bugs.webkit.org/show_bug.cgi?id=16634
No test case possible.
* kjs/nodes.cpp:
(KJS::BreakpointCheckStatement::optimizeVariableAccess):
* kjs/nodes.h:
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Fix (-0).toFixed() and re-factor a little
Fix (-0).toExponential() and printing of trailing 0s in toExponential
Fix toPrecision(nan) handling
http://bugs.webkit.org/show_bug.cgi?id=16640
* kjs/number_object.cpp:
(KJS::numberToFixed):
(KJS::fractionalPartToString):
(KJS::numberToExponential):
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More changes to make number code readable
* kjs/number_object.cpp:
(KJS::integer_part_noexp):
(KJS::numberToFixed):
(KJS::numberToExponential):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small cleanups to toPrecision
* kjs/number_object.cpp:
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small attempts to make number code readable
* kjs/number_object.cpp:
(KJS::exponentialPartToString):
(KJS::numberToExponential):
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Break out callAsFunction implementations into static functions
* kjs/number_object.cpp:
(KJS::numberToString):
(KJS::numberToFixed):
(KJS::numberToExponential):
(KJS::numberToPrecision):
(KJS::NumberProtoFunc::callAsFunction):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Apply wkstyle/astyle and fix placement of *
* kjs/number_object.cpp:
(KJS::NumberInstance::NumberInstance):
(KJS::NumberPrototype::NumberPrototype):
(KJS::NumberProtoFunc::NumberProtoFunc):
(KJS::integer_part_noexp):
(KJS::intPow10):
(KJS::NumberProtoFunc::callAsFunction):
(KJS::NumberObjectImp::NumberObjectImp):
(KJS::NumberObjectImp::getOwnPropertySlot):
(KJS::NumberObjectImp::getValueProperty):
(KJS::NumberObjectImp::implementsConstruct):
(KJS::NumberObjectImp::construct):
(KJS::NumberObjectImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::put):
2007-12-27 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
ASSERT in JavaScriptCore while viewing WICD test case
http://bugs.webkit.org/show_bug.cgi?id=16626
* kjs/nodes.cpp:
(KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16390
Use autotools or GNU make as the build system for the GTK port
* GNUmakefile.am: Added.
2007-12-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Remove unnecessary redundant check from property setting
http://bugs.webkit.org/show_bug.cgi?id=16602
1.3% speedup on SunSpider.
* kjs/object.cpp:
(KJS::JSObject::put): Don't do canPut check when not needed; let
the PropertyMap handle it.
(KJS::JSObject::canPut): Don't check the static property
table. lookupPut does that already.
2007-12-24 Alp Toker <alp@atoker.com>
Fix builds that don't use AllInOneFile.cpp following breakage
introduced in r28973.
* kjs/grammar.y:
2007-12-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- Optimize variable declarations
http://bugs.webkit.org/show_bug.cgi?id=16585
3.5% speedup on SunSpider.
var statements now result in either assignments or empty statements.
This allows a couple of optimization opportunities:
- No need to branch at runtime to check if there is an initializer
- EmptyStatementNodes can be removed entirely (also done in this patch)
- Assignment expressions get properly optimized for local variables
This patch also includes some code cleanup:
- Most of the old VarStatement/VarDecl logic is now only used for const declarations,
thus it is renamed appropriately
- AssignExprNode is gone
* JavaScriptCore.exp:
* kjs/NodeInfo.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::SourceElements::append):
(KJS::ConstDeclNode::ConstDeclNode):
(KJS::ConstDeclNode::optimizeVariableAccess):
(KJS::ConstDeclNode::handleSlowCase):
(KJS::ConstDeclNode::evaluateSingle):
(KJS::ConstDeclNode::evaluate):
(KJS::ConstStatementNode::optimizeVariableAccess):
(KJS::ConstStatementNode::execute):
(KJS::VarStatementNode::optimizeVariableAccess):
(KJS::VarStatementNode::execute):
(KJS::ForInNode::ForInNode):
(KJS::ForInNode::optimizeVariableAccess):
(KJS::ForInNode::execute):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::ProgramNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::ProgramNode::processDeclarations):
(KJS::EvalNode::processDeclarations):
* kjs/nodes.h:
(KJS::DeclarationStacks::):
(KJS::StatementNode::):
(KJS::ConstDeclNode::):
(KJS::ConstStatementNode::):
(KJS::EmptyStatementNode::):
(KJS::VarStatementNode::):
(KJS::ForNode::):
* kjs/nodes2string.cpp:
(KJS::ConstDeclNode::streamTo):
(KJS::ConstStatementNode::streamTo):
(KJS::ScopeNode::streamTo):
(KJS::VarStatementNode::streamTo):
(KJS::ForNode::streamTo):
(KJS::ForInNode::streamTo):
2007-12-21 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
* JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
being generated in JavaScriptCore.framework.
2007-12-21 Darin Adler <darin@apple.com>
Requested by Maciej.
* kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
KJS_NO_INLINE. We don't want to have two, and we figured it was better
to keep the one that's in WTF.
2007-12-21 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=16561
remove debugger overhead from non-debugged JavaScript execution
1.022x as fast on SunSpider.
* JavaScriptCore.exp: Updated.
* kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
since that more accurately describes the role of this object, which
is a reference-counted wrapper for a Vector.
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
and use plain assignment instead of set.
* kjs/Parser.h: Changed parameter type of didFinishParsing to a
SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
of an OwnPtr as well.
* kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
That's now handed inside the constructors for various node types, since we now
use vector swapping instead.
* kjs/nodes.cpp:
(KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
and we want exception handling out of the normal code flow.
(KJS::SourceElements::append): Moved here from the header. This now handles
creating a BreakpointCheckStatement for each statement in the debugger case.
That way we can get breakpoint handling without having it in every execute function.
(KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
(KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
(KJS::BreakpointCheckStatement::streamTo): Added.
(KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
type is void.
(KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
(KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
Changed code to use release since the class now contains a vector rather than
a vector point.
(KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
(KJS::BlockNode::execute): Ditto.
(KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
(KJS::IfNode::execute): Ditto.
(KJS::IfElseNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto.
(KJS::WhileNode::execute): Ditto.
(KJS::ContinueNode::execute): Ditto.
(KJS::BreakNode::execute): Ditto.
(KJS::ReturnNode::execute): Ditto.
(KJS::WithNode::execute): Ditto.
(KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
(KJS::CaseClauseNode::executeStatements): Ditto.
(KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
(KJS::ThrowNode::execute): Ditto.
(KJS::TryNode::execute): Ditto.
(KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
(KJS::ProgramNode::ProgramNode): Ditto.
(KJS::EvalNode::EvalNode): Ditto.
(KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
(KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
* kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
Renamed SourceElementsStub to SourceElements and made it derive from
ParserRefCounted rather than from Node, hold a vector rather than a pointer to
a vector, and changed the release function to swap with another vector rather
than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
vectors instead of pointers to vectors. Added BreakpointCheckStatement.
* kjs/nodes2string.cpp:
(KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
to a vector.
(KJS::BlockNode::streamTo): Ditto.
(KJS::CaseClauseNode::streamTo): Ditto.
* wtf/AlwaysInline.h: Added NEVER_INLINE.
* wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
ones in OwnPtr and auto_ptr.
* wtf/RefPtr.h: Ditto.
2007-12-21 Darin Adler <darin@apple.com>
- fix broken regression tests
The broken tests were fast/js/do-while-expression-value.html and
fast/js/while-expression-value.html.
* kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
an old version of my patch for bug 16471.
(KJS::statementListExecute): The logic here was backwards. Have to set the value
even for non-normal execution results.
2007-12-20 Alexey Proskuryakov <ap@webkit.org>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
to WebKitBuild.
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Split IfNode into IfNode and IfElseNode for speedup.
http://bugs.webkit.org/show_bug.cgi?id=16470
SunSpider claims this is 1.003x as fast as before.
(This required running with --runs 15 to get consistent enough results to tell!)
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::IfNode::optimizeVariableAccess):
(KJS::IfNode::execute):
(KJS::IfNode::getDeclarations):
(KJS::IfElseNode::optimizeVariableAccess):
(KJS::IfElseNode::execute):
(KJS::IfElseNode::getDeclarations):
* kjs/nodes.h:
(KJS::IfNode::):
(KJS::IfElseNode::):
* kjs/nodes2string.cpp:
(KJS::IfNode::streamTo):
(KJS::IfElseNode::streamTo):
2007-12-20 Darin Adler <darin@apple.com>
Reviewed by Sam.
* wtf/OwnPtr.h:
(WTF::operator==): Added.
(WTF::operator!=): Added.
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
AST optimization: Avoid NULL-checking ForNode's child nodes.
0.6% speedup on SunSpider.
This is a proof of concept patch that demonstrates how to optimize
grammar productions with optional components, like
for (optional; optional; optional) {
...
}
The parser emits NULL for an optional component that is not present.
Instead of checking for a NULL child at execution time, a node that
expects an optional component to be present more often than not checks
for a NULL child at construction time, and substitutes a viable
alternative node in its place.
(We'd like the parser to start emitting NULL a lot more once we teach
it to emit NULL for certain no-op productions like EmptyStatement and
VariableStatement, so, as a foundation, it's important for nodes with
NULL optional components to be fast.)
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
moved didFinishParsing into the .cpp file because adding a branch while
it was in the header file caused a substantial and inexplicable
performance regression. (Did I mention that GCC is crazy?)
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BlockNode::BlockNode): Check for NULL SourceElements.
(KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
(KJS::ForNode::execute): No need to check for NULL here.
* kjs/nodes.h:
(KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
because it's semantically harmless, and it evaluates to boolean in an
efficient manner.
2007-12-20 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Slight logic reordering in JSImmediate::from(double)
This gives a 0.6% improvement in SunSpider.
* kjs/JSImmediate.h:
(KJS::JSImmediate::from):
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Fix major Array regression introduced by 28899.
SunSpider claims this is at least 1.37x as fast as pre-regression. :)
* kjs/array_instance.cpp: make Arrays fast again!
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
http://bugs.webkit.org/show_bug.cgi?id=16537
Make msToYear human-readable
Make msToDayInMonth slightly more readable and avoid recalculating msToYear
Remove use of isInLeapYear to avoid calling msToYear
Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
* kjs/DateMath.cpp:
(KJS::daysFrom1970ToYear):
(KJS::msToYear):
(KJS::monthFromDayInYear):
(KJS::checkMonth):
(KJS::dayInMonthFromDayInYear):
(KJS::dateToDayInYear):
(KJS::getDSTOffsetSimple):
(KJS::getDSTOffset):
(KJS::gregorianDateTimeToMS):
(KJS::msToGregorianDateTime):
2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Darin Adler.
Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
This is for building with X11, as some type and enum names conflict
with #define names in X11 headers.
http://bugs.webkit.org/show_bug.cgi?id=15669
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/NP_jsobject.h:
* bindings/npapi.h:
* bindings/npruntime.cpp:
* bindings/npruntime_impl.h:
* bindings/npruntime_priv.h:
* bindings/npruntime_internal.h:
* bindings/testbindings.cpp:
* bindings/c/c_class.h:
* bindings/c/c_runtime.h:
* bindings/c/c_utility.h:
2007-12-20 Darin Adler <darin@apple.com>
- re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
Completions need to be smaller (or not exist at all)
Same patch as last time with the test failures problem fixed.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
type from newExec to see if the execute raised an exception.
2007-12-20 Darin Adler <darin@apple.com>
- roll out that last change -- it was causing test failures;
I'll check it back in after fixing them
2007-12-20 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=16471
Completions need to be smaller (or not exist at all)
SuSpider shows 2.4% speedup.
Stop using completions in the execution engine.
Instead, the completion type and label target are both
stored in the ExecState.
* API/JSContextRef.cpp: Removed unneeded include of "completion.h".
* bindings/runtime_method.cpp: Removed unused execute function.
* bindings/runtime_method.h: Ditto.
* kjs/ExecState.h: Added completionType, breakOrContinueTarget,
setCompletionType, setNormalCompletion, setBreakCompletion,
setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
* kjs/completion.h: Removed constructor and getter for target
for break and continue from Completion. This class is now only
used for the public API to Interpreter and such.
* kjs/date_object.h: Removed unused execute function.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Removed some unneeded
exception processing. Updated to call the new execute function
and to get the completion type from the ExecState. Merged in
the execute function, which repeated some of the same logic and
was called only from here.
(KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
* kjs/function.h: Removed execute.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate): Added code to convert the result of
execut into a Completion.
* kjs/nodes.cpp:
(KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
Now sets the completion type in the ExecState.
(KJS::Node::rethrowException): Now sets the completion type in the
ExecState.
(KJS::StatementNode::hitStatement): Now sets the completion type in
the ExecState.
(KJS::VarStatementNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::statementListExecute): Ditto. Also changed the for loop to use
indices instead of iterators.
(KJS::BlockNode::execute): Updated return type.
(KJS::EmptyStatementNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::ExprStatementNode::execute): Ditto.
(KJS::IfNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
to make the normal case a little faster and moved the end outside the
loop so that "break" can do a break.
(KJS::WhileNode::execute): Ditto.
(KJS::ForNode::execute): Ditto.
(KJS::ForInNode::execute): Ditto.
(KJS::ContinueNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::BreakNode::execute): Ditto.
(KJS::ReturnNode::execute): Ditto.
(KJS::WithNode::execute): Ditto.
(KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
execute in its name to reflect the fact that it's a member of the same
family of functions.
(KJS::CaseBlockNode::executeBlock): Ditto.
(KJS::SwitchNode::execute): Ditto.
(KJS::LabelNode::execute): Ditto.
(KJS::ThrowNode::execute): Ditto.
(KJS::TryNode::execute): Ditto.
(KJS::ProgramNode::execute): Ditto.
(KJS::EvalNode::execute): Ditto.
(KJS::FunctionBodyNode::execute): Ditto.
(KJS::FuncDeclNode::execute): Ditto.
* kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
hitStatement protected, changed return value of execute to a JSValue,
renamed evalStatements to executeStatements, and evalBlock to executeBlock.
* kjs/number_object.h: Removed unused execute function.
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Added Radar number.
* kjs/nodes.cpp:
(KJS::ProgramNode::processDeclarations):
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Linux build fix: config.h has to come first.
* kjs/error_object.cpp:
2007-12-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Optimized global access to global variables, using a symbol table.
SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
and a whopping 33.1% speedup on bitops-bitwise-and.
* API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
calls to Base::, since JSObject is not always our base class. This
was always a bug, but the bug is even more apparent after some of my
changes.
(KJS::::staticFunctionGetter): Replaced use of getDirect with call to
getOwnPropertySlot. Global declarations are no longer stored in the
property map, so a call to getDirect is insufficient for finding
override properties.
* API/testapi.c:
* API/testapi.js: Added test for the getDirect change mentioned above.
* kjs/ExecState.cpp:
* kjs/ExecState.h: Dialed back the optimization to store a direct
pointer to the localStorage buffer. One ExecState can grow the global
object's localStorage without another ExecState's knowledge, so
ExecState can't store a direct pointer to the localStorage buffer
unless/until we invent a way to update all the relevant ExecStates.
* kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
operations.
(KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
too. Also, clear the property map here, removing the need for a
separate call.
* kjs/JSVariableObject.cpp:
* kjs/JSVariableObject.h: Added support for saving localStorage and the
symbol table to the back/forward cache, and restoring them.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
because it's an EvalNode, not a ProgramNode.
* kjs/lookup.h:
(KJS::cacheGlobalObject): Replaced put with faster putDirect, since
that's how the rest of lookup.h works. putDirect is safe here because
cacheGlobalObject is only used for objects whose names are not valid
identifiers.
* kjs/nodes.cpp: The good stuff!
(KJS::EvalNode::processDeclarations): Replaced hasProperty with
the new hasOwnProperty, which is slightly faster.
* kjs/object.h: Nixed clearProperties because clear() does this job now.
* kjs/property_map.cpp:
* kjs/property_map.h: More back/forward cache support.
* wtf/Vector.h:
(WTF::::grow): Added fast non-branching grow function. I used it in
an earlier version of this patch, even though it's not used anymore.
2007-12-09 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
declaration in grammar.h is able to declare members of that type.
* kjs/NodeInfo.h: Added.
(KJS::createNodeInfo):
(KJS::mergeDeclarationLists):
(KJS::appendToVarDeclarationList):
* kjs/grammar.y:
* kjs/lexer.cpp:
2007-12-19 Oliver Hunt <oliver@apple.com>
Make appendToVarDeclarationList static
RS=Weinig.
* kjs/grammar.y:
2007-12-18 Oliver Hunt <oliver@apple.com>
Remove dead code due to removal of post-parse declaration discovery.
RS=Geoff.
Due to the removal of the declaration discovery pass after parsing we
no longer need any of the logic used for that discovery.
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::VarDeclNode::VarDeclNode):
(KJS::BlockNode::BlockNode):
(KJS::ForInNode::ForInNode):
(KJS::CaseBlockNode::CaseBlockNode):
* kjs/nodes.h:
(KJS::VarStatementNode::):
(KJS::IfNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::WithNode::):
(KJS::LabelNode::):
(KJS::TryNode::):
(KJS::FuncDeclNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
(KJS::SwitchNode::):
2007-12-18 Oliver Hunt <oliver@apple.com>
Replace post-parse pass to find declarations with logic in the parser itself
Reviewed by Geoff.
Instead of finding declarations in a pass following the initial parsing of
a program, we incorporate the logic directly into the parser. This lays
the groundwork for further optimisations (such as improving performance in
declaration expressions -- var x = y; -- to match that of standard assignment)
in addition to providing a 0.4% performance improvement in SunSpider.
* JavaScriptCore.exp:
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::Parser::didFinishParsing):
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ParserTracked::ParserTracked):
(KJS::ParserTracked::~ParserTracked):
(KJS::ParserTracked::ref):
(KJS::ParserTracked::deref):
(KJS::ParserTracked::refcount):
(KJS::ParserTracked::clearNewTrackedObjects):
(KJS::Node::Node):
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::EvalNode::EvalNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
* kjs/nodes.h:
(KJS::ParserTracked::):
(KJS::Node::):
(KJS::ScopeNode::):
2007-12-18 Xan Lopez <xan@gnome.org>
Reviewed by Geoff.
Fix http://bugs.webkit.org/show_bug.cgi?id=14521
Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Unlock):
Use less strict memory operand constraint on inline asm generation.
PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
Patch by David Kilzer <ddkilzer@webkit.org>
2007-12-18 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Maciej Stachowiak.
Remove outdated and non-functioning project files for the Apollo port.
* JavaScriptCore.apolloproj: Removed.
2007-12-18 Darin Adler <darin@apple.com>
- fix Windows build
* pcre/pcre_exec.cpp:
(jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
2007-12-18 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16458
REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
<rdar://problem/5636067>
Test: fast/regex/slow.html
Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
http://bugs.webkit.org/show_bug.cgi?id=16503
* pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
* pcre/pcre_exec.cpp:
(match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
since they are just true and false (1 and 0).
(jsRegExpExecute): More of the MATCH_MATCH change.
2007-12-17 Darin Adler <darin@apple.com>
- speculative build fix for non-gcc platforms
* pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
2007-12-16 Mark Rowe <mrowe@apple.com>
Speculative build fix for non-Mac platforms.
* pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
2007-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=16438
- removed some more unused code
- changed quite a few more names to WebKit-style
- moved more things out of pcre_internal.h
- changed some indentation to WebKit-style
- improved design of the functions for reading and writing
2-byte values from the opcode stream (in pcre_internal.h)
* pcre/dftables.cpp:
(main): Added the kjs prefix a normal way in lieu of using macros.
* pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
(errorText): Name changes, fewer typedefs.
(checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
(isCountedRepeat): Name change.
(readRepeatCounts): Name change.
(firstSignificantOpcode): Got rid of the use of OP_lengths, which is
very lightly used here. Hard-coded the length of OP_BRANUMBER.
(firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
use the advanceToEndOfBracket function.
(getOthercaseRange): Name changes.
(encodeUTF8): Ditto.
(compileBranch): Name changes. Removed unused after_manual_callout and
the code to handle it. Removed code to handle OP_ONCE since we never
emit this opcode. Changed to use advanceToEndOfBracket in more places.
(compileBracket): Name changes.
(branchIsAnchored): Removed code to handle OP_ONCE since we never emit
this opcode.
(bracketIsAnchored): Name changes.
(branchNeedsLineStart): More fo the same.
(bracketNeedsLineStart): Ditto.
(branchFindFirstAssertedCharacter): Removed OP_ONCE code.
(bracketFindFirstAssertedCharacter): More of the same.
(calculateCompiledPatternLengthAndFlags): Ditto.
(returnError): Name changes.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
(matchRef): Updated names.
Improved macros to use the do { } while(0) idiom so they expand to single
statements rather than to blocks or multiple statements. And refeactored
the recursive match macros.
(MatchStack::pushNewFrame): Name changes.
(getUTF8CharAndIncrementLength): Name changes.
(match): Name changes. Removed the ONCE opcode.
(jsRegExpExecute): Name changes.
* pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
quite a few comments. Removed the macros that add kjs prefixes to the
functions with external linkage; instead renamed the functions. Removed
the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
dead and not-all-working code for LINK_SIZE values other than 2, although
we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
(put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
(get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
(put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
(putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
addition, since a comma is really no better than a plus sign. Added an
assertion to catch out of range values and changed the parameter type to
int rather than unsigned.
(getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
(putLinkValue): New function that most former callers of the
putOpcodeValueAtOffset function can use; asserts the value that is
being stored is non-zero and then calls putLinkValueAllowZero.
(getLinkValue): Ditto.
(putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
caller was using an offset, which makes sense given the advancing behavior.
(putLinkValueAllowZeroAndAdvance): Ditto.
(isBracketOpcode): Added. For use in an assertion.
(advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
and removed comments about how it's not well designed. This function takes
a pointer to the beginning of a bracket and advances to the end of the
bracket.
* pcre/pcre_tables.cpp: Updated names.
* pcre/pcre_ucp_searchfuncs.cpp:
(kjs_pcre_ucp_othercase): Ditto.
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer): Ditto.
(kjs_pcre_xclass): Ditto.
* pcre/ucpinternal.h: Ditto.
* wtf/ASCIICType.h:
(WTF::isASCIIAlpha): Added an int overload, like the one we already have for
isASCIIDigit.
(WTF::isASCIIAlphanumeric): Ditto.
(WTF::isASCIIHexDigit): Ditto.
(WTF::isASCIILower): Ditto.
(WTF::isASCIISpace): Ditto.
(WTF::toASCIILower): Ditto.
(WTF::toASCIIUpper): Ditto.
2007-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=16459
REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
<rdar://problem/5646361>
The problem was that \B was not handled properly in character classes.
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp:
(check_escape): Added handling of ESC_b and ESC_B in character classes here.
Allows us to get rid of the handling of \b in character classes from all the
call sites that handle it separately and to handle \B properly as well.
(compileBranch): Remove the ESC_b handling, since it's not needed any more.
(calculateCompiledPatternLengthAndFlags): Ditto.
2007-12-16 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Fix http://bugs.webkit.org/show_bug.cgi?id=16448
Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
* kjs/array_instance.cpp:
(KJS::compareByStringPairForQSort):
(KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
results. This avoids calling toString twice per comparison, but requires a temporary buffer
so we only use this approach in cases where the array being sorted is not too large.
2007-12-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler and Maciej Stachowiak.
More refactoring to support global variable optimization.
Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
UString::Rep*. With globals, the symbol table can outlast the
declaration node for any given symbol, so the symbol table needs to ref
its symbol names.
In support, specialized HashMaps with RefPtr keys to allow lookup
via raw pointer, avoiding refcount churn.
SunSpider reports a .6% speedup (prolly just noise).
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
* JavaScriptCore.xcodeproj/project.pbxproj: ditto
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
* kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
static Rep* for null, which helps compute the deletedValue() trait.
* wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
* wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
of find(), contains(), get(), set(), add(), remove(), and take() that take
raw pointers as keys.
2007-12-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=16162
Problems with float parsing on Linux (locale-dependent parsing was used).
* kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
* kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
2007-12-14 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Enable the AllInOneFile.cpp optimization for the GTK+ port.
* JavaScriptCore.pri:
2007-12-14 Mark Rowe <mrowe@apple.com>
Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
2007-12-14 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
currently untested on other platforms.
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
through into another mechanism if multiple are supported.
2007-12-14 Alp Toker <alp@atoker.com>
Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
Include UnusedParam.h.
* wtf/TCSystemAlloc.cpp:
2007-12-14 Oliver Hunt <oliver@apple.com>
Reviewed by Stephanie.
Fix build on windows
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
2007-12-14 Dan Bernstein <mitz@apple.com>
- try again to fix the Windows build
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Dan Bernstein <mitz@apple.com>
- try to fix the Windows build
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej and Oliver.
Add final changes to make TCMalloc release memory to the system.
This results in a 0.4% regression against ToT, but this is offset
against the gains made by the original TCMalloc r38 merge - in fact
we retain around 0.3-0.4% progression overall.
* wtf/FastMalloc.cpp:
(WTF::InitSizeClasses):
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- removed unnecessary includes of "Vector.h"
* wtf/HashMap.h:
(WTF::copyKeysToVector): Make the type of the vector be a template parameter.
This allows copying keys into a vector of a base class or one with an inline capacity.
(WTF::copyValuesToVector): Ditto.
* wtf/HashSet.h:
(WTF::copyToVector): Ditto.
2007-12-14 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Geoff.
<rdar://problem/5619295>
REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
The way this used to work was that each NPObject that wrapped a JSObject would have a root object
corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
doing security checks).
This would prevent a plug-in from accessing a frame's window object if it's security origin was different
(some parts of the window, such as the location object, can be accessed from frames with different security
origins, and those checks are being done in WebCore).
Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
Window JSObject being garbage collected and the NPObject pointing to freed memory.
How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
for a plug-in will have the root object of the containing frame of that plug-in.
* bindings/NP_jsobject.cpp:
(jsDeallocate):
Don't free the origin root object.
(_NPN_CreateScriptObject):
Remove the origin root object parameter.
(_NPN_InvokeDefault):
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_Enumerate):
Get rid of all security checks.
* bindings/NP_jsobject.h:
Remove originRootObject from the JavaScriptObject struct.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertValueToNPVariant):
Always use the root object from the ExecState.
2007-12-13 Steve Falkenburg <sfalken@apple.com>
Move source file generation into its own vcproj to fix build dependencies.
Reviewed by Adam.
* JavaScriptCore.vcproj/JavaScriptCore.sln:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
2007-12-13 Alp Toker <alp@atoker.com>
http://bugs.webkit.org/show_bug.cgi?id=16406
[Gtk] JavaScriptCore needs -lpthread
Build fix for Debian and any other platforms that don't implicitly
link to pthread.
Link to pthread on non-Windows platforms until this dependency is
removed from JSC.
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Build fix: Note some variables that are used only for ASSERTs.
* API/testapi.c:
(Base_finalize):
(globalObject_initialize):
(testInitializeFinalize):
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed: All JS tests crash on Windows.
NDEBUG wasn't defined when compiling testkjs in release builds, so the
HashTable definition in HashTable.h included an extra data member.
The solution was to add NDEBUG to the release testkjs configuration on
Windows and Mac.
For giggles, I also added other missing #defines to testkjs on Windows.
* Configurations/Base.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/testkjs.cpp:
(main):
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed bogus ASSERT.
ASSERT should only be used when we know that a code path will not be
taken. This code path is taken often during the jsFunFuzz test.
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
2007-12-11 Darin Adler <darin@apple.com>
* wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
2007-12-10 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
- fix http://bugs.webkit.org/show_bug.cgi?id=16379
REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
fast/dom/xmlhttprequest-html-response-encoding.html
and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
find_firstassertedchar
Test: fast/js/regexp-find-first-asserted.html
* pcre/pcre_compile.cpp:
(compileBracket): Take out unnecessary initialization of out parameters.
(branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
a branch.
(bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
options parameter -- the caller can handle the options.
(jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
passing in the options.
2007-12-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Split this:
FunctionBodyNode
^
|
ProgramNode
into this:
ScopeNode
^ ^ ^
| | |
FunctionBodyNode ProgramNode EvalNode
in preparation for specializing each class more while optimizing global
variable access.
Also removed some cruft from the FunctionBodyNode interface to simplify
things.
SunSpider says this patch is a .8% speedup, which seems reasonable,
since it eliminates a few branches and adds KJS_FAST_CALL in a few
places.
Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
mileage may vary...)
2007-12-10 Geoffrey Garen <ggaren@apple.com>
RS by Mark Rowe.
Mac build fix: added some exported symbols, now that Parser::parse is
defined in the header.
* JavaScriptCore.exp:
2007-12-10 Sam Weinig <sam@webkit.org>
Build fix.
Template methods need to be in the header.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* kjs/Parser.cpp:
* kjs/Parser.h:
(KJS::Parser::parse):
2007-12-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Merged different implementations of Parser::parse into a single,
templatized implementation, in preparation for adding yet another
implementation for "eval" code.
JS and layout tests pass.
2007-12-10 Timothy Hatcher <timothy@apple.com>
Reviewed by Mark Rowe
<rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
* Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
2007-12-10 Mark Rowe <mrowe@apple.com>
Tiger build fix.
* kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
2007-12-10 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=16375
REGRESSION: Safari crashes on quit
Probably a debug-only issue.
* kjs/Parser.cpp:
(KJS::parser): Create the parser and never destroy it by using a pointer instead
of a global object.
2007-12-09 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
- fix http://bugs.webkit.org/show_bug.cgi?id=16369
REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
* pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
(branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
branch and the other on an anchor. The old function would only work on a bracket.
Also removed unneeded parameters; the anchored check does not require the bracket
map or the options any more because we have a reduced set of features.
(bracketIsAnchored): Ditto.
(branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
both a better name. This is the function that was returning the wrong value. The failure
was beacuse the old function would only work on a bracket.
(bracketNeedsLineStart): Ditto.
(jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
functions based on whether we compiled an outer bracket. Also removed inaccurate comments
and unneeded parameters.
- other small changes
* pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
the recursion limit, then running out of memory, and finally an unexpected internal error.
* pcre/pcre_exec.cpp: Fixed indentation.
(jsRegExpExecute): Corrected an inaccurate comment.
2007-12-09 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=16370
REGRESSION (r28540): source URL and line number no longer set for outer function/programs
Test: fast/js/exception-linenums-in-html-1.html
Test: fast/js/exception-linenums-in-html-2.html
Test: fast/js/exception-linenums.html
By the time the ProgramNode was constructed, the source URL was empty.
* kjs/Parser.cpp:
(KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
handled here instead of in the lexer; it needs to still be set when we create the
program node. Call setLoc to set the first and last line number.
(KJS::Parser::parseFunctionBody): Ditto, but for the body.
(KJS::Parser::parse): Removed the sourceURL argument.
* kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
parameter to didFinishParsing, since the bison grammar knows the last line number
and we otherwise do not know it. Removed the sourceURL parameter from parse, since
that's now handled at a higher level.
* kjs/grammar.y: Pass the last line number to didFinishParsing.
* kjs/lexer.cpp:
(KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
(KJS::Lexer::clear): Ditto.
* kjs/lexer.h: More of the same.
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
than from the lexer. Removed unneeded call to setLoc, since the line numbers already
both default to -1.
2007-12-08 Oliver Hunt <oliver@apple.com>
Reviewed by Sam W.
Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
Fixes <rdar://problem/5620249> Must disable SVG animation
<rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
Minor config changes.
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-12-07 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
- Rename isSafeScript to allowsAccessFrom.
* bindings/NP_jsobject.cpp:
(_isSafeScript):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
the new call.
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Refactored variable access optimization: Removed the assumption that
the FunctionBodyNode holds the symbol table.
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/nodes.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/interpreter.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/grammar.y:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/function_object.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed crash seen running layout tests.
Reverted a change I made earlier today. Added a comment to try to
discourage myself from making this mistake a third time.
* kjs/function.cpp:
(KJS::ActivationImp::mark):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpData::ActivationImpData):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Refactored parsing of global code: Removed the assumption that
ProgramNode inherits from FunctionBodyNode from the parser.
* kjs/Parser.cpp:
(KJS::Parser::parseProgram):
(KJS::Parser::parseFunctionBody):
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::Parser::didFinishParsing):
* kjs/function.cpp:
* kjs/grammar.y:
* kjs/nodes.h:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added JSVariableObject.cpp to the .pri file.
* JavaScriptCore.pri:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/function.cpp:
2007-12-07 Steve Falkenburg <sfalken@apple.com>
Re-named our B&I flag from BUILDBOT to PRODUCTION.
Reviewed by Sam Weinig.
* JavaScriptCore.vcproj/JavaScriptCore.make:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: removed stray name qualification.
* kjs/function.h:
(KJS::ActivationImp::ActivationImp):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: moved functions with qualified names outside of class
declaration.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet):
(KJS::JSVariableObject::symbolTablePut):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Next step in refactoring JSGlobalObject: Added JSVariableObject class,
and factored symbol-table-related code into it. (JSGlobalObject doesn't
use the symbol table code yet, though.)
Layout and JS tests, and testapi, pass. SunSpider reports no regression.
2007-12-07 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16185
jsRegExpCompile should not add implicit non-capturing bracket
While this does not make SunSpider faster, it will make many regular
expressions a bit faster.
* pcre/pcre_compile.cpp: Moved CompileData struct in here from the
header since it's private to this file.
(compile_branch): Updated for function name change.
(compile_bracket): Renamed from compile_regex, since, for one thing,
this does not compile an entire regular expression.
(calculateCompiledPatternLengthAndFlags): Removed unused item_count
local variable. Renamed CompileData to cd instead of compile_block
to be consistent with other functions. Added code to set the
needOuterBracket flag if there's at least one "|" at the outer level.
(jsRegExpCompile): Renamed CompileData to cd instead of compile_block
to be consistent with other functions. Removed unneeded "size" field
from the compiled regular expression. If no outer bracket is needed,
then use compile_branch to compile the regular expression.
* pcre/pcre_internal.h: Removed the CompileData struct, which is now
private to pcre_compile.cpp. Removed the size member from JSRegExp.
2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
MSVC7 build fix due to a compiler bug with placement new and/or
templates and casting.
Reviewed by Darin Adler.
* wtf/Vector.h:
(WTF::::append):
2007-12-06 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- fix http://bugs.webkit.org/show_bug.cgi?id=16321
new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
<rdar://problem/5632992>
Test: fast/js/regexp-oveflow.html
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags): In the case where a single character
character class is optimized to not use a character class at all, the preflight
code was not setting the lastitemlength variable.
2007-12-05 Mark Rowe <mrowe@apple.com>
Qt Windows build fix. Include the time-related headers in the correct place.
* kjs/JSGlobalObject.cpp:
* kjs/interpreter.cpp:
2007-12-05 Darin Adler <darin@apple.com>
Not reviewed; just undoing a previous commit.
- remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
<rdar://problem/5625221> Crash opening www.news.com (CNet)
The real bug was the backwards ?: in the compile function, which Geoff just
fixed. Rolling out the incorrect earlier fix.
* pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
the unneeded preflight change. The regression test proves this is still working
fine, so the bug remains fixed.
2007-12-01 Mark Rowe <mrowe@apple.com>
Build fix. Include headers before trying to use the things that they declare.
* kjs/JSImmediate.cpp:
* kjs/nodes.cpp:
* kjs/object.cpp:
* kjs/object_object.cpp:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added some #includes.
* kjs/JSImmediate.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added some #includes.
* kjs/JSGlobalObject.cpp:
* kjs/JSImmediate.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: Fixed #include spelling.
* kjs/debugger.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/debugger.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added a forward declaration.
* kjs/debugger.h:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/error_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/bool_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Third step in refactoring JSGlobalObject: Moved data members and
functions accessing data members from Interpreter to JSGlobalObject.
Changed Interpreter member functions to static functions.
This resolves a bug in global object bootstrapping, where the global
ExecState could be used when uninitialized.
This is a big change, but it's mostly code motion and renaming.
Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
a .7% regression, but Shark sees no difference related to this patch,
and SunSpider reported a .7% speedup from an earlier step in this
refactoring, so I think it's fair to call that a wash.
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler. (Or vice versa.)
Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
ASSERT, but the bug wasn't new.)
* pcre/pcre_compile.cpp:
(compile_branch): The ?: operator here was backwards, causing us to
execute the loop too many times, adding stray KET opcodes to the
compiled regular expression.
2007-12-05 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
- Wait until local variable data is fully constructed before notifying the debugger of entering
or leaving a call frame.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::execute):
2007-12-05 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver.
Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
* wtf/FastMalloc.cpp:
(WTF::):
(WTF::getPageHeap):
2007-12-05 Mark Rowe <mrowe@apple.com>
Reviewed by Darin.
Fix testkjs in 64-bit.
When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
it will fail and trigger a call to abort.
* wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
* wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
2007-12-04 Oliver Hunt <oliver@apple.com>
Fix gtk build.
* wtf/TCSystemAlloc.cpp:
2007-12-03 Oliver Hunt <oliver@apple.com>
Reviewed by Mark Rowe and Geoff Garen.
Merge TCMalloc r38
It also result in a performance progression between 0.5% and
0.9% depending on the test, however most if not all of this
gain will be consumed by the overhead involved in the later
change to release memory to the system.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/FastMalloc.cpp:
(WTF::KernelSupportsTLS):
(WTF::CheckIfKernelSupportsTLS):
(WTF::):
(WTF::ClassIndex):
(WTF::SLL_Next):
(WTF::SLL_SetNext):
(WTF::SLL_Push):
(WTF::SLL_Pop):
(WTF::SLL_PopRange):
(WTF::SLL_PushRange):
(WTF::SLL_Size):
(WTF::SizeClass):
(WTF::ByteSizeForClass):
(WTF::NumMoveSize):
(WTF::InitSizeClasses):
(WTF::AllocationSize):
(WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
(WTF::TCMalloc_PageHeap::CacheSizeClass):
(WTF::TCMalloc_PageHeap::init):
(WTF::TCMalloc_PageHeap::New):
(WTF::TCMalloc_PageHeap::AllocLarge):
(WTF::TCMalloc_PageHeap::Carve):
(WTF::TCMalloc_PageHeap::Delete):
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
(WTF::PagesToMB):
(WTF::TCMalloc_PageHeap::Dump):
(WTF::TCMalloc_PageHeap::GrowHeap):
(WTF::TCMalloc_PageHeap::Check):
(WTF::ReleaseFreeList):
(WTF::TCMalloc_PageHeap::ReleaseFreePages):
(WTF::TCMalloc_ThreadCache_FreeList::Push):
(WTF::TCMalloc_ThreadCache_FreeList::PushRange):
(WTF::TCMalloc_ThreadCache_FreeList::PopRange):
(WTF::TCMalloc_ThreadCache_FreeList::Pop):
(WTF::TCMalloc_Central_FreeList::length):
(WTF::TCMalloc_Central_FreeList::tc_length):
(WTF::TCMalloc_Central_FreeList::Init):
(WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
(WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
(WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
(WTF::TCMalloc_Central_FreeList::ShrinkCache):
(WTF::TCMalloc_Central_FreeList::InsertRange):
(WTF::TCMalloc_Central_FreeList::RemoveRange):
(WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
(WTF::TCMalloc_Central_FreeList::Populate):
(WTF::TCMalloc_ThreadCache::Init):
(WTF::TCMalloc_ThreadCache::Cleanup):
(WTF::TCMalloc_ThreadCache::Allocate):
(WTF::TCMalloc_ThreadCache::Deallocate):
(WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
(WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
(WTF::TCMalloc_ThreadCache::Scavenge):
(WTF::TCMalloc_ThreadCache::PickNextSample):
(WTF::TCMalloc_ThreadCache::NewHeap):
(WTF::TCMalloc_ThreadCache::GetThreadHeap):
(WTF::TCMalloc_ThreadCache::GetCache):
(WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
(WTF::TCMalloc_ThreadCache::InitTSD):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(WTF::TCMallocStats::ExtractStats):
(WTF::TCMallocStats::DumpStats):
(WTF::TCMallocStats::DumpStackTraces):
(WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
(WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
(WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
(WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
(WTF::TCMallocStats::DoSampledAllocation):
(WTF::TCMallocStats::CheckCachedSizeClass):
(WTF::TCMallocStats::CheckedMallocResult):
(WTF::TCMallocStats::SpanToMallocResult):
(WTF::TCMallocStats::do_malloc):
(WTF::TCMallocStats::do_free):
(WTF::TCMallocStats::do_memalign):
(WTF::TCMallocStats::do_malloc_stats):
(WTF::TCMallocStats::do_mallopt):
(WTF::TCMallocStats::do_mallinfo):
(WTF::TCMallocStats::realloc):
(WTF::TCMallocStats::cpp_alloc):
(WTF::TCMallocStats::operator new):
(WTF::TCMallocStats::):
(WTF::TCMallocStats::operator new[]):
(WTF::TCMallocStats::malloc_stats):
(WTF::TCMallocStats::mallopt):
(WTF::TCMallocStats::mallinfo):
* wtf/TCPackedCache.h: Added.
(PackedCache::PackedCache):
(PackedCache::Put):
(PackedCache::Has):
(PackedCache::GetOrDefault):
(PackedCache::Clear):
(PackedCache::EntryToValue):
(PackedCache::EntryToUpper):
(PackedCache::KeyToUpper):
(PackedCache::UpperToPartialKey):
(PackedCache::Hash):
(PackedCache::KeyMatch):
* wtf/TCPageMap.h:
(TCMalloc_PageMap2::PreallocateMoreMemory):
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
* wtf/TCSystemAlloc.h:
2007-12-04 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
Make isSafeScript const.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::isSafeScript):
2007-12-04 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
<rdar://problem/5625221> Crash opening www.news.com (CNet)
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
was generated in the compile code but not taken into account here.
2007-12-03 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=15618
<rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
Test: fast/js/recursion-limit-equal.html
* kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
2007-12-03 Dan Bernstein <mitz@apple.com>
- fix a copy-and-paste-o
* bindings/npruntime.cpp:
(_NPN_GetIntIdentifier):
2007-12-03 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix an ASSERT when getIntIdentifier is called with 0 or -1
* bindings/npruntime.cpp:
(_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
they are the empty value and the deleted value. Instead, keep the
identifiers for those two integers in a static array.
2007-12-02 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=15848
<rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
Test: fast/js/sparse-array.html
* kjs/array_instance.cpp:
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
in hash map. Can't avoid the branch because we can't look for 0 in the hash.
(KJS::ArrayInstance::deleteProperty): Ditto.
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/collector.cpp:
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Second step in refactoring JSGlobalObject: moved virtual functions from
Interpreter to JSGlobalObject.
Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
believe his lies.
2007-12-01 Alp Toker <alp@atoker.com>
Reviewed by Adam Roben.
http://bugs.webkit.org/show_bug.cgi?id=16228
kJSClassDefinitionEmpty is not exported with JS_EXPORT
Add JS_EXPORT to kJSClassDefinitionEmpty.
Make the gcc compiler check take precedence over the WIN32||_WIN32
check to ensure that symbols are exported on Windows when using gcc.
Add a TODO referencing the bug about JS_EXPORT in the Win build
(http://bugs.webkit.org/show_bug.cgi?id=16227)
Don't define JS_EXPORT as 'extern' when the compiler is unknown since
it would result in the incorrect expansion:
extern extern const JSClassDefinition kJSClassDefinitionEmpty;
(This was something we inherited from CFBase.h that doesn't make sense
for JSBase.h)
* API/JSBase.h:
* API/JSObjectRef.h:
2007-11-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Reversed the ownership relationship between Interpreter and JSGlobalObject.
Now, the JSGlobalObject owns the Interpreter, and top-level objects
that need the two to persist just protect the JSGlobalObject from GC.
Global object bootstrapping looks a little odd right now, but it will
make much more sense soon, after further rounds of refactoring.
* bindings/runtime_root.h: Made this class inherit from RefCounted,
to avoid code duplication.
* kjs/collector.cpp:
(KJS::Collector::collect): No need to give special GC treatment to
Interpreters, since we mark their global objects, which mark them.
* kjs/interpreter.cpp:
(KJS::Interpreter::mark): No need to mark our global object, since it
marks us.
* kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
owns us directly.
* kjs/testkjs.cpp: Modified to follow the new rules.
(createGlobalObject):
(runWithScripts):
2007-11-30 Brent Fulgham <bfulgham@gmail.com>
Reviewed by Eric.
* ChangeLog:
* pcre/pcre_compile.cpp:
(compile_branch):
2007-11-30 Eric Seidel <eric@webkit.org>
No review, build fix only.
Fix uninitialized var warnings in release build.
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_compile.cpp:
(compile_regex):
2007-11-30 Darin Adler <darin@apple.com>
Reviewed by Adam Roben.
- fix http://bugs.webkit.org/show_bug.cgi?id=16207
JavaScript regular expressions should match UTF-16 code units rather than characters
SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
Test: fast/js/regexp-non-bmp.html
Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
* pcre/pcre_compile.cpp:
(compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
them with simple pointer dereferences in some cases, and no code at all in others.
(calculateCompiledPatternLengthAndFlags): Ditto.
* pcre/pcre_exec.cpp:
(match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
Removed calls to the UTF-16 character accessor functions, replacing them with simple
pointer dereferences in some cases, and no code at all in others. Also removed some
explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
end_subject in because it is already done outside the loop.
(jsRegExpExecute):
* pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
2007-11-30 Eric Seidel <eric@webkit.org>
Reviewed by darin.
PCRE crashes under GuardMalloc
http://bugs.webkit.org/show_bug.cgi?id=16127
check against patternEnd to make sure we don't walk off the end of the string
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
2007-11-30 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Fix layout test regressions caused by r28186
http://bugs.webkit.org/show_bug.cgi?id=16195
change first_byte and req_byte back to shorts instead of chars
(I think PCRE stuffs information in the high bits)
* pcre/pcre_internal.h:
2007-11-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej and Darin.
Make the JS collector work with multiple threads
Under heavy contention it was possible the GC to suspend other
threads inside the pthread spinlock, which could lead to the GC
thread blocking on the pthread spinlock itself.
We now determine and store each thread's stack base when it is
registered, thus removing the need for any calls to pthread_get_stackaddr_np
that needed the pthread spinlock.
* kjs/collector.cpp:
(KJS::Collector::Thread::Thread):
(KJS::Collector::registerThread):
(KJS::Collector::markOtherThreadConservatively):
2007-11-29 Adam Roben <aroben@apple.com>
Windows build fix
Removed some unreachable code (ironically, the code was some
ASSERT_NOT_REACHED()s).
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
2007-11-29 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151.
* pcre/pcre_compile.cpp:
(is_anchored):
2007-11-28 Mark Rowe <mrowe@apple.com>
Gtk build fix. Rubber-stamped by Eric.
* pcre/pcre_exec.cpp:
(match): Add braces around the body of the case statement to prevent
wanings about jumps across the initialization of a variable.
2007-11-29 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Attempt to fix non-mac builds after PCRE cleanup.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCoreSources.bkl:
* pcre/pcre.pri:
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Centralize code for subjectPtr adjustments using inlines, only ever check for a single
trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char
classes and garbled UTF16 strings.
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(getPreviousChar):
(movePtrToPreviousChar):
(movePtrToNextChar):
(movePtrToStartOfCurrentChar):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
change getChar* functions to return result and push 'c' into local scopes for clarity
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(getChar):
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Comment cleanup
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Further cleanups to calculateCompiledPatternLengthAndFlags
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give consistent naming to the RegExp options/compile flags
* pcre/pcre_compile.cpp:
(compile_branch):
(is_anchored):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win.
* pcre/pcre_exec.cpp:
(tryFirstByteOptimization):
(tryRequiredByteOptimization):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines
* pcre/pcre_compile.cpp:
(compile_branch):
(is_anchored):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Deprecate jsRegExpExecute's offset-vector fallback code
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(canApplyFirstCharOptimization):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Mitz & Maciej.
Change _NC operators to use _IGNORING_CASE for clarity
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(find_firstassertedchar):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Mitz.
Remove branch from return
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add repeatInformationFromInstructionOffset inline
* pcre/pcre_exec.cpp:
(repeatInformationFromInstructionOffset):
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove no longer used error code JSRegExpErrorMatchLimit
* kjs/regexp.cpp:
(KJS::RegExp::match):
* pcre/pcre.h:
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Make i locally scoped for better code clarity
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup.
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match_ref):
(MatchStack::pushNewFrame):
(getUTF8CharAndIncrementLength):
(match):
* pcre/pcre_internal.h:
(getChar):
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::popCurrentFrame):
2007-11-25 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests
* pcre/pcre_internal.h:
2007-11-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove match_is_group variable for another 5% speedup
* pcre/pcre_compile.cpp:
* pcre/pcre_exec.cpp:
(startNewGroup):
(match):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract frame variables into locals and args
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Section off MatchData arguments into args struct
* pcre/pcre_exec.cpp:
(MatchStack::pushNewFrame):
(match):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove redundant eptrblock struct
* pcre/pcre_exec.cpp:
(MatchStack::pushNewFrame):
(match):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove redundant match_call_count and move recursion check out of super-hot code path
SunSpider says this is at least an 8% speedup for regexp.
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::pushNewFrame):
(MatchStack::popCurrentFrame):
(MatchStack::popAllFrames):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Get rid of GETCHAR* macros, replacing them with better named inlines
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Further cleanup GET/PUT inlines
* pcre/pcre_internal.h:
(putOpcodeValueAtOffset):
(getOpcodeValueAtOffset):
(putOpcodeValueAtOffsetAndAdvance):
(put2ByteOpcodeValueAtOffset):
(get2ByteOpcodeValueAtOffset):
(put2ByteOpcodeValueAtOffsetAndAdvance):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches
* pcre/pcre_compile.cpp:
(firstSignificantOpCodeSkippingAssertions):
(find_fixedlength):
(complete_callout):
(compile_branch):
(compile_regex):
(is_anchored):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(putOpcodeValueAtOffset):
(getOpcodeValueAtOffset):
(putOpcodeValueAtOffsetAndAdvance):
(put2ByteOpcodeValueAtOffset):
(get2ByteOpcodeValueAtOffset):
(moveOpcodePtrPastAnyAlternateBranches):
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup
* pcre/pcre_compile.cpp:
(compile_branch):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(toLowerCase):
(flipCase):
(classBitmapForChar):
(charTypeForChar):
(isWordChar):
(isSpaceChar):
(CompileData::CompileData):
* pcre/pcre_xclass.cpp:
(_pcre_xclass):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
cleanup _pcre_ucp_othercase
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Use better variable names for case ignoring options
* pcre/pcre_compile.cpp:
(compile_branch):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match_ref):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
split first_significant_code into two simpler functions
* pcre/pcre_compile.cpp:
(firstSignificantOpCode):
(firstSignificantOpCodeSkippingAssertions):
(is_anchored):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
clean up is_counted_repeat
* pcre/pcre_compile.cpp:
(is_counted_repeat):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
clean up check_escape
* pcre/pcre_compile.cpp:
(check_escape):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Reformat find_fixedlength
* pcre/pcre_compile.cpp:
(find_fixedlength):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
reformat is_anchored
* pcre/pcre_compile.cpp:
(is_anchored):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove unused function could_be_empty_branch
* pcre/pcre_compile.cpp:
(first_significant_code):
(find_fixedlength):
(compile_branch):
(canApplyFirstCharOptimization):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Pass around MatchData objects by reference
* pcre/pcre_exec.cpp:
(pchars):
(match_ref):
(match):
(jsRegExpExecute):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
give PCRE_STARTLINE a better name and rename match_data to MatchData
* pcre/pcre_compile.cpp:
(compile_branch):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(pchars):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up find_firstassertedchar
* pcre/pcre_compile.cpp:
(get_othercase_range):
(find_firstassertedchar):
(calculateCompiledPatternLengthAndFlags):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Tim Hatcher.
Pass around CompileData& instead of CompileData*
* pcre/pcre_compile.cpp:
(compile_branch):
(jsRegExpCompile):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_compile.cpp:
(_pcre_ord2utf8):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_internal.h:
* pcre/pcre_ord2utf8.cpp: Removed.
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
removing more macros
* pcre/pcre_compile.cpp:
(could_be_empty_branch):
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
* pcre/pcre_xclass.cpp:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
clean up formating in compile_branch
* pcre/pcre_compile.cpp:
(compile_branch):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Fix spacing for read_repeat_counts
* pcre/pcre_compile.cpp:
(read_repeat_counts):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Get rid of PCRE custom char types
* pcre/pcre_compile.cpp:
(check_escape):
(complete_callout):
(compile_branch):
(compile_regex):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match_ref):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
reformat get_othercase_range
* pcre/pcre_compile.cpp:
(get_othercase_range):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove register keyword and more cleanup
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(is_anchored):
(is_startline):
(find_firstassertedchar):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::allocateNextFrame):
(MatchStack::pushNewFrame):
(MatchStack::frameIsStackAllocated):
(MatchStack::popCurrentFrame):
(MatchStack::unrollAnyHeapAllocatedFrames):
(getUTF8CharAndIncrementLength):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(PUT2INC):
(isLeadingSurrogate):
(isTrailingSurrogate):
(decodeSurrogatePair):
(getChar):
* pcre/pcre_ord2utf8.cpp:
(_pcre_ord2utf8):
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer):
(_pcre_xclass):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Clean up jsRegExpExecute
* pcre/pcre_compile.cpp:
(returnError):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-29 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Merging updated system alloc and spinlock code from r38 of TCMalloc.
This is needed as a precursor to the merge of TCMalloc proper.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::GrowHeap):
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::TCMalloc_SpinLock):
(TCMalloc_SpinLock::):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SpinLock::IsHeld):
* wtf/TCSystemAlloc.cpp:
(TrySbrk):
(TryMmap):
(TryVirtualAlloc):
(TryDevMem):
(TCMalloc_SystemAlloc):
* wtf/TCSystemAlloc.h:
2007-11-28 Brady Eidson <beidson@apple.com>
Reviewed by Geoff
Add copyKeysToVector utility, mirroring copyValuesToVector
Also change the copyValuesToVector implementation to be a little more attractive
* wtf/HashMap.h:
(WTF::copyKeysToVector):
(WTF::copyValuesToVector):
2007-11-27 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Add a list of public JavaScriptCore headers for installation.
This follows the convention used for the Qt and GTK+ header lists.
* headers.pri: Added.
2007-11-27 Alp Toker <alp@atoker.com>
Prospective MSVC build fix.
Roll back dllexport/dllimport support for now.
* API/JSBase.h:
2007-11-27 Alp Toker <alp@atoker.com>
Reviewed by Maciej.
http://bugs.webkit.org/show_bug.cgi?id=15569
[gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF
Introduce JS_EXPORT to mark symbols to be exported as public API.
Export all public symbols in the JavaScriptCore C API.
This matches conventions for exporting symbols set by the CF and CG
frameworks.
* API/JSBase.h:
* API/JSContextRef.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSStringRefBSTR.h:
* API/JSStringRefCF.h:
* API/JSValueRef.h:
2007-11-27 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Make PropertyNameArray and ScopeChain COMEnumVariant friendly.
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::swap):
Implement PropertyNameArray::swap.
* kjs/PropertyNameArray.h:
Add ValueType typedef. Replace PropertyNameArrayIterator with
PropertyNameArray::const_iterator.
* kjs/nodes.cpp:
(KJS::ForInNode::execute):
* kjs/scope_chain.cpp:
(KJS::ScopeChain::print):
Update for changes to PropertyNameArray.
* kjs/scope_chain.h:
Add const_iterator and ValueType typedef.
2007-11-27 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
Add a ValueType typedef.
* wtf/Vector.h:
2007-11-26 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=16096
REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
Removed a stray "ptr++" that I added by accident when merging the
changes between PCRE 6.4 and 6.5.
2007-11-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Kevin McCullough.
Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not
show variables (can't enumerate ActivationImp properties)
Implemented a custom ActivationImp::getPropertyNames, since
ActivationImp now uses a custom property storage mechanism for local
variables.
* kjs/function.cpp:
(KJS::ActivationImp::getPropertyNames):
* kjs/function.h:
2007-11-26 Alp Toker <alp@atoker.com>
GTK+/Qt/Wx build fix for breakage introduced in r28039.
* ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
2007-11-24 Laszlo Gombos <laszlo.gombos@gmail.com>
Reviewed by Maciej Stachowiak.
Fix minor compiler warning (GCC 4.1.3)
* pcre/pcre_internal.h:
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-25 Mark Rowe <mrowe@apple.com>
Reviewed by Dan Bernstein.
Fix http://bugs.webkit.org/show_bug.cgi?id=16129
Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
* pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
to our caller like they expect.
2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
MSVC7 build fix. (rand_s doesn't exist there)
Reviewed by Adam Roben.
* kjs/config.h:
* wtf/MathExtras.h:
2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
wx build fix. Move WX_PYTHON logic into project build settings,
add WebKitLibraries dirs on Win, and explicitly include JSCore
headers in testkjs rather than getting them from a template.
(Include dir order of JSCore/WTF and ICU headers is important due
to wtf/unicode/utf8.h.)
* jscore.bkl:
2007-11-23 Simon Hausmann <hausmann@webkit.org>
Reviewed by George Staikos <staikos@kde.org>.
Fix make (dist)clean on Windows.
OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-22 Simon Hausmann <hausmann@kde.org>
Reviewed by George.
Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-22 Simon Hausmann <hausmann@kde.org>
Reviewed by George.
Centralize the setup for all the extra compilers in a addExtraCompiler function.
This allows adding a "generated_files" target that builds all generated files using "make generated_files".
For the build inside Qt we do not generate actual rules for the extra compilers but instead
do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-20 Mark Rowe <mrowe@apple.com>
Reviewed by Tim Hatcher.
<rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
-Werror to succeed. At present they will crash when executed due to code that is not safe
under strict aliasing (<rdar://problem/5536806>).
* Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
* kjs/date_object.cpp:
(KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
* kjs/dtoa.cpp:
(Bigint::): Tweak formatting to silence warnings.
* pcre/pcre_exec.cpp:
(match): Tweak formatting to silence warnings
* wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
* wtf/Assertions.h: Ditto.
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
wx port build fix (wx headers include ctype functions).
* kjs/config.h:
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
Remove outdated and unused Windows port files.
Reviewed by Adam Roben.
* Makefile.vc: Removed.
* README-Win32.txt: Removed.
2007-11-18 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
* tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
<rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
http://bugs.webkit.org/show_bug.cgi?id=16033
Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
and constructors, and storing them on the global object. This allows JSClassRef's passed to
JSGlobalContextCreate to be instantiated with the correct prototype.
* API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::::JSCallbackObject):
(KJS::::init):
* API/JSContextRef.cpp:
(JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
prevent any JSObjectInitializeCallback's being invoked before a global object is set.
* API/testapi.c:
(globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
(globalObject_get):
(globalObject_set):
(main):
* API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
* JavaScriptCore.exp:
* bindings/testbindings.cpp:
(main): Update for changes in Interpreter method signatures.
* bindings/testbindings.mm:
(main): Ditto.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::mark):
(KJS::ExecState::setGlobalObject):
* kjs/ExecState.h: Rename scope to m_scopeChain.
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::globalObject):
(KJS::Interpreter::setGlobalObject):
(KJS::Interpreter::resetGlobalObjectProperties):
(KJS::Interpreter::createObjectsForGlobalObjectProperties):
(KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
call back into JavaScript from the initialization of the global object's members.
* kjs/interpreter.h:
* kjs/testkjs.cpp:
(setupInterpreter): Update for changes in Interpreter method signatures.
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Prevent testapi from reporting false leaks. Clear out local variables pointing at
JSObjectRefs to allow their values to be collected.
* API/testapi.c:
(main):
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
* API/testapi.c:
(main):
2007-11-17 Alp Toker <alp@atoker.com>
Reviewed by Eric.
http://bugs.webkit.org/show_bug.cgi?id=16032
JS minidom is not portable
Use a plain UTF-8 string instead of a CFString.
Print to stdout, not stderr like CFShow() would have done, since that
behaviour seems unintentional.
* API/minidom.c:
(main):
2007-11-17 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-11-16 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/lexer.cpp:
(KJS::Lexer::record8):
2007-11-16 Mark Rowe <mrowe@apple.com>
Reviewed by Eric.
Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
SunSpider claims this is a 0.7% speedup.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::lex):
(KJS::Lexer::record8):
(KJS::Lexer::record16):
(KJS::Lexer::scanRegExp):
(KJS::Lexer::clear):
(KJS::Lexer::makeIdentifier):
(KJS::Lexer::makeUString):
* kjs/lexer.h:
* kjs/ustring.cpp:
(KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
* kjs/ustring.h:
2007-11-16 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
and ignore the int -> bool conversion warning.
2007-11-16 Alexey Proskuryakov <ap@webkit.org>
Fix Windows debug build.
Rubber-stamped by Eric
* pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
complain about unreachable code.
2007-11-15 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/Parser.cpp:
2007-11-15 Mark Rowe <mrowe@apple.com>
Mac build and header search path sanity fix.
Reviewed by Sam Weinig and Tim Hatcher.
Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
it in JavaScriptCore.xcconfig. This removes the need to override it on a
per-target basis inside the .xcodeproj file.
* Configurations/Base.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-15 Mark Rowe <mrowe@apple.com>
Qt build fix.
* kjs/Parser.h:
2007-11-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Another round of grammar / parsing cleanup.
1. Created distinct parser calls for parsing function bodies vs
programs. This will help later with optimizing global variable access.
2. Turned Parser into a singleton. Cleaned up Lexer's singleton
interface.
3. Modified Lexer to free a little more memory when done lexing. (Added
FIXMEs for similar issues that I didn't fix.)
4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
respecting the arguments passed to them. (No behavior change, but this
problem could have caused serious problems for an unsuspecting user of
these functions.)
5. Removed KJS_DEBUG_MEM because it was bit-rotted.
6. Removed Parser::prettyPrint because the same work was simpler to do
at the call site.
7. Some renames:
"Parser::accept" => "Parser::didFinishParsing"
"Parser::sid" => "Parser::m_sourceID"
"Lexer::doneParsing" => "Lexer::clear"
"sid" => "sourceId"
"lineno" => "lineNo"
* JavaScriptCore.exp:
* kjs/Parser.cpp:
(KJS::Parser::Parser):
(KJS::Parser::parseProgram):
(KJS::Parser::parseFunctionBody):
(KJS::Parser::parse):
(KJS::Parser::didFinishParsing):
(KJS::parser):
* kjs/Parser.h:
(KJS::Parser::sourceId):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/grammar.y:
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lexer.cpp:
(kjsyylex):
(KJS::lexer):
(KJS::Lexer::Lexer):
(KJS::Lexer::~Lexer):
(KJS::Lexer::scanRegExp):
(KJS::Lexer::doneParsing):
(KJS::Lexer::makeIdentifier):
(KJS::Lexer::makeUString):
* kjs/lexer.h:
(KJS::Lexer::pattern):
(KJS::Lexer::flags):
(KJS::Lexer::sawError):
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::FunctionBodyNode::FunctionBodyNode):
* kjs/nodes.h:
* kjs/testkjs.cpp:
(prettyPrintScript):
(kjsmain):
* kjs/ustring.cpp:
* kjs/ustring.h:
2007-11-15 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
<rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
Add a stub node to maintain the Vector of SourceElements until assignment.
* kjs/grammar.y:
* kjs/nodes.h:
(KJS::SourceElementsStub::SourceElementsStub):
(KJS::SourceElementsStub::append):
(KJS::SourceElementsStub::release):
(KJS::SourceElementsStub::):
(KJS::SourceElementsStub::precedence):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract most of RMATCH into MatchStack functions.
SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
* pcre/pcre_exec.cpp:
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::allocateNextFrame):
(MatchStack::pushNewFrame):
(MatchStack::frameIsStackAllocated):
(MatchStack::popCurrentFrame):
(MatchStack::unrollAnyHeapAllocatedFrames):
(match):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove RETURN_ERROR, add MatchStack
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::unrollAnyHeapAllocatedFrames):
(matchError):
(match):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up match function to match WebKit style
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_exec.cpp:
(match):
2007-11-15 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore.make:
2007-11-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15982
Improve JSString UTF-8 decoding
* API/JSStringRef.cpp:
(JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::convertUTF16ToUTF8):
(WTF::Unicode::convertUTF8ToUTF16):
* wtf/unicode/UTF8.h:
Made these function names start with a lower case letter.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
from convertUTF8ToUTF16 in wtf/unicode.
(KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
(KJS::Bindings::identifierFromNPIdentifier): Ditto.
* bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
2007-11-14 Sam Weinig <sam@webkit.org>
Rubber-stamped by Anders.
Fix the Xcode project file after it was messed up in r27402.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
More PCRE style cleanup.
* pcre/pcre_compile.cpp:
(compile_regex):
2007-11-14 Adam Roben <aroben@apple.com>
Clean up the bison conflict checking script
Reviewed by Geoff.
* DerivedSources.make:
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Geoff.
Another round of PCRE cleanups: inlines
SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
* pcre/pcre_compile.cpp:
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(PUT):
(GET):
(PUT2):
(GET2):
(isNewline):
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give PCRE a (small) bath.
Fix some formating and break things off into separate functions
http://bugs.webkit.org/show_bug.cgi?id=15993
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags):
(printCompiledRegExp):
(returnError):
(jsRegExpCompile):
* pcre/pcre_internal.h:
(compile_data::compile_data):
2007-11-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Cleaned up the JavaScript grammar a bit.
1. Changed BlockNode to always hold a child vector (which may be empty),
eliminating a few NULL-check branches in the common execution case.
2. Changed the Block production to correctly report its starting and
ending line numbers to the debugger. (It used to report its ending line
as its starting line.) Also, removed duplicate line-reporting code
inside the BlockNode constructor.
3. Moved curly braces up from FunctionBody production into parent
productions. (I had to move the line number reporting code, too, since
it depends on the location of the curly braces.) This matches the ECMA
spec more closely, and makes some future changes I plan easier.
4. Fixed statementList* convenience functions to deal appropriately with
empty Vectors.
SunSpider reports a small and statistically insignificant speedup.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStack):
(KJS::statementListInitializeVariableAccessStack):
(KJS::BlockNode::BlockNode):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::getDeclarations):
(KJS::BlockNode::execute):
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::optimizeVariableAccess):
2007-11-13 Anders Carlsson <andersca@apple.com>
Add RefCounted.h (And remove Shared.h)
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Build fix.
* kjs/regexp.h:
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Anders Carlsson.
Renamed Shared to RefCounted.
* API/JSClassRef.h:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/interpreter.h:
* kjs/regexp.h:
* wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
(WTF::RefCounted::RefCounted):
* wtf/Shared.h: Removed.
2007-11-13 Adam Roben <aroben@apple.com>
Build fix
Reviewed by Geoff.
* kjs/regexp.h: Added a missing #include.
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Moved Shared.h into wtf so it could be used in more places. Deployed
Shared in places where JSCore previously had hand-rolled ref-counting
classes.
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass):
* API/JSClassRef.h:
* API/JSObjectRef.cpp:
(JSClassRetain):
(JSClassRelease):
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/interpreter.cpp:
(KJS::Interpreter::init):
* kjs/interpreter.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp):
* kjs/regexp.h:
* wtf/Shared.h: Copied from WebCore/platform/Shared.h.
2007-11-13 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add an ASSERT to getTruncatedInt32 to enforce proper usage.
Best part about this patch? It doesn't break the web!
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32):
(KJS::JSImmediate::toDouble):
(KJS::JSImmediate::getUInt32):
2007-11-13 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertUTF8ToUTF16):
* kjs/ustring.cpp:
(KJS::UString::UTF8String):
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::ConvertUTF8ToUTF16):
2007-11-13 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=11231
RegExp bug when handling newline characters
and a number of other differences between PCRE behvior
and JavaScript regular expressions:
+ single-digit sequences like \4 should be treated as octal
character constants, unless there is a sufficient number
of brackets for them to be treated as backreferences
+ \8 turns into the character "8", not a binary zero character
followed by "8" (same for 9)
+ only the first 3 digits should be considered part of an
octal character constant (the old behavior was to decode
an arbitrarily long sequence and then mask with 0xFF)
+ if \x is followed by anything other than two valid hex digits,
then it should simply be treated a the letter "x"; that includes
not supporting the \x{41} syntax
+ if \u is followed by anything less than four valid hex digits,
then it should simply be treated a the letter "u"
+ an extra "+" should be a syntax error, rather than being treated
as the "possessive quantifier"
+ if a "]" character appears immediately after a "[" character that
starts a character class, then that's an empty character class,
rather than being the start of a character class that includes a
"]" character
+ a "$" should not match a terminating newline; we could have gotten
PCRE to handle this the way we wanted by passing an appropriate option
Test: fast/js/regexp-no-extensions.html
* pcre/pcre_compile.cpp:
(check_escape): Check backreferences against bracount to catch both
overflows and things that should be treated as octal. Rewrite octal
loop to not go on indefinitely. Rewrite both hex loops to match and
remove \x{} support.
(compile_branch): Restructure loops so that we don't special-case a "]"
at the beginning of a character class. Remove code that treated "+" as
the possessive quantifier.
(jsRegExpCompile): Change the "]" handling here too.
* pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
Changed DOLL to remove handling of "terminating newline", a Perl concept
which we don't need.
* tests/mozilla/expected.html: Two tests are fixed now:
ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
was due to a bug (we treated all 1-character numeric escapes as backreferences).
The date tests also now both expect success -- whatever was making them fail
before was probably due to the time being close to a DST shift; maybe we need
to get rid of those tests.
2007-11-13 Darin Adler <darin@apple.com>
* kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
Remove too-strong assert that was firing constantly and preventing even basic
web browsing from working in a debug build. This function is used in many
cases where the immediate value is not a number; the assertion could perhaps
be added back later with a bit of reorganization.
2007-11-13 Alp Toker <alp@atoker.com>
Build fix for breakage to non-Mac builds introduced in r27746.
* kjs/ustring.cpp:
2007-11-13 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
* kjs/JSImmediate.h:
* kjs/nodes.cpp:
(KJS::GreaterNode::inlineEvaluateToBoolean):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::inlineEvaluateToBoolean):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::inlineEvaluateToBoolean):
(KJS::GreaterEqNode::evaluate):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::inlineEvaluateToBoolean):
(KJS::EqualNode::evaluate):
(KJS::NotEqualNode::inlineEvaluateToBoolean):
(KJS::NotEqualNode::evaluate):
(KJS::StrictEqualNode::inlineEvaluateToBoolean):
(KJS::StrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
(KJS::NotStrictEqualNode::evaluate):
* kjs/nodes.h:
2007-11-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
base64 spends 1.1% of total time checking for special Infinity case
Use a fast character test instead of calling strncmp.
1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
Sharks reports only .1%. Who are you going to believe? Huh?
* kjs/ustring.cpp:
(KJS::UString::toDouble):
2007-11-12 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
Fix a few missing evaluateToBoolean methods
Deploy all evaluateTo* functions to more nodes to avoid slowdowns
http://bugs.webkit.org/show_bug.cgi?id=15950
SunSpider claims this is at least a 1.4% speedup.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32):
(KJS::JSImmediate::toDouble):
(KJS::JSImmediate::getUInt32):
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToNumber):
(KJS::ExpressionNode::evaluateToInt32):
(KJS::ExpressionNode::evaluateToUInt32):
(KJS::NumberNode::evaluateToInt32):
(KJS::NumberNode::evaluateToUInt32):
(KJS::ImmediateNumberNode::evaluateToInt32):
(KJS::ImmediateNumberNode::evaluateToUInt32):
(KJS::ResolveNode::evaluate):
(KJS::ResolveNode::evaluateToNumber):
(KJS::ResolveNode::evaluateToBoolean):
(KJS::ResolveNode::evaluateToInt32):
(KJS::ResolveNode::evaluateToUInt32):
(KJS::LocalVarAccessNode::evaluateToInt32):
(KJS::LocalVarAccessNode::evaluateToUInt32):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::BracketAccessorNode::evaluateToBoolean):
(KJS::BracketAccessorNode::evaluateToInt32):
(KJS::BracketAccessorNode::evaluateToUInt32):
(KJS::DotAccessorNode::inlineEvaluate):
(KJS::DotAccessorNode::evaluate):
(KJS::DotAccessorNode::evaluateToNumber):
(KJS::DotAccessorNode::evaluateToBoolean):
(KJS::DotAccessorNode::evaluateToInt32):
(KJS::DotAccessorNode::evaluateToUInt32):
(KJS::NewExprNode::inlineEvaluate):
(KJS::NewExprNode::evaluate):
(KJS::NewExprNode::evaluateToNumber):
(KJS::NewExprNode::evaluateToBoolean):
(KJS::NewExprNode::evaluateToInt32):
(KJS::NewExprNode::evaluateToUInt32):
(KJS::FunctionCallResolveNode::inlineEvaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluateToNumber):
(KJS::FunctionCallResolveNode::evaluateToBoolean):
(KJS::FunctionCallResolveNode::evaluateToInt32):
(KJS::FunctionCallResolveNode::evaluateToUInt32):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluateToNumber):
(KJS::LocalVarFunctionCallNode::evaluateToBoolean):
(KJS::LocalVarFunctionCallNode::evaluateToInt32):
(KJS::LocalVarFunctionCallNode::evaluateToUInt32):
(KJS::FunctionCallDotNode::evaluate):
(KJS::FunctionCallDotNode::evaluateToNumber):
(KJS::FunctionCallDotNode::evaluateToBoolean):
(KJS::FunctionCallDotNode::evaluateToInt32):
(KJS::FunctionCallDotNode::evaluateToUInt32):
(KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToBoolean):
(KJS::PostDecLocalVarNode::evaluateToInt32):
(KJS::PostDecLocalVarNode::evaluateToUInt32):
(KJS::typeStringForValue):
(KJS::UnaryPlusNode::evaluate):
(KJS::UnaryPlusNode::evaluateToBoolean):
(KJS::UnaryPlusNode::evaluateToNumber):
(KJS::UnaryPlusNode::evaluateToInt32):
(KJS::BitwiseNotNode::inlineEvaluateToInt32):
(KJS::BitwiseNotNode::evaluate):
(KJS::BitwiseNotNode::evaluateToNumber):
(KJS::BitwiseNotNode::evaluateToBoolean):
(KJS::BitwiseNotNode::evaluateToInt32):
(KJS::MultNode::evaluateToBoolean):
(KJS::MultNode::evaluateToInt32):
(KJS::MultNode::evaluateToUInt32):
(KJS::DivNode::evaluateToInt32):
(KJS::DivNode::evaluateToUInt32):
(KJS::ModNode::evaluateToBoolean):
(KJS::ModNode::evaluateToInt32):
(KJS::ModNode::evaluateToUInt32):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNode::evaluateToInt32):
(KJS::AddNode::evaluateToUInt32):
(KJS::AddNumbersNode::evaluateToInt32):
(KJS::AddNumbersNode::evaluateToUInt32):
(KJS::SubNode::evaluateToInt32):
(KJS::SubNode::evaluateToUInt32):
(KJS::LeftShiftNode::inlineEvaluateToInt32):
(KJS::LeftShiftNode::evaluate):
(KJS::LeftShiftNode::evaluateToNumber):
(KJS::LeftShiftNode::evaluateToInt32):
(KJS::RightShiftNode::inlineEvaluateToInt32):
(KJS::RightShiftNode::evaluate):
(KJS::RightShiftNode::evaluateToNumber):
(KJS::RightShiftNode::evaluateToInt32):
(KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluateToNumber):
(KJS::UnsignedRightShiftNode::evaluateToInt32):
(KJS::LessNode::inlineEvaluateToBoolean):
(KJS::LessNode::evaluate):
(KJS::LessNode::evaluateToBoolean):
(KJS::LessNumbersNode::inlineEvaluateToBoolean):
(KJS::LessNumbersNode::evaluate):
(KJS::LessNumbersNode::evaluateToBoolean):
(KJS::LessStringsNode::inlineEvaluateToBoolean):
(KJS::LessStringsNode::evaluate):
(KJS::BitAndNode::evaluate):
(KJS::BitAndNode::inlineEvaluateToInt32):
(KJS::BitAndNode::evaluateToNumber):
(KJS::BitAndNode::evaluateToBoolean):
(KJS::BitAndNode::evaluateToInt32):
(KJS::BitXOrNode::inlineEvaluateToInt32):
(KJS::BitXOrNode::evaluate):
(KJS::BitXOrNode::evaluateToNumber):
(KJS::BitXOrNode::evaluateToBoolean):
(KJS::BitXOrNode::evaluateToInt32):
(KJS::BitOrNode::inlineEvaluateToInt32):
(KJS::BitOrNode::evaluate):
(KJS::BitOrNode::evaluateToNumber):
(KJS::BitOrNode::evaluateToBoolean):
(KJS::BitOrNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToNumber):
(KJS::ConditionalNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToUInt32):
(KJS::valueForReadModifyAssignment):
(KJS::AssignExprNode::evaluate):
(KJS::AssignExprNode::evaluateToBoolean):
(KJS::AssignExprNode::evaluateToNumber):
(KJS::AssignExprNode::evaluateToInt32):
(KJS::VarDeclNode::handleSlowCase):
* kjs/nodes.h:
(KJS::FunctionCallResolveNode::precedence):
(KJS::AddNode::precedence):
(KJS::AddNode::):
(KJS::LessNumbersNode::):
(KJS::LessStringsNode::):
* kjs/value.cpp:
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
* kjs/value.h:
(KJS::JSValue::asCell):
(KJS::JSValue::toInt32):
(KJS::JSValue::toUInt32):
2007-11-12 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15953
Add UTF-8 encoding/decoding to WTF
* kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
parameter. Callers are not interested in getting decoding results in strict mode, so
this allows for bailing out as soon as an error is seen.
* kjs/function.cpp:
(KJS::encode): Updated for new UString::UTF8String() signature.
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters): Disambiguate UChar.
(JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
* bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
* wtf/unicode/UTF8.cpp: Added.
(WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
(WTF::Unicode::inlineUTF8SequenceLength):
(WTF::Unicode::UTF8SequenceLength):
(WTF::Unicode::decodeUTF8Sequence):
(WTF::Unicode::):
(WTF::Unicode::ConvertUTF16ToUTF8):
(WTF::Unicode::isLegalUTF8):
(WTF::Unicode::ConvertUTF8ToUTF16):
* wtf/unicode/UTF8.h: Added.
(WTF::Unicode::):
Some code moved from ustring.h, some adapted from unicode.org sources.
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
Added UTF8.{h,cpp}
2007-11-12 Josh Aas <joshmoz@gmail.com>
Reviewed by Darin.
- http://bugs.webkit.org/show_bug.cgi?id=15946
add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
* bindings/npapi.h:
2007-11-12 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15951
REGRESSION: assertion failure in regexp match() when running JS tests
Test: fast/js/regexp-many-brackets.html
* pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
the BRANUMBER opcode.
2007-11-12 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix use of prefix and config.h, got rid of a few unneeded things in
the PCRE code; no behavior changes
* API/JSBase.cpp: Added include of config.h.
* API/JSCallbackConstructor.cpp: Ditto.
* API/JSCallbackFunction.cpp: Ditto.
* API/JSCallbackObject.cpp: Ditto.
* API/JSClassRef.cpp: Ditto.
* API/JSContextRef.cpp: Ditto.
* API/JSObjectRef.cpp: Ditto.
* API/JSStringRef.cpp: Ditto.
* API/JSValueRef.cpp: Ditto.
* JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
Moved new/delete macros after includes, as they are in WebCore's prefix.
Removed "config.h".
* pcre/dftables.cpp: (main): Changed back to not use a separate maketables
function. This is needed for PCRE, but not helpful for our use. Also changed
the tables to all be 128 entries long instead of 256, since only the first
128 are ever used.
* pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
which was only being used to check hex digits. Changed all uses of TRUE and
FALSE to use the C++ true and false instead.
(check_escape): Just the TRUE/FALSE thing.
(is_counted_repeat): Ditto.
(could_be_empty_branch): Ditto.
(get_othercase_range): Ditto.
(compile_branch): Ditto.
(compile_regex): Ditto.
(is_anchored): Ditto.
(is_startline): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
FALSE to use the C++ true and false instead.
(match_ref): Just the TRUE/FALSE thing.
(match): Ditto. Removed some unneeded braces.
(jsRegExpExecute): Just the TRUE/FALSE thing.
* pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
of the file instead of the bottom, so they can be used. Also changed the table
sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
be a macro instead of a extern int.
* pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
* pcre/pcre_tables.cpp: Made table sizes explicit.
* pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
2007-11-12 Adam Roben <aroben@apple.com>
Build fix
* wtf/FastMalloc.h: Add missing using statement.
2007-11-11 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Add special fastZeroedMalloc function to replace a
number of fastCalloc calls where one argument was 1.
This results in a 0.4% progression in SunSpider, more
than making up for the earlier regression caused by
additional overflow checks.
* JavaScriptCore.exp:
* kjs/array_instance.cpp:
* kjs/property_map.cpp:
* wtf/FastMalloc.cpp:
* wtf/FastMalloc.h:
* wtf/HashTable.h:
2007-11-11 Adam Roben <aroben@apple.com>
Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
The bug was due to a mismatch between HashMap::remove and
HashTable::checkTableConsistency. HashMap::remove can delete the value
stored in the HashTable (by derefing it), which is not normally
allowed by HashTable. It's OK in this case because the value is about
to be removed from the table, but HashTable wasn't aware of this.
HashMap::remove now performs the consistency check itself before
derefing the value.
Darin noticed that the same bug would occur in HashSet, so I've fixed
it there as well.
Reviewed by Darin.
* wtf/HashMap.h:
(WTF::HashMap::remove): Perform the HashTable consistency check
manually before calling deref.
* wtf/HashSet.h:
(WTF::HashSet::remove): Ditto.
* wtf/HashTable.h: Made checkTableConsistency public so that HashMap
and HashSet can call it.
(WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
Added.
(WTF::HashTable::removeAndInvalidate): Added.
(WTF::HashTable::remove):
(WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
2007-11-11 Mark Rowe <mrowe@apple.com>
Build fix. Use the correct filename case.
* kjs/nodes.h:
2007-11-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
15% of string-validate-input.js is spent compiling the same regular expression
Store a compiled representation of the regular expression in the AST.
Only a .2% SunSpider speedup overall, but a 10.6% speedup on
string-validate-input.js.
* kjs/nodes.cpp:
(KJS::RegExpNode::evaluate):
* kjs/nodes.h:
(KJS::RegExpNode::):
* kjs/nodes2string.cpp:
(KJS::RegExpNode::streamTo):
* kjs/regexp.cpp:
(KJS::RegExp::flags):
* kjs/regexp.h:
(KJS::RegExp::pattern):
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::construct):
(KJS::RegExpObjectImp::createRegExpImp):
* kjs/regexp_object.h:
2007-11-11 Oliver Hunt <oliver@apple.com>
Reviewed by Eric.
Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
Unfortunately this is a very slight regression, but is unavoidable.
* wtf/FastMalloc.cpp:
2007-11-10 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add simple type inferencing to the parser, and create custom
AddNode and LessNode subclasses based on inferred types.
http://bugs.webkit.org/show_bug.cgi?id=15884
SunSpider claims this is at least a 0.5% speedup.
* JavaScriptCore.exp:
* kjs/grammar.y:
* kjs/internal.cpp:
(KJS::NumberImp::getPrimitiveNumber):
(KJS::GetterSetterImp::getPrimitiveNumber):
* kjs/internal.h:
* kjs/lexer.cpp:
(KJS::Lexer::lex):
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::StringNode::evaluate):
(KJS::StringNode::evaluateToNumber):
(KJS::StringNode::evaluateToBoolean):
(KJS::RegExpNode::evaluate):
(KJS::UnaryPlusNode::optimizeVariableAccess):
(KJS::AddNode::evaluate):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNumbersNode::inlineEvaluateToNumber):
(KJS::AddNumbersNode::evaluate):
(KJS::AddNumbersNode::evaluateToNumber):
(KJS::AddStringsNode::evaluate):
(KJS::AddStringLeftNode::evaluate):
(KJS::AddStringRightNode::evaluate):
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNumbersNode::evaluate):
(KJS::LessStringsNode::evaluate):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::RegExpNode::):
(KJS::RegExpNode::precedence):
(KJS::TypeOfResolveNode::):
(KJS::LocalVarTypeOfNode::):
(KJS::UnaryPlusNode::):
(KJS::UnaryPlusNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::AddNumbersNode::):
(KJS::AddStringLeftNode::):
(KJS::AddStringRightNode::):
(KJS::AddStringsNode::):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::LessNumbersNode::):
(KJS::LessStringsNode::):
* kjs/nodes2string.cpp:
(KJS::StringNode::streamTo):
* kjs/object.cpp:
* kjs/object.h:
* kjs/value.h:
(KJS::JSValue::getPrimitiveNumber):
2007-11-11 Darin Adler <darin@apple.com>
- try another way of fixing dftables builds -- refactor pcre_internal.h a bit
* pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
Later we can break it into two files.
* JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
* pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
* pcre/dftables.pro: Take out now-unneeded include paths.
* pcre/pcre_maketables.cpp: Use new instead of malloc.
2007-11-11 Darin Adler <darin@apple.com>
* pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
another include path.
2007-11-11 Darin Adler <darin@apple.com>
* JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
by adding another include path.
2007-11-11 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15924
next round of changes to JSRegExp (formerly PCRE)
This is a combination of converting to C++, tweaking the API, and adding
some additional optimizations.
Future steps will involve getting rid of the use of UTF-8 completely
(we'll use UTF-16 exclusively instead), eliminating more source files,
and some more speed-ups.
SunSpider says the current round is an 0.9% speed-up overall, and a
5.3% speed-up for regexp.
* JavaScriptCore.exp: Updated for new entry points.
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* jscore.bkl:
Updated for new source file names and ForwardingHeaders.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Changed to use the error message without calling
strdup on it and to pass the new types and options.
(KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
(KJS::RegExp::match): Pass the new types and options.
* kjs/regexp.h: Update type of m_constructionError.
* pcre/AUTHORS: Update to reflect the status of the project -- we don't include
the Google parts, and this isn't the PCRE library, per se.
* pcre/COPYING: Ditto.
* pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
(main): Removed unneeded ctype_digit.
* pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
* pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
Moved a lot of private stuff used only within this file here from pcre_internal.h.
Renumbered the error codes.
(error_text): Use a single string with embedded nulls for the error text (I got
this idea from newer versions of PCRE).
(check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
uses with isASCIIDigit.
(is_counted_repeat): Ditto.
(read_repeat_counts): Ditto.
(first_significant_code): Ditto.
(find_fixedlength): Ditto.
(could_be_empty_branch): Ditto.
(compile_branch): Ditto. Also removed some code that handles changing options.
JavaScript doesn't have any of the features that allow options to change.
(compile_regex): Updated for change to options parameter.
(is_anchored): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Changed to take separate flags instead of an options int.
Also changed to call new/delete instead of pcre_malloc/free.
(jsRegExpFree): Ditto.
* pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
Added a case that uses computed goto for the opcode loop, but did not turn it on.
Changed the RMATCH macro to handle returns more efficiently by putting the where
pointer in the new frame instead of the old one, allowing us to branch to the
return with a single statement. Switched to new/delete from pcre_malloc/free.
Changed many RRETURN callers to not set the return value since it's already
set correctly. Replaced the rrc variable with an is_match variable. Values other
than "match" and "no match" are now handled differently. This allows us to remove
the code to check for those cases in various rules.
(match): All the case statements use a macro BEGIN_OPCODE instead. And all the
continue statements, or break statements that break out of the outer case use
a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
(jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
start_match field from the match block.
* pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
in here. Removed various unused types. Converted from JSRegExpChar to UChar.
Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
used in multiple places. Unfortunately we lose the comments for each opcode; we
should find a place to put those back. Removed ctype_digit.
* pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
(pcre_maketables): Got rid of the conditional code that allows this to be compiled
in -- it's only used for dftables now (and soon may be obsolete entirely).
Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
loop. Removed ctype_digit.
* pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
* pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
* pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
Updated for other file name changes.
* pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
* pcre/ucpinternal.h: Updated header.
* pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
* wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
& for this operation. Also added an overload that takes an int because that's
useful for PCRE. Later we could optimize for int and overload other functions in
this file; stuck to this simple one for now.
* wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
* wtf/unicode/qt4/UnicodeQt4.h: Ditto.
* pcre/LICENCE: Removed.
* pcre/pcre-config.h: Removed.
* wtf/FastMallocPCRE.cpp: Removed.
* pcre/dftables.c: Renamed to cpp.
* pcre/pcre_compile.c: Ditto.
* pcre/pcre_exec.c: Ditto.
* pcre/pcre_maketables.c: Ditto.
* pcre/pcre_ord2utf8.c: Ditto.
* pcre/pcre_tables.c: Ditto.
* pcre/pcre_ucp_searchfuncs.c: Ditto.
* pcre/pcre_xclass.c: Ditto.
* pcre/ucptable.c: Ditto.
2007-11-11 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToBoolean):
(KJS::LessNode::evaluateToBoolean):
(KJS::GreaterNode::evaluateToBoolean):
(KJS::LessEqNode::evaluateToBoolean):
(KJS::GreaterEqNode::evaluateToBoolean):
(KJS::InstanceOfNode::evaluateToBoolean):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::evaluateToBoolean):
(KJS::NotEqualNode::evaluateToBoolean):
(KJS::StrictEqualNode::evaluateToBoolean):
(KJS::NotStrictEqualNode::evaluateToBoolean):
(KJS::LogicalAndNode::evaluateToBoolean):
(KJS::LogicalOrNode::evaluateToBoolean):
(KJS::ConditionalNode::evaluateToBoolean):
2007-11-10 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=15927
REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
Test: fast/js/delete-then-put.html
* kjs/property_map.cpp:
(KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
(KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
problem before.
- roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
* kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
optimizeForUnnecessaryResult, since the result is used in some cases.
2007-11-10 Adam Roben <aroben@apple.com>
Windows build fix
Roll out some changes that were (seemingly accidentally) checked in
with r27664.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-11-10 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15915
add an evaluation path for booleans like the one we have for numbers
Gives 1.1% on SunSpider.
* kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
* kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
down from Node to ExpressionNode. Changed some classes to not inherit from
ExpressionNode where not necessary, and removed unnneeded evaluate functions
as well as evaluate functions that need not be virtual. Call the
optimizeForUnnecessaryResult function on the start of a for loop too.
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToBoolean): Added.
(KJS::FalseNode::evaluate): Added.
(KJS::TrueNode::evaluate): Added.
(KJS::NumberNode::evaluateToBoolean): Added.
(KJS::StringNode::evaluateToBoolean): Added.
(KJS::LocalVarAccessNode::evaluateToBoolean): Added.
(KJS::BracketAccessorNode::evaluateToBoolean): Added.
(KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
(KJS::LogicalNotNode::evaluateToBoolean): Added.
(KJS::lessThan): Changed to return bool.
(KJS::lessThanEq): Ditto.
(KJS::LessNode::evaluate): Changed since lessThan returns bool.
(KJS::LessNode::evaluateToBoolean): Added.
(KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
(KJS::GreaterNode::evaluateToBoolean): Added.
(KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
(KJS::LessEqNode::evaluateToBoolean): Added.
(KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
(KJS::GreaterEqNode::evaluateToBoolean): Added.
(KJS::InstanceOfNode::evaluateToBoolean): Added.
(KJS::InNode::evaluateToBoolean): Added.
(KJS::EqualNode::evaluateToBoolean): Added.
(KJS::NotEqualNode::evaluateToBoolean): Added.
(KJS::StrictEqualNode::evaluateToBoolean): Added.
(KJS::NotStrictEqualNode::evaluateToBoolean): Added.
(KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
(KJS::IfNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto.
(KJS::WhileNode::execute): Ditto.
(KJS::ForNode::execute): Ditto.
* kjs/nodes2string.cpp:
(KJS::FalseNode::streamTo): Added.
(KJS::TrueNode::streamTo): Added.
2007-11-09 Adam Roben <aroben@apple.com>
Windows build fix
Reviewed by Darin.
* kjs/value.h:
(KJS::jsNumber): Add some explicit casts.
2007-11-08 Darin Adler <darin@apple.com>
- fix build
* kjs/grammar.y:
* kjs/nodes.h:
* kjs/property_map.cpp:
2007-11-08 Darin Adler <darin@apple.com>
- roll out accidentally-checked in changes
* kjs/nodes.cpp: Back to previous version.
* kjs/nodes.h: Ditto.
* kjs/grammar.y: Ditto.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15912
fasta spends a lot of time in qsort
* kjs/property_map.cpp:
(KJS::PropertyMap::getEnumerablePropertyNames):
Use insertion sort instead of qsort for small sets of property names.
We can probably do some even-better speedups of for/in, but this nets
0.6% overall and 6.7% on fasta.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15906
getting characters by indexing into a string is very slow
This fixes one source of the slowness -- the conversion to an unused
Identifier as we call the get function from the slot -- but doesn't
fix others, such as the fact that we have to allocate a new UString::Rep
for every single character.
Speeds up string-base64 30%, and at least 0.5% overall.
But does slow down access-fannkuch quite a bit. Might be worth
revisiting in the future to see what we can do about that (although
I did look at a profile for a while).
* kjs/property_slot.h: Add a new marker for "numeric" property slots;
slots where we don't need to pass the identifier to the get function.
(KJS::PropertySlot::getValue): Added code to call the numeric get function.
(KJS::PropertySlot::setCustomNumeric): Added.
* kjs/string_object.cpp:
(KJS::StringInstance::indexGetter): Changed to use substr() instead
of constructing a wholly new UString each time.
(KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
takes advantage of setCustomNumeric to avoid creating an Identifier.
(KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- http://bugs.webkit.org/show_bug.cgi?id=15904
more speed-ups possible by tightening up int version of JSImmediate
1% improvement of SunSpider
* kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
(KJS::JSImmediate::from): Overload for most numeric types; many types can
do fewer branches and checks.
(KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
(KJS::JSImmediate::getTruncatedInt32): Ditto.
(KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
* kjs/grammar.y: Update since fromDouble is now just from.
* kjs/nodes.h: Ditto.
* kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
Bakefiles for building JavaScriptCore, needed by wx port.
Reviewed by Mark Rowe.
* JavaScriptCoreSources.bkl: Added.
* jscore.bkl: Added.
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
The implementation of JSImmediate::areBothImmediateNumbers relies on
(JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
a unique result when both immediate values are numbers.
The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
By swapping the value of NumberType and UndefinedType this ceases to be a problem.
* kjs/JSType.h:
2007-11-08 Darin Adler <darin@apple.com>
- fix build
* kjs/nodes.h: Add missing parameter name.
2007-11-08 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add ExpressionNode subclass of Node, use it.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ForInNode::ForInNode):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::NullNode::):
(KJS::NullNode::precedence):
(KJS::BooleanNode::):
(KJS::BooleanNode::precedence):
(KJS::RegExpNode::):
(KJS::RegExpNode::precedence):
(KJS::ThisNode::):
(KJS::ThisNode::precedence):
(KJS::ResolveNode::):
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyNode::):
(KJS::PropertyNode::precedence):
(KJS::PropertyNode::name):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::ObjectLiteralNode::precedence):
(KJS::BracketAccessorNode::):
(KJS::DotAccessorNode::):
(KJS::DotAccessorNode::precedence):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::NewExprNode::):
(KJS::NewExprNode::precedence):
(KJS::FunctionCallValueNode::):
(KJS::FunctionCallValueNode::precedence):
(KJS::FunctionCallResolveNode::):
(KJS::FunctionCallBracketNode::):
(KJS::FunctionCallBracketNode::precedence):
(KJS::FunctionCallDotNode::):
(KJS::FunctionCallDotNode::precedence):
(KJS::PrePostResolveNode::):
(KJS::PostfixBracketNode::):
(KJS::PostfixBracketNode::precedence):
(KJS::PostIncBracketNode::):
(KJS::PostIncBracketNode::isIncrement):
(KJS::PostDecBracketNode::):
(KJS::PostDecBracketNode::isIncrement):
(KJS::PostfixDotNode::):
(KJS::PostfixDotNode::precedence):
(KJS::PostIncDotNode::):
(KJS::PostIncDotNode::isIncrement):
(KJS::PostDecDotNode::):
(KJS::PostDecDotNode::isIncrement):
(KJS::PostfixErrorNode::):
(KJS::PostfixErrorNode::precedence):
(KJS::DeleteResolveNode::):
(KJS::DeleteBracketNode::):
(KJS::DeleteBracketNode::precedence):
(KJS::DeleteDotNode::):
(KJS::DeleteDotNode::precedence):
(KJS::DeleteValueNode::):
(KJS::DeleteValueNode::precedence):
(KJS::VoidNode::):
(KJS::VoidNode::precedence):
(KJS::TypeOfResolveNode::):
(KJS::TypeOfValueNode::):
(KJS::PrefixBracketNode::):
(KJS::PrefixBracketNode::precedence):
(KJS::PreIncBracketNode::):
(KJS::PreIncBracketNode::isIncrement):
(KJS::PreDecBracketNode::):
(KJS::PreDecBracketNode::isIncrement):
(KJS::PrefixDotNode::):
(KJS::PrefixDotNode::precedence):
(KJS::PreIncDotNode::):
(KJS::PreIncDotNode::isIncrement):
(KJS::PreDecDotNode::):
(KJS::PreDecDotNode::isIncrement):
(KJS::PrefixErrorNode::):
(KJS::PrefixErrorNode::precedence):
(KJS::UnaryPlusNode::):
(KJS::UnaryPlusNode::precedence):
(KJS::NegateNode::):
(KJS::NegateNode::precedence):
(KJS::BitwiseNotNode::):
(KJS::BitwiseNotNode::precedence):
(KJS::LogicalNotNode::):
(KJS::LogicalNotNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::LeftShiftNode::):
(KJS::LeftShiftNode::precedence):
(KJS::RightShiftNode::):
(KJS::RightShiftNode::precedence):
(KJS::UnsignedRightShiftNode::):
(KJS::UnsignedRightShiftNode::precedence):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::GreaterNode::):
(KJS::GreaterNode::precedence):
(KJS::LessEqNode::):
(KJS::LessEqNode::precedence):
(KJS::GreaterEqNode::):
(KJS::GreaterEqNode::precedence):
(KJS::InstanceOfNode::):
(KJS::InstanceOfNode::precedence):
(KJS::InNode::):
(KJS::InNode::precedence):
(KJS::EqualNode::):
(KJS::EqualNode::precedence):
(KJS::NotEqualNode::):
(KJS::NotEqualNode::precedence):
(KJS::StrictEqualNode::):
(KJS::StrictEqualNode::precedence):
(KJS::NotStrictEqualNode::):
(KJS::NotStrictEqualNode::precedence):
(KJS::BitAndNode::):
(KJS::BitAndNode::precedence):
(KJS::BitOrNode::):
(KJS::BitOrNode::precedence):
(KJS::BitXOrNode::):
(KJS::BitXOrNode::precedence):
(KJS::LogicalAndNode::):
(KJS::LogicalAndNode::precedence):
(KJS::LogicalOrNode::):
(KJS::LogicalOrNode::precedence):
(KJS::ConditionalNode::):
(KJS::ConditionalNode::precedence):
(KJS::ReadModifyResolveNode::):
(KJS::ReadModifyResolveNode::precedence):
(KJS::AssignResolveNode::):
(KJS::AssignResolveNode::precedence):
(KJS::ReadModifyBracketNode::):
(KJS::ReadModifyBracketNode::precedence):
(KJS::AssignBracketNode::):
(KJS::AssignBracketNode::precedence):
(KJS::AssignDotNode::):
(KJS::AssignDotNode::precedence):
(KJS::ReadModifyDotNode::):
(KJS::ReadModifyDotNode::precedence):
(KJS::AssignErrorNode::):
(KJS::AssignErrorNode::precedence):
(KJS::CommaNode::):
(KJS::CommaNode::precedence):
(KJS::AssignExprNode::):
(KJS::AssignExprNode::precedence):
(KJS::ExprStatementNode::):
(KJS::IfNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::ReturnNode::):
(KJS::WithNode::):
(KJS::ThrowNode::):
(KJS::ParameterNode::):
(KJS::CaseClauseNode::):
(KJS::CaseClauseNode::precedence):
(KJS::ClauseListNode::):
(KJS::SwitchNode::):
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Sam.
Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
This only improves bitwise-and performance, as the additional logic required
for similar code paths on or, xor, and shifting requires additional operations
and branches that negate (and in certain cases, regress) any advantage we might
otherwise receive.
This improves performance on all bitop tests, the cryptography tests, as well as
the string-base64 and string-unpack-code tests. No significant degradation on
any other tests.
* kjs/JSImmediate.h:
(KJS::JSImmediate::areBothImmediateNumbers):
(KJS::JSImmediate::andImmediateNumbers):
* kjs/nodes.cpp:
(KJS::BitAndNode::evaluate):
* kjs/value.h:
(KJS::jsNumberFromAnd):
2007-11-08 Adam Roben <aroben@apple.com>
Stop using KJS inside of MathExtras.h
Reviewed by Darin.
* wtf/MathExtras.h: Removed an unused header, and a now-unused
forward-declaration.
(wtf_atan2): Use std::numeric_limits intead of KJS.
2007-11-08 Sam Weinig <sam@webkit.org>
Windows build fix.
* kjs/date_object.cpp:
(KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
(KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
(KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
2007-11-08 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/lookup.h: Add missing include.
2007-11-08 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Convert JavaScript internal function objects to use one class per
function. This avoids a switch statement inside what used to be
the shared function classes and will allow Shark to better analyze
the code.
To make this switch, the value property of the HashEntry was changed
to a union of an intptr_t (which is used to continue handle valueGetters)
and function pointer which points to a static constructor for the
individual new function objects.
SunSpider claims this is a 1.0% speedup.
* kjs/array_object.cpp:
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::getProperty):
(KJS::ArrayProtoFuncToString::callAsFunction):
(KJS::ArrayProtoFuncToLocaleString::callAsFunction):
(KJS::ArrayProtoFuncJoin::callAsFunction):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncPop::callAsFunction):
(KJS::ArrayProtoFuncPush::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
(KJS::ArrayProtoFuncForEach::callAsFunction):
(KJS::ArrayProtoFuncSome::callAsFunction):
(KJS::ArrayProtoFuncIndexOf::callAsFunction):
(KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
* kjs/array_object.h:
(KJS::ArrayPrototype::classInfo):
* kjs/create_hash_table:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::DateProtoFuncToString::callAsFunction):
(KJS::DateProtoFuncToUTCString::callAsFunction):
(KJS::DateProtoFuncToDateString::callAsFunction):
(KJS::DateProtoFuncToTimeString::callAsFunction):
(KJS::DateProtoFuncToLocaleString::callAsFunction):
(KJS::DateProtoFuncToLocaleDateString::callAsFunction):
(KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
(KJS::DateProtoFuncValueOf::callAsFunction):
(KJS::DateProtoFuncGetTime::callAsFunction):
(KJS::DateProtoFuncGetFullYear::callAsFunction):
(KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
(KJS::DateProtoFuncToGMTString::callAsFunction):
(KJS::DateProtoFuncGetMonth::callAsFunction):
(KJS::DateProtoFuncGetUTCMonth::callAsFunction):
(KJS::DateProtoFuncGetDate::callAsFunction):
(KJS::DateProtoFuncGetUTCDate::callAsFunction):
(KJS::DateProtoFuncGetDay::callAsFunction):
(KJS::DateProtoFuncGetUTCDay::callAsFunction):
(KJS::DateProtoFuncGetHours::callAsFunction):
(KJS::DateProtoFuncGetUTCHours::callAsFunction):
(KJS::DateProtoFuncGetMinutes::callAsFunction):
(KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncGetSeconds::callAsFunction):
(KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
(KJS::DateProtoFuncSetTime::callAsFunction):
(KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncSetSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncSetMinutes::callAsFunction):
(KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncSetHours::callAsFunction):
(KJS::DateProtoFuncSetUTCHours::callAsFunction):
(KJS::DateProtoFuncSetDate::callAsFunction):
(KJS::DateProtoFuncSetUTCDate::callAsFunction):
(KJS::DateProtoFuncSetMonth::callAsFunction):
(KJS::DateProtoFuncSetUTCMonth::callAsFunction):
(KJS::DateProtoFuncSetFullYear::callAsFunction):
(KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
(KJS::DateProtoFuncSetYear::callAsFunction):
(KJS::DateProtoFuncGetYear::callAsFunction):
* kjs/date_object.h:
* kjs/lookup.cpp:
(KJS::Lookup::find):
* kjs/lookup.h:
(KJS::HashEntry::):
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
(KJS::getStaticPropertySlot):
(KJS::getStaticFunctionSlot):
(KJS::lookupPut):
* kjs/math_object.cpp:
(KJS::MathObjectImp::getOwnPropertySlot):
(KJS::MathProtoFuncAbs::callAsFunction):
(KJS::MathProtoFuncACos::callAsFunction):
(KJS::MathProtoFuncASin::callAsFunction):
(KJS::MathProtoFuncATan::callAsFunction):
(KJS::MathProtoFuncATan2::callAsFunction):
(KJS::MathProtoFuncCeil::callAsFunction):
(KJS::MathProtoFuncCos::callAsFunction):
(KJS::MathProtoFuncExp::callAsFunction):
(KJS::MathProtoFuncFloor::callAsFunction):
(KJS::MathProtoFuncLog::callAsFunction):
(KJS::MathProtoFuncMax::callAsFunction):
(KJS::MathProtoFuncMin::callAsFunction):
(KJS::MathProtoFuncPow::callAsFunction):
(KJS::MathProtoFuncRandom::callAsFunction):
(KJS::MathProtoFuncRound::callAsFunction):
(KJS::MathProtoFuncSin::callAsFunction):
(KJS::MathProtoFuncSqrt::callAsFunction):
(KJS::MathProtoFuncTan::callAsFunction):
* kjs/math_object.h:
(KJS::MathObjectImp::classInfo):
(KJS::MathObjectImp::):
* kjs/string_object.cpp:
(KJS::StringPrototype::getOwnPropertySlot):
(KJS::StringProtoFuncToString::callAsFunction):
(KJS::StringProtoFuncValueOf::callAsFunction):
(KJS::StringProtoFuncCharAt::callAsFunction):
(KJS::StringProtoFuncCharCodeAt::callAsFunction):
(KJS::StringProtoFuncConcat::callAsFunction):
(KJS::StringProtoFuncIndexOf::callAsFunction):
(KJS::StringProtoFuncLastIndexOf::callAsFunction):
(KJS::StringProtoFuncMatch::callAsFunction):
(KJS::StringProtoFuncSearch::callAsFunction):
(KJS::StringProtoFuncReplace::callAsFunction):
(KJS::StringProtoFuncSlice::callAsFunction):
(KJS::StringProtoFuncSplit::callAsFunction):
(KJS::StringProtoFuncSubstr::callAsFunction):
(KJS::StringProtoFuncSubstring::callAsFunction):
(KJS::StringProtoFuncToLowerCase::callAsFunction):
(KJS::StringProtoFuncToUpperCase::callAsFunction):
(KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
(KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
(KJS::StringProtoFuncLocaleCompare::callAsFunction):
(KJS::StringProtoFuncBig::callAsFunction):
(KJS::StringProtoFuncSmall::callAsFunction):
(KJS::StringProtoFuncBlink::callAsFunction):
(KJS::StringProtoFuncBold::callAsFunction):
(KJS::StringProtoFuncFixed::callAsFunction):
(KJS::StringProtoFuncItalics::callAsFunction):
(KJS::StringProtoFuncStrike::callAsFunction):
(KJS::StringProtoFuncSub::callAsFunction):
(KJS::StringProtoFuncSup::callAsFunction):
(KJS::StringProtoFuncFontcolor::callAsFunction):
(KJS::StringProtoFuncFontsize::callAsFunction):
(KJS::StringProtoFuncAnchor::callAsFunction):
(KJS::StringProtoFuncLink::callAsFunction):
* kjs/string_object.h:
2007-11-08 Adam Roben <aroben@apple.com>
Windows build fix
Reviewed by Sam and Ada.
* wtf/MathExtras.h: Get rid of a circular #include dependency to fix
the build.
2007-11-08 Adam Roben <aroben@apple.com>
Fix a precedence warning on Windows
* kjs/JSImmediate.h:
(KJS::JSImmediate::toBoolean):
2007-11-08 Mark Rowe <mrowe@apple.com>
Build fix for JavaScriptGlue.
* wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
2007-11-08 Darin Adler <darin@apple.com>
- Windows build fix
* kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
we should now have faster array access, faster immediate to double conversion, and the
potential to further improve bitwise operators in future.
This also removes the need for unions to avoid strict aliasing problems when extracting
a value from immediates.
* kjs/JSImmediate.h:
(KJS::JSImmediate::trueImmediate):
(KJS::JSImmediate::falseImmediate):
(KJS::JSImmediate::undefinedImmediate):
(KJS::JSImmediate::nullImmediate):
(KJS::JSImmediate::toBoolean):
* kjs/value.h:
(KJS::jsNaN):
2007-11-07 Eric Seidel <eric@webkit.org>
Reviewed by Darin and Oliver.
Add evaluateToNumber parallel evaluation tree to speed up number operations.
Make ImmediateNumberNode a subclass of NumberNode.
Share evaluate logic between evaluate and evaluateToNumber using inline functions
There is still a lot of improvement to be made here.
SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
Given the huge win that this prepares us for with simple type inferencing I see the small
regression in base64 being worth the substantial overall improvement.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::Node::evaluateToNumber):
(KJS::NumberNode::evaluate):
(KJS::NumberNode::evaluateToNumber):
(KJS::StringNode::evaluateToNumber):
(KJS::LocalVarAccessNode::inlineEvaluate):
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarAccessNode::evaluateToNumber):
(KJS::BracketAccessorNode::inlineEvaluate):
(KJS::BracketAccessorNode::evaluate):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::NegateNode::evaluate):
(KJS::NegateNode::evaluateToNumber):
(KJS::MultNode::inlineEvaluateToNumber):
(KJS::MultNode::evaluate):
(KJS::MultNode::evaluateToNumber):
(KJS::DivNode::inlineEvaluateToNumber):
(KJS::DivNode::evaluate):
(KJS::DivNode::evaluateToNumber):
(KJS::ModNode::inlineEvaluateToNumber):
(KJS::ModNode::evaluate):
(KJS::ModNode::evaluateToNumber):
(KJS::throwOutOfMemoryErrorToNumber):
(KJS::addSlowCaseToNumber):
(KJS::add):
(KJS::addToNumber):
(KJS::AddNode::evaluateToNumber):
(KJS::SubNode::inlineEvaluateToNumber):
(KJS::SubNode::evaluate):
(KJS::SubNode::evaluateToNumber):
(KJS::valueForReadModifyAssignment):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::ReadModifyDotNode::evaluate):
(KJS::ReadModifyBracketNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::NumberNode::):
(KJS::ImmediateNumberNode::):
(KJS::AddNode::precedence):
* kjs/nodes2string.cpp:
(KJS::NumberNode::streamTo):
2007-11-07 Mark Rowe <mrowe@apple.com>
Reviewed by Eric.
Fix up initialization after being mangled in r27572, and remove the
ternary expression as extraCost will always be zero for the numeric
heap.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2007-11-07 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/regexp_object.cpp:
2007-11-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Eliminated a bogus (though compiled-out) branch in the collector.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2007-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
5.8% of string-validate-input.js is spent creating RegExpImps
Put RegExpImp properties into a static hashtable to avoid a slew of
PropertyMap churn when creating a RegExpImp.
Factored important bits of regular expression implementation out of
RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
making RegExp a ref-counted class. (This will help later.)
Removed PCRE_POSIX support because I didn't quite know how to test it
and keep it working with these changes.
1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
* kjs/regexp.h: A few interface changes:
1. Renamed "subpatterns()" => "numSubpatterns()"
2. Made flag enumeration private and replaced it with public getters for
specific flags.
3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
4. Made RegExp take a string of flags instead of an int, eliminating
duplicated flag parsing code elsewhere.
* kjs/regexp_object.cpp:
(KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
- Fixed a bug where compile(undefined) would throw an exception.
- Removed some now-redundant code.
- Used RegExp sharing to eliminate an allocation and a bunch of
PropertyMap thrash. (Not a big win since compile is a deprecated
function. I mainly did this to test the plubming.)
2007-11-07 Simon Hausmann <hausmann@kde.org>
Reviewed by nobody, Qt/Windows build fix.
JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
testkjs.pro, too, where it's included from.
* kjs/testkjs.pro:
2007-11-07 Simon Hausmann <shausman@trolltech.com>
Reviewed by Lars.
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.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-07 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
fix umemcasecmp
Pretty embarrassing bug. Has the potential to fix quite a few test failures.
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::umemcasecmp):
2007-11-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- only collect when the heap is full, unless we have lots of extra cost garbage
1.1% SunSpider speedup.
This shouldn't hit memory use much since the extra space in those
blocks hangs around either way.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
(KJS::Collector::collect): Fix logic error that reversed the sense of collect's
return value.
2007-11-06 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
'for (...; ...; ++<var>) ...'.
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
(KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
* kjs/nodes.h:
(KJS::PrePostResolveNode::):
(KJS::PostIncResolveNode::):
(KJS::PostIncLocalVarNode::):
(KJS::PostDecResolveNode::):
(KJS::PostDecLocalVarNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::ForNode::ForNode):
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by darin.
This fixes a regressed layout test for string + object
SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
* kjs/nodes.cpp:
(KJS::add): remove erroneous "fast path" for string + *
2007-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Added toJSNumber, a fast path for converting a JSValue to a JS number,
and deployed it in postfix expressions. In the fast case this
eliminates a call to jsNumber.
0.4% speedup on SunSpider.
* ChangeLog:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::UnaryPlusNode::evaluate):
* kjs/value.h:
(KJS::JSValue::toJSNumber):
2007-11-06 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15846
REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
There was a mistake in the algorithm used to find an empty slot in the property
map entries vector; when we were putting in a new property value and not overwriting
an existing deleted sentinel, we would enlarge the entries vector, but would not
overwrite the stale data that's in the new part. It was easy to pin this down by
turning on property map consistency checks -- I never would have landed with this
bug if I had run the regression tests once with consistency checks on!
* kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
foundDeletedElement is false to always use the item at the end of the entries vector.
Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
2007-11-06 Oliver Hunt <oliver@apple.com>
RS=Darin.
Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
* kjs/nodes.cpp:
(KJS::add):
2007-11-06 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Replace boolean comparisons in AddNode with mask
comparisons for a 0.2% improvement in sunspider.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(KJS::add):
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by darin.
SunSpider claims this is a 1.1% speedup.
* kjs/nodes.cpp:
(KJS::throwOutOfMemoryError): Added, non inline.
(KJS::addSlowCase): renamed from add(), non inline.
(KJS::add): add fast path for String + String, Number + Number and String + *
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Avoid more UString creation.
SunSpider claims this is a 0.4% speedup.
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::construct): use UString::find(UChar)
2007-11-05 Mark Rowe <mrowe@apple.com>
Mac build fix.
* kjs/array_object.cpp:
(KJS::ArrayProtoFunc::callAsFunction):
2007-11-05 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/list.h:
2007-11-05 Mark Rowe <mrowe@apple.com>
Build fix. Add missing #include.
* kjs/operations.cpp:
2007-11-05 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Remove another call to toString(exec)
SunSpider claims this is a 0.5% speedup.
* kjs/operations.cpp:
(KJS::equal): remove another toString
2007-11-05 Eric Seidel <eric@webkit.org>
* kjs/operations.cpp:
(KJS::equal): correct broken change.
2007-11-05 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Remove one more call to toString(exec).
SunSpider claims this is a 0.7% speedup.
* kjs/operations.cpp:
(KJS::equal): remove a call to toString()
2007-11-05 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* pcre/pcre.pri:
2007-11-05 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/list.cpp:
2007-11-05 Geoffrey Garen <ggaren@apple.com>
Touched a file to test my new HTTP access.
* kjs/scope_chain.cpp:
2007-11-05 Alp Toker <alp@atoker.com>
Unreviewed build fix for qmake-based ports.
Someone with a better understanding of qmake still needs to sort out
the INCLUDEPATH/DEPENDPATH mess.
* JavaScriptCore.pri:
2007-11-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15835
Switched List implementation from a custom heap allocator to an inline
Vector, for a disappointing .5% SunSpider speedup.
Also renamed List::slice to List::getSlice because "get" is the
conventional prefix for functions returning a value through an out
parameter.
* kjs/array_object.cpp:
(KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
calls and memory accesses.
* kjs/bool_object.cpp:
(BooleanObjectImp::construct): Removed questionable use of iterator.
* kjs/list.cpp:
* kjs/list.h: New List class, implemented in terms of Vector. Two
interesting differences:
1. The inline capacity is 8, not 5. Many of the Lists constructed
during a SunSpider run are larger than 5; almost none are larger
than 8.
2. The growth factor is 4, not 2. Since we can guarantee that Lists
aren't long-lived, we can grow them more aggressively, to avoid
excessive copying.
* kjs/regexp_object.cpp:
(RegExpObjectImp::construct): Removed redundant function calls.
* kjs/string_object.cpp:
(KJS::StringObjectImp::construct): Removed questionable use of iterator.
* wtf/Vector.h:
(WTF::::uncheckedAppend): Added a fast, unchecked version of append.
2007-11-05 Mark Rowe <mrowe@apple.com>
Reviewed by Alp Toker.
Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-04 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15826
optimize opcode loop and case insensitive ASCII compares for a 30% speedup
SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
* pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
* pcre/pcre_compile.c:
(find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
added OP_NOT since there was no reason it should not be in here.
(could_be_empty_branch): Ditto.
(compile_branch): Streamlined all the single-character cases; there was a bit of
duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
But in particular, compile to those opcodes when the single character match is
ASCII.
(find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
* pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
the matchframe, after I discovered that none of them needed to be saved and restored
across recursive match calls. Also eliminated the ignored result field from the
matchframe, since I discovered that rrc ("recursive result code") was already the
exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
statement of the switch instead of doing them before the switch. This removes a
branch from each iteration of the opcode interpreter, just as removal of "op"
removed at least one store from each iteration. Last, but not least, add the
OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
surrogate pair and the letter case can be handled efficiently.
2007-11-04 Darin Adler <darin@apple.com>
* pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
2007-11-03 Darin Adler <darin@apple.com>
- fix non-Mac builds; remove some more unused PCRE stuff
* pcre/pcre_compile.c:
(compile_branch): Removed branch chain and some unused ESC values.
(compile_regex): Ditto.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.c:
(match): Removed unused branch targets. Don't use macros any more.
(jsRegExpExecute): More of the same.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* pcre/pcre.pri: Ditto.
* pcre/MERGING: Removed.
* pcre/pcre_fullinfo.c: Removed.
* pcre/pcre_get.c: Removed.
* pcre/pcre_internal.h:
* pcre/ucp.h: Removed.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15821
remove unused PCRE features for speed
A first step toward removing the PCRE features we don't use.
This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
the SunSpider regular expression test.
Replaced the public interface with one that doesn't use the
name PCRE. Removed code we don't need for JavaScript and various
configurations we don't use. This is in preparation for still
more changes in the future. We'll probably switch to C++ and
make some even more significant changes to the regexp engine
to get some additional speed.
There's probably additional unused stuff that I haven't
deleted yet.
This does mean that our PCRE is now a fork, but I think that's
not really a big deal.
* JavaScriptCore.exp: Remove the 5 old entry points and add
the 3 new entry points for WebCore's direct use of the regular
expression engine.
* kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
its sense and now there's a USE(POSIX_REGEX) instead, which should
probably not be set by anyone. Maybe later we'll just get rid of it
altogether.
* kjs/regexp.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Switch to new jsRegExp function names and
defines. Cut down on the number of functions used.
(KJS::RegExp::~RegExp): Ditto.
(KJS::RegExp::match): Ditto.
* pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
which are unused.
* pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
and JAVASCRIPT. These are all no longer configurable in our copy
of the library.
* pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
the include of <stdlib.h>, and most of the constants and
functions defined in this header. Changed the naming scheme to
use a JSRegExp prefix rather than a pcre prefix. In the future,
we'll probably change this to be a C++ header.
* pcre/pcre_compile.c: Removed all unused code branches,
including many whole functions and various byte codes.
Kept changes outside of removal to a minimum.
(check_escape):
(first_significant_code):
(find_fixedlength):
(find_recurse):
(could_be_empty_branch):
(compile_branch):
(compile_regex):
(is_anchored):
(is_startline):
(find_firstassertedchar):
(jsRegExpCompile): Renamed from pcre_compile2 and changed the
parameters around a bit.
(jsRegExpFree): Added.
* pcre/pcre_exec.c: Removed many unused opcodes and variables.
Also started tearing down the NO_RECURSE mechanism since it's
now the default. In some cases there were things in the explicit
frame that could be turned into plain old local variables and
other small like optimizations.
(pchars):
(match_ref):
(match): Changed parameters quite a bit since it's now not used
recursively.
(jsRegExpExecute): Renamed from pcre_exec.
* pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
_pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
* pcre/pcre_maketables.c: Changed to only compile in dftables.
Also got rid of many of the tables that we don't use.
* pcre/pcre_tables.c: Removed the unused Unicode property tables.
* pcre/pcre_ucp_searchfuncs.c: Removed everything except for
_pcre_ucp_othercase.
* pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
for classes based on Unicode properties.
* wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
to eliminate this completely, but we need the regular expression
code to be C++ first.
* pcre/pcre_fullinfo.c:
* pcre/pcre_get.c:
* pcre/ucp.h:
Files that are no longer needed. I didn't remove them with this
check-in, because I didn't want to modify all the project files.
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
It turns out that doing this check costs more than it saves.
* kjs/JSImmediate.h:
(KJS::JSImmediate::fromDouble):
2007-11-03 Sam Weinig <sam@webkit.org>
Reviewed by Oliver.
Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
The variable had been kept around for binary compatibility, but since nothing
else is there is no point in continuing to keep it around.
* API/JSCallbackConstructor.cpp:
* API/JSCallbackFunction.cpp:
* API/JSCallbackObject.cpp:
* bindings/objc/objc_runtime.mm:
* bindings/runtime_array.cpp:
* bindings/runtime_object.cpp:
* kjs/array_instance.cpp:
* kjs/array_object.cpp:
* kjs/bool_object.cpp:
* kjs/date_object.cpp:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/internal.cpp:
* kjs/lookup.h:
* kjs/math_object.cpp:
* kjs/number_object.cpp:
* kjs/object.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
2007-11-03 Kevin McCullough <kmccullough@apple.com>
- Updated testkjs results to make the build bots green until we
can fix the tests that are failing. The new failures are in DST.
* tests/mozilla/expected.html:
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- don't print the var twice for ForInNodes with a var declaration
* kjs/nodes2string.cpp:
(KJS::ForInNode::streamTo):
2007-11-03 Darin Adler <darin@apple.com>
* pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
C-incompatible declaration.
2007-11-03 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/nodes.cpp: Add missing include.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15814
<rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
These changes cause us to match the JavaScript specification and pass the
fast/js/kde/encode_decode_uri.html test.
* kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
new strict mode, throwing an exception if there are malformed UTF-16 surrogate
pairs in the text.
* kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
* kjs/ustring.cpp:
(KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
those might be illegal in some sense, they aren't supposed to get any special
handling in the place where this function is currently used.
(KJS::UString::UTF8String): Added the strictness.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15812
some JavaScript tests (from the Mozilla test suite) are failing
Two or three fixes get 7 more of the Mozilla tests passing.
This gets us down from 61 failing tests to 54.
* kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
Made this inline and gave it a more specific type. Some day we should
probably do that for all of these -- might even get a bit of a speed
boost from it.
* kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
inline in the header.
* kjs/regexp_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
switch statement into the RegExpImp object, so they can be shared with
RegExpImp::callAsFunction.
(KJS::RegExpImp::match): Added. Common code used by both test and exec.
(KJS::RegExpImp::test): Added.
(KJS::RegExpImp::exec): Added.
(KJS::RegExpImp::implementsCall): Added.
(KJS::RegExpImp::callAsFunction): Added.
(KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
lastInput to null rather than empty string -- we take advantage of the
difference in RegExpImp::match.
(KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
just to get at a field like this.
* pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
the JavaScript specification. If there are not 4 hex digits after the \u,
then it's processed as if it wasn't an escape sequence at all.
* pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
for JavaScript (4 specific Unicode values).
* pcre/pcre_exec.c:
(match): Changed all call sites to use IS_NEWLINE.
(pcre_exec): Ditto.
* tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
Sort files(...); sections of Xcode project files.
Rubber-stamped by Darin.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::VarDeclNode::optimizeVariableAccess):
(KJS::VarDeclNode::getDeclarations):
(KJS::VarDeclNode::handleSlowCase):
(KJS::VarDeclNode::evaluateSingle):
(KJS::VarDeclNode::evaluate):
(KJS::VarStatementNode::execute):
* kjs/nodes.h:
(KJS::VarDeclNode::):
(KJS::VarStatementNode::):
* kjs/nodes2string.cpp:
(KJS::VarDeclNode::streamTo):
2007-11-03 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15800
REGRESSION (r27303): RegExp leaks
* kjs/regexp_object.h:
(KJS::RegExpImp::setRegExp):
(KJS::RegExpImp::regExp):
(KJS::RegExpImp::classInfo):
* kjs/regexp_object.cpp:
(RegExpImp::RegExpImp):
(RegExpImp::~RegExpImp):
Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2007-11-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStacks):
(KJS::statementListInitializeVariableAccessStack):
(KJS::statementListExecute):
(KJS::BlockNode::BlockNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::ProgramNode::ProgramNode):
* kjs/nodes.h:
(KJS::CaseClauseNode::):
2007-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15791
change property map data structure for less memory use, better speed
The property map now has an array of indices and a separate array of
property map entries. This slightly slows down lookup because of a second
memory acess, but makes property maps smaller and faster to iterate in
functions like mark().
SunSpider says this is 1.2% faster, although it makes the bitwise-end test
more than 10% slower. To fix that we'll need to optimize global variable lookup.
* kjs/property_map.cpp:
(KJS::PropertyMapEntry::PropertyMapEntry):
(KJS::PropertyMapHashTable::entries):
(KJS::PropertyMapHashTable::allocationSize):
(KJS::SavedProperties::SavedProperties):
(KJS::SavedProperties::~SavedProperties):
(KJS::PropertyMap::checkConsistency):
(KJS::PropertyMap::~PropertyMap):
(KJS::PropertyMap::clear):
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::createTable):
(KJS::PropertyMap::rehash):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::mark):
(KJS::comparePropertyMapEntryIndices):
(KJS::PropertyMap::containsGettersOrSetters):
(KJS::PropertyMap::getEnumerablePropertyNames):
(KJS::PropertyMap::save):
(KJS::PropertyMap::restore):
* kjs/property_map.h:
2007-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15807
HashMap needs a take() function that combines get and remove
* wtf/HashMap.h: Added take function. Simplistic implementation for now,
but still does only one hash table lookup.
* kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
a find followed by a remove.
2007-11-02 David Carson <dacarson@gmail.com>
Reviewed by Darin.
Fix compiler warning "warning: suggest parentheses around && within ||"
http://bugs.webkit.org/show_bug.cgi?id=15764
* kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
In preparation for making List a simple stack-allocated Vector:
Removed all instances of List copying and/or assignment, and made List
inherit from Noncopyable.
Functions that used to return a List by copy now take List& out
parameters.
Layout tests and JS tests pass.
* kjs/list.cpp:
(KJS::List::slice): Replaced copyTail with a more generic slice
alternative. (JavaScriptCore only calls slice(1), but WebCore calls
slice(2)).
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
REGRESSION(r27344): Crash on load at finance.yahoo.com
Reverted a small portion of my last check-in. (The speedup and the List
removal are still there, though.)
ActivationImp needs to hold a pointer to its function, and mark that
pointer (rather than accessing its function through its ExecState, and
counting on the active scope to mark its function) because a closure
can cause an ActivationImp to outlive its ExecState along with any
active scope.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/function.cpp:
(KJS::FunctionImp::~FunctionImp):
(KJS::ActivationImp::ActivationImp):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
Also made HashTable a little more crash-happy in debug builds, so
problems like this will show up earlier:
* wtf/HashTable.h:
(WTF::HashTable::~HashTable):
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Addressed some of Darin's review comments.
Used perl -p, which is the shorthand while(<>) {}.
Made sure not to suppress bison's output.
Added line to removed bison_out.txt, since this script removes other
intermediate files, too.
* DerivedSources.make:
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed List from ActivationImp, in preparation for making all lists
stack-allocated.
Tests pass.
1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::createArgumentsObject):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2007-11-01 Adam Roben <aroben@apple.com>
Use jsNumberCell instead of jsNumber when converting double constants to JSValues
This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
It also gets rid of an MSVC warning that we previously had to silence.
Reviewed by Geoff.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
back on the "overflow in constant arithmetic" warning.
* kjs/number_object.cpp:
(NumberObjectImp::getValueProperty): Use jsNumberCell instead of
jsNumber.
2007-10-31 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/ExecState.h:
2007-10-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- shave some cycles off of local storage access for a 1% SunSpider speedup
Keep the LocalStorage pointer in the ExecState, instead of getting
it from the ActivationImp all the time.
* kjs/ExecState.cpp:
(KJS::ExecState::updateLocalStorage):
* kjs/ExecState.h:
(KJS::ExecState::localStorage):
* kjs/nodes.cpp:
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::AssignLocalVarNode::evaluate):
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2007-10-31 Adam Roben <aroben@apple.com>
Fix a crash on launch due to a static initializer race
We now use fast inline assembler spinlocks which can be statically
initialized at compile time.
As a side benefit, this speeds up SunSpider by 0.4%.
Reviewed by Oliver.
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SlowLock):
* wtf/TCSystemAlloc.cpp:
2007-10-31 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
- Corrected spelling.
* wtf/HashTraits.h:
2007-10-31 Mark Rowe <mrowe@apple.com>
Further Gtk build fixage.
* kjs/regexp_object.cpp:
2007-10-31 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/regexp.h:
2007-10-31 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15749
RegExp/RegExpObjectImp cause needless UString creation
Speeds things up 0.4% according to SunSpider.
* kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
because this library doesn't use the real PCRE -- it uses its
own PCRE that works on UTF-16.
* kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
Use Noncopyable. Change the return value of match.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
(KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
(KJS::RegExp::match): Change to return the position as an int and the
ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
* kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
require a result string.
* kjs/regexp_object.cpp:
(RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
(RegExpObjectImp::performMatch): Change so it doesn't return a string.
(RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
the main result with the backreferences; now it doesn't need to take
a result parameter.
(RegExpObjectImp::getBackref): Minor tweaks.
(RegExpObjectImp::getLastParen): Ditto.
(RegExpObjectImp::getLeftContext): Ditto.
(RegExpObjectImp::getRightContext): Ditto.
(RegExpObjectImp::getValueProperty): Change LastMatch case to call
getBackref(0) so we don't need a separate getLastMatch function.
* kjs/string_object.cpp:
(KJS::replace): Update to use new performMatch, including merging the
matched string section with the other substrings.
(KJS::StringProtoFunc::callAsFunction): Update functions to use the
new performMatch and match. Also change to use OwnArrayPtr.
2007-10-31 Oliver Hunt <oliver@apple.com>
* kjs/nodes.h: include OwnPtr.h
2007-10-31 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStacks):
(KJS::statementListInitializeVariableAccessStack):
(KJS::statementListExecute):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::BlockNode):
(KJS::BlockNode::getDeclarations):
(KJS::BlockNode::execute):
(KJS::CaseClauseNode::optimizeVariableAccess):
(KJS::CaseClauseNode::getDeclarations):
(KJS::CaseClauseNode::evalStatements):
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::optimizeVariableAccess):
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::statementListStreamTo):
(KJS::BlockNode::streamTo):
(KJS::CaseClauseNode::streamTo):
2007-10-30 Mark Rowe <mrowe@apple.com>
* kjs/property_map.cpp: Added a missing using directive to fix the build
for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
2007-10-31 Maciej Stachowiak <mjs@apple.com>
* kjs/property_map.cpp: Include HashTable.h the right way to fix the build
for non-Mac ports.
2007-10-31 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=11001
WebKit doesn't support RegExp.compile method
Test: fast/js/regexp-compile.html
* kjs/regexp_object.cpp:
(RegExpPrototype::RegExpPrototype):
(RegExpProtoFunc::callAsFunction):
* kjs/regexp_object.h:
(KJS::RegExpProtoFunc::):
Added RegExp.compile.
* tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
2007-10-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
Integer divide sucks. Fortunately, a bunch of shifts and XORs
biased towards the high bits is sufficient to provide a good
double hash. Besides the SunSpider win, I used the dump statistics
mode for both to verify that collisions did not increase and that
the longest collision chain is not any longer.
* kjs/property_map.cpp:
(KJS::doubleHash):
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* wtf/HashTable.h:
(WTF::doubleHash):
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-30 Adam Roben <aroben@apple.com>
* kjs/collector.h: Make HeapType public so it can be used for non-member
things like the HeapConstants struct template. Fixes the build on Windows.
2007-10-30 Adam Roben <aroben@apple.com>
Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
Speeds up SunSpider by 0.4%.
Reviewed by Steve and Maciej.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
a warning during LTCG in release builds about double -> float
conversion.
* wtf/AlwaysInline.h:
* wtf/FastMalloc.h:
2007-10-30 Adam Roben <aroben@apple.com>
Use GetCurrentThreadId instead of pthread_self in FastMalloc
Speeds up SunSpider by 0.3%.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_ThreadCache::InitTSD):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2007-10-30 Adam Roben <aroben@apple.com>
Switch to a Win32 critical section implementation of spinlocks
Speeds up SunSpider by 0.4%.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::TCMalloc_SpinLock):
(TCMalloc_SpinLock::Init):
(TCMalloc_SpinLock::Finalize):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
* wtf/TCSystemAlloc.cpp:
2007-10-30 Adam Roben <aroben@apple.com>
Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
http://bugs.webkit.org/show_bug.cgi?id=15586
Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
Use Win32 TLS functions instead of __declspec(thread), which breaks
delay-loading.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
(WTF::getThreadHeap):
(WTF::TCMalloc_ThreadCache::InitModule):
2007-10-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- allocate numbers in half-size cells, for an 0.5% SunSpider speedup
http://bugs.webkit.org/show_bug.cgi?id=15772
We do this by using a single mark bit per two number cells, and
tweaking marking.
Besides being an 0.5% win overall, this is a 7.1% win on morph.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::sweep):
* kjs/collector.h:
(KJS::SmallCollectorCell::):
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben, Sam Weinig.
Made conflicts in grammar.y a persistent build failure.
* DerivedSources.make:
2007-10-30 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam and Geoff.
- Added a new cast so all the casts are in the same place.
* API/APICast.h:
(toGlobalRef):
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
JS tests, including
ecma_2/Statements/dowhile-001.js
ecma_2/Statements/dowhile-002.js
ecma_2/Statements/dowhile-003.js
ecma_2/Statements/dowhile-004.js
ecma_2/Statements/dowhile-005.js
ecma_2/Statements/dowhile-006.js
ecma_2/Statements/dowhile-007.js
js1_2/statements/do_while.js
and layout tests, including
do-while-expression-value.html
do-while-semicolon.html
do-while-without-semicolon.html
pass.
* kjs/grammar.y: Use the explicit "error" production, as we do with other
automatic semicolon insertions, to disambiguate "do { } while();" from
"do { } while()" followed by ";" (the empty statement).
2007-10-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Debranching remaining assignment nodes, and miscellaneous cleanup
Split read-modify code paths out of AssignBracketNode and AssignDotNode
Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
and ReadModifyResolveNode evaluate methods
Leads to a 1% gain in SunSpider.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignDotNode::evaluate):
(KJS::ReadModifyDotNode::optimizeVariableAccess):
(KJS::ReadModifyDotNode::evaluate):
(KJS::AssignBracketNode::evaluate):
(KJS::ReadModifyBracketNode::optimizeVariableAccess):
(KJS::ReadModifyBracketNode::evaluate):
* kjs/nodes.h:
(KJS::AssignBracketNode::):
(KJS::AssignBracketNode::precedence):
(KJS::AssignDotNode::):
(KJS::AssignDotNode::precedence):
* kjs/nodes2string.cpp:
(KJS::ReadModifyBracketNode::streamTo):
(KJS::AssignBracketNode::streamTo):
(KJS::ReadModifyDotNode::streamTo):
(KJS::AssignDotNode::streamTo):
2007-10-29 Oliver Hunt <oliver@apple.com>
Debranching various Node::evaluate implementations
Reviewed by Maciej.
Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
Gains 1.6% on SunSpider
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::optimizeVariableAccess):
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::optimizeVariableAccess):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::PreIncResolveNode::optimizeVariableAccess):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::optimizeVariableAccess):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::PreIncBracketNode::evaluate):
(KJS::PreDecBracketNode::evaluate):
(KJS::PreIncDotNode::evaluate):
(KJS::PreDecDotNode::evaluate):
(KJS::ReadModifyResolveNode::optimizeVariableAccess):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::AssignLocalVarNode::evaluate):
(KJS::AssignResolveNode::evaluate):
* kjs/nodes.h:
(KJS::PostDecResolveNode::):
(KJS::PostDecResolveNode::precedence):
(KJS::PostDecLocalVarNode::):
(KJS::PostfixBracketNode::):
(KJS::PostfixBracketNode::precedence):
(KJS::PostIncBracketNode::):
(KJS::PostIncBracketNode::isIncrement):
(KJS::PostDecBracketNode::):
(KJS::PostDecBracketNode::isIncrement):
(KJS::PostfixDotNode::):
(KJS::PostfixDotNode::precedence):
(KJS::PostIncDotNode::):
(KJS::PostIncDotNode::isIncrement):
(KJS::PostDecDotNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::PreDecResolveNode::precedence):
(KJS::PreDecLocalVarNode::):
(KJS::PrefixBracketNode::):
(KJS::PrefixBracketNode::precedence):
(KJS::PreIncBracketNode::):
(KJS::PreIncBracketNode::isIncrement):
(KJS::PreDecBracketNode::):
(KJS::PreDecBracketNode::isIncrement):
(KJS::PrefixDotNode::):
(KJS::PrefixDotNode::precedence):
(KJS::PreIncDotNode::):
(KJS::PreIncDotNode::isIncrement):
(KJS::PreDecDotNode::):
(KJS::ReadModifyResolveNode::):
(KJS::ReadModifyLocalVarNode::):
(KJS::AssignResolveNode::):
(KJS::AssignResolveNode::precedence):
* kjs/nodes2string.cpp:
(KJS::PostIncResolveNode::streamTo):
(KJS::PostDecResolveNode::streamTo):
(KJS::PostfixBracketNode::streamTo):
(KJS::PostfixDotNode::streamTo):
(KJS::PreIncResolveNode::streamTo):
(KJS::PreDecResolveNode::streamTo):
(KJS::ReadModifyResolveNode::streamTo):
(KJS::AssignResolveNode::streamTo):
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Not reviewed, build fix.
- Include Vector.h in a way that actually works.
* kjs/LocalStorage.h:
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Not reviewed, build fix.
- Install LocalStorage.h as a private header.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/LocalStorage.h: Added.
(KJS::LocalStorageEntry::LocalStorageEntry):
(WTF::):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2007-10-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Some small tweaks that I notice while reviewing Oliver's last patch.
Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
No change in SunSpider because SunSpider doesn't take the code path that
would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
* kjs/nodes.cpp:
(KJS::LocalVarPostfixNode::evaluate):
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::PrefixResolveNode::optimizeVariableAccess):
(KJS::LocalVarPrefixNode::evaluate):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::LocalVarAssignNode::evaluate):
* kjs/nodes.h:
(KJS::LocalVarTypeOfNode::):
(KJS::PrefixResolveNode::):
(KJS::LocalVarPrefixNode::):
(KJS::AssignResolveNode::):
(KJS::LocalVarAssignNode::):
2007-10-29 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
SunSpider claims this was a 0.7% speedup.
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- re-enable asserts for access to empty or deleted keys
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-29 Eric Seidel <eric@webkit.org>
Build fix only, no review.
* JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
2007-10-29 Mark Rowe <mrowe@apple.com>
Gtk build fix. Move struct declarations into nodes.h.
* kjs/grammar.y:
* kjs/nodes.h:
2007-10-29 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
Make it a compile time error to use toString(ExecState) on a StringInstance
SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
* kjs/internal.h:
(KJS::StringImp::getLength):
* kjs/string_object.cpp:
(KJS::StringInstance::lengthGetter):
(KJS::StringInstance::inlineGetOwnPropertySlot):
(KJS::StringInstance::getOwnPropertySlot):
* kjs/string_object.h:
2007-10-28 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Add nodes to allow Assignment, TypeOf, and prefix operators to
make use of the new optimised local variable look up.
5% gain on sunspider
* kjs/nodes.cpp:
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalTypeOfAccessNode::evaluate):
(KJS::PrefixResolveNode::optimizeVariableAccess):
(KJS::PrefixLocalAccessNode::evaluate):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::AssignLocalAccessNode::evaluate):
* kjs/nodes.h:
(KJS::TypeOfResolveNode::):
(KJS::TypeOfResolveNode::precedence):
(KJS::LocalTypeOfAccessNode::):
(KJS::PrefixResolveNode::):
(KJS::PrefixResolveNode::precedence):
(KJS::PrefixLocalAccessNode::):
(KJS::AssignResolveNode::):
(KJS::AssignLocalAccessNode::):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
http://bugs.webkit.org/show_bug.cgi?id=15748
Not a significant speedup or slowdown on SunSpider.
* kjs/Parser.cpp:
(KJS::clearNewNodes):
* kjs/Parser.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BlockNode::BlockNode):
(KJS::CaseBlockNode::CaseBlockNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::SourceElementsNode::SourceElementsNode):
(KJS::ProgramNode::ProgramNode):
* kjs/nodes.h:
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::VarDeclListNode::):
(KJS::VarStatementNode::):
(KJS::ForNode::):
(KJS::ParameterNode::):
(KJS::FuncExprNode::):
(KJS::FuncDeclNode::):
(KJS::SourceElementsNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
2007-10-28 Mark Rowe <mrowe@apple.com>
Disable assertions in a manner that doesn't break the Qt Windows build.
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Temporarily disabling some ASSERTs I introduced in my last check-in
because of http://bugs.webkit.org/show_bug.cgi?id=15747
Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
#ifndef ASSERT_DISABLED is no good!
Replaced with #if !ASSERT_DISABLED.
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
to the AST transfom that replaces slow resolve nodes with fast local
variable alternatives.
2.5% speedup on SunSpider.
Also added some missing copyright notices.
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::optimizeVariableAccess):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::PostfixResolveNode::optimizeVariableAccess):
(KJS::PostfixResolveNode::evaluate):
(KJS::LocalVarPostfixNode::evaluate):
(KJS::DeleteResolveNode::optimizeVariableAccess):
(KJS::DeleteResolveNode::evaluate):
(KJS::LocalVarDeleteNode::evaluate):
* kjs/nodes.h:
(KJS::FunctionCallResolveNode::):
(KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
(KJS::PostfixResolveNode::):
(KJS::LocalVarPostfixNode::LocalVarPostfixNode):
(KJS::DeleteResolveNode::):
(KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2007-10-28 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
Add virtual keyword to a few virtual functions previously unmarked.
* kjs/internal.h:
(KJS::StringImp::type):
(KJS::NumberImp::type):
* kjs/ustring.h:
(KJS::UString::Rep::deref):
2007-10-28 Darin Adler <darin@apple.com>
- fix "broken everything" from the storage leak fix
* wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
* kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Adam.
- turn on unused parameter waring on Mac OS X because it's already on elsewhere
* Configurations/Base.xcconfig: Took out -wno-unused-parameter.
* API/JSNode.c:
* API/JSNodeList.c:
* API/minidom.c:
* API/testapi.c:
Fixed unused variables by using them or marked them with UNUSED_PARAM.
* kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
Removed parameter names to indicate they are unused.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix a storage leak where we ref the UString every time we replace
a ResolveNode with a LocalVarAccessNode
* kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
that takes PlacementNewAdopt.
* kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
with PlacementNewAdopt instead of the old value of ident.
* kjs/ustring.h: (KJS::UString::UString): Added a constructor that
takes PlacementNewAdopt.
2007-10-28 Darin Adler <darin@apple.com>
- Windows build fix; get rid of unused parameter
* kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
* kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
The assertions weren't all that helpful.
2007-10-28 Mark Rowe <mrowe@apple.com>
Gtk build fix. Add include of MathExtras.h.
* kjs/string_object.cpp:
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej and Tim.
Replace uses of isNaN and isInf with isnan and isinf, and
remove isNaN and isInf.
* kjs/config.h: Remove unused HAVE_'s.
* kjs/date_object.cpp:
(KJS::DateInstance::getTime):
(KJS::DateInstance::getUTCTime):
(KJS::DateProtoFunc::callAsFunction):
(KJS::DateObjectImp::construct):
(KJS::DateObjectFuncImp::callAsFunction):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/math_object.cpp:
(MathFuncImp::callAsFunction):
* kjs/nodes2string.cpp:
(KJS::isParserRoundTripNumber):
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction):
* kjs/ustring.cpp:
(KJS::UString::from):
* kjs/value.cpp:
(KJS::JSValue::toInteger):
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Build fix: use the new-fangled missingSymbolMarker().
* kjs/nodes.cpp:
(KJS::ResolveNode::optimizeVariableAccess):
* kjs/nodes.h:
(KJS::LocalVarAccessNode::LocalVarAccessNode):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak, Darin Adler.
Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
Cameron Zwarich.
AST transfom to replace slow resolve nodes with fast local variable
alternatives that do direct memory access. Currently, only ResolveNode
provides a fast local variable alternative. 6 others are soon to come.
16.7% speedup on SunSpider.
Most of this patch is just scaffolding to support iterating all the
resolve nodes in the AST through optimizeResolveNodes(). In
optimizeResolveNodes(), most classes just push their child nodes onto
the processing stack, while ResolveNodes actually replace themselves in
the tree with more optimized alternatives, if possible.
Here are the interesting bits:
* kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
in Node and ResolveNode. This tag allows you to use placement new to
swap out a base class Node in favor of a subclass copy that holds the
same data. (Without this tag, default initialization would NULL out
RefPtrs, change line numbers, etc.)
* kjs/nodes.cpp:
(KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
that the fast path is impossible, to make sure we didn't leave anything
on the table.
(KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
transformation happens.
(KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
optimization happens.
* kjs/function.h: Added symbolTable() accessor for, for the sake of
an ASSERT.
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej.
Fix "AllInOneFile.o has a global initializer in it".
Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
We can avoid this by moving it inside an inline function.
* kjs/SymbolTable.h:
(KJS::missingSymbolMarker):
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::put):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- Added assertions to protect against adding empty or deleted keys to a HashTable
* wtf/HashTable.h:
(WTF::HashTable::lookup):
(WTF::HashTable::lookupForWriting):
(WTF::HashTable::fullLookupForWriting):
(WTF::HashTable::add):
2007-10-28 Darin Adler <darin@apple.com>
- fix GTK build
* kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
Use isNaN and isInf instead of isnan and isinf.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15735
remove GroupNode to simplify AST and possibly get a modest speedup
This patch removes 4 node types: GroupNode, PropertyNameNode,
FunctionCallParenBracketNode, and FunctionCallParenDotNode.
To remove GroupNode, we add knowledge of precedence to the tree nodes,
and use that when serializing to determine where parentheses are needed.
This means we no longer have to represent parentheses in the tree.
The precedence values are named after productions in the grammar from the
JavaScript standard.
SunSpider says this is an 0.4% speedup.
* kjs/function.h:
* kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
serialization, so I moved it to the file that takes care of that.
* kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
indicate failure instead of a separate boolean. Got rid of PropertyNameNode
by merging the PropertyName rule into the Property rule (which was easier
than figuring out how to pass the Identifier from one node to another).
Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
and FunctionCallParenDotNode.
* kjs/nodes.h: Removed unused forward declarations and Operator values.
Added Precedence enum, and precedence function to all nodes. Removed
nodeInsideAllParens. Added streamBinaryOperator function for serialization.
Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
* kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
(KJS::PropertyListNode::evaluate): Changed code to get name directly instead
of converting it from an Identifier to a jsString then back to a UString
then into an Identifier again!
* kjs/nodes2string.cpp: Changed special-token implementation to use a separate
function for each of Endl, Indent, Unindent, and DotExpr instead of using a
single function with a switch. Added a precedence that you can stream in, to
cause the next node serialized to add parentheses based on that precedence value.
(KJS::operatorString): Moved to the top of the file.
(KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
workaround for snprintf, since StringExtras.h takes care of that.
(KJS::operator<<): Made the char and char* versions faster by using UString's
character append functions instead of constructing a UString. Added the logic
to the Node* version to add parentheses if needed.
(KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
(KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
(KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
the bracket.
(KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
(KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
(KJS::NewExprNode::streamTo): Use PrecMember for the expression.
(KJS::FunctionCallValueNode::streamTo): Use PrecCall.
(KJS::FunctionCallBracketNode::streamTo): Ditto.
(KJS::FunctionCallDotNode::streamTo): Ditto.
(KJS::PostfixBracketNode::streamTo): Ditto.
(KJS::PostfixDotNode::streamTo): Ditto.
(KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
(KJS::DeleteBracketNode::streamTo): Use PrecCall.
(KJS::DeleteDotNode::streamTo): Ditto.
(KJS::DeleteValueNode::streamTo): Use PrecUnary.
(KJS::VoidNode::streamTo): Ditto.
(KJS::TypeOfValueNode::streamTo): Ditto.
(KJS::PrefixBracketNode::streamTo): Use PrecCall.
(KJS::PrefixDotNode::streamTo): Ditto.
(KJS::PrefixErrorNode::streamTo): Use PrecUnary.
(KJS::UnaryPlusNode::streamTo): Ditto.
(KJS::NegateNode::streamTo): Ditto.
(KJS::BitwiseNotNode::streamTo): Ditto.
(KJS::LogicalNotNode::streamTo): Ditto.
(KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
(KJS::DivNode::streamTo): Ditto.
(KJS::ModNode::streamTo): Ditto.
(KJS::AddNode::streamTo): Ditto.
(KJS::SubNode::streamTo): Ditto.
(KJS::LeftShiftNode::streamTo): Ditto.
(KJS::RightShiftNode::streamTo): Ditto.
(KJS::UnsignedRightShiftNode::streamTo): Ditto.
(KJS::LessNode::streamTo): Ditto.
(KJS::GreaterNode::streamTo): Ditto.
(KJS::LessEqNode::streamTo): Ditto.
(KJS::GreaterEqNode::streamTo): Ditto.
(KJS::InstanceOfNode::streamTo): Ditto.
(KJS::InNode::streamTo): Ditto.
(KJS::EqualNode::streamTo): Ditto.
(KJS::NotEqualNode::streamTo): Ditto.
(KJS::StrictEqualNode::streamTo): Ditto.
(KJS::NotStrictEqualNode::streamTo): Ditto.
(KJS::BitAndNode::streamTo): Ditto.
(KJS::BitXOrNode::streamTo): Ditto.
(KJS::BitOrNode::streamTo): Ditto.
(KJS::LogicalAndNode::streamTo): Ditto.
(KJS::LogicalOrNode::streamTo): Ditto.
(KJS::ConditionalNode::streamTo): Ditto.
(KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
(KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
the bracket and PrecAssignment for the right side.
(KJS::AssignDotNode::streamTo): Ditto.
(KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
and PrecAssignment for the right side.
(KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
(KJS::AssignExprNode::streamTo): Use PrecAssignment.
2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
Define wx port and set wx port USE options.
Reviewed by Adam Roben.
* wtf/Platform.h:
2007-10-28 Mark Rowe <mrowe@apple.com>
We don't include "config.h" in headers.
* bindings/jni/jni_instance.h:
* kjs/regexp.h:
* wtf/TCPageMap.h:
* wtf/TCSpinLock.h:
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Mark.
- avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
* kjs/SymbolTable.h:
(KJS::SymbolTableIndexHashTraits::emptyValue):
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::put):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
* kjs/SymbolTable.h:
(KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
(KJS::IdentifierRepHash::equal): ditto
(KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
(KJS::SymbolTable): change to a typedef for a HashMap.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
(KJS::ActivationImp::deleteProperty): ditto
(KJS::ActivationImp::put): ditto
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
you now have to store a UString::rep, not an identifier.
2007-10-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- numerous HashTable performance improvements
This does not quite add up to a measurable win on SunSpider, but it allows a
follow-on > 3% improvement and probably helps WebCore too.
I made the following improvements, among others:
- Made HashFunctions note whether it is ok to compare a real value with the equal() function
to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
- Specialized lookup so it doesn't have to do so many extra branches and build so many extra
std::pairs for cases that don't need them. There are now four versions, one for read-only access,
two for writing, and one folded directly into add() (these all were improvments).
- Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
- Made a special constructor for iterators that knows it points to
a valid filled cell and so skips updating itself.
- Reordered memory accesses in the various lookup functions for better code generation
- Made simple translators avoid passing a hash code around
- Other minor tweaks
* wtf/HashTable.h:
(WTF::):
(WTF::HashTableConstIterator::HashTableConstIterator):
(WTF::HashTableIterator::HashTableIterator):
(WTF::IdentityHashTranslator::translate):
(WTF::HashTable::end):
(WTF::HashTable::lookup):
(WTF::HashTable::lookupForWriting):
(WTF::HashTable::makeKnownGoodIterator):
(WTF::HashTable::makeKnownGoodConstIterator):
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
(WTF::::addPassingHashCode):
(WTF::::reinsert):
(WTF::::find):
(WTF::::contains):
* kjs/identifier.cpp:
(WTF::):
* wtf/HashFunctions.h:
(WTF::):
* wtf/HashMap.h:
(WTF::):
(WTF::::get):
* wtf/HashSet.h:
(WTF::):
(WTF::::add):
* wtf/ListHashSet.h:
(WTF::ListHashSetTranslator::translate):
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix ASCIICType.h for some Windows compiles
* wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
compiler/library that has the wchar_t that is just a typedef.
2007-10-27 Kevin McCullough <kmccullough@apple.com>
- BuildFix
- Forgot to change the build step when I changed the filename.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-27 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718
* kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
hash value. Also changed O(n) strlen to O(1) check for empty string.
(KJS::Identifier::add):
* kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
(KJS::UString::UString):
(KJS::UString::operator=):
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix pow on Windows
* wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
a "pow" function that does not properly handle the case where arg1 is
NaN and arg2 is 0.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
specify "::pow" -- just "pow" is fine.
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15711
force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
* kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
* kjs/object.h: Removed redundant includes.
* kjs/value.h: Ditto.
2007-10-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718
* kjs/identifier.cpp:
(KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
now that we count on all Identifiers already having one.
2007-10-27 Mark Rowe <mrowe@apple.com>
Silence a warning.
* kjs/SymbolTable.h:
2007-10-27 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/function.h:
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Rubber stamp by Adam.
- Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
files contain are functions that operate on BSTRs.
* API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
* API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
* API/JSStringRefCOM.cpp: Removed.
* API/JSStringRefCOM.h: Removed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
- Made JSStringCreateWithBSTR capable of handling null BSTRs.
* API/JSStringRefCOM.cpp:
(JSStringCreateWithBSTR):
2007-10-26 Sam Weinig <sam@webkit.org>
Windows build fix.
* kjs/SymbolTable.h: Add header gaurd.
* kjs/nodes.h: #include "SymbolTable.h"
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Suggested by Anders Carlsson.
Fixed tyop.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Suggested by Darin Adler.
Use computedHash(), which is safer than just directly accessing _hash.
* kjs/lookup.cpp:
(KJS::Lookup::findEntry):
(KJS::Lookup::find):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Build fix: svn add SymbolTable.h
* kjs/SymbolTable.h: Added.
(KJS::SymbolTable::set):
(KJS::SymbolTable::get):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Build fix: export SymbolTable.h to WebCore.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Comment tweak suggested by Maciej.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
* kjs/property_map.cpp: Use a special no branch accessor to the UString's
hash value. Also, return immediately instead of branching to the end
of the loop if the value is not found.
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* kjs/ustring.h:
(KJS::UString::Rep::computedHash): Special no branch accessor to the
UString's hash value. Used when the caller knows that the hash value
has already been computed. (For example, if the caller got the UString
from an Identifier.)
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Switched ActivationImp to using a symbol table. For now, though, all
clients take the slow path.
Net .6% speedup on SunSpider.
Slowdowns:
- ActivationImp now mallocs in its constructor
- Local variable hits use an extra level of indirection to retrieve
data
- Local variable misses do two lookups
Speedups:
- Fast initialization of local variables upon function entry
* JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
data that won't fit in a JSCell.
(KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
lookup.
(KJS::ActivationImp::getOwnPropertySlot): ditto
(KJS::ActivationImp::deleteProperty): ditto
(KJS::ActivationImp::put): ditto
(KJS::ActivationImp::createArgumentsObject): ditto
(KJS::ActivationImp::mark): Call JSObject::mark first so that one of
our properties doesn't try to recursively mark us. (This caused a crash
in earlier testing. Not sure why we haven't run into it before.)
* kjs/nodes.cpp: Functions now build a symbol table the first time
they're called.
(KJS::VarDeclNode::evaluate):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsForProgramCode):
* kjs/nodes.h:
(KJS::FunctionBodyNode::symbolTable):
* wtf/Forward.h: Added Vector.
2007-10-26 Kevin McCullough <kmccullough@apple.com>
- Corrected function name mistake in this changelog.
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam and Steve.
- Added convenience methods for converting between BSTR and JSStringRefs
* API/JSStringRefCOM.cpp: Added.
(JSStringCreateWithBSTR):
(JSStringCopyBSTR):
* API/JSStringRefCOM.h: Added.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/collector.cpp:
(KJS::Collector::collect):
2007-10-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
* kjs/CollectorHeapIntrospector.cpp:
(KJS::CollectorHeapIntrospector::init):
(KJS::CollectorHeapIntrospector::enumerate):
* kjs/CollectorHeapIntrospector.h:
* kjs/collector.cpp:
(KJS::Collector::recordExtraCost):
(KJS::Collector::heapAllocate):
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
(KJS::Collector::registerThread):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::markMainThreadOnlyObjects):
(KJS::Collector::sweep):
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/internal.h:
(KJS::NumberImp::operator new):
Force numbers to be allocated in the secondary heap.
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
* kjs/value.h:
(KJS::JSValue::getUInt32):
(KJS::JSValue::getTruncatedInt32):
(KJS::JSValue::toNumber):
* wtf/PassRefPtr.h:
(WTF::PassRefPtr::~PassRefPtr):
* wtf/RefPtr.h:
(WTF::RefPtr::operator->):
2007-10-26 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/ExecState.h:
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- Merge Context class fully into ExecState, since they are always created and used together.
No measurable performance impact but this is a useful cleanup.
* JavaScriptCore.pri:
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
(KJS::ExecState::mark):
(KJS::ExecState::lexicalInterpreter):
* kjs/ExecState.h:
(KJS::ExecState::dynamicInterpreter):
(KJS::ExecState::setException):
(KJS::ExecState::clearException):
(KJS::ExecState::exception):
(KJS::ExecState::exceptionSlot):
(KJS::ExecState::hadException):
(KJS::ExecState::scopeChain):
(KJS::ExecState::callingExecState):
(KJS::ExecState::propertyNames):
* kjs/collector.cpp:
(KJS::Collector::reportOutOfMemoryToAllInterpreters):
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::callerGetter):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::evaluate):
(KJS::Interpreter::mark):
* kjs/interpreter.h:
(KJS::Interpreter::setCurrentExec):
(KJS::Interpreter::currentExec):
* kjs/nodes.cpp:
(KJS::currentSourceId):
(KJS::currentSourceURL):
(KJS::ThisNode::evaluate):
(KJS::ResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::PostfixResolveNode::evaluate):
(KJS::DeleteResolveNode::evaluate):
(KJS::TypeOfResolveNode::evaluate):
(KJS::PrefixResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::VarDeclNode::evaluate):
(KJS::DoWhileNode::execute):
(KJS::WhileNode::execute):
(KJS::ForNode::execute):
(KJS::ForInNode::execute):
(KJS::ContinueNode::execute):
(KJS::BreakNode::execute):
(KJS::ReturnNode::execute):
(KJS::WithNode::execute):
(KJS::SwitchNode::execute):
(KJS::LabelNode::execute):
(KJS::TryNode::execute):
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::evaluate):
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* JavaScriptCore.pri:
* kjs/ExecState.cpp:
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- moved Context class into ExecState.{h,cpp} in preparation for merging
ExecState and Context classes.
* kjs/ExecState.h: Moved CodeType enum and Context class here in
preparation for merging ExecState and Context.
* kjs/ExecState.cpp: Moved Context class here from Context.cpp.
(KJS::Context::Context):
(KJS::Context::~Context):
(KJS::Context::mark):
* kjs/context.h: Removed.
* kjs/Context.cpp: Removed.
* kjs/function.h: Removed CodeType enum.
* kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
* kjs/internal.h: Removed LabelStack.
* JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
* kjs/collector.cpp: Fixed includes.
* kjs/function.cpp: ditto
* kjs/internal.cpp: ditto
* kjs/interpreter.cpp: ditto
* kjs/lookup.h: ditto
* kjs/nodes.cpp: ditto
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/string_object.cpp:
(KJS::StringObjectFuncImp::callAsFunction):
2007-10-25 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15703
fix numeric functions -- improve correctness and speed
Gives about 1% gain on SunSpider.
* kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
(KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
with both immediate and number values.
(KJS::JSValue::toUInt32): Ditto.
* kjs/value.cpp:
(KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
differences. One is that it now correctly returns 0 for NaN, and another is that
there's no special case for 0 or infinity, since the general case already handles
those correctly.
(KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
check for NaN.
(KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
truncation done by the typecast already does the necessary truncation that
roundValue was doing.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Removed.
* kjs/internal.h: Removed roundValue.
* kjs/internal.cpp: Ditto.
* kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
toNumber as specified.
(KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
with a call to toNumber and timeClip as specified.
(KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
where the default behavior of toInt32 (returning 0) was already correct. Replaced
call to roundValue with a call to toNumber as specified.
(KJS::DateObjectFuncImp::callAsFunction): Ditto.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
cases for the pow function that the library already handles correctly.
* kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
The real toInteger now returns 0 for NaN. Took out unneeded special case in
ToFixed for undefined; was only needed because our toInteger was wrong. Same
thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
cases for undefined that were only needed because toInteger was wrong. Same in
IndexOf, and was able to remove some special cases. In LastIndexOf, used
toIntegerPreserveNaN, but was able to remove some special cases there too.
Changed Substr implementation to preserve correct behavior with the change
to toInteger and match the specification. Also made sure we weren't converting
an out of range double to an int.
(KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
no reason to have toUInt16 as a second, less-optimized function that's only
called at this one call site.
* wtf/MathExtras.h: Added trunc function for Windows.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Tweaked the inner hashtable lookup loop to remove a branch in the "not
found" case. .5% speedup on SunSpider.
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/HashTable.h:
(WTF::::lookup):
2007-10-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
* kjs/nodes.cpp:
(KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
adding any value over toNumber() here.
(KJS::valueForReadModifyAssignment): Ditto.
(KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
and branches.
(KJS::lessThanEq): Ditto.
* JavaScriptCore.exp: Export new functions as needed.
* kjs/value.h:
(KJS::JSValue::toPrimitive): Fixed formatting.
(KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
to number and tells you whether a toPrimitive() conversion with a Number hint
would have given a string.
* kjs/internal.cpp:
(KJS::StringImp::getPrimitiveNumber): Implemented.
(KJS::NumberImp::getPrimitiveNumber): ditto
(KJS::GetterSetterImp::getPrimitiveNumber): ditto
(KJS::StringImp::toPrimitive): Fixed formatting.
(KJS::NumberImp::toPrimitive): ditto
(KJS::GetterSetterImp::toPrimitive): ditto
* kjs/internal.h:
* kjs/object.cpp:
(KJS::JSObject::getPrimitiveNumber): Implemented.
* kjs/object.h:
2007-10-25 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
Remove JSStringRefCFHack from windows as it is no longer needed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Rolled out my last patch. It turns out that I needed 2 words, not 1,
so it didn't help.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
Shrink the size of an activation object by 1 word
This is in preparation for adding a symbol table to the activation
object.
The basic strategy here is to rely on the mutual exclusion between
the arguments object pointer and the function pointer (you only need
the latter in order to create the former), and store them in the same
place. The LazyArgumentsObject class encapsulates this strategy.
Also inlined the ArgumentsImp constructor, for good measure.
SunSpider reports no regression. Regression tests pass.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Context.cpp:
(KJS::Context::~Context):
* kjs/function.cpp:
(KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::mark):
(KJS::ActivationImp::argumentsGetter):
(KJS::ActivationImp::mark):
* kjs/function.h:
(KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
(KJS::ActivationImp::LazyArgumentsObject::resetArguments):
(KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::setFunction):
(KJS::ActivationImp::LazyArgumentsObject::function):
(KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::):
(KJS::ActivationImp::ActivationImp::ActivationImp):
(KJS::ActivationImp::resetArguments):
2007-10-25 Adam Roben <aroben@apple.com>
Change JavaScriptCore.vcproj to use DerivedSources.make
We were trying to emulate the logic of make in
build-generated-files.sh, but we got it wrong. We now use a
build-generated-files very much like the one that WebCore uses to
invoke make.
We also now only have a Debug configuration of dftables which we build
even when doing a Release build of JavaScriptCore. dftables also no
longer has the "_debug" name suffix.
Changes mostly made by Darin, reviewed by me.
* DerivedSources.make: Add a variable to set the extension used for
the dftables executable.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
dftables in Release configurations.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
- Updated include path to point to the new location of the derived
sources.
- Modified pre-build event to pass the right arguments to
build-generated-files.sh and not call dftables directly.
- Added the derived source files to the project.
- Removed grammarWrapper.cpp, which isn't needed now that we're
compiling grammar.cpp directly.
* JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
Slightly modified from the WebCore version.
* JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
- Changed the output location to match Mac.
- Removed the Release configuration.
- Removed the _debug suffix.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Slightly elaborated the differences between declaration procesing in
Function Code and Program Code.
.3% speedup on SunSpider.
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
minimum set of attributes instead of recomputing all the time. Also,
ignore m_parameters, since programs don't have arguments.
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
More preparation work before adding long-running mode to testkjs.
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(prettyPrintScript):
(runWithScripts):
(parseArguments):
(kjsmain):
(fillBufferWithContentsOfFile):
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Bring testkjs code out of the dark ages in preparation for more
radical improvements (like long-running testing support!)
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(setupInterpreter):
(doIt):
(fillBufferWithContentsOfFile):
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Make a fast path for declaration processing inside Function Code.
Lifted declaration processing code up from individual declaration nodes
and into processDeclarations.
Broke out processDeclarations into two cases, depending on the type of
code. This eliminates 2 branches, and facilitates more radical
divergeance in the future.
2.5% SunSpider speedup.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode):
(KJS::FunctionBodyNode::execute):
(KJS::FuncDeclNode::makeFunction):
* kjs/nodes.h:
2007-10-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- add header includes needed on platforms that don't use AllInOneFile.cpp
* API/JSCallbackObject.cpp:
* kjs/Context.cpp:
* kjs/ExecState.cpp:
* kjs/array_instance.cpp:
* kjs/function_object.cpp:
* kjs/interpreter.cpp:
* kjs/nodes.cpp:
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Geoff.
* JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
Re-order declaration initialization to avoid calling hasProperty inside
VarDeclNode::processDeclaration
.7% speedup on SunSpider.
* kjs/function.h:
* kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
other processing of declared symbols, so the order of execution could
change.
* kjs/nodes.cpp:
(KJS::VarDeclNode::getDeclarations): Added special case for the
"arguments" property name, explained in the comment.
(KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
in the case of function code, since we know the declared symbol
management will resolve conflicts between symbols. Yay!
(KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
implementation of getDeclarations is non-trivial, we can't take a
short-cut here any longer -- we need to put the VarDecl node on the
stack so it gets processed normally.
(KJS::FunctionBodyNode::processDeclarations): Changed the order of
processing to enforce mutual exclusion rules.
* kjs/nodes.h:
(KJS::DeclarationStacks::DeclarationStacks): Structure includes an
ExecState now, for fast access to the "arguments" property name.
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add a JSGlobalObject class and remove the InterpreterMap
http://bugs.webkit.org/show_bug.cgi?id=15681
This required making JSCallbackObject a template class to allow for
JSGlobalObjects with JSCallbackObject functionality.
SunSpider claims this was a 0.5% speedup.
* API/JSCallbackObject.cpp:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
(KJS::::JSCallbackObject):
(KJS::::init):
(KJS::::~JSCallbackObject):
(KJS::::initializeIfNeeded):
(KJS::::className):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::implementsConstruct):
(KJS::::construct):
(KJS::::implementsHasInstance):
(KJS::::hasInstance):
(KJS::::implementsCall):
(KJS::::callAsFunction):
(KJS::::getPropertyNames):
(KJS::::toNumber):
(KJS::::toString):
(KJS::::setPrivate):
(KJS::::getPrivate):
(KJS::::inherits):
(KJS::::cachedValueGetter):
(KJS::::staticValueGetter):
(KJS::::staticFunctionGetter):
(KJS::::callbackGetter):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSContextRef.cpp:
(JSGlobalContextCreate):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectGetPrivate):
(JSObjectSetPrivate):
* API/JSValueRef.cpp:
(JSValueIsObjectOfClass):
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertValueToNPVariant):
* bindings/jni/jni_jsobject.cpp:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
* kjs/Context.cpp:
(KJS::Context::Context):
* kjs/ExecState.cpp:
(KJS::ExecState::lexicalInterpreter):
* kjs/JSGlobalObject.h: Added.
(KJS::JSGlobalObject::JSGlobalObject):
(KJS::JSGlobalObject::isGlobalObject):
(KJS::JSGlobalObject::interpreter):
(KJS::JSGlobalObject::setInterpreter):
* kjs/array_instance.cpp:
* kjs/context.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::~Interpreter):
(KJS::Interpreter::globalObject):
(KJS::Interpreter::initGlobalObject):
(KJS::Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lookup.h:
(KJS::cacheGlobalObject):
* kjs/object.h:
(KJS::JSObject::isGlobalObject):
* kjs/testkjs.cpp:
2007-10-24 Eric Seidel <eric@webkit.org>
Build fix for Gtk, no review.
* kjs/collector.cpp: #include "context.h"
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Stop checking isOutOfMemory after every allocation, instead let the collector
notify all ExecStates if we ever hit this rare condition.
SunSpider claims this was a 2.2% speedup.
* kjs/collector.cpp:
(KJS::Collector::collect):
(KJS::Collector::reportOutOfMemoryToAllInterpreters):
* kjs/collector.h:
* kjs/nodes.cpp:
(KJS::TryNode::execute):
2007-10-24 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/identifier.h: Remove extra qualification.
2007-10-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Disable ALWAYS_INLINE in debug builds, since it drives the debugger
crazy.
* wtf/AlwaysInline.h:
2007-10-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Inlined the fast path for creating an Identifier from an Identifier.
This is a .4% speedup on SunSpider overall, but as big as a 2.5%
speedup on certain individual tests. 65% of the Identifiers creating
by SunSpider are already Identifiers.
(The main reason I'm making this change is that it resolves a large
regression in a patch I haven't checked in yet.)
* JavaScriptCore.exp:
* kjs/identifier.cpp:
(KJS::Identifier::addSlowCase):
* kjs/identifier.h:
(KJS::Identifier::Identifier::add):
2007-10-24 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
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.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::invokeMethod):
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::QtField::setValueToInstance):
2007-10-24 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
* kjs/nodes.cpp:
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNode::evaluate):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::evaluate):
* kjs/operations.cpp:
* kjs/operations.h:
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by darin.
* kjs/nodes.h:
(KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Eric.
* kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- separate out the code to create a hash table the first time from the code
to rehash
SunSpider claims this was a 0.7% speedup.
* kjs/property_map.cpp:
(KJS::PropertyMap::expand): Changed to call either createTable or rehash.
(KJS::PropertyMap::createTable): Added. For the case where we had no table.
(KJS::PropertyMap::rehash): Removed code needed only in the case where we
had no table.
* kjs/property_map.h: Added createTable.
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
which can be represented by JSImmediate.
SunSpider claims this was a 0.6% speedup.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::NumberNode::evaluate):
(KJS::ImmediateNumberNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::ImmediateNumberNode::):
* kjs/nodes2string.cpp:
(ImmediateNumberNode::streamTo):
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15657
change static hash tables to use powers of two for speed
Seems to give 0.7% SunSpider speedup.
* kjs/create_hash_table: Updated to generate new format.
* kjs/lookup.cpp:
(KJS::keysMatch): Took out unneeded typecast.
(KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
Replaced the modulus with a bit mask.
(KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
their hash -- saves a branch.
(KJS::Lookup::find): Ditto.
* kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
2007-10-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
* kjs/nodes.cpp:
(KJS::DoWhileNode::execute):
(KJS::WhileNode::execute):
(KJS::ForNode::execute):
(KJS::ForInNode::execute):
(KJS::SourceElementsNode::execute):
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Maciej.
* kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
Changed an && to an & for a 1% gain in SunSpider.
2007-10-23 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
* kjs/nodes.cpp:
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::add):
(KJS::sub):
(KJS::AddNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::valueForReadModifyAssignment):
* kjs/operations.cpp:
* kjs/operations.h:
2007-10-23 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Separating all of the simple (eg. non-read-modify-write) binary operators
into separate classes in preparation for further JS optimisations.
Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
no further work.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::AddNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::LeftShiftNode::evaluate):
(KJS::RightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::LessNode::evaluate):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::evaluate):
(KJS::InstanceOfNode::evaluate):
(KJS::InNode::evaluate):
(KJS::EqualNode::evaluate):
(KJS::NotEqualNode::evaluate):
(KJS::StrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::evaluate):
(KJS::BitAndNode::evaluate):
(KJS::BitXOrNode::evaluate):
(KJS::BitOrNode::evaluate):
(KJS::LogicalAndNode::evaluate):
(KJS::LogicalOrNode::evaluate):
* kjs/nodes.h:
(KJS::MultNode::):
(KJS::DivNode::):
(KJS::ModNode::):
(KJS::AddNode::):
(KJS::SubNode::):
(KJS::LeftShiftNode::):
(KJS::RightShiftNode::):
(KJS::UnsignedRightShiftNode::):
(KJS::LessNode::):
(KJS::GreaterNode::):
(KJS::LessEqNode::):
(KJS::GreaterEqNode::):
(KJS::InstanceOfNode::):
(KJS::InNode::):
(KJS::EqualNode::):
(KJS::NotEqualNode::):
(KJS::StrictEqualNode::):
(KJS::NotStrictEqualNode::):
(KJS::BitAndNode::):
(KJS::BitOrNode::):
(KJS::BitXOrNode::):
(KJS::LogicalAndNode::):
(KJS::LogicalOrNode::):
* kjs/nodes2string.cpp:
(MultNode::streamTo):
(DivNode::streamTo):
(ModNode::streamTo):
(AddNode::streamTo):
(SubNode::streamTo):
(LeftShiftNode::streamTo):
(RightShiftNode::streamTo):
(UnsignedRightShiftNode::streamTo):
(LessNode::streamTo):
(GreaterNode::streamTo):
(LessEqNode::streamTo):
(GreaterEqNode::streamTo):
(InstanceOfNode::streamTo):
(InNode::streamTo):
(EqualNode::streamTo):
(NotEqualNode::streamTo):
(StrictEqualNode::streamTo):
(NotStrictEqualNode::streamTo):
(BitAndNode::streamTo):
(BitXOrNode::streamTo):
(BitOrNode::streamTo):
(LogicalAndNode::streamTo):
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15639
fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
Test: fast/js/math.html
* kjs/math_object.cpp: (MathFuncImp::callAsFunction):
Fix abs to look at the sign bit. Add a special case for values in the range
between -0 and -1 and a special case for ceil and for -0 for floor.
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Eric.
- streamline exception handling code for a >1% speed-up of SunSpider
* kjs/nodes.cpp: Changed macros to use functions for everything that's not
part of normal execution. We'll take function call overhead when propagating
an exception or out of memory.
(KJS::createOutOfMemoryCompletion): Added.
(KJS::substitute): Use append instead of the relatively inefficient + operator.
(KJS::Node::rethrowException): Added.
* kjs/nodes.h: Added rethrowException.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15636
some JavaScriptCore regression tests are failing due to numeric conversion
This should restore correctness and make speed better too, restoring some
of the optimization we lost in my last check-in.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
I used in my patch yesterday.
(KJS::JSImmediate::getTruncatedUInt32): Ditto.
* kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
* kjs/internal.cpp:
(KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
a way to write this more efficiently for float.
(KJS::NumberImp::getTruncatedInt32): Added.
(KJS::NumberImp::getTruncatedUInt32): Added.
* kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
(KJS::JSValue::getUInt32):
(KJS::JSValue::getTruncatedInt32): Added.
(KJS::JSValue::getTruncatedUInt32): Added.
(KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
(KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
* kjs/value.cpp:
(KJS::JSCell::getTruncatedInt32): Added.
(KJS::JSCell::getTruncatedUInt32): Added.
(KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
(KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
had left in here.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
* JavaScriptCore.exp: Updated.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=15632
js1_5/Array/array-001.js test failing
One of the JavaScriptCore tests was failing; it failed because of
my change to NumberImp::getUInt32. The incorrect code I copied was
from JSImmediate::getUInt32, and was a pre-existing bug.
This patch fixes correctness, but will surely slow down SunSpider.
We may be able to code this tighter and get the speed back.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
reflect the fact that this function only returns true if the value is
accurate (no fractional part, etc.). Changed code so that it returns
false when the value has a fraction.
(KJS::JSImmediate::getUInt32): Ditto.
* kjs/internal.cpp:
(KJS::NumberImp::getInt32): Changed code so that it returns false when
the value has a fraction. Restores the old behavior.
(KJS::NumberImp::getUInt32): Ditto.
* kjs/value.h:
(KJS::JSValue::getInt32): Updated for name change.
(KJS::JSValue::getUInt32): Ditto.
(KJS::JSValue::toInt32): Ditto.
(KJS::JSValue::toUInt32): Ditto.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Brady.
- fix crash seen when running JavaScriptCore tests
* kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
Copy and paste error: I accidentally had code here that was
making a copy of the HashMap -- that's illegal inside a mark
function and was unnecessary. The other callsite was modifying
the map as it iterated it, but this function is not.
2007-10-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
http://bugs.webkit.org/show_bug.cgi?id=15627
* kjs/JSImmediate.h:
(KJS::JSImmediate::fromDouble): Avoid moving floats to integer
registers since this is very slow.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- http://bugs.webkit.org/show_bug.cgi?id=15617
improve speed of integer conversions
Makes SunSpider 6% faster.
* kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
32-bit and 64-bit.
* kjs/value.h:
(KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
* kjs/internal.h: Added getInt32.
* kjs/internal.cpp:
(KJS::NumberImp::getInt32): Added.
(KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
stolen from JSValue.
* kjs/value.h:
(KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
inlined.
(KJS::JSValue::getInt32): Added.
(KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
to avoid converting from float to double.
(KJS::JSValue::toInt32): Made inline, separated out the slow case.
(KJS::JSValue::toUInt32): Ditto.
* kjs/value.cpp:
(KJS::JSCell::getInt32): Added.
(KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
new getInt32. Added a faster case for in-range numbers.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
* JavaScriptCore.exp: Updated for changes.
2007-10-22 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
warning about implicit conversion to bool.
2007-10-22 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/array_instance.cpp:
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15606
make cut-off for sparse vs. dense arrays smarter for speed with large arrays
Makes the morph test in SunSpider 26% faster, and the overall
benchmark 3% faster.
This also fixes some small problems we had with the distinction
between nonexistent and undefined values in arrays.
* kjs/array_instance.h: Tweaked formatting and naming.
* kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
(KJS::storageSize): Added. Computes the size of the storage given a vector length.
(KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
(KJS::isDenseEnoughForVector): Added.
(KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
(KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
(KJS::ArrayInstance::getItem): Updated for name changes.
(KJS::ArrayInstance::lengthGetter): Ditto.
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
getOwnPropertySlot to share more code.
(KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
(KJS::ArrayInstance::put): Added logic for extending the vector as long as the
array is dense enough. Also keep m_numValuesInVector up to date.
(KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
up to date.
(KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
for array indices with undefined values.
(KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
simplified to only handle getting larger.
(KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
zero out the unused part of the vector and to delete the map if it's no longer
needed.
(KJS::ArrayInstance::mark): Tweaked formatting.
(KJS::compareByStringForQSort): Ditto.
(KJS::ArrayInstance::sort): Ditto.
(KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
Ditto.
(KJS::compareWithCompareFunctionForQSort): Ditto.
(KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
undefined values into nonexistent values in some cases.
* kjs/array_object.h: Removed MAX_ARRAY_INDEX.
* kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
* JavaScriptCore.pri: Added array_instance.cpp.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* kjs/AllInOneFile.cpp: Ditto.
2007-10-22 Andrew Wellington <proton@wiretapped.net>
Reviewed by Mark Rowe.
Fix for local database support after r26879
Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
* Configurations/JavaScriptCore.xcconfig:
2007-10-22 Simon Hausmann <hausmann@kde.org>
Reviewed by Alp.
Build fix for the non-qmake builds.
* wtf/Platform.h: Default to enabling the database features unless
otherwise specified. (similar to ENABLE_ICONDATABASE)
2007-10-22 Holger Freyther <zecke@selfish.org>
Reviewed by Simon Hausmann <hausmann@kde.org>.
* Do not build testkjs as an application bundle. This is
needed for run-javascriptcore-tests on OSX.
* Also, based on r26633, allow to test the WebKit/Qt port on OSX.
* Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
as we do not have -rpath on OSX.
* kjs/testkjs.pro:
2007-10-21 Mark Rowe <mrowe@apple.com>
Reviewed by Alp.
http://bugs.webkit.org/show_bug.cgi?id=15575
Bug 15575: [GTK] Implement threading using GThread
* wtf/Platform.h: Do not enable pthreads for Gtk.
2007-10-21 Mark Rowe <mrowe@apple.com>
Reviewed by Mitz.
Fix http://bugs.webkit.org/show_bug.cgi?id=15603
Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
* kjs/array_object.cpp:
(KJS::freeStorage): Reinstate null-check that was removed in r26847.
2007-10-21 Darin Adler <darin@apple.com>
- fix Windows build
* kjs/array_instance.h: Removed unused ExecState parameter.
* kjs/array_object.cpp:
(KJS::ArrayInstance::put): Ditto.
(KJS::ArrayInstance::setLength): Ditto.
2007-10-21 Darin Adler <darin@apple.com>
* kjs/array_object.cpp: (KJS::ArrayInstance::put):
Add missing assignment that was causing regression test crash.
2007-10-21 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15585
speed up sparse arrays by using a custom map
Speeds up SunSpider by 10%.
* kjs/array_object.cpp:
(allocateStorage): Leave room for an additional pointer.
(reallocateStorage): Ditto.
(freeStorage): Ditto.
(ArrayInstance::~ArrayInstance): Delete the overflow map if present.
(ArrayInstance::getItem): Read values from the overflow map if present.
Removed the check of length, since it slows down the common case.
(ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
to the property map.
(ArrayInstance::put): Write values into the overflow map as needed.
Also create overflow map when needed.
(ArrayInstance::deleteProperty): Remove values from the overflow map
as appropriate.
(ArrayInstance::getPropertyNames): Add a name for each identifier in
the property map. This is extremely inefficient.
(ArrayInstance::setLength): Remove any values in the overflow map
that are past the new length, as we formerly did with the property map.
(ArrayInstance::mark): Mark any values in the overflow map.
(compareByStringForQSort): Removed unneeded undefined case, since
compactForSorting guarantees we will have no undefined values.
(compareWithCompareFunctionForQSort): Ditto.
(ArrayInstance::compactForSorting): Copy all the values out of the
overflow map and destroy it.
* kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
* kjs/property_map.cpp: Ditto.
2007-10-20 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15579
stop churning identifier reference counts copying Completion objects
* kjs/completion.h: Replace the Identifier with an Identifier*.
* kjs/nodes.cpp:
(ForInNode::execute): Update for change to Completion constructor.
(ContinueNode::execute): Ditto.
(BreakNode::execute): Ditto.
2007-10-20 Mark Rowe <mrowe@apple.com>
Reviewed by Alp.
Gtk changes needed to enable HTML 5 client-side database storage.
* wtf/Platform.h: Have Gtk use pthreads for now.
2007-10-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
Store gathered declaration nodes in the function body node.
This means that you only have to gather the declaration nodes the first
time the function executes. Performance gain of 2.10% on SunSpider,
0.90% on command-line JS iBench.
* kjs/nodes.cpp: Split declaration stack initialization code off into
initializeDeclarationStacks().
(FunctionBodyNode::FunctionBodyNode):
(FunctionBodyNode::initializeDeclarationStacks):
(FunctionBodyNode::processDeclarations):
* kjs/nodes.h: Changed DeclarationStacks structure to hold references,
since the actual Vectors are now stored either on the stack or in the
function body node.
2007-10-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15559
Moved processDeclarations call into FunctionBodyNode::execute
To improve encapsulation, moved processDeclarations call into
FunctionBodyNode::execute. Also marked processDeclarations
ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
on command-line JS iBench.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
* kjs/nodes.cpp:
(FunctionBodyNode::execute):
* kjs/nodes.h:
2007-10-19 Brady Eidson <beidson@apple.com>
Reviewed by Sam
Queue -> Deque! and small style tweaks
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
* wtf/Deque.h: Added.
(WTF::DequeNode::DequeNode):
(WTF::Deque::Deque):
(WTF::Deque::~Deque):
(WTF::Deque::size):
(WTF::Deque::isEmpty):
(WTF::Deque::append):
(WTF::Deque::prepend):
(WTF::Deque::first):
(WTF::Deque::last):
(WTF::Deque::removeFirst):
(WTF::Deque::clear):
* wtf/Queue.h: Removed.
2007-10-19 Brady Eidson <beidson@apple.com>
Reviewed by Oliver
Added a simple LinkedList based Queue to wtf
We can make a better, more sophisticated an efficient one later, but have
needed one for some time, now!
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/Queue.h: Added.
(WTF::QueueNode::QueueNode):
(WTF::Queue::Queue):
(WTF::Queue::~Queue):
(WTF::Queue::size):
(WTF::Queue::isEmpty):
(WTF::Queue::append):
(WTF::Queue::prepend):
(WTF::Queue::first):
(WTF::Queue::last):
(WTF::Queue::removeFirst):
(WTF::Queue::clear):
2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Anders.
Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
* kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
2007-10-19 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
* wtf/ASCIICType.h:
(WTF::isASCIIAlpha):
(WTF::isASCIIAlphanumeric):
(WTF::isASCIIDigit):
(WTF::isASCIIHexDigit):
(WTF::isASCIILower):
(WTF::isASCIISpace):
(WTF::toASCIILower):
(WTF::toASCIIUpper):
2007-10-19 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
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.
* kjs/config.h:
2007-10-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- use __declspec(thread) for fast thread-local storage on Windows
- 2.2% speedup on sunspider (on Windows)
- 7% speedup on the string section
- 6% speedup on JS iBench
- fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
- fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
* wtf/FastMalloc.cpp:
(WTF::getThreadHeap):
(WTF::setThreadHeap):
(WTF::TCMalloc_ThreadCache::GetCache):
(WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2007-10-17 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=15543
<rdar://problem/5545639> REGRESSION (r26697):
GoogleDocs: Can't create new documents or open existing ones
Test: fast/js/regexp-non-character.html
* pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
in the \u sequences -- not needed and actively harmful.
2007-10-17 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver.
* wtf/Platform.h:
#define USE_PTHREADS on Mac.
2007-10-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Merged DeclaredFunctionImp into FunctionImp (the base class) because
the distinction between the two was unused.
Removed codeType() from FunctionImp because FunctionImp and its
subclasses all returned FunctionCode, so it was unused, practically
speaking.
Removed a different codeType() from GlobalFuncImp because it was unused.
(Perhaps it was vestigial from a time when GlobalFuncImp used to
inherit from FunctionImp.)
* bindings/runtime_method.cpp:
* bindings/runtime_method.h:
* kjs/function.cpp:
(KJS::FunctionImp::FunctionImp):
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::construct):
(KJS::FunctionImp::execute):
(KJS::FunctionImp::processVarDecls):
* kjs/function.h:
(KJS::FunctionImp::implementsConstruct):
(KJS::FunctionImp::scope):
* kjs/function_object.cpp:
(FunctionProtoFunc::callAsFunction):
(FunctionObjectImp::construct):
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
2007-10-17 Adam Roben <aroben@apple.com>
Windows build fix part 2.
Fix was by Darin, reviewed by Anders and Adam.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
FastMallocPCRE.cpp to the project, and let Visual Studio have its way
with the post-build step.
* pcre/pcre.h: Don't DLL export the entry points just because this
is Win32 -- this is an internal copy of PCRE and should be private.
* pcre/pcre_compile.c: Fix an uninitialized variable warning --
there's no real problem but it's better to quiet the compiler by
tweaking the code slightly than turn off the warning entirely.
2007-10-17 Adam Roben <aroben@apple.com>
Windows build fix.
Reviewed by Anders.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
some mismatched signed/unsigned comparison warnings.
* pcre/pcre_exec.c:
(match): #if-out some labels that don't seem to exist.
2007-10-17 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* JavaScriptCore.pri: Add FastMallocPCRE.cpp.
* pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
is currently unavailable for UTF-16.
2007-10-16 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- merged PCRE changes between 6.4 and 6.5
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
* pcre/AUTHORS:
* pcre/LICENCE:
* pcre/MERGING:
* pcre/dftables.c:
* pcre/pcre-config.h:
* pcre/pcre.h:
* pcre/pcre.pri:
* pcre/pcre_compile.c:
* pcre/pcre_exec.c:
* pcre/pcre_fullinfo.c:
* pcre/pcre_get.c:
* pcre/pcre_internal.h:
* pcre/pcre_maketables.c:
* pcre/pcre_ord2utf8.c:
* pcre/pcre_tables.c:
* pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
* pcre/pcre_xclass.c:
* pcre/ucp.h:
* pcre/ucpinternal.h:
* pcre/ucptable.c:
Updated with new versions from the PCRE 6.5 release, merged with changes.
* pcre/pcre_config.c: Removed.
* pcre/pcre_globals.c: Removed.
* pcre/pcre_info.c: Removed.
* pcre/pcre_printint.src: Removed.
* pcre/pcre_refcount.c: Removed.
* pcre/pcre_study.c: Removed.
* pcre/pcre_try_flipped.c: Removed.
* pcre/pcre_ucp_findchar.c: Removed.
* pcre/pcre_version.c: Removed.
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed KJS_VERBOSE because it was getting in the way of readability,
and the messages didn't seem very helpful.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::passInParameters):
* kjs/lookup.h:
(KJS::lookupPut):
* kjs/object.cpp:
(KJS::JSObject::put):
* kjs/value.h:
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed the Parameter class because it was a redundant wrapper around
Identifier.
* kjs/function.cpp:
(KJS::FunctionImp::passInParameters):
(KJS::FunctionImp::getParameterName):
* kjs/nodes.cpp:
(FunctionBodyNode::addParam):
* kjs/nodes.h:
(KJS::FunctionBodyNode::):
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Global replace of assert with ASSERT.
2007-10-16 Adam Roben <aroben@apple.com>
Make testkjs not delay-load WebKit
Soon, delay-loading WebKit will be impossible (because we will be
using __declspec(thread) for thread-local storage). This change
prepares testkjs for the future.
Reviewed by Sam.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
added FindSafari.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
WebKitInitializer, don't delay-load WebKit.
* kjs/testkjs.cpp: Don't use WebKitInitializer.
2007-10-16 Adam Roben <aroben@apple.com>
Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
Reviewed by Kevin McCullough.
* JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
* JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
* JavaScriptCore.vcproj/release.vsprops: Ditto.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
in the name of icuuc36[_debug].dll.
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Re-structured variable and function declaration code.
Command-line JS iBench shows no regression.
Here are the changes:
1. Function declarations are now processed at the same time as var
declarations -- namely, immediately upon entry to an execution context.
This does not match Firefox, which waits to process a function
declaration until the declaration's containing block executes, but it
does match IE and the ECMA spec. (10.1.3 states that var and function
declarations should be processed at the same time -- namely, "On
entering an execution context." 12.2 states that "A Block does not
define a new execution scope.")
2. Declaration processing proceeds iteratively now, rather than
recursively, storing the nodes is finds in stacks. This will later
facilitate an optimization to hold on to the gathered declaration nodes,
rather than re-fetching them in every function call.
[ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
Modified these tests because they expected the incorrect Mozilla
behavior described above:
* tests/mozilla/ecma_3/Function/scope-001.js:
* tests/mozilla/js1_5/Scope/regress-184107.js:
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the GTK build
* kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the Windows build
* kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the GTK build
* kjs/ustring.cpp: Include ASCIICType.h.
2007-10-16 Darin Adler <darin@apple.com>
Reviewed by Maciej and Geoff (and looked over by Eric).
- http://bugs.webkit.org/show_bug.cgi?id=15519
eliminate use of <ctype.h> for processing ASCII
* wtf/ASCIICType.h: Added.
* wtf/DisallowCType.h: Added.
* kjs/config.h: Include DisallowCType.h.
* kjs/date_object.cpp:
(KJS::skipSpacesAndComments):
(KJS::findMonth):
(KJS::parseDate):
* kjs/function.cpp:
(KJS::decode):
* kjs/ustring.cpp:
(KJS::UString::toDouble):
Use ASCIICType.h functions instead of ctype.h ones.
2007-10-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixes for "New JavaScript benchmark"
http://bugs.webkit.org/show_bug.cgi?id=15515
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction): Implement "load" for compatibility
with SpiderMonkey.
(TestFunctionImp::): ditto
(doIt): ditto
(kjsmain): Drop useless --> from output.
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Removed unnecessary #include.
* API/JSObjectRef.cpp:
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Double-reverse build fix. My tree was out of date.
* kjs/nodes.cpp:
(NumberNode::evaluate):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Build fix.
* kjs/nodes.cpp:
(NumberNode::evaluate):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed surprising self-named "hack" that made nested functions
available as named properties of their containing functions, and placed
containing function objects in the scope chains of nested functions.
There were a few reasons to remove this "hack:"
1. It contradicted FF, IE, and the ECMA spec.
2. It incurred a performance penalty, since merely parsing a function
required parsing its body for nested functions (and so on).
3. SVN history contains no explanation for why it was added. It was just
legacy code in a large merge a long, long time ago.
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed the concept of AnonymousCode. It was unused, and it doesn't
exist in the ECMA spec.
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/Context.cpp:
(KJS::Context::Context):
* kjs/function.h:
* kjs/nodes.cpp:
(ReturnNode::execute):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Made function parameters DontDelete. This matches FF and the vague
description in ECMA 10.1.3. It's also required in order to make
symbol table based lookup of function parameters valid. (If the
parameters aren't DontDelete, you can't guarantee that you'll find
them later in the symbol table.)
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/function.cpp:
(KJS::FunctionImp::passInParameters):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Some Vector optimizations. These are especially important when using
Vector as a stack for implementing recursive algorithms iteratively.
[ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1. Added shrink(), which is a version of resize() that you can call
to save a branch / improve code generation and inlining when you know
that the vector is not getting bigger.
2. Changed subclassing relationship in VectorBuffer to remove a call to
fastFree() in the destructor for the inlineCapacity != 0 template
specialization. This brings inline Vectors one step closer to true
stack-allocated arrays.
Also changed abort() to CRASH(), since the latter works better.
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::VectorBufferBase::VectorBufferBase):
(WTF::VectorBufferBase::~VectorBufferBase):
(WTF::):
(WTF::VectorBuffer::VectorBuffer):
(WTF::VectorBuffer::~VectorBuffer):
(WTF::VectorBuffer::deallocateBuffer):
(WTF::VectorBuffer::releaseBuffer):
(WTF::Vector::clear):
(WTF::Vector::removeLast):
(WTF::::operator):
(WTF::::fill):
(WTF::::shrink):
2007-10-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
Iteration statements sometimes incorrectly evaluate to the empty value
(KDE r670547).
[ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
This patch is a merge of KDE r670547, with substantial modification
for performance.
It fixes do-while statements to evaluate to a value. (They used
to evaluate to the empty value in all cases.)
It also fixes SourceElementsNode to maintain the value of abnormal
completions like "break" and "continue."
It also re-works the main execution loop in SourceElementsNode so that
it (1) makes a little more sense and (2) avoids unnecessary work. This
is a .28% speedup on command-line JS iBench.
* kjs/nodes.cpp:
(DoWhileNode::execute):
(SourceElementsNode::execute):
2007-10-15 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
* wtf/HashTraits.h:
2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
Reviewed by Adam.
Add support for MSVC7, and fix cases where PLATFORM(WIN) should
be PLATFORM(WIN_OS) for other ports building on Windows.
* kjs/DateMath.cpp:
(KJS::getDSTOffsetSimple):
* kjs/JSImmediate.h:
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/Platform.h:
* wtf/StringExtras.h:
(snprintf):
(vsnprintf):
2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Adds NegateNode optimization from KJS. The relevant revision in KDE
is 666736.
* kjs/grammar.y:
* kjs/nodes.cpp:
(NumberNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::NumberNode::):
* kjs/nodes2string.cpp:
(NumberNode::streamTo):
2007-10-14 Jason Foreman <jason@threeve.org>
Reviewed by Maciej.
Fix http://bugs.webkit.org/show_bug.cgi?id=15145
Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
that the property n < intPow10(p) is maintained.
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
== Rolled over to ChangeLog-2007-10-14 ==