diff options
Diffstat (limited to 'Source/JavaScriptCore')
125 files changed, 1874 insertions, 907 deletions
diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.cpp b/Source/JavaScriptCore/API/JSCallbackFunction.cpp index d287ab778..59de186b0 100644 --- a/Source/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/Source/JavaScriptCore/API/JSCallbackFunction.cpp @@ -49,7 +49,7 @@ JSCallbackFunction::JSCallbackFunction(JSGlobalObject* globalObject, JSObjectCal { } -void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const Identifier& name) +void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const UString& name) { Base::finishCreation(globalData, name); ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.h b/Source/JavaScriptCore/API/JSCallbackFunction.h index fec4136f8..40bef8c48 100644 --- a/Source/JavaScriptCore/API/JSCallbackFunction.h +++ b/Source/JavaScriptCore/API/JSCallbackFunction.h @@ -34,12 +34,12 @@ namespace JSC { class JSCallbackFunction : public InternalFunction { protected: JSCallbackFunction(JSGlobalObject*, JSObjectCallAsFunctionCallback); - void finishCreation(JSGlobalData&, const Identifier& name); + void finishCreation(JSGlobalData&, const UString& name); public: typedef InternalFunction Base; - static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name) + static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const UString& name) { JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, callback); function->finishCreation(exec->globalData(), name); diff --git a/Source/JavaScriptCore/API/JSCallbackObject.h b/Source/JavaScriptCore/API/JSCallbackObject.h index 9aca0c7e1..2c3e0e859 100644 --- a/Source/JavaScriptCore/API/JSCallbackObject.h +++ b/Source/JavaScriptCore/API/JSCallbackObject.h @@ -177,12 +177,12 @@ private: static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier&); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned); static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue proto); @@ -209,9 +209,9 @@ private: static EncodedJSValue JSC_HOST_CALL call(ExecState*); static EncodedJSValue JSC_HOST_CALL construct(ExecState*); - JSValue getStaticValue(ExecState*, const Identifier&); - static JSValue staticFunctionGetter(ExecState*, JSValue, const Identifier&); - static JSValue callbackGetter(ExecState*, JSValue, const Identifier&); + JSValue getStaticValue(ExecState*, PropertyName); + static JSValue staticFunctionGetter(ExecState*, JSValue, PropertyName); + static JSValue callbackGetter(ExecState*, JSValue, PropertyName); OwnPtr<JSCallbackObjectData> m_callbackObjectData; }; diff --git a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h index b909dde71..fdc58fccf 100644 --- a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -122,7 +122,7 @@ UString JSCallbackObject<Parent>::className(const JSObject* object) } template <class Parent> -bool JSCallbackObject<Parent>::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSCallbackObject<Parent>::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell); JSContextRef ctx = toRef(exec); @@ -205,7 +205,7 @@ JSValue JSCallbackObject<Parent>::defaultValue(const JSObject* object, ExecState } template <class Parent> -bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object); PropertySlot slot; @@ -225,7 +225,7 @@ bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecSt } template <class Parent> -void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell); JSContextRef ctx = toRef(exec); @@ -284,7 +284,7 @@ void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, const Identifi } template <class Parent> -bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell); JSContextRef ctx = toRef(exec); @@ -504,7 +504,7 @@ bool JSCallbackObject<Parent>::inherits(JSClassRef c) const } template <class Parent> -JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifier& propertyName) +JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, PropertyName propertyName) { JSObjectRef thisRef = toRef(this); RefPtr<OpaqueJSString> propertyNameRef; @@ -533,7 +533,7 @@ JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifi } template <class Parent> -JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName) +JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName) { JSCallbackObject* thisObj = asCallbackObject(slotParent); @@ -547,7 +547,7 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) { if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { - JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName); + JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName.ustring()); thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes); return o; } @@ -559,7 +559,7 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue } template <class Parent> -JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName) +JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName) { JSCallbackObject* thisObj = asCallbackObject(slotParent); diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp index 746febfbb..92e03a671 100644 --- a/Source/JavaScriptCore/API/JSContextRef.cpp +++ b/Source/JavaScriptCore/API/JSContextRef.cpp @@ -38,6 +38,12 @@ #include "UStringBuilder.h" #include <wtf/text/StringHash.h> +#if OS(DARWIN) +#include <mach-o/dyld.h> + +static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 +#endif + using namespace JSC; // From the API's perspective, a context group remains alive iff @@ -67,6 +73,16 @@ void JSContextGroupRelease(JSContextGroupRef group) JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) { initializeThreading(); + +#if OS(DARWIN) + // If the application was linked before JSGlobalContextCreate was changed to use a unique JSGlobalData, + // we use a shared one for backwards compatibility. + if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) { + JSLock lock(LockForReal); + return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); + } +#endif // OS(DARWIN) + return JSGlobalContextCreateInGroup(0, globalObjectClass); } diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp index e01214d5e..91aa3c6bd 100644 --- a/Source/JavaScriptCore/API/JSObjectRef.cpp +++ b/Source/JavaScriptCore/API/JSObjectRef.cpp @@ -92,10 +92,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, { ExecState* exec = toJS(ctx); APIEntryShim entryShim(exec); - - Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); - - return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, nameID)); + return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->ustring() : "anonymous")); } JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) diff --git a/Source/JavaScriptCore/API/JSValueRef.h b/Source/JavaScriptCore/API/JSValueRef.h index 4186db822..125e4028a 100644 --- a/Source/JavaScriptCore/API/JSValueRef.h +++ b/Source/JavaScriptCore/API/JSValueRef.h @@ -63,7 +63,7 @@ extern "C" { @param value The JSValue whose type you want to obtain. @result A value of type JSType that identifies value's type. */ -JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value); +JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef); /*! @function diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 38f229734..e8aac4510 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,795 @@ +2012-05-17 Filip Pizlo <fpizlo@apple.com> + + Setting array index -1 and looping over array causes bad behavior + https://bugs.webkit.org/show_bug.cgi?id=86733 + <rdar://problem/11477670> + + Reviewed by Oliver Hunt. + + * dfg/DFGOperations.cpp: + +2012-05-17 Geoffrey Garen <ggaren@apple.com> + + Not reviewed. + + Rolled out r117495 because it caused som out of memory crashes. + + * heap/Heap.cpp: + (JSC::Heap::collect): + +2012-05-17 Geoffrey Garen <ggaren@apple.com> + + Refactored the Heap to move more MarkedSpace logic into MarkedSpace + https://bugs.webkit.org/show_bug.cgi?id=86790 + + Reviewed by Gavin Barraclough. + + * heap/Heap.cpp: + (JSC::Heap::lastChanceToFinalize): + (JSC::Heap::markRoots): + (JSC): + (JSC::Heap::objectCount): + (JSC::Heap::size): + (JSC::Heap::capacity): + (JSC::Heap::collect): + * heap/Heap.h: + (Heap): Took all the functors from here... + + * heap/MarkedBlock.h: + (CountFunctor): + (JSC::MarkedBlock::CountFunctor::CountFunctor): + (JSC::MarkedBlock::CountFunctor::count): + (JSC::MarkedBlock::CountFunctor::returnValue): + (MarkedBlock): + * heap/MarkedSpace.h: + (JSC::ClearMarks::operator()): + (JSC): + (JSC::Sweep::operator()): + (JSC::MarkCount::operator()): + (JSC::Size::operator()): + (JSC::Capacity::operator()): + (MarkedSpace): + (JSC::MarkedSpace::clearMarks): + (JSC::MarkedSpace::sweep): + (JSC::MarkedSpace::objectCount): + (JSC::MarkedSpace::size): + (JSC::MarkedSpace::capacity): and put them here. + +2012-05-17 Geoffrey Garen <ggaren@apple.com> + + Increase the GC allocation trigger + https://bugs.webkit.org/show_bug.cgi?id=86699 + + Reviewed by Sam Weinig. + + This helps a lot when the heap is growing, and helps to resolve + the regression caused by r116484. + + * heap/Heap.cpp: + (JSC::Heap::collect): + +2012-05-16 Mark Hahnenberg <mhahnenberg@apple.com> + + GC in the middle of JSObject::allocatePropertyStorage can cause badness + https://bugs.webkit.org/show_bug.cgi?id=83839 + + Reviewed by Geoff Garen. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * jit/JITStubs.cpp: Making changes to use the new return value of growPropertyStorage. + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSObject.cpp: + (JSC::JSObject::growPropertyStorage): Renamed to more accurately reflect that we're + growing our already-existing PropertyStorage. + * runtime/JSObject.h: + (JSObject): + (JSC::JSObject::setPropertyStorage): "Atomically" sets the new property storage + and the new structure so that we can be sure a GC never occurs when our Structure + info is out of sync with our PropertyStorage. + (JSC): + (JSC::JSObject::putDirectInternal): Moved the check to see if we should + allocate more backing store before the actual property insertion into + the structure. + (JSC::JSObject::putDirectWithoutTransition): Ditto. + (JSC::JSObject::transitionTo): Ditto. + * runtime/Structure.cpp: + (JSC::Structure::suggestedNewPropertyStorageSize): Added to keep the resize policy + for property backing stores contained within the Structure class. + (JSC): + * runtime/Structure.h: + (JSC::Structure::shouldGrowPropertyStorage): Lets clients know if another insertion + into the Structure would require resizing the property backing store so that they can + preallocate the required storage. + (Structure): + +2012-05-16 Geoffrey Garen <ggaren@apple.com> + + GC is not thread-safe when moving values between C stacks + https://bugs.webkit.org/show_bug.cgi?id=86672 + + Reviewed by Phil Pizlo. + + GC pauses thread A while marking thread A, and then B while marking B, + which isn't safe against A and B moving values between each others' + stacks. + + This is a theoretical bug -- I haven't been able to reproduce it + in the wild. + + * heap/MachineStackMarker.cpp: + (JSC::MachineThreads::gatherFromOtherThread): + (JSC::MachineThreads::gatherConservativeRoots): Pause all C stacks for the + duration of stack marking, to avoid missing values that might be moving + between C stacks. + +2012-05-15 Mark Hahnenberg <mhahnenberg@apple.com> + + Block freeing thread should not free blocks when we are actively requesting them + https://bugs.webkit.org/show_bug.cgi?id=86519 + + Reviewed by Geoff Garen. + + * heap/BlockAllocator.h: + (JSC::BlockAllocator::allocate): Reordering the setting of the flag so its done + while we hold the lock to ensure proper locking. + +2012-05-15 Filip Pizlo <fpizlo@apple.com> + + shrinkToFit() is often not called for Vectors in CodeBlock + https://bugs.webkit.org/show_bug.cgi?id=86436 + + Reviewed by Oliver Hunt. + + The vectors in CodeBlock are often appended to during various stages of + compilation, but we neglect to shrink them after compilation finishes. This + patch takes the most brutal possible approach: shrink all the vectors after + the bytecompile phase, and then shrink them again after the appropriate + JITing phase. The two shrinks are necessary because the JIT may append more + stuff, but may also generate code that directly references things in other + vectors; hence some can only be shrunk before JIT and some after. Also, + we may allow a CodeBlock to sit around for a long time - possibly forever - + before invoking the JIT, hence it makes sense to have two shrinks. + + This is performance neutral on the major benchmarks we track. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::shrinkToFit): + * bytecode/CodeBlock.h: + (CodeBlock): + (JSC::CodeBlock::appendWeakReferenceTransition): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::generate): + * dfg/DFGDriver.cpp: + (JSC::DFG::compile): + * dfg/DFGJITCompiler.cpp: + (JSC::DFG::JITCompiler::link): + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + +2012-05-15 Oliver Hunt <oliver@apple.com> + + Make error information available even if all we have is line number information. + https://bugs.webkit.org/show_bug.cgi?id=86547 + + Reviewed by Filip Pizlo. + + We don't need expression information to generate useful line, file, and stack information, + so only require that we have line number info available. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::throwException): + * runtime/Executable.h: + (JSC): + +2012-05-15 Mark Hahnenberg <mhahnenberg@apple.com> + + Block freeing thread should not free blocks when we are actively requesting them + https://bugs.webkit.org/show_bug.cgi?id=86519 + + Reviewed by Geoffrey Garen. + + The block freeing thread shoots us in the foot if it decides to run while we're actively + requesting blocks and returning them. This situation can arise when there is a lot of copying + collection going on in steady state. We allocate a large swath of pages to copy into, then we + return all the newly free old pages to the BlockAllocator. In this state, if the block freeing + thread wakes up in between collections (which is more likely than it waking up during a + collection) and frees half of these pages, they will be needed almost immediately during the + next collection, causing a storm of VM allocations which we know are going to be very slow. + + What we'd like is for when things have quieted down the block freeing thread can then return + memory to the OS. Usually this will be when a page has fully loaded and has a low allocation + rate. In this situation, our opportunistic collections will only be running at least every few + seconds, thus the extra time spent doing VM allocations won't matter nearly as much as, say, + while a page is loading. + + * heap/BlockAllocator.cpp: + (JSC::BlockAllocator::BlockAllocator): Initialize our new field. + (JSC::BlockAllocator::blockFreeingThreadMain): We check if we've seen any block requests recently. + If so, reset our flag and go back to sleep. We also don't bother with locking here. If we miss out + on an update, we'll see it when we wake up again. + * heap/BlockAllocator.h: Add new field to track whether or not we've received recent block requests. + (BlockAllocator): + (JSC::BlockAllocator::allocate): If we receive a request for a block, set our field that tracks + that to true. We don't bother locking since we assume that writing to a bool is atomic. + +2012-05-14 Luke Macpherson <macpherson@chromium.org> + + Introduce ENABLE_CSS_VARIABLES compile flag. + https://bugs.webkit.org/show_bug.cgi?id=86338 + + Reviewed by Dimitri Glazkov. + + Add a configuration option for CSS Variables support, disabling it by default. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-14 Gavin Barraclough <barraclough@apple.com> + + Cannot login to iCloud + https://bugs.webkit.org/show_bug.cgi?id=86321 + + Reviewed by Filip Pizlo. + + This is a bug introduced by bug#85853, we shouldn't allow assignment to + the prototype property of functions to be cached, since we need to clear + the cached inheritorID. + + * runtime/JSFunction.cpp: + (JSC::JSFunction::put): + +2012-05-14 Michael Saboff <msaboff@apple.com> + + Enh: Add the Ability to Disable / Enable JavaScript GC Timer + https://bugs.webkit.org/show_bug.cgi?id=86382 + + Reviewed by Darin Adler. + + Add flag to GCActivityCallback to enable / disable activity timer. + Add api via Heap to set the flag's value. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Windows export + * heap/Heap.cpp: + (JSC::Heap::setGarbageCollectionTimerEnabled): + * heap/Heap.h: + * runtime/GCActivityCallback.h: + (JSC::GCActivityCallback::isEnabled): + (JSC::GCActivityCallback::setEnabled): + (JSC::GCActivityCallback::GCActivityCallback): + * runtime/GCActivityCallbackCF.cpp: + (JSC::DefaultGCActivityCallbackPlatformData::timerDidFire): + +2012-05-14 Michael Saboff <msaboff@apple.com> + + Increase Debug Logging in MarkStack::validate() + https://bugs.webkit.org/show_bug.cgi?id=86408 + + Rubber-stamped by Filip Pizlo. + + Added some descriptive debug messages for the conditions and + values when a cell validation fails. + + * heap/MarkStack.cpp: + (JSC::MarkStack::validate): + +2012-05-14 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix make distcheck. + + * GNUmakefile.list.am: Add missing header file. + +2012-05-14 Yong Li <yoli@rim.com> + + DFG JIT didn't work with ARM EABI. + https://bugs.webkit.org/show_bug.cgi?id=84449 + + Reviewed by Filip Pizlo. + + Add a 32-bit dummy argument for some callOperation() + methods to make it work for ARM EABI. + + * dfg/DFGCCallHelpers.h: + (JSC::DFG::CCallHelpers::setupArgumentsWithExecState): + (CCallHelpers): + * dfg/DFGOperations.cpp: + * dfg/DFGSpeculativeJIT.h: + (SpeculativeJIT): + (JSC::DFG::SpeculativeJIT::callOperation): + +2012-05-13 Gavin Barraclough <barraclough@apple.com> + + Introduce PropertyName class + https://bugs.webkit.org/show_bug.cgi?id=86241 + + Reviewed by Darin Adler. + + This patch introduced a couple of small bugs. + + * runtime/PropertyName.h: + (JSC::toUInt32FromCharacters): + - Returning wrong value for "" - should not convert to 0. + (JSC::PropertyName::PropertyName): + - Remove the ASSERT, it was a little too aspirational. + +2012-05-13 Filip Pizlo <fpizlo@apple.com> + + DFG performs incorrect constant folding on double-to-uint32 conversion in + Uint32Array PutByVal + https://bugs.webkit.org/show_bug.cgi?id=86330 + + Reviewed by Darin Adler. + + static_cast<int>(d) is wrong, since JS semantics require us to use toInt32(d). + In particular, C++ casts on typical hardware (like x86 and similar) will + return 0x80000000 for double values that are out of range of the int32 domain + (i.e. less than -2^31 or greater than or equal to 2^31). But JS semantics call + for wrap-around; for example the double value 4294967297 ought to become the + int32 value 1, not 0x80000000. + + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray): + +2012-05-11 Gavin Barraclough <barraclough@apple.com> + + Introduce PropertyName class + https://bugs.webkit.org/show_bug.cgi?id=86241 + + Reviewed by Geoff Garen. + + Replace 'const Identifier&' arguments to functions accessing object properties with a new 'PropertyName' type. + This change paves the way to allow for properties keyed by values that are not Identifiers. + + This change is largely a mechanical find & replace. + It also changes JSFunction's constructor to take a UString& instead of an Identifier& + (since in some cases we can no longer guarantee that we'lll have an Identifier), and + unifies Identifier's methods to obtain array indices onto PropertyName. + + The new PropertyName class retains the ability to support .impl() and .ustring(), but + in a future patch we may need to rework this, since not all PropertyNames should be + equal based on their string representation. + + * API/JSCallbackFunction.cpp: + (JSC::JSCallbackFunction::finishCreation): + * API/JSCallbackFunction.h: + (JSCallbackFunction): + (JSC::JSCallbackFunction::create): + * API/JSCallbackObject.h: + (JSCallbackObject): + * API/JSCallbackObjectFunctions.h: + (JSC::::getOwnPropertySlot): + (JSC::::getOwnPropertyDescriptor): + (JSC::::put): + (JSC::::deleteProperty): + (JSC::::getStaticValue): + (JSC::::staticFunctionGetter): + (JSC::::callbackGetter): + * API/JSObjectRef.cpp: + (JSObjectMakeFunctionWithCallback): + * JSCTypedArrayStubs.h: + (JSC): + * JavaScriptCore.xcodeproj/project.pbxproj: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::getOwnPropertySlot): + (JSC::DebuggerActivation::put): + (JSC::DebuggerActivation::putDirectVirtual): + (JSC::DebuggerActivation::deleteProperty): + (JSC::DebuggerActivation::getOwnPropertyDescriptor): + (JSC::DebuggerActivation::defineOwnProperty): + * debugger/DebuggerActivation.h: + (DebuggerActivation): + * jsc.cpp: + (GlobalObject::addFunction): + (GlobalObject::addConstructableFunction): + * runtime/Arguments.cpp: + (JSC::Arguments::getOwnPropertySlot): + (JSC::Arguments::getOwnPropertyDescriptor): + (JSC::Arguments::put): + (JSC::Arguments::deleteProperty): + (JSC::Arguments::defineOwnProperty): + * runtime/Arguments.h: + (Arguments): + * runtime/ArrayConstructor.cpp: + (JSC::ArrayConstructor::finishCreation): + (JSC::ArrayConstructor::getOwnPropertySlot): + (JSC::ArrayConstructor::getOwnPropertyDescriptor): + * runtime/ArrayConstructor.h: + (ArrayConstructor): + * runtime/ArrayPrototype.cpp: + (JSC::ArrayPrototype::getOwnPropertySlot): + (JSC::ArrayPrototype::getOwnPropertyDescriptor): + (JSC::putProperty): + * runtime/ArrayPrototype.h: + (ArrayPrototype): + * runtime/BooleanConstructor.cpp: + (JSC::BooleanConstructor::finishCreation): + * runtime/BooleanPrototype.cpp: + (JSC::BooleanPrototype::getOwnPropertySlot): + (JSC::BooleanPrototype::getOwnPropertyDescriptor): + * runtime/BooleanPrototype.h: + (BooleanPrototype): + * runtime/ClassInfo.h: + (MethodTable): + * runtime/DateConstructor.cpp: + (JSC::DateConstructor::finishCreation): + (JSC::DateConstructor::getOwnPropertySlot): + (JSC::DateConstructor::getOwnPropertyDescriptor): + * runtime/DateConstructor.h: + (DateConstructor): + * runtime/DatePrototype.cpp: + (JSC::DatePrototype::getOwnPropertySlot): + (JSC::DatePrototype::getOwnPropertyDescriptor): + * runtime/DatePrototype.h: + (DatePrototype): + * runtime/Error.h: + (JSC::StrictModeTypeErrorFunction::create): + * runtime/ErrorConstructor.cpp: + (JSC::ErrorConstructor::finishCreation): + * runtime/ErrorPrototype.cpp: + (JSC::ErrorPrototype::getOwnPropertySlot): + (JSC::ErrorPrototype::getOwnPropertyDescriptor): + * runtime/ErrorPrototype.h: + (ErrorPrototype): + * runtime/FunctionConstructor.cpp: + (JSC::FunctionConstructor::finishCreation): + * runtime/FunctionPrototype.cpp: + (JSC::FunctionPrototype::finishCreation): + (JSC::FunctionPrototype::addFunctionProperties): + (JSC::functionProtoFuncBind): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::create): + (FunctionPrototype): + * runtime/Identifier.cpp: + (JSC): + * runtime/Identifier.h: + (Identifier): + * runtime/InternalFunction.cpp: + (JSC::InternalFunction::finishCreation): + * runtime/InternalFunction.h: + (InternalFunction): + * runtime/JSActivation.cpp: + (JSC::JSActivation::symbolTableGet): + (JSC::JSActivation::symbolTablePut): + (JSC::JSActivation::symbolTablePutWithAttributes): + (JSC::JSActivation::getOwnPropertySlot): + (JSC::JSActivation::put): + (JSC::JSActivation::putDirectVirtual): + (JSC::JSActivation::deleteProperty): + (JSC::JSActivation::argumentsGetter): + * runtime/JSActivation.h: + (JSActivation): + * runtime/JSArray.cpp: + (JSC::JSArray::defineOwnProperty): + (JSC::JSArray::getOwnPropertySlot): + (JSC::JSArray::getOwnPropertyDescriptor): + (JSC::JSArray::put): + (JSC::JSArray::deleteProperty): + * runtime/JSArray.h: + (JSArray): + (JSC): + * runtime/JSBoundFunction.cpp: + (JSC::JSBoundFunction::create): + (JSC::JSBoundFunction::finishCreation): + * runtime/JSBoundFunction.h: + (JSBoundFunction): + * runtime/JSCell.cpp: + (JSC::JSCell::getOwnPropertySlot): + (JSC::JSCell::put): + (JSC::JSCell::deleteProperty): + (JSC::JSCell::putDirectVirtual): + (JSC::JSCell::defineOwnProperty): + (JSC::JSCell::getOwnPropertyDescriptor): + * runtime/JSCell.h: + (JSCell): + * runtime/JSFunction.cpp: + (JSC::JSFunction::create): + (JSC::JSFunction::finishCreation): + (JSC::JSFunction::argumentsGetter): + (JSC::JSFunction::callerGetter): + (JSC::JSFunction::lengthGetter): + (JSC::JSFunction::getOwnPropertySlot): + (JSC::JSFunction::getOwnPropertyDescriptor): + (JSC::JSFunction::put): + (JSC::JSFunction::deleteProperty): + (JSC::JSFunction::defineOwnProperty): + (JSC::getCalculatedDisplayName): + * runtime/JSFunction.h: + (JSFunction): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::put): + (JSC::JSGlobalObject::putDirectVirtual): + (JSC::JSGlobalObject::defineOwnProperty): + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::createThrowTypeError): + (JSC::JSGlobalObject::getOwnPropertySlot): + (JSC::JSGlobalObject::getOwnPropertyDescriptor): + * runtime/JSGlobalObject.h: + (JSGlobalObject): + (JSC::JSGlobalObject::hasOwnPropertyForWrite): + (JSC::JSGlobalObject::symbolTableHasProperty): + * runtime/JSNotAnObject.cpp: + (JSC::JSNotAnObject::getOwnPropertySlot): + (JSC::JSNotAnObject::getOwnPropertyDescriptor): + (JSC::JSNotAnObject::put): + (JSC::JSNotAnObject::deleteProperty): + * runtime/JSNotAnObject.h: + (JSNotAnObject): + * runtime/JSONObject.cpp: + (JSC::JSONObject::getOwnPropertySlot): + (JSC::JSONObject::getOwnPropertyDescriptor): + * runtime/JSONObject.h: + (JSONObject): + * runtime/JSObject.cpp: + (JSC::JSObject::put): + (JSC::JSObject::putDirectVirtual): + (JSC::JSObject::putDirectAccessor): + (JSC::JSObject::hasProperty): + (JSC::JSObject::deleteProperty): + (JSC::JSObject::hasOwnProperty): + (JSC::callDefaultValueFunction): + (JSC::JSObject::findPropertyHashEntry): + (JSC::JSObject::getPropertySpecificValue): + (JSC::JSObject::removeDirect): + (JSC::JSObject::getOwnPropertyDescriptor): + (JSC::JSObject::getPropertyDescriptor): + (JSC::putDescriptor): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + (JSObject): + (JSC::JSObject::getDirect): + (JSC::JSObject::getDirectLocation): + (JSC::JSObject::inlineGetOwnPropertySlot): + (JSC::JSObject::getOwnPropertySlot): + (JSC::JSCell::fastGetOwnPropertySlot): + (JSC::JSObject::getPropertySlot): + (JSC::JSObject::get): + (JSC::JSObject::putDirectInternal): + (JSC::JSObject::putOwnDataProperty): + (JSC::JSObject::putDirect): + (JSC::JSObject::putDirectWithoutTransition): + (JSC::JSValue::get): + (JSC::JSValue::put): + * runtime/JSStaticScopeObject.cpp: + (JSC::JSStaticScopeObject::put): + (JSC::JSStaticScopeObject::putDirectVirtual): + (JSC::JSStaticScopeObject::getOwnPropertySlot): + * runtime/JSStaticScopeObject.h: + (JSStaticScopeObject): + * runtime/JSString.cpp: + (JSC::JSString::getOwnPropertySlot): + (JSC::JSString::getStringPropertyDescriptor): + * runtime/JSString.h: + (JSString): + (JSC::JSString::getStringPropertySlot): + * runtime/JSValue.cpp: + (JSC::JSValue::putToPrimitive): + * runtime/JSValue.h: + (JSC): + (JSValue): + * runtime/JSVariableObject.cpp: + (JSC::JSVariableObject::deleteProperty): + (JSC::JSVariableObject::symbolTableGet): + (JSC::JSVariableObject::putDirectVirtual): + * runtime/JSVariableObject.h: + (JSVariableObject): + (JSC::JSVariableObject::symbolTableGet): + (JSC::JSVariableObject::symbolTablePut): + (JSC::JSVariableObject::symbolTablePutWithAttributes): + * runtime/Lookup.cpp: + (JSC::setUpStaticFunctionSlot): + * runtime/Lookup.h: + (JSC::HashTable::entry): + (JSC): + (JSC::getStaticPropertySlot): + (JSC::getStaticPropertyDescriptor): + (JSC::getStaticFunctionSlot): + (JSC::getStaticFunctionDescriptor): + (JSC::getStaticValueSlot): + (JSC::getStaticValueDescriptor): + (JSC::lookupPut): + * runtime/MathObject.cpp: + (JSC::MathObject::getOwnPropertySlot): + (JSC::MathObject::getOwnPropertyDescriptor): + * runtime/MathObject.h: + (MathObject): + * runtime/NativeErrorConstructor.h: + (JSC::NativeErrorConstructor::finishCreation): + * runtime/NumberConstructor.cpp: + (JSC): + (JSC::NumberConstructor::finishCreation): + (JSC::NumberConstructor::getOwnPropertySlot): + (JSC::NumberConstructor::getOwnPropertyDescriptor): + (JSC::NumberConstructor::put): + (JSC::numberConstructorNaNValue): + (JSC::numberConstructorNegInfinity): + (JSC::numberConstructorPosInfinity): + (JSC::numberConstructorMaxValue): + (JSC::numberConstructorMinValue): + * runtime/NumberConstructor.h: + (NumberConstructor): + * runtime/NumberPrototype.cpp: + (JSC::NumberPrototype::getOwnPropertySlot): + (JSC::NumberPrototype::getOwnPropertyDescriptor): + * runtime/NumberPrototype.h: + (NumberPrototype): + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::finishCreation): + (JSC::ObjectConstructor::getOwnPropertySlot): + (JSC::ObjectConstructor::getOwnPropertyDescriptor): + * runtime/ObjectConstructor.h: + (ObjectConstructor): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::put): + (JSC::ObjectPrototype::defineOwnProperty): + (JSC::ObjectPrototype::getOwnPropertySlot): + (JSC::ObjectPrototype::getOwnPropertyDescriptor): + * runtime/ObjectPrototype.h: + (ObjectPrototype): + * runtime/PropertySlot.h: + (PropertySlot): + (JSC::PropertySlot::getValue): + * runtime/RegExpConstructor.cpp: + (JSC): + (JSC::RegExpConstructor::finishCreation): + (JSC::RegExpConstructor::getOwnPropertySlot): + (JSC::RegExpConstructor::getOwnPropertyDescriptor): + (JSC::regExpConstructorDollar1): + (JSC::regExpConstructorDollar2): + (JSC::regExpConstructorDollar3): + (JSC::regExpConstructorDollar4): + (JSC::regExpConstructorDollar5): + (JSC::regExpConstructorDollar6): + (JSC::regExpConstructorDollar7): + (JSC::regExpConstructorDollar8): + (JSC::regExpConstructorDollar9): + (JSC::regExpConstructorInput): + (JSC::regExpConstructorMultiline): + (JSC::regExpConstructorLastMatch): + (JSC::regExpConstructorLastParen): + (JSC::regExpConstructorLeftContext): + (JSC::regExpConstructorRightContext): + (JSC::RegExpConstructor::put): + * runtime/RegExpConstructor.h: + (RegExpConstructor): + * runtime/RegExpMatchesArray.h: + (JSC::RegExpMatchesArray::getOwnPropertySlot): + (JSC::RegExpMatchesArray::getOwnPropertyDescriptor): + (JSC::RegExpMatchesArray::put): + (JSC::RegExpMatchesArray::deleteProperty): + (JSC::RegExpMatchesArray::defineOwnProperty): + * runtime/RegExpObject.cpp: + (JSC): + (JSC::RegExpObject::getOwnPropertySlot): + (JSC::RegExpObject::getOwnPropertyDescriptor): + (JSC::RegExpObject::deleteProperty): + (JSC::RegExpObject::defineOwnProperty): + (JSC::regExpObjectGlobal): + (JSC::regExpObjectIgnoreCase): + (JSC::regExpObjectMultiline): + (JSC::regExpObjectSource): + (JSC::RegExpObject::put): + * runtime/RegExpObject.h: + (RegExpObject): + * runtime/RegExpPrototype.cpp: + (JSC::RegExpPrototype::getOwnPropertySlot): + (JSC::RegExpPrototype::getOwnPropertyDescriptor): + * runtime/RegExpPrototype.h: + (RegExpPrototype): + * runtime/StrictEvalActivation.cpp: + (JSC::StrictEvalActivation::deleteProperty): + * runtime/StrictEvalActivation.h: + (StrictEvalActivation): + * runtime/StringConstructor.cpp: + (JSC::StringConstructor::finishCreation): + (JSC::StringConstructor::getOwnPropertySlot): + (JSC::StringConstructor::getOwnPropertyDescriptor): + * runtime/StringConstructor.h: + (StringConstructor): + * runtime/StringObject.cpp: + (JSC::StringObject::getOwnPropertySlot): + (JSC::StringObject::getOwnPropertyDescriptor): + (JSC::StringObject::put): + (JSC::StringObject::defineOwnProperty): + (JSC::StringObject::deleteProperty): + * runtime/StringObject.h: + (StringObject): + * runtime/StringPrototype.cpp: + (JSC::StringPrototype::getOwnPropertySlot): + (JSC::StringPrototype::getOwnPropertyDescriptor): + * runtime/StringPrototype.h: + (StringPrototype): + * runtime/Structure.cpp: + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::attributeChangeTransition): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::removePropertyWithoutTransition): + (JSC::Structure::get): + (JSC::Structure::despecifyFunction): + (JSC::Structure::putSpecificValue): + (JSC::Structure::remove): + * runtime/Structure.h: + (Structure): + (JSC::Structure::get): + +2012-05-11 Michael Saboff <msaboff@apple.com> + + Rolling out r116659. + + Causes ASSERT failures on bots. + + Rubber stamped by Geoff Garen. + + * heap/Heap.cpp: + (JSC::Heap::markRoots): + * heap/MarkStack.cpp: + (JSC::MarkStackThreadSharedData::markingThreadMain): + (JSC::MarkStackThreadSharedData::markingThreadStartFunc): + (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData): + (JSC::MarkStackThreadSharedData::reset): + (JSC::MarkStack::reset): + (JSC): + (JSC::SlotVisitor::copyAndAppend): + * heap/MarkStack.h: + (MarkStackThreadSharedData): + (MarkStack): + * runtime/JSString.h: + (JSString): + (JSC::JSString::finishCreation): + (JSC::JSString::is8Bit): + (JSC::JSRopeString::finishCreation): + +2012-05-11 Oliver Hunt <oliver@apple.com> + + Appease thread verifier when dealing with the JSC API's shared VM + https://bugs.webkit.org/show_bug.cgi?id=86268 + + Reviewed by Geoffrey Garen. + + If we're the shared VM, just disable the verifier. This makes debug builds + livable against non-webkit clients. + + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + +2012-05-11 Filip Pizlo <fpizlo@apple.com> + + JIT memory allocator is not returning memory to the OS on Darwin + https://bugs.webkit.org/show_bug.cgi?id=86047 + + Reviewed by Geoff Garen. + + * jit/ExecutableAllocatorFixedVMPool.cpp: + (JSC::FixedVMPoolExecutableAllocator::notifyPageIsFree): + +2012-05-11 Geoffrey Garen <ggaren@apple.com> + + Clarified JSGlobalData (JavaScript VM) lifetime + https://bugs.webkit.org/show_bug.cgi?id=85142 + + Reviewed by Alexey Proskuryakov. + + (Follow-up fix.) + + * API/JSContextRef.cpp: + (JSGlobalContextCreate): Restored some code I removed because I misread an #ifdef. + (We don't need to test BUILDING_ON_LEOPARD, but we still need the linked-on + test, because apps might have been linked on older OS's.) + +2012-05-11 Sam Weinig <sam@webkit.org> + + Fix crash seen when running with libgmalloc + <rdar://problem/11435411> + https://bugs.webkit.org/show_bug.cgi?id=86232 + + Reviewed by Gavin Barraclough. + + * heap/MarkStack.cpp: + (JSC::MarkStackThreadSharedData::markingThreadMain): + Don't delete the SlotVisitor before the ParallelModeEnabler has had a chance to run its + destructor. + 2012-05-10 Gavin Barraclough <barraclough@apple.com> Remove op_get_callee diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 91d688b53..84c9ee23e 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -38,6 +38,7 @@ ENABLE_BLOB = ENABLE_BLOB; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; ENABLE_CSS_GRID_LAYOUT = ENABLE_CSS_GRID_LAYOUT; +ENABLE_CSS_VARIABLES = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; ENABLE_DATALIST = ; @@ -122,4 +123,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index 7b3167aa1..b626a84dd 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -521,6 +521,7 @@ javascriptcore_sources += \ Source/JavaScriptCore/runtime/PropertyDescriptor.cpp \ Source/JavaScriptCore/runtime/PropertyDescriptor.h \ Source/JavaScriptCore/runtime/PropertyMapHashTable.h \ + Source/JavaScriptCore/runtime/PropertyName.h \ Source/JavaScriptCore/runtime/PropertyNameArray.cpp \ Source/JavaScriptCore/runtime/PropertyNameArray.h \ Source/JavaScriptCore/runtime/PropertySlot.cpp \ diff --git a/Source/JavaScriptCore/JSCTypedArrayStubs.h b/Source/JavaScriptCore/JSCTypedArrayStubs.h index ca4030186..fa42d3c56 100644 --- a/Source/JavaScriptCore/JSCTypedArrayStubs.h +++ b/Source/JavaScriptCore/JSCTypedArrayStubs.h @@ -52,10 +52,10 @@ public: \ return ptr; \ }\ \ - static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);\ - static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);\ + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName propertyName, JSC::PropertySlot&);\ + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName propertyName, JSC::PropertyDescriptor&);\ static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\ - static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\ + static void put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName propertyName, JSC::JSValue, JSC::PutPropertySlot&);\ static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool);\ static const JSC::ClassInfo s_info;\ \ @@ -98,26 +98,26 @@ void JS##name##Array::finishCreation(JSGlobalData& globalData)\ ASSERT(inherits(&s_info));\ }\ \ -bool JS##name##Array::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\ +bool JS##name##Array::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)\ {\ JS##name##Array* thisObject = jsCast<JS##name##Array*>(cell);\ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\ - bool ok;\ - unsigned index = propertyName.toUInt32(ok);\ - if (ok && index < thisObject->m_storageLength) {\ + unsigned index = propertyName.asIndex();\ + if (index < thisObject->m_storageLength) {\ + ASSERT(index != PropertyName::NotAnIndex);\ slot.setValue(thisObject->getByIndex(exec, index));\ return true;\ }\ return Base::getOwnPropertySlot(cell, exec, propertyName, slot);\ }\ \ -bool JS##name##Array::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)\ +bool JS##name##Array::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)\ {\ JS##name##Array* thisObject = jsCast<JS##name##Array*>(object);\ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\ - bool ok;\ - unsigned index = propertyName.toUInt32(ok);\ - if (ok && index < thisObject->m_storageLength) {\ + unsigned index = propertyName.asIndex();\ + if (index < thisObject->m_storageLength) {\ + ASSERT(index != PropertyName::NotAnIndex);\ descriptor.setDescriptor(thisObject->getByIndex(exec, index), DontDelete);\ return true;\ }\ @@ -135,13 +135,12 @@ bool JS##name##Array::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, u return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);\ }\ \ -void JS##name##Array::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)\ +void JS##name##Array::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\ {\ JS##name##Array* thisObject = jsCast<JS##name##Array*>(cell);\ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\ - bool ok;\ - unsigned index = propertyName.toUInt32(ok);\ - if (ok) {\ + unsigned index = propertyName.asIndex();\ + if (index != PropertyName::NotAnIndex) {\ thisObject->indexSetter(exec, index, value);\ return;\ }\ diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index 951f85186..4b099b2ff 100755 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -56,13 +56,12 @@ EXPORTS ?addBytes@SHA1@WTF@@QAEXPBEI@Z ?addCurrentThread@MachineThreads@JSC@@QAEXXZ ?addFinalizer@Heap@JSC@@QAEXPAVJSCell@2@P6AX0@Z@Z - ?addPropertyTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z - ?addPropertyTransitionToExistingStructure@Structure@JSC@@SAPAV12@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z - ?addPropertyWithoutTransition@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@IPAVJSCell@2@@Z + ?addPropertyTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@VPropertyName@2@IPAVJSCell@2@AAI@Z + ?addPropertyTransitionToExistingStructure@Structure@JSC@@SAPAV12@PAV12@VPropertyName@2@IPAVJSCell@2@AAI@Z + ?addPropertyWithoutTransition@Structure@JSC@@QAEIAAVJSGlobalData@2@VPropertyName@2@IPAVJSCell@2@@Z ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z - ?allocatePropertyStorage@JSObject@JSC@@QAEXAAVJSGlobalData@2@II@Z ?allocateSlowCase@MarkedAllocator@JSC@@AAEPAXXZ ?append@StringBuilder@WTF@@QAEXPBEI@Z ?append@StringBuilder@WTF@@QAEXPB_WI@Z @@ -102,7 +101,7 @@ EXPORTS ?convertLatin1ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBEPBEPAPADPAD@Z ?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z ?convertUTF8ToUTF16@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBDPBDPAPA_WPA_W_N@Z - ?create@JSFunction@JSC@@SAPAV12@PAVExecState@2@PAVJSGlobalObject@2@HABVIdentifier@2@P6I_J0@ZW4Intrinsic@2@3@Z + ?create@JSFunction@JSC@@SAPAV12@PAVExecState@2@PAVJSGlobalObject@2@HABVUString@2@P6I_J0@ZW4Intrinsic@2@3@Z ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@W4HeapSize@2@@Z ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z ?create@RegExp@JSC@@SAPAV12@AAVJSGlobalData@2@ABVUString@2@W4RegExpFlags@2@@Z @@ -110,6 +109,7 @@ EXPORTS ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createInterruptedExecutionException@JSC@@YAPAVJSObject@1@PAVJSGlobalData@1@@Z ?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@W4HeapSize@2@@Z + ?createNotEnoughArgumentsError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z ?createRangeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z ?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z @@ -120,7 +120,6 @@ EXPORTS ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z ?createThread@WTF@@YAIP6AXPAX@Z0PBD@Z ?createTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z - ?createNotEnoughArgumentsError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z ?cryptographicallyRandomNumber@WTF@@YAIXZ ?cryptographicallyRandomValues@WTF@@YAXPAXI@Z ?currentThread@WTF@@YAIXZ @@ -133,19 +132,19 @@ EXPORTS ?dayInYear@WTF@@YAHNH@Z ?decrement@RefCountedLeakCounter@WTF@@QAEXXZ ?defaultValue@JSObject@JSC@@SA?AVJSValue@2@PBV12@PAVExecState@2@W4PreferredPrimitiveType@2@@Z - ?defineOwnProperty@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z - ?defineOwnProperty@JSObject@JSC@@SA_NPAV12@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z + ?defineOwnProperty@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@VPropertyName@2@AAVPropertyDescriptor@2@_N@Z + ?defineOwnProperty@JSObject@JSC@@SA_NPAV12@PAVExecState@2@VPropertyName@2@AAVPropertyDescriptor@2@_N@Z ?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z ?deleteOwnedPtr@WTF@@YAXPAUHBRUSH__@@@Z ?deleteOwnedPtr@WTF@@YAXPAUHDC__@@@Z ?deleteOwnedPtr@WTF@@YAXPAUHFONT__@@@Z ?deleteOwnedPtr@WTF@@YAXPAUHRGN__@@@Z - ?deleteProperty@JSObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@ABVIdentifier@2@@Z - ?deleteProperty@JSVariableObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@ABVIdentifier@2@@Z + ?deleteProperty@JSObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@VPropertyName@2@@Z + ?deleteProperty@JSVariableObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@VPropertyName@2@@Z ?deletePropertyByIndex@JSObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@I@Z ?deleteTable@HashTable@JSC@@QBEXXZ - ?despecifyDictionaryFunction@Structure@JSC@@QAEXAAVJSGlobalData@2@ABVIdentifier@2@@Z - ?despecifyFunctionTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@ABVIdentifier@2@@Z + ?despecifyDictionaryFunction@Structure@JSC@@QAEXAAVJSGlobalData@2@VPropertyName@2@@Z + ?despecifyFunctionTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@VPropertyName@2@@Z ?destroy@JSCell@JSC@@KAXPAV12@@Z ?destroy@JSGlobalObject@JSC@@SAXPAVJSCell@2@@Z ?destroy@OutOfLineBits@BitVector@WTF@@SAXPAV123@@Z @@ -177,7 +176,7 @@ EXPORTS ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z ?findAllocator@WeakSet@JSC@@AAEPAUFreeCell@WeakBlock@2@XZ ?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z - ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVIdentifier@2@@Z + ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVUString@2@@Z ?finishCreation@JSArray@JSC@@IAEXAAVJSGlobalData@2@I@Z ?finishCreation@RegExpObject@JSC@@IAEXPAVJSGlobalObject@2@@Z ?finishCreation@StringObject@JSC@@IAEXAAVJSGlobalData@2@PAVJSString@2@@Z @@ -186,21 +185,19 @@ EXPORTS ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@I@Z ?functionGetter@PropertySlot@JSC@@ABE?AVJSValue@2@PAVExecState@2@@Z ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ - ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@AAIAAPAVJSCell@2@@Z - ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@PAVStringImpl@WTF@@AAIAAPAVJSCell@2@@Z + ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@VPropertyName@2@AAIAAPAVJSCell@2@@Z ?getCalculatedDisplayName@JSC@@YA?AVUString@1@PAVExecState@1@PAVJSObject@1@@Z ?getCallData@JSCell@JSC@@SA?AW4CallType@2@PAV12@AATCallData@2@@Z ?getConstructData@JSCell@JSC@@SA?AW4ConstructType@2@PAV12@AATConstructData@2@@Z ?getCurrentLocalTime@WTF@@YAXPAUtm@@@Z ?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ - ?getOwnPropertyDescriptor@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z - ?getOwnPropertyDescriptor@JSObject@JSC@@SA_NPAV12@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z + ?getOwnPropertyDescriptor@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@VPropertyName@2@AAVPropertyDescriptor@2@@Z + ?getOwnPropertyDescriptor@JSObject@JSC@@SA_NPAV12@PAVExecState@2@VPropertyName@2@AAVPropertyDescriptor@2@@Z ?getOwnPropertyNames@JSObject@JSC@@SAXPAV12@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z ?getOwnPropertyNames@JSVariableObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z - ?getOwnPropertySlot@JSGlobalObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z + ?getOwnPropertySlot@JSGlobalObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@VPropertyName@2@AAVPropertySlot@2@@Z ?getOwnPropertySlotByIndex@JSArray@JSC@@SA_NPAVJSCell@2@PAVExecState@2@IAAVPropertySlot@2@@Z ?getOwnPropertySlotByIndex@JSObject@JSC@@SA_NPAVJSCell@2@PAVExecState@2@IAAVPropertySlot@2@@Z - ?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z ?getPropertyNames@JSObject@JSC@@SAXPAV12@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z ?getSlice@ArgList@JSC@@QBEXHAAV12@@Z ?getStackTrace@Interpreter@JSC@@SAXPAVJSGlobalData@2@AAV?$Vector@UStackFrame@JSC@@$0A@@WTF@@@Z @@ -210,9 +207,10 @@ EXPORTS ?globalExec@JSGlobalObject@JSC@@QAEPAVExecState@2@XZ ?globalObjectCount@Heap@JSC@@QAEIXZ ?grow@HandleSet@JSC@@AAEXXZ + ?growPropertyStorage@JSObject@JSC@@QAEPAV?$WriteBarrierBase@W4Unknown@JSC@@@2@AAVJSGlobalData@2@II@Z ?hasInstance@JSObject@JSC@@SA_NPAV12@PAVExecState@2@VJSValue@2@2@Z - ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@ABVIdentifier@2@@Z ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@I@Z + ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@VPropertyName@2@@Z ?hashSlowCase@StringImpl@WTF@@ABEIXZ ?heap@Heap@JSC@@SAPAV12@VJSValue@2@@Z ?increment@RefCountedLeakCounter@WTF@@QAEXXZ @@ -266,12 +264,12 @@ EXPORTS ?protectedGlobalObjectCount@Heap@JSC@@QAEIXZ ?protectedObjectCount@Heap@JSC@@QAEIXZ ?protectedObjectTypeCounts@Heap@JSC@@QAE?AV?$PassOwnPtr@V?$HashCountedSet@PBDU?$PtrHash@PBD@WTF@@U?$HashTraits@PBD@2@@WTF@@@WTF@@XZ - ?put@JSGlobalObject@JSC@@SAXPAVJSCell@2@PAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z - ?put@JSObject@JSC@@SAXPAVJSCell@2@PAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z + ?put@JSGlobalObject@JSC@@SAXPAVJSCell@2@PAVExecState@2@VPropertyName@2@VJSValue@2@AAVPutPropertySlot@2@@Z + ?put@JSObject@JSC@@SAXPAVJSCell@2@PAVExecState@2@VPropertyName@2@VJSValue@2@AAVPutPropertySlot@2@@Z ?putByIndex@JSObject@JSC@@SAXPAVJSCell@2@PAVExecState@2@IVJSValue@2@_N@Z ?putDirectIndexBeyondVectorLength@JSArray@JSC@@AAE_NPAVExecState@2@IVJSValue@2@_N@Z - ?putDirectVirtual@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z - ?putDirectVirtual@JSObject@JSC@@SAXPAV12@PAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z + ?putDirectVirtual@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@VPropertyName@2@VJSValue@2@I@Z + ?putDirectVirtual@JSObject@JSC@@SAXPAV12@PAVExecState@2@VPropertyName@2@VJSValue@2@I@Z ?randomNumber@WTF@@YANXZ ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z ?regExpFlags@JSC@@YA?AW4RegExpFlags@1@ABVUString@1@@Z @@ -296,6 +294,7 @@ EXPORTS ?setDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@I@Z ?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z ?setEnumerable@PropertyDescriptor@JSC@@QAEX_N@Z + ?setGarbageCollectionTimerEnabled@Heap@JSC@@QAEX_N@Z ?setGetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z ?setLoc@StatementNode@JSC@@QAEXHH@Z ?setMainThreadCallbacksPaused@WTF@@YAX_N@Z @@ -304,7 +303,7 @@ EXPORTS ?setSetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z ?setUndefined@PropertyDescriptor@JSC@@QAEXXZ ?setUnwrappedObject@JSGlobalThis@JSC@@IAEXAAVJSGlobalData@2@PAVJSGlobalObject@2@@Z - ?setUpStaticFunctionSlot@JSC@@YA_NPAVExecState@1@PBVHashEntry@1@PAVJSObject@1@ABVIdentifier@1@AAVPropertySlot@1@@Z + ?setUpStaticFunctionSlot@JSC@@YA_NPAVExecState@1@PBVHashEntry@1@PAVJSObject@1@VPropertyName@1@AAVPropertySlot@1@@Z ?setWritable@PropertyDescriptor@JSC@@QAEX_N@Z ?setter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ ?shrinkToFit@StringBuilder@WTF@@QAEXXZ @@ -320,7 +319,7 @@ EXPORTS ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z ?stopSampling@JSGlobalData@JSC@@QAEXXZ ?substringSharingImpl@UString@JSC@@QBE?AV12@II@Z - ?symbolTableGet@JSVariableObject@JSC@@IAE_NABVIdentifier@2@AAVPropertyDescriptor@2@@Z + ?suggestedNewPropertyStorageSize@Structure@JSC@@QAEIXZ ?synthesizePrototype@JSValue@JSC@@QBEPAVJSObject@2@PAVExecState@2@@Z ?thisObject@DebuggerCallFrame@JSC@@QBEPAVJSObject@2@XZ ?throwError@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@@Z @@ -343,7 +342,6 @@ EXPORTS ?toStringSlowCase@JSValue@JSC@@ABEPAVJSString@2@PAVExecState@2@@Z ?toThisObject@JSObject@JSC@@SAPAV12@PAVJSCell@2@PAVExecState@2@@Z ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z - ?toUInt32@Identifier@JSC@@SAIABVUString@2@AA_N@Z ?transfer@ArrayBuffer@WTF@@QAE_NAAVArrayBufferContents@2@AAV?$Vector@V?$RefPtr@VArrayBufferView@WTF@@@WTF@@$0A@@2@@Z ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z ?tryFastMalloc@WTF@@YA?AUTryMallocReturnValue@1@I@Z diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index c5a5b63be..6eabcced5 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -362,6 +362,7 @@ 8604F505143CE1C200B295F5 /* JSGlobalThis.h in Headers */ = {isa = PBXBuildFile; fileRef = 8604F503143CE1C100B295F5 /* JSGlobalThis.h */; settings = {ATTRIBUTES = (Private, ); }; }; 860BD801148EA6F200112B2F /* Intrinsic.h in Headers */ = {isa = PBXBuildFile; fileRef = 86BF642A148DB2B5004DE36A /* Intrinsic.h */; settings = {ATTRIBUTES = (Private, ); }; }; 8612E4CD152389EC00C836BE /* MatchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 8612E4CB1522918400C836BE /* MatchResult.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 86158AB3155C8B4000B45C9C /* PropertyName.h in Headers */ = {isa = PBXBuildFile; fileRef = 86158AB2155C8B3F00B45C9C /* PropertyName.h */; settings = {ATTRIBUTES = (Private, ); }; }; 863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */; settings = {ATTRIBUTES = (Private, ); }; }; 863C6D9C1521111A00585E4E /* YarrCanonicalizeUCS2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 863C6D981521111200585E4E /* YarrCanonicalizeUCS2.cpp */; }; 8642C510151C06A90046D4EF /* RegExpCachedResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86F75EFB151C062F007C9BA3 /* RegExpCachedResult.cpp */; }; @@ -1020,6 +1021,7 @@ 8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; }; 8604F503143CE1C100B295F5 /* JSGlobalThis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalThis.h; sourceTree = "<group>"; }; 8612E4CB1522918400C836BE /* MatchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchResult.h; sourceTree = "<group>"; }; + 86158AB2155C8B3F00B45C9C /* PropertyName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyName.h; sourceTree = "<group>"; }; 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerCodeRef.h; sourceTree = "<group>"; }; 863C6D981521111200585E4E /* YarrCanonicalizeUCS2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YarrCanonicalizeUCS2.cpp; path = yarr/YarrCanonicalizeUCS2.cpp; sourceTree = "<group>"; }; 863C6D991521111200585E4E /* YarrCanonicalizeUCS2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YarrCanonicalizeUCS2.h; path = yarr/YarrCanonicalizeUCS2.h; sourceTree = "<group>"; }; @@ -1936,6 +1938,7 @@ A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */, A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */, BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */, + 86158AB2155C8B3F00B45C9C /* PropertyName.h */, 65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */, 65400C100A69BAF200509887 /* PropertyNameArray.h */, 65621E6B089E859700760F35 /* PropertySlot.cpp */, @@ -2580,6 +2583,7 @@ 0F1E3A471534CBB9000F9456 /* DFGDoubleFormatState.h in Headers */, 14150133154BB13F005D8C98 /* WeakSetInlines.h in Headers */, 14816E1C154CC56C00B8054C /* BlockAllocator.h in Headers */, + 86158AB3155C8B4000B45C9C /* PropertyName.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 6a4d073bf..fa663504c 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -2092,22 +2092,33 @@ bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset) } #endif -void CodeBlock::shrinkToFit() +void CodeBlock::shrinkToFit(ShrinkMode shrinkMode) { -#if ENABLE(CLASSIC_INTERPRETER) m_propertyAccessInstructions.shrinkToFit(); m_globalResolveInstructions.shrinkToFit(); +#if ENABLE(LLINT) + m_llintCallLinkInfos.shrinkToFit(); #endif #if ENABLE(JIT) m_structureStubInfos.shrinkToFit(); m_globalResolveInfos.shrinkToFit(); m_callLinkInfos.shrinkToFit(); + m_methodCallLinkInfos.shrinkToFit(); #endif - - m_identifiers.shrinkToFit(); - m_functionDecls.shrinkToFit(); - m_functionExprs.shrinkToFit(); - m_constantRegisters.shrinkToFit(); +#if ENABLE(VALUE_PROFILER) + if (shrinkMode == EarlyShrink) + m_argumentValueProfiles.shrinkToFit(); + m_valueProfiles.shrinkToFit(); + m_rareCaseProfiles.shrinkToFit(); + m_specialFastCaseProfiles.shrinkToFit(); +#endif + + if (shrinkMode == EarlyShrink) { + m_identifiers.shrinkToFit(); + m_functionDecls.shrinkToFit(); + m_functionExprs.shrinkToFit(); + m_constantRegisters.shrinkToFit(); + } // else don't shrink these, because we would have already pointed pointers into these tables. if (m_rareData) { m_rareData->m_exceptionHandlers.shrinkToFit(); @@ -2117,7 +2128,24 @@ void CodeBlock::shrinkToFit() m_rareData->m_stringSwitchJumpTables.shrinkToFit(); m_rareData->m_expressionInfo.shrinkToFit(); m_rareData->m_lineInfo.shrinkToFit(); +#if ENABLE(JIT) + m_rareData->m_callReturnIndexVector.shrinkToFit(); +#endif +#if ENABLE(DFG_JIT) + m_rareData->m_inlineCallFrames.shrinkToFit(); + m_rareData->m_codeOrigins.shrinkToFit(); +#endif } + +#if ENABLE(DFG_JIT) + if (m_dfgData) { + m_dfgData->osrEntry.shrinkToFit(); + m_dfgData->osrExit.shrinkToFit(); + m_dfgData->speculationRecovery.shrinkToFit(); + m_dfgData->weakReferences.shrinkToFit(); + m_dfgData->transitions.shrinkToFit(); + } +#endif } void CodeBlock::createActivation(CallFrame* callFrame) diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index 778376f94..fe69ec673 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -309,26 +309,12 @@ namespace JSC { m_dfgData->weakReferences.append(WriteBarrier<JSCell>(*globalData(), ownerExecutable(), target)); } - void shrinkWeakReferencesToFit() - { - if (!m_dfgData) - return; - m_dfgData->weakReferences.shrinkToFit(); - } - void appendWeakReferenceTransition(JSCell* codeOrigin, JSCell* from, JSCell* to) { createDFGDataIfNecessary(); m_dfgData->transitions.append( WeakReferenceTransition(*globalData(), ownerExecutable(), codeOrigin, from, to)); } - - void shrinkWeakReferenceTransitionsToFit() - { - if (!m_dfgData) - return; - m_dfgData->transitions.shrinkToFit(); - } #endif unsigned bytecodeOffset(Instruction* returnAddress) @@ -826,7 +812,16 @@ namespace JSC { EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; } - void shrinkToFit(); + enum ShrinkMode { + // Shrink prior to generating machine code that may point directly into vectors. + EarlyShrink, + + // Shrink after generating machine code, and after possibly creating new vectors + // and appending to others. At this time it is not safe to shrink certain vectors + // because we would have generated machine code that references them directly. + LateShrink + }; + void shrinkToFit(ShrinkMode); void copyPostParseDataFrom(CodeBlock* alternative); void copyPostParseDataFromAlternative(); diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index b12bf40dc..330750b61 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -189,7 +189,7 @@ JSObject* BytecodeGenerator::generate() if ((m_codeType == FunctionCode && !m_codeBlock->needsFullScopeChain() && !m_codeBlock->usesArguments()) || m_codeType == EvalCode) symbolTable().clear(); - m_codeBlock->shrinkToFit(); + m_codeBlock->shrinkToFit(CodeBlock::EarlyShrink); if (m_expressionTooDeep) return createOutOfMemoryError(m_scopeChain->globalObject.get()); diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp index 2a83f5138..3c8212f46 100644 --- a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp +++ b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -65,25 +65,25 @@ UString DebuggerActivation::className(const JSObject* object) return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get()); } -bool DebuggerActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool DebuggerActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell); return thisObject->m_activation->methodTable()->getOwnPropertySlot(thisObject->m_activation.get(), exec, propertyName, slot); } -void DebuggerActivation::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void DebuggerActivation::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell); thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot); } -void DebuggerActivation::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void DebuggerActivation::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); thisObject->m_activation->methodTable()->putDirectVirtual(thisObject->m_activation.get(), exec, propertyName, value, attributes); } -bool DebuggerActivation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool DebuggerActivation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell); return thisObject->m_activation->methodTable()->deleteProperty(thisObject->m_activation.get(), exec, propertyName); @@ -95,13 +95,13 @@ void DebuggerActivation::getOwnPropertyNames(JSObject* object, ExecState* exec, thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode); } -bool DebuggerActivation::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool DebuggerActivation::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); return thisObject->m_activation->methodTable()->getOwnPropertyDescriptor(thisObject->m_activation.get(), exec, propertyName, descriptor); } -bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow); diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.h b/Source/JavaScriptCore/debugger/DebuggerActivation.h index 6560c3d11..07d20141f 100644 --- a/Source/JavaScriptCore/debugger/DebuggerActivation.h +++ b/Source/JavaScriptCore/debugger/DebuggerActivation.h @@ -43,13 +43,13 @@ namespace JSC { static void visitChildren(JSCell*, SlotVisitor&); static UString className(const JSObject*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); - static void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); + static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); JS_EXPORTDATA static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h index 256608f0d..aa08da128 100644 --- a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h +++ b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h @@ -505,6 +505,29 @@ public: ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, GPRReg arg3) { + move(arg3, GPRInfo::argumentGPR3); + move(arg1, GPRInfo::argumentGPR1); + move(arg2, GPRInfo::argumentGPR2); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3) + { + move(arg2, GPRInfo::argumentGPR2); + move(arg1, GPRInfo::argumentGPR1); + move(arg3, GPRInfo::argumentGPR3); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3) + { + setupTwoStubArgs<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3); + move(arg1, GPRInfo::argumentGPR1); + move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3) + { move(arg1, GPRInfo::argumentGPR1); move(arg2, GPRInfo::argumentGPR2); move(arg3, GPRInfo::argumentGPR3); @@ -545,6 +568,60 @@ public: poke(arg4); setupArgumentsWithExecState(arg1, arg2, arg3); } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) + { + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) + { + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) + { + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) + { + poke(arg5, 1); + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) + { + poke(arg5, 1); + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) + { + poke(arg5, 1); + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) + { + poke(arg5, 1); + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + + ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) + { + poke(arg5, 1); + poke(arg4); + setupArgumentsWithExecState(arg1, arg2, arg3); + } + #endif // NUMBER_OF_ARGUMENT_REGISTERS == 4 void setupResults(GPRReg destA, GPRReg destB) diff --git a/Source/JavaScriptCore/dfg/DFGDriver.cpp b/Source/JavaScriptCore/dfg/DFGDriver.cpp index 205e94e6b..f583a8d63 100644 --- a/Source/JavaScriptCore/dfg/DFGDriver.cpp +++ b/Source/JavaScriptCore/dfg/DFGDriver.cpp @@ -58,6 +58,12 @@ inline bool compile(CompileMode compileMode, JSGlobalData& globalData, CodeBlock if (compileMode == CompileFunction) dfg.predictArgumentTypes(); + + // By this point the DFG bytecode parser will have potentially mutated various tables + // in the CodeBlock. This is a good time to perform an early shrink, which is more + // powerful than a late one. It's safe to do so because we haven't generated any code + // that references any of the tables directly, yet. + codeBlock->shrinkToFit(CodeBlock::EarlyShrink); performRedundantPhiElimination(dfg); performPredictionPropagation(dfg); diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp index 56e0d4e18..8d5b7238c 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp @@ -190,8 +190,7 @@ void JITCompiler::link(LinkBuffer& linkBuffer) exit.m_check.correctLateJump(linkBuffer); } - codeBlock()->shrinkWeakReferencesToFit(); - codeBlock()->shrinkWeakReferenceTransitionsToFit(); + codeBlock()->shrinkToFit(CodeBlock::LateShrink); } bool JITCompiler::compile(JITCode& entry) diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp index dfaf5dfe8..376902d97 100644 --- a/Source/JavaScriptCore/dfg/DFGOperations.cpp +++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp @@ -100,6 +100,16 @@ "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \ ); +// EncodedJSValue in JSVALUE32_64 is a 64-bit integer. When being compiled in ARM EABI, it must be aligned even-numbered register (r0, r2 or [sp]). +// As a result, return address will be at a 4-byte further location in the following cases. +#if COMPILER_SUPPORTS(EABI) && CPU(ARM) +#define INSTRUCTION_STORE_RETURN_ADDRESS_EJI "str lr, [sp, #4]" +#define INSTRUCTION_STORE_RETURN_ADDRESS_EJCI "str lr, [sp, #8]" +#else +#define INSTRUCTION_STORE_RETURN_ADDRESS_EJI "str lr, [sp, #0]" +#define INSTRUCTION_STORE_RETURN_ADDRESS_EJCI "str lr, [sp, #4]" +#endif + #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) \ asm ( \ ".text" "\n" \ @@ -109,7 +119,7 @@ ".thumb" "\n" \ ".thumb_func " THUMB_FUNC_PARAM(function) "\n" \ SYMBOL_STRING(function) ":" "\n" \ - "str lr, [sp, #0]" "\n" \ + INSTRUCTION_STORE_RETURN_ADDRESS_EJI "\n" \ "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \ ); @@ -122,7 +132,7 @@ ".thumb" "\n" \ ".thumb_func " THUMB_FUNC_PARAM(function) "\n" \ SYMBOL_STRING(function) ":" "\n" \ - "str lr, [sp, #4]" "\n" \ + INSTRUCTION_STORE_RETURN_ADDRESS_EJCI "\n" \ "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \ ); @@ -444,9 +454,16 @@ void DFG_OPERATION operationPutByValBeyondArrayBoundsStrict(ExecState* exec, JSA JSGlobalData* globalData = &exec->globalData(); NativeCallFrameTracer tracer(globalData, exec); - // We should only get here if index is outside the existing vector. - ASSERT(!array->canSetIndex(index)); - JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue), true); + if (index >= 0) { + // We should only get here if index is outside the existing vector. + ASSERT(!array->canSetIndex(index)); + JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue), true); + return; + } + + PutPropertySlot slot(true); + array->methodTable()->put( + array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot); } void DFG_OPERATION operationPutByValBeyondArrayBoundsNonStrict(ExecState* exec, JSArray* array, int32_t index, EncodedJSValue encodedValue) @@ -454,9 +471,16 @@ void DFG_OPERATION operationPutByValBeyondArrayBoundsNonStrict(ExecState* exec, JSGlobalData* globalData = &exec->globalData(); NativeCallFrameTracer tracer(globalData, exec); - // We should only get here if index is outside the existing vector. - ASSERT(!array->canSetIndex(index)); - JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue), false); + if (index >= 0) { + // We should only get here if index is outside the existing vector. + ASSERT(!array->canSetIndex(index)); + JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue), false); + return; + } + + PutPropertySlot slot(false); + array->methodTable()->put( + array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot); } EncodedJSValue DFG_OPERATION operationArrayPush(ExecState* exec, EncodedJSValue encodedValue, JSArray* array) diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index 18db85c22..0bcee7510 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -1974,7 +1974,7 @@ void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& } GPRTemporary scratch(this); GPRReg scratchReg = scratch.gpr(); - m_jit.move(Imm32(static_cast<int>(d)), scratchReg); + m_jit.move(Imm32(toInt32(d)), scratchReg); value.adopt(scratch); valueGPR = scratchReg; } else if (at(valueUse).shouldSpeculateInteger()) { diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index dbfaec4f8..6f8dc1156 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -1260,6 +1260,15 @@ private: return appendCallSetResult(operation, result); } #else + +// EncodedJSValue in JSVALUE32_64 is a 64-bit integer. When being compiled in ARM EABI, it must be aligned even-numbered register (r0, r2 or [sp]). +// To avoid assemblies from using wrong registers, let's occupy r1 or r3 with a dummy argument when necessary. +#if COMPILER_SUPPORTS(EABI) && CPU(ARM) +#define EABI_32BIT_DUMMY_ARG TrustedImm32(0), +#else +#define EABI_32BIT_DUMMY_ARG +#endif + JITCompiler::Call callOperation(Z_DFGOperation_D operation, GPRReg result, FPRReg arg1) { prepareForExternalCall(); @@ -1310,12 +1319,12 @@ private: } JITCompiler::Call callOperation(J_DFGOperation_EJP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, void* pointer) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, TrustedImmPtr(pointer)); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(pointer)); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, arg2); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_ECI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, Identifier* identifier) @@ -1325,22 +1334,22 @@ private: } JITCompiler::Call callOperation(J_DFGOperation_EJI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, Identifier* identifier) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, TrustedImmPtr(identifier)); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(identifier)); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJI operation, GPRReg resultTag, GPRReg resultPayload, int32_t arg1Tag, GPRReg arg1Payload, Identifier* identifier) { - m_jit.setupArgumentsWithExecState(arg1Payload, TrustedImm32(arg1Tag), TrustedImmPtr(identifier)); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, TrustedImm32(arg1Tag), TrustedImmPtr(identifier)); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJA operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, arg2); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(C_DFGOperation_E operation, GPRReg result) @@ -1370,7 +1379,7 @@ private: } JITCompiler::Call callOperation(S_DFGOperation_EJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag); return appendCallWithExceptionCheckSetResult(operation, result); } JITCompiler::Call callOperation(S_DFGOperation_ECC operation, GPRReg result, GPRReg arg1, GPRReg arg2) @@ -1380,22 +1389,22 @@ private: } JITCompiler::Call callOperation(S_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, arg2Payload, arg2Tag); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag); return appendCallWithExceptionCheckSetResult(operation, result); } JITCompiler::Call callOperation(J_DFGOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, arg2Payload, arg2Tag); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, arg2Tag); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, MacroAssembler::TrustedImm32 imm) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, imm, TrustedImm32(JSValue::Int32Tag)); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, imm, TrustedImm32(JSValue::Int32Tag)); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, MacroAssembler::TrustedImm32 imm, GPRReg arg2Tag, GPRReg arg2Payload) { - m_jit.setupArgumentsWithExecState(imm, TrustedImm32(JSValue::Int32Tag), arg2Payload, arg2Tag); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG imm, TrustedImm32(JSValue::Int32Tag), arg2Payload, arg2Tag); return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); } JITCompiler::Call callOperation(J_DFGOperation_ECJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload) @@ -1415,12 +1424,12 @@ private: } JITCompiler::Call callOperation(V_DFGOperation_EJPP operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2, void* pointer) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, arg2, TrustedImmPtr(pointer)); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2, TrustedImmPtr(pointer)); return appendCallWithExceptionCheck(operation); } JITCompiler::Call callOperation(V_DFGOperation_EJCI operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2, Identifier* identifier) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag, arg2, TrustedImmPtr(identifier)); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2, TrustedImmPtr(identifier)); return appendCallWithExceptionCheck(operation); } JITCompiler::Call callOperation(V_DFGOperation_ECJJ operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload) @@ -1430,18 +1439,18 @@ private: } JITCompiler::Call callOperation(V_DFGOperation_EPZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload) { - m_jit.setupArgumentsWithExecState(arg1, arg2, arg3Payload, arg3Tag); + m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag); return appendCallWithExceptionCheck(operation); } JITCompiler::Call callOperation(V_DFGOperation_EAZJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3Tag, GPRReg arg3Payload) { - m_jit.setupArgumentsWithExecState(arg1, arg2, arg3Payload, arg3Tag); + m_jit.setupArgumentsWithExecState(arg1, arg2, EABI_32BIT_DUMMY_ARG arg3Payload, arg3Tag); return appendCallWithExceptionCheck(operation); } JITCompiler::Call callOperation(D_DFGOperation_EJ operation, FPRReg result, GPRReg arg1Tag, GPRReg arg1Payload) { - m_jit.setupArgumentsWithExecState(arg1Payload, arg1Tag); + m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag); return appendCallWithExceptionCheckSetResult(operation, result); } @@ -1455,6 +1464,9 @@ private: m_jit.setupArguments(arg1, arg2); return appendCallSetResult(operation, result); } + +#undef EABI_32BIT_DUMMY_ARG + #endif #ifndef NDEBUG diff --git a/Source/JavaScriptCore/heap/BlockAllocator.cpp b/Source/JavaScriptCore/heap/BlockAllocator.cpp index 028c84c2d..ce6024079 100644 --- a/Source/JavaScriptCore/heap/BlockAllocator.cpp +++ b/Source/JavaScriptCore/heap/BlockAllocator.cpp @@ -33,6 +33,7 @@ namespace JSC { BlockAllocator::BlockAllocator() : m_numberOfFreeBlocks(0) + , m_isCurrentlyAllocating(false) , m_blockFreeingThreadShouldQuit(false) , m_blockFreeingThread(createThread(blockFreeingThreadStartFunc, this, "JavaScriptCore::BlockFree")) { @@ -104,6 +105,11 @@ void BlockAllocator::blockFreeingThreadMain() if (m_blockFreeingThreadShouldQuit) break; + if (m_isCurrentlyAllocating) { + m_isCurrentlyAllocating = false; + continue; + } + // Now process the list of free blocks. Keep freeing until half of the // blocks that are currently on the list are gone. Assume that a size_t // field can be accessed atomically. diff --git a/Source/JavaScriptCore/heap/BlockAllocator.h b/Source/JavaScriptCore/heap/BlockAllocator.h index 4b90d28b9..cc9557f85 100644 --- a/Source/JavaScriptCore/heap/BlockAllocator.h +++ b/Source/JavaScriptCore/heap/BlockAllocator.h @@ -56,6 +56,7 @@ private: DoublyLinkedList<HeapBlock> m_freeBlocks; size_t m_numberOfFreeBlocks; + bool m_isCurrentlyAllocating; bool m_blockFreeingThreadShouldQuit; Mutex m_freeBlockLock; ThreadCondition m_freeBlockCondition; @@ -65,6 +66,7 @@ private: inline HeapBlock* BlockAllocator::allocate() { MutexLocker locker(m_freeBlockLock); + m_isCurrentlyAllocating = true; if (!m_numberOfFreeBlocks) { ASSERT(m_freeBlocks.isEmpty()); return 0; diff --git a/Source/JavaScriptCore/heap/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp index d43ec1242..2254b5b01 100644 --- a/Source/JavaScriptCore/heap/Heap.cpp +++ b/Source/JavaScriptCore/heap/Heap.cpp @@ -178,100 +178,20 @@ static inline bool isValidThreadState(JSGlobalData* globalData) return true; } -class CountFunctor { -public: - typedef size_t ReturnType; - - CountFunctor(); - void count(size_t); - ReturnType returnValue(); - -private: - ReturnType m_count; -}; - -inline CountFunctor::CountFunctor() - : m_count(0) -{ -} - -inline void CountFunctor::count(size_t count) -{ - m_count += count; -} - -inline CountFunctor::ReturnType CountFunctor::returnValue() -{ - return m_count; -} - -struct ClearMarks : MarkedBlock::VoidFunctor { - void operator()(MarkedBlock*); -}; - -inline void ClearMarks::operator()(MarkedBlock* block) -{ - block->clearMarks(); -} - -struct Sweep : MarkedBlock::VoidFunctor { - void operator()(MarkedBlock*); -}; - -inline void Sweep::operator()(MarkedBlock* block) -{ - block->sweep(); -} - -struct MarkCount : CountFunctor { - void operator()(MarkedBlock*); -}; - -inline void MarkCount::operator()(MarkedBlock* block) -{ - count(block->markCount()); -} - -struct Size : CountFunctor { - void operator()(MarkedBlock*); -}; - -inline void Size::operator()(MarkedBlock* block) -{ - count(block->markCount() * block->cellSize()); -} - -struct Capacity : CountFunctor { - void operator()(MarkedBlock*); +struct Count : public MarkedBlock::CountFunctor { + void operator()(JSCell*) { count(1); } }; -inline void Capacity::operator()(MarkedBlock* block) -{ - count(block->capacity()); -} - -struct Count : public CountFunctor { - void operator()(JSCell*); -}; - -inline void Count::operator()(JSCell*) -{ - count(1); -} - -struct CountIfGlobalObject : CountFunctor { - void operator()(JSCell*); +struct CountIfGlobalObject : MarkedBlock::CountFunctor { + void operator()(JSCell* cell) { + if (!cell->isObject()) + return; + if (!asObject(cell)->isGlobalObject()) + return; + count(1); + } }; -inline void CountIfGlobalObject::operator()(JSCell* cell) -{ - if (!cell->isObject()) - return; - if (!asObject(cell)->isGlobalObject()) - return; - count(1); -} - class RecordType { public: typedef PassOwnPtr<TypeCountSet> ReturnType; @@ -363,9 +283,9 @@ void Heap::lastChanceToFinalize() WTFLogAlways("ERROR: JavaScriptCore heap deallocated while %ld values were still protected", static_cast<unsigned long>(size)); m_weakSet.finalizeAll(); - canonicalizeCellLivenessData(); - clearMarks(); - sweep(); + m_objectSpace.canonicalizeCellLivenessData(); + m_objectSpace.clearMarks(); + m_objectSpace.sweep(); m_globalData->smallStrings.finalizeSmallStrings(); #if ENABLE(SIMPLE_HEAP_PROFILING) @@ -540,7 +460,7 @@ void Heap::markRoots(bool fullGC) #endif { GCPHASE(clearMarks); - clearMarks(); + m_objectSpace.clearMarks(); } m_storageSpace.startedCopying(); @@ -656,37 +576,24 @@ void Heap::markRoots(bool fullGC) visitor.doneCopying(); visitor.reset(); m_sharedData.reset(); -#if ENABLE(PARALLEL_GC) - m_sharedData.resetChildren(); -#endif m_storageSpace.doneCopying(); m_operationInProgress = NoOperation; } -void Heap::clearMarks() -{ - m_objectSpace.forEachBlock<ClearMarks>(); -} - -void Heap::sweep() -{ - m_objectSpace.forEachBlock<Sweep>(); -} - size_t Heap::objectCount() { - return m_objectSpace.forEachBlock<MarkCount>(); + return m_objectSpace.objectCount(); } size_t Heap::size() { - return m_objectSpace.forEachBlock<Size>() + m_storageSpace.size(); + return m_objectSpace.size() + m_storageSpace.size(); } size_t Heap::capacity() { - return m_objectSpace.forEachBlock<Capacity>() + m_storageSpace.capacity(); + return m_objectSpace.capacity() + m_storageSpace.capacity(); } size_t Heap::protectedGlobalObjectCount() @@ -761,7 +668,7 @@ void Heap::collect(SweepToggle sweepToggle) #endif { GCPHASE(Canonicalize); - canonicalizeCellLivenessData(); + m_objectSpace.canonicalizeCellLivenessData(); } markRoots(fullGC); @@ -780,8 +687,9 @@ void Heap::collect(SweepToggle sweepToggle) JAVASCRIPTCORE_GC_MARKED(); { - GCPHASE(ResetAllocator); - resetAllocators(); + GCPHASE(ResetAllocators); + m_objectSpace.resetAllocators(); + m_weakSet.resetAllocator(); } { @@ -792,7 +700,7 @@ void Heap::collect(SweepToggle sweepToggle) if (sweepToggle == DoSweep) { SamplingRegion samplingRegion("Garbage Collection: Sweeping"); GCPHASE(Sweeping); - sweep(); + m_objectSpace.sweep(); m_objectSpace.shrink(); m_weakSet.shrink(); m_bytesAbandoned = 0; @@ -814,17 +722,6 @@ void Heap::collect(SweepToggle sweepToggle) JAVASCRIPTCORE_GC_END(); } -void Heap::canonicalizeCellLivenessData() -{ - m_objectSpace.canonicalizeCellLivenessData(); -} - -void Heap::resetAllocators() -{ - m_objectSpace.resetAllocators(); - m_weakSet.resetAllocator(); -} - void Heap::setActivityCallback(PassOwnPtr<GCActivityCallback> activityCallback) { m_activityCallback = activityCallback; @@ -835,6 +732,11 @@ GCActivityCallback* Heap::activityCallback() return m_activityCallback.get(); } +void Heap::setGarbageCollectionTimerEnabled(bool enable) +{ + activityCallback()->setEnabled(enable); +} + void Heap::didAllocate(size_t bytes) { m_activityCallback->didAllocate(m_bytesAllocated + m_bytesAbandoned); diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h index 10fdb07be..6bf82e4a5 100644 --- a/Source/JavaScriptCore/heap/Heap.h +++ b/Source/JavaScriptCore/heap/Heap.h @@ -100,6 +100,7 @@ namespace JSC { JS_EXPORT_PRIVATE GCActivityCallback* activityCallback(); JS_EXPORT_PRIVATE void setActivityCallback(PassOwnPtr<GCActivityCallback>); + JS_EXPORT_PRIVATE void setGarbageCollectionTimerEnabled(bool); // true if an allocation or collection is in progress inline bool isBusy(); @@ -187,22 +188,12 @@ namespace JSC { JS_EXPORT_PRIVATE bool isValidAllocation(size_t); JS_EXPORT_PRIVATE void reportExtraMemoryCostSlowCase(size_t); - // Call this function before any operation that needs to know which cells - // in the heap are live. (For example, call this function before - // conservative marking, eager sweeping, or iterating the cells in a MarkedBlock.) - void canonicalizeCellLivenessData(); - - void resetAllocators(); - - void clearMarks(); void markRoots(bool fullGC); void markProtectedObjects(HeapRootVisitor&); void markTempSortVectors(HeapRootVisitor&); void harvestWeakReferences(); void finalizeUnconditionalFinalizers(); - void sweep(); - RegisterFile& registerFile(); BlockAllocator& blockAllocator(); diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp index 30915eaf8..affd833eb 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.cpp +++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp @@ -452,8 +452,6 @@ static void freePlatformThreadRegisters(PlatformThreadRegisters& regs) void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread) { - suspendThread(thread->platformThread); - PlatformThreadRegisters regs; size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs); @@ -464,8 +462,6 @@ void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, swapIfBackwards(stackPointer, stackBase); conservativeRoots.add(stackPointer, stackBase); - resumeThread(thread->platformThread); - freePlatformThreadRegisters(regs); } @@ -484,12 +480,23 @@ void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoot // thread that had been suspended while holding the malloc lock. fastMallocForbid(); #endif + for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { + if (!equalThread(thread->platformThread, currentPlatformThread)) + suspendThread(thread->platformThread); + } + // It is safe to access the registeredThreads list, because we earlier asserted that locks are being held, // and since this is a shared heap, they are real locks. for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { if (!equalThread(thread->platformThread, currentPlatformThread)) gatherFromOtherThread(conservativeRoots, thread); } + + for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { + if (!equalThread(thread->platformThread, currentPlatformThread)) + resumeThread(thread->platformThread); + } + #ifndef NDEBUG fastMallocAllow(); #endif diff --git a/Source/JavaScriptCore/heap/MarkStack.cpp b/Source/JavaScriptCore/heap/MarkStack.cpp index 785444e55..678f1cb45 100644 --- a/Source/JavaScriptCore/heap/MarkStack.cpp +++ b/Source/JavaScriptCore/heap/MarkStack.cpp @@ -36,8 +36,8 @@ #include "JSObject.h" #include "ScopeChain.h" #include "Structure.h" -#include "UString.h" #include "WriteBarrier.h" +#include <wtf/DataLog.h> #include <wtf/MainThread.h> namespace JSC { @@ -219,24 +219,19 @@ void MarkStackArray::stealSomeCellsFrom(MarkStackArray& other) } #if ENABLE(PARALLEL_GC) -void MarkStackThreadSharedData::resetChildren() -{ - for (unsigned i = 0; i < m_slaveMarkStacks.size(); ++i) - m_slaveMarkStacks[i]->reset(); -} - -void MarkStackThreadSharedData::markingThreadMain(SlotVisitor* slotVisitor) +void MarkStackThreadSharedData::markingThreadMain() { WTF::registerGCThread(); - ParallelModeEnabler enabler(*slotVisitor); - slotVisitor->drainFromShared(SlotVisitor::SlaveDrain); - delete slotVisitor; + { + SlotVisitor slotVisitor(*this); + ParallelModeEnabler enabler(slotVisitor); + slotVisitor.drainFromShared(SlotVisitor::SlaveDrain); + } } -void MarkStackThreadSharedData::markingThreadStartFunc(void* myVisitor) +void MarkStackThreadSharedData::markingThreadStartFunc(void* shared) { - SlotVisitor* slotVisitor = static_cast<SlotVisitor*>(myVisitor); - slotVisitor->sharedData().markingThreadMain(slotVisitor); + static_cast<MarkStackThreadSharedData*>(shared)->markingThreadMain(); } #endif @@ -249,9 +244,7 @@ MarkStackThreadSharedData::MarkStackThreadSharedData(JSGlobalData* globalData) { #if ENABLE(PARALLEL_GC) for (unsigned i = 1; i < Options::numberOfGCMarkers; ++i) { - SlotVisitor* slotVisitor = new SlotVisitor(*this); - m_slaveMarkStacks.append(slotVisitor); - m_markingThreads.append(createThread(markingThreadStartFunc, slotVisitor, "JavaScriptCore::Marking")); + m_markingThreads.append(createThread(markingThreadStartFunc, this, "JavaScriptCore::Marking")); ASSERT(m_markingThreads.last()); } #endif @@ -283,6 +276,7 @@ void MarkStackThreadSharedData::reset() #else ASSERT(m_opaqueRoots.isEmpty()); #endif + m_weakReferenceHarvesters.removeAll(); } @@ -295,7 +289,6 @@ void MarkStack::reset() #else m_opaqueRoots.clear(); #endif - m_uniqueStrings.clear(); } void MarkStack::append(ConservativeRoots& conservativeRoots) @@ -496,34 +489,6 @@ void* SlotVisitor::allocateNewSpace(void* ptr, size_t bytes) return CopiedSpace::allocateFromBlock(m_copyBlock, bytes); } -inline void MarkStack::internalAppend(JSValue* slot) -{ - ASSERT(slot); - JSValue value = *slot; - ASSERT(value); - if (!value.isCell()) - return; - - if (value.isString()) { - JSString* string = jsCast<JSString*>(value.asCell()); - if (!string->isHashConstSingleton() && string->length() > 1 && !string->isRope()) { - UniqueStringMap::AddResult addResult = m_uniqueStrings.add(string->string().impl(), value); - if (addResult.isNewEntry) - string->setHashConstSingleton(); - else { - JSValue existingJSValue = addResult.iterator->second; - if (value != existingJSValue) - jsCast<JSString*>(existingJSValue.asCell())->clearHashConstSingleton(); - *slot = existingJSValue; - return; - } - } - } - - internalAppend(value.asCell()); -} - - void SlotVisitor::copyAndAppend(void** ptr, size_t bytes, JSValue* values, unsigned length) { void* oldPtr = *ptr; @@ -537,7 +502,7 @@ void SlotVisitor::copyAndAppend(void** ptr, size_t bytes, JSValue* values, unsig newValues[i] = value; if (!value) continue; - internalAppend(&newValues[i]); + internalAppend(value); } memcpy(newPtr, oldPtr, jsValuesOffset); @@ -571,16 +536,29 @@ void SlotVisitor::finalizeUnconditionalFinalizers() #if ENABLE(GC_VALIDATION) void MarkStack::validate(JSCell* cell) { - if (!cell) + if (!cell) { + dataLog("cell is NULL\n"); CRASH(); + } - if (!cell->structure()) + if (!cell->structure()) { + dataLog("cell at %p has a null structure\n" , cell); CRASH(); + } // Both the cell's structure, and the cell's structure's structure should be the Structure Structure. // I hate this sentence. - if (cell->structure()->structure()->JSCell::classInfo() != cell->structure()->JSCell::classInfo()) + if (cell->structure()->structure()->JSCell::classInfo() != cell->structure()->JSCell::classInfo()) { + const char* parentClassName = 0; + const char* ourClassName = 0; + if (cell->structure()->structure() && cell->structure()->structure()->JSCell::classInfo()) + parentClassName = cell->structure()->structure()->JSCell::classInfo()->className; + if (cell->structure()->JSCell::classInfo()) + ourClassName = cell->structure()->JSCell::classInfo()->className; + dataLog("parent structure (%p <%s>) of cell at %p doesn't match cell's structure (%p <%s>)\n", + cell->structure()->structure(), parentClassName, cell, cell->structure(), ourClassName); CRASH(); + } } #else void MarkStack::validate(JSCell*) diff --git a/Source/JavaScriptCore/heap/MarkStack.h b/Source/JavaScriptCore/heap/MarkStack.h index 48b65c069..0695b1b32 100644 --- a/Source/JavaScriptCore/heap/MarkStack.h +++ b/Source/JavaScriptCore/heap/MarkStack.h @@ -34,14 +34,12 @@ #include "UnconditionalFinalizer.h" #include "VTableSpectrum.h" #include "WeakReferenceHarvester.h" -#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/Vector.h> #include <wtf/Noncopyable.h> #include <wtf/OSAllocator.h> #include <wtf/PageBlock.h> -#include <wtf/text/StringHash.h> namespace JSC { @@ -173,17 +171,13 @@ namespace JSC { ~MarkStackThreadSharedData(); void reset(); - -#if ENABLE(PARALLEL_GC) - void resetChildren(); -#endif - + private: friend class MarkStack; friend class SlotVisitor; #if ENABLE(PARALLEL_GC) - void markingThreadMain(SlotVisitor*); + void markingThreadMain(); static void markingThreadStartFunc(void* heap); #endif @@ -193,7 +187,6 @@ namespace JSC { MarkStackSegmentAllocator m_segmentAllocator; Vector<ThreadIdentifier> m_markingThreads; - Vector<MarkStack*> m_slaveMarkStacks; Mutex m_markingLock; ThreadCondition m_markingCondition; @@ -228,14 +221,13 @@ namespace JSC { void addOpaqueRoot(void*); bool containsOpaqueRoot(void*); int opaqueRootCount(); - - MarkStackThreadSharedData& sharedData() { return m_shared; } + bool isEmpty() { return m_stack.isEmpty(); } void reset(); size_t visitCount() const { return m_visitCount; } - + #if ENABLE(SIMPLE_HEAP_PROFILING) VTableSpectrum m_visitedTypeCounts; #endif @@ -259,7 +251,6 @@ namespace JSC { void internalAppend(JSCell*); void internalAppend(JSValue); - void internalAppend(JSValue*); JS_EXPORT_PRIVATE void mergeOpaqueRoots(); @@ -279,8 +270,6 @@ namespace JSC { MarkStackArray m_stack; HashSet<void*> m_opaqueRoots; // Handle-owning data structures not visible to the garbage collector. - typedef HashMap<StringImpl*, JSValue> UniqueStringMap; - UniqueStringMap m_uniqueStrings; #if !ASSERT_DISABLED public: diff --git a/Source/JavaScriptCore/heap/MarkedBlock.h b/Source/JavaScriptCore/heap/MarkedBlock.h index 429b7c08e..aa99ebf48 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.h +++ b/Source/JavaScriptCore/heap/MarkedBlock.h @@ -100,6 +100,18 @@ namespace JSC { void returnValue() { } }; + class CountFunctor { + public: + typedef size_t ReturnType; + + CountFunctor() : m_count(0) { } + void count(size_t count) { m_count += count; } + ReturnType returnValue() { return m_count; } + + private: + ReturnType m_count; + }; + static MarkedBlock* create(Heap*, size_t cellSize, bool cellsNeedDestruction); static MarkedBlock* recycle(MarkedBlock*, Heap*, size_t cellSize, bool cellsNeedDestruction); static void destroy(MarkedBlock*); diff --git a/Source/JavaScriptCore/heap/MarkedSpace.h b/Source/JavaScriptCore/heap/MarkedSpace.h index 19061a12b..7bd5ca509 100644 --- a/Source/JavaScriptCore/heap/MarkedSpace.h +++ b/Source/JavaScriptCore/heap/MarkedSpace.h @@ -45,6 +45,26 @@ class LLIntOffsetsExtractor; class WeakGCHandle; class SlotVisitor; +struct ClearMarks : MarkedBlock::VoidFunctor { + void operator()(MarkedBlock* block) { block->clearMarks(); } +}; + +struct Sweep : MarkedBlock::VoidFunctor { + void operator()(MarkedBlock* block) { block->sweep(); } +}; + +struct MarkCount : MarkedBlock::CountFunctor { + void operator()(MarkedBlock* block) { count(block->markCount()); } +}; + +struct Size : MarkedBlock::CountFunctor { + void operator()(MarkedBlock* block) { count(block->markCount() * block->cellSize()); } +}; + +struct Capacity : MarkedBlock::CountFunctor { + void operator()(MarkedBlock* block) { count(block->capacity()); } +}; + class MarkedSpace { WTF_MAKE_NONCOPYABLE(MarkedSpace); public: @@ -73,11 +93,18 @@ public: template<typename Functor> typename Functor::ReturnType forEachBlock(); void shrink(); + void freeAllBlocks(); void freeBlocks(MarkedBlock* head); void didAddBlock(MarkedBlock*); void didConsumeFreeList(MarkedBlock*); + void clearMarks(); + void sweep(); + size_t objectCount(); + size_t size(); + size_t capacity(); + bool isPagedOut(double deadline); private: @@ -185,6 +212,31 @@ inline void MarkedSpace::didAddBlock(MarkedBlock* block) m_blocks.add(block); } +inline void MarkedSpace::clearMarks() +{ + forEachBlock<ClearMarks>(); +} + +inline void MarkedSpace::sweep() +{ + forEachBlock<Sweep>(); +} + +inline size_t MarkedSpace::objectCount() +{ + return forEachBlock<MarkCount>(); +} + +inline size_t MarkedSpace::size() +{ + return forEachBlock<Size>(); +} + +inline size_t MarkedSpace::capacity() +{ + return forEachBlock<Capacity>(); +} + } // namespace JSC #endif // MarkedSpace_h diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 89547f40a..355acaa02 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -1023,9 +1023,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV if (exception->isErrorInstance() && static_cast<ErrorInstance*>(exception)->appendSourceToMessage()) appendSourceToError(callFrame, static_cast<ErrorInstance*>(exception), bytecodeOffset); - // Using hasExpressionInfo to imply we are interested in rich exception info. - if (codeBlock->hasExpressionInfo() && !hasErrorInfo(callFrame, exception)) { - ASSERT(codeBlock->hasLineInfo()); + if (codeBlock->hasLineInfo() && !hasErrorInfo(callFrame, exception)) { // FIXME: should only really be adding these properties to VM generated exceptions, // but the inspector currently requires these for all thrown objects. addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source()); diff --git a/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp index 884248b20..2e08f1205 100644 --- a/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp +++ b/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp @@ -93,7 +93,10 @@ protected: if (!result) return; ASSERT(result == -1); - ASSERT(errno == EAGAIN); + if (errno != EAGAIN) { + ASSERT_NOT_REACHED(); // In debug mode, this should be a hard failure. + break; // In release mode, we should just ignore the error - not returning memory to the OS is better than crashing, especially since we _will_ be able to reuse the memory internally anyway. + } } #else m_reservation.decommit(page, pageSize()); diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp index abc79d34b..c2aec549a 100644 --- a/Source/JavaScriptCore/jit/JIT.cpp +++ b/Source/JavaScriptCore/jit/JIT.cpp @@ -749,6 +749,8 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck, JITCompilationEffo static_cast<double>(result.size()) / static_cast<double>(m_codeBlock->instructions().size())); + m_codeBlock->shrinkToFit(CodeBlock::LateShrink); + #if ENABLE(JIT_VERBOSE) dataLog("JIT generated code for %p at [%p, %p).\n", m_codeBlock, result.executableMemory()->start(), result.executableMemory()->end()); #endif diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index 73f4892ac..a6d6be106 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -1492,7 +1492,9 @@ DEFINE_STUB_FUNCTION(JSObject*, op_put_by_id_transition_realloc) ASSERT(baseValue.isObject()); JSObject* base = asObject(baseValue); - base->allocatePropertyStorage(*stackFrame.globalData, oldSize, newSize); + JSGlobalData& globalData = *stackFrame.globalData; + PropertyStorage newStorage = base->growPropertyStorage(globalData, oldSize, newSize); + base->setPropertyStorage(globalData, newStorage, newStructure); return base; } diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index 665333d64..8407edd86 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -218,13 +218,13 @@ protected: void addFunction(JSGlobalData& globalData, const char* name, NativeFunction function, unsigned arguments) { Identifier identifier(globalExec(), name); - putDirect(globalData, identifier, JSFunction::create(globalExec(), this, arguments, identifier, function)); + putDirect(globalData, identifier, JSFunction::create(globalExec(), this, arguments, identifier.ustring(), function)); } void addConstructableFunction(JSGlobalData& globalData, const char* name, NativeFunction function, unsigned arguments) { Identifier identifier(globalExec(), name); - putDirect(globalData, identifier, JSFunction::create(globalExec(), this, arguments, identifier, function, NoIntrinsic, function)); + putDirect(globalData, identifier, JSFunction::create(globalExec(), this, arguments, identifier.ustring(), function, NoIntrinsic, function)); } }; COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false); diff --git a/Source/JavaScriptCore/runtime/Arguments.cpp b/Source/JavaScriptCore/runtime/Arguments.cpp index 9a3d7257b..1fd05fd9e 100644 --- a/Source/JavaScriptCore/runtime/Arguments.cpp +++ b/Source/JavaScriptCore/runtime/Arguments.cpp @@ -124,12 +124,12 @@ void Arguments::createStrictModeCalleeIfNecessary(ExecState* exec) methodTable()->defineOwnProperty(this, exec, exec->propertyNames().callee, descriptor, false); } -bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { Arguments* thisObject = jsCast<Arguments*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + ASSERT(i < PropertyName::NotAnIndex); slot.setValue(thisObject->argument(i).get()); return true; } @@ -153,12 +153,12 @@ bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifi return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot); } -bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { Arguments* thisObject = jsCast<Arguments*>(object); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + ASSERT(i < PropertyName::NotAnIndex); descriptor.setDescriptor(thisObject->argument(i).get(), None); return true; } @@ -208,12 +208,12 @@ void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue va JSObject::put(thisObject, exec, Identifier(exec, UString::number(i)), value, slot); } -void Arguments::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { Arguments* thisObject = jsCast<Arguments*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + ASSERT(i < PropertyName::NotAnIndex); thisObject->argument(i).set(exec->globalData(), thisObject, value); return; } @@ -259,15 +259,15 @@ bool Arguments::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned i) return JSObject::deleteProperty(thisObject, exec, Identifier(exec, UString::number(i))); } -bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { if (exec->globalData().isInDefineOwnProperty()) return Base::deleteProperty(cell, exec, propertyName); Arguments* thisObject = jsCast<Arguments*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments) { + ASSERT(i < PropertyName::NotAnIndex); if (!Base::deleteProperty(cell, exec, propertyName)) return false; @@ -300,12 +300,12 @@ bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& return JSObject::deleteProperty(thisObject, exec, propertyName); } -bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { Arguments* thisObject = jsCast<Arguments*>(object); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments) { + ASSERT(i < PropertyName::NotAnIndex); // If the property is not yet present on the object, and is not yet marked as deleted, then add it now. PropertySlot slot; if ((!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i]) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) diff --git a/Source/JavaScriptCore/runtime/Arguments.h b/Source/JavaScriptCore/runtime/Arguments.h index a1f36de56..5925ed491 100644 --- a/Source/JavaScriptCore/runtime/Arguments.h +++ b/Source/JavaScriptCore/runtime/Arguments.h @@ -109,15 +109,15 @@ namespace JSC { private: static void destroy(JSCell*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); void createStrictModeCallerIfNecessary(ExecState*); void createStrictModeCalleeIfNecessary(ExecState*); diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp index ebcc43781..83e48ca1b 100644 --- a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp @@ -60,17 +60,17 @@ ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* stru void ArrayConstructor::finishCreation(ExecState* exec, ArrayPrototype* arrayPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, arrayPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), arrayPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(cell), propertyName, slot); } -bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.h b/Source/JavaScriptCore/runtime/ArrayConstructor.h index c60571fbd..b223a0f13 100644 --- a/Source/JavaScriptCore/runtime/ArrayConstructor.h +++ b/Source/JavaScriptCore/runtime/ArrayConstructor.h @@ -51,9 +51,9 @@ namespace JSC { private: ArrayConstructor(JSGlobalObject*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static ConstructType getConstructData(JSCell*, ConstructData&); static CallType getCallData(JSCell*, CallData&); diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp index 6df58b773..b73a1296a 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -126,12 +126,12 @@ void ArrayPrototype::finishCreation(JSGlobalObject* globalObject) ASSERT(inherits(&s_info)); } -bool ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayPrototypeTable(exec), jsCast<ArrayPrototype*>(cell), propertyName, slot); } -bool ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayPrototypeTable(exec), jsCast<ArrayPrototype*>(object), propertyName, descriptor); } @@ -147,7 +147,7 @@ static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index) return slot.getValue(exec, index); } -static void putProperty(ExecState* exec, JSObject* obj, const Identifier& propertyName, JSValue value) +static void putProperty(ExecState* exec, JSObject* obj, PropertyName propertyName, JSValue value) { PutPropertySlot slot; obj->methodTable()->put(obj, exec, propertyName, value, slot); diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.h b/Source/JavaScriptCore/runtime/ArrayPrototype.h index f49a9a667..4f52fb61f 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.h +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.h @@ -40,8 +40,8 @@ namespace JSC { return prototype; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp index a54d281a7..9b666292c 100644 --- a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -38,7 +38,7 @@ BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* void BooleanConstructor::finishCreation(ExecState* exec, BooleanPrototype* booleanPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, booleanPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), booleanPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp index b9605d0cf..1551eabf2 100644 --- a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp +++ b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp @@ -63,12 +63,12 @@ void BooleanPrototype::finishCreation(ExecState* exec, JSGlobalObject*) ASSERT(inherits(&s_info)); } -bool BooleanPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool BooleanPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), jsCast<BooleanPrototype*>(cell), propertyName, slot); } -bool BooleanPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool BooleanPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), jsCast<BooleanPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.h b/Source/JavaScriptCore/runtime/BooleanPrototype.h index f35d586e6..3767f76ed 100644 --- a/Source/JavaScriptCore/runtime/BooleanPrototype.h +++ b/Source/JavaScriptCore/runtime/BooleanPrototype.h @@ -49,9 +49,9 @@ namespace JSC { private: BooleanPrototype(ExecState*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ClassInfo.h b/Source/JavaScriptCore/runtime/ClassInfo.h index eb4a6f9cd..b0adab32c 100644 --- a/Source/JavaScriptCore/runtime/ClassInfo.h +++ b/Source/JavaScriptCore/runtime/ClassInfo.h @@ -45,19 +45,19 @@ namespace JSC { typedef ConstructType (*GetConstructDataFunctionPtr)(JSCell*, ConstructData&); GetConstructDataFunctionPtr getConstructData; - typedef void (*PutFunctionPtr)(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + typedef void (*PutFunctionPtr)(JSCell*, ExecState*, PropertyName propertyName, JSValue, PutPropertySlot&); PutFunctionPtr put; typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); PutByIndexFunctionPtr putByIndex; - typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, const Identifier&); + typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, PropertyName); DeletePropertyFunctionPtr deleteProperty; typedef bool (*DeletePropertyByIndexFunctionPtr)(JSCell*, ExecState*, unsigned); DeletePropertyByIndexFunctionPtr deletePropertyByIndex; - typedef bool (*GetOwnPropertySlotFunctionPtr)(JSCell*, ExecState*, const Identifier&, PropertySlot&); + typedef bool (*GetOwnPropertySlotFunctionPtr)(JSCell*, ExecState*, PropertyName, PropertySlot&); GetOwnPropertySlotFunctionPtr getOwnPropertySlot; typedef bool (*GetOwnPropertySlotByIndexFunctionPtr)(JSCell*, ExecState*, unsigned, PropertySlot&); @@ -81,13 +81,13 @@ namespace JSC { typedef bool (*HasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue, JSValue); HasInstanceFunctionPtr hasInstance; - typedef void (*PutWithAttributesFunctionPtr)(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); + typedef void (*PutWithAttributesFunctionPtr)(JSObject*, ExecState*, PropertyName propertyName, JSValue, unsigned attributes); PutWithAttributesFunctionPtr putDirectVirtual; - typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool); + typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool); DefineOwnPropertyFunctionPtr defineOwnProperty; - typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); GetOwnPropertyDescriptorFunctionPtr getOwnPropertyDescriptor; }; diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp index 66f0baea5..08b815035 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.cpp +++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp @@ -81,17 +81,17 @@ DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* struct void DateConstructor::finishCreation(ExecState* exec, DatePrototype* datePrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, datePrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), datePrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete); } -bool DateConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool DateConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<InternalFunction>(exec, ExecState::dateConstructorTable(exec), jsCast<DateConstructor*>(cell), propertyName, slot); } -bool DateConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool DateConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::dateConstructorTable(exec), jsCast<DateConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/DateConstructor.h b/Source/JavaScriptCore/runtime/DateConstructor.h index fe6597418..f089e036c 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.h +++ b/Source/JavaScriptCore/runtime/DateConstructor.h @@ -54,9 +54,9 @@ namespace JSC { static ConstructType getConstructData(JSCell*, ConstructData&); static CallType getCallData(JSCell*, CallData&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; JSObject* constructDate(ExecState*, JSGlobalObject*, const ArgList&); diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp index ddea33786..f81ae10f3 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.cpp +++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp @@ -467,12 +467,12 @@ void DatePrototype::finishCreation(ExecState* exec, JSGlobalObject*) // The constructor will be added later, after DateConstructor has been built. } -bool DatePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool DatePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), jsCast<DatePrototype*>(cell), propertyName, slot); } -bool DatePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool DatePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::dateTable(exec), jsCast<DatePrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/DatePrototype.h b/Source/JavaScriptCore/runtime/DatePrototype.h index 90eec28a1..c4f6d6916 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.h +++ b/Source/JavaScriptCore/runtime/DatePrototype.h @@ -40,9 +40,9 @@ namespace JSC { prototype->finishCreation(exec, globalObject); return prototype; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/Error.h b/Source/JavaScriptCore/runtime/Error.h index 79617655e..65aea3edc 100644 --- a/Source/JavaScriptCore/runtime/Error.h +++ b/Source/JavaScriptCore/runtime/Error.h @@ -90,7 +90,7 @@ namespace JSC { static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message) { StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message); - function->finishCreation(exec->globalData(), exec->globalData().propertyNames->emptyIdentifier); + function->finishCreation(exec->globalData(), ""); return function; } diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp index c8f93ba32..96272d0cf 100644 --- a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp @@ -39,7 +39,7 @@ ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* stru void ErrorConstructor::finishCreation(ExecState* exec, ErrorPrototype* errorPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, errorPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), errorPrototype->classInfo()->className); // ECMA 15.11.3.1 Error.prototype putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp index 7af294782..5dd3e85e2 100644 --- a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp @@ -63,12 +63,12 @@ void ErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject*) putDirect(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum); } -bool ErrorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ErrorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), jsCast<ErrorPrototype*>(cell), propertyName, slot); } -bool ErrorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ErrorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), jsCast<ErrorPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.h b/Source/JavaScriptCore/runtime/ErrorPrototype.h index 6f02583a6..e961946df 100644 --- a/Source/JavaScriptCore/runtime/ErrorPrototype.h +++ b/Source/JavaScriptCore/runtime/ErrorPrototype.h @@ -52,8 +52,8 @@ namespace JSC { static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags; private: - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h index b9d3e6ee1..d8367ecc8 100644 --- a/Source/JavaScriptCore/runtime/Executable.h +++ b/Source/JavaScriptCore/runtime/Executable.h @@ -43,8 +43,6 @@ namespace JSC { class LLIntOffsetsExtractor; class ProgramCodeBlock; class ScopeChainNode; - - struct ExceptionInfo; enum CompilationKind { FirstCompilation, OptimizingCompilation }; diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp index 956b2161d..7f82a74ce 100644 --- a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -47,7 +47,7 @@ FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure void FunctionConstructor::finishCreation(ExecState* exec, FunctionPrototype* functionPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, functionPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), functionPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); // Number of arguments for constructor diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp index d341b847b..4206cf2b0 100644 --- a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -47,7 +47,7 @@ FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* st { } -void FunctionPrototype::finishCreation(ExecState* exec, const Identifier& name) +void FunctionPrototype::finishCreation(ExecState* exec, const UString& name) { Base::finishCreation(exec->globalData(), name); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); @@ -55,16 +55,16 @@ void FunctionPrototype::finishCreation(ExecState* exec, const Identifier& name) void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, JSFunction** callFunction, JSFunction** applyFunction) { - JSFunction* toStringFunction = JSFunction::create(exec, globalObject, 0, exec->propertyNames().toString, functionProtoFuncToString); + JSFunction* toStringFunction = JSFunction::create(exec, globalObject, 0, exec->propertyNames().toString.ustring(), functionProtoFuncToString); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().toString, toStringFunction, DontEnum); - *applyFunction = JSFunction::create(exec, globalObject, 2, exec->propertyNames().apply, functionProtoFuncApply); + *applyFunction = JSFunction::create(exec, globalObject, 2, exec->propertyNames().apply.ustring(), functionProtoFuncApply); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().apply, *applyFunction, DontEnum); - *callFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().call, functionProtoFuncCall); + *callFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().call.ustring(), functionProtoFuncCall); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().call, *callFunction, DontEnum); - JSFunction* bindFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().bind, functionProtoFuncBind); + JSFunction* bindFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().bind.ustring(), functionProtoFuncBind); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().bind, bindFunction, DontEnum); } @@ -207,9 +207,8 @@ EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState* exec) length = targetLength - numBoundArgs; } - Identifier name(exec, target.get(exec, exec->propertyNames().name).toString(exec)->value(exec)); - - return JSValue::encode(JSBoundFunction::create(exec, globalObject, targetObject, exec->argument(0), boundArgs, length, name)); + JSString* name = target.get(exec, exec->propertyNames().name).toString(exec); + return JSValue::encode(JSBoundFunction::create(exec, globalObject, targetObject, exec->argument(0), boundArgs, length, name->value(exec))); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.h b/Source/JavaScriptCore/runtime/FunctionPrototype.h index 7dd1c2418..59427912b 100644 --- a/Source/JavaScriptCore/runtime/FunctionPrototype.h +++ b/Source/JavaScriptCore/runtime/FunctionPrototype.h @@ -32,7 +32,7 @@ namespace JSC { static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) { FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure); - prototype->finishCreation(exec, exec->propertyNames().nullIdentifier); + prototype->finishCreation(exec, ""); return prototype; } @@ -46,7 +46,7 @@ namespace JSC { static const ClassInfo s_info; protected: - void finishCreation(ExecState*, const Identifier& name); + void finishCreation(ExecState*, const UString& name); private: FunctionPrototype(JSGlobalObject*, Structure*); diff --git a/Source/JavaScriptCore/runtime/GCActivityCallback.h b/Source/JavaScriptCore/runtime/GCActivityCallback.h index 1a18a8b45..32077f2b0 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallback.h +++ b/Source/JavaScriptCore/runtime/GCActivityCallback.h @@ -47,9 +47,16 @@ public: virtual void willCollect() { } virtual void synchronize() { } virtual void cancel() { } + bool isEnabled() const { return m_enabled; } + void setEnabled(bool enabled) { m_enabled = enabled; } protected: - GCActivityCallback() {} + GCActivityCallback() + : m_enabled(true) + { + } + + bool m_enabled; }; struct DefaultGCActivityCallbackPlatformData; diff --git a/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp b/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp index 8b690a480..d82403a6b 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp +++ b/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp @@ -63,6 +63,9 @@ const CFTimeInterval hour = 60 * 60; void DefaultGCActivityCallbackPlatformData::timerDidFire(CFRunLoopTimerRef, void *info) { Heap* heap = static_cast<Heap*>(info); + if (!heap->activityCallback()->isEnabled()) + return; + APIEntryShim shim(heap->globalData()); #if !PLATFORM(IOS) double startTime = WTF::monotonicallyIncreasingTime(); diff --git a/Source/JavaScriptCore/runtime/Identifier.cpp b/Source/JavaScriptCore/runtime/Identifier.cpp index 182bcc462..20770928c 100644 --- a/Source/JavaScriptCore/runtime/Identifier.cpp +++ b/Source/JavaScriptCore/runtime/Identifier.cpp @@ -145,56 +145,6 @@ PassRefPtr<StringImpl> Identifier::add8(JSGlobalData* globalData, const UChar* s return addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator; } -template <typename CharType> -ALWAYS_INLINE uint32_t Identifier::toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok) -{ - // Get the first character, turning it into a digit. - uint32_t value = characters[0] - '0'; - if (value > 9) - return 0; - - // Check for leading zeros. If the first characher is 0, then the - // length of the string must be one - e.g. "042" is not equal to "42". - if (!value && length > 1) - return 0; - - while (--length) { - // Multiply value by 10, checking for overflow out of 32 bits. - if (value > 0xFFFFFFFFU / 10) - return 0; - value *= 10; - - // Get the next character, turning it into a digit. - uint32_t newValue = *(++characters) - '0'; - if (newValue > 9) - return 0; - - // Add in the old value, checking for overflow out of 32 bits. - newValue += value; - if (newValue < value) - return 0; - value = newValue; - } - - ok = true; - return value; -} - -uint32_t Identifier::toUInt32(const UString& string, bool& ok) -{ - ok = false; - - unsigned length = string.length(); - - // An empty string is not a number. - if (!length) - return 0; - - if (string.is8Bit()) - return toUInt32FromCharacters(string.characters8(), length, ok); - return toUInt32FromCharacters(string.characters16(), length, ok); -} - PassRefPtr<StringImpl> Identifier::addSlowCase(JSGlobalData* globalData, StringImpl* r) { ASSERT(!r->isIdentifier()); diff --git a/Source/JavaScriptCore/runtime/Identifier.h b/Source/JavaScriptCore/runtime/Identifier.h index 14960876b..7b7907983 100644 --- a/Source/JavaScriptCore/runtime/Identifier.h +++ b/Source/JavaScriptCore/runtime/Identifier.h @@ -63,10 +63,6 @@ namespace JSC { static Identifier from(JSGlobalData*, int y); static Identifier from(JSGlobalData*, double y); - JS_EXPORT_PRIVATE static uint32_t toUInt32(const UString&, bool& ok); - uint32_t toUInt32(bool& ok) const { return toUInt32(m_string, ok); } - unsigned toArrayIndex(bool& ok) const; - bool isNull() const { return m_string.isNull(); } bool isEmpty() const { return m_string.isEmpty(); } diff --git a/Source/JavaScriptCore/runtime/InternalFunction.cpp b/Source/JavaScriptCore/runtime/InternalFunction.cpp index 50ea504c1..985ab73b0 100644 --- a/Source/JavaScriptCore/runtime/InternalFunction.cpp +++ b/Source/JavaScriptCore/runtime/InternalFunction.cpp @@ -39,12 +39,12 @@ InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* stru { } -void InternalFunction::finishCreation(JSGlobalData& globalData, const Identifier& name) +void InternalFunction::finishCreation(JSGlobalData& globalData, const UString& name) { Base::finishCreation(globalData); ASSERT(inherits(&s_info)); ASSERT(methodTable()->getCallData != InternalFunction::s_info.methodTable.getCallData); - putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); + putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum); } const UString& InternalFunction::name(ExecState* exec) diff --git a/Source/JavaScriptCore/runtime/InternalFunction.h b/Source/JavaScriptCore/runtime/InternalFunction.h index 532bd0c8d..150fb759e 100644 --- a/Source/JavaScriptCore/runtime/InternalFunction.h +++ b/Source/JavaScriptCore/runtime/InternalFunction.h @@ -51,7 +51,7 @@ namespace JSC { JS_EXPORT_PRIVATE InternalFunction(JSGlobalObject*, Structure*); - JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const Identifier& name); + JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const UString& name); static CallType getCallData(JSCell*, CallData&); }; diff --git a/Source/JavaScriptCore/runtime/JSActivation.cpp b/Source/JavaScriptCore/runtime/JSActivation.cpp index a10361007..f8883187e 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.cpp +++ b/Source/JavaScriptCore/runtime/JSActivation.cpp @@ -90,7 +90,7 @@ void JSActivation::visitChildren(JSCell* cell, SlotVisitor& visitor) visitor.appendValues(registerArray + offset, thisObject->m_numCapturedVars); } -inline bool JSActivation::symbolTableGet(const Identifier& propertyName, PropertySlot& slot) +inline bool JSActivation::symbolTableGet(PropertyName propertyName, PropertySlot& slot) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (entry.isNull()) @@ -102,7 +102,7 @@ inline bool JSActivation::symbolTableGet(const Identifier& propertyName, Propert return true; } -inline bool JSActivation::symbolTablePut(ExecState* exec, const Identifier& propertyName, JSValue value, bool shouldThrow) +inline bool JSActivation::symbolTablePut(ExecState* exec, PropertyName propertyName, JSValue value, bool shouldThrow) { JSGlobalData& globalData = exec->globalData(); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -137,7 +137,7 @@ void JSActivation::getOwnPropertyNames(JSObject* object, ExecState* exec, Proper JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -154,7 +154,7 @@ inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, return true; } -bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSActivation* thisObject = jsCast<JSActivation*>(cell); if (propertyName == exec->propertyNames().arguments) { @@ -177,7 +177,7 @@ bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Ident return false; } -void JSActivation::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSActivation::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSActivation* thisObject = jsCast<JSActivation*>(cell); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -193,7 +193,7 @@ void JSActivation::put(JSCell* cell, ExecState* exec, const Identifier& property } // FIXME: Make this function honor ReadOnly (const) and DontEnum -void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { JSActivation* thisObject = jsCast<JSActivation*>(object); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -208,7 +208,7 @@ void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, const Ide JSObject::putDirectVirtual(thisObject, exec, propertyName, value, attributes); } -bool JSActivation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSActivation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { if (propertyName == exec->propertyNames().arguments) return false; @@ -221,7 +221,7 @@ JSObject* JSActivation::toThisObject(JSCell*, ExecState* exec) return exec->globalThisValue(); } -JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&) +JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, PropertyName) { JSActivation* activation = asActivation(slotBase); CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(activation->m_registers)); diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h index fd1b2fd7f..95639076d 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.h +++ b/Source/JavaScriptCore/runtime/JSActivation.h @@ -59,13 +59,13 @@ namespace JSC { bool isDynamicScope(bool& requiresDynamicChecks) const; - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static void putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static JSObject* toThisObject(JSCell*, ExecState*); @@ -82,13 +82,13 @@ namespace JSC { static const unsigned StructureFlags = IsEnvironmentRecord | OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags; private: - bool symbolTableGet(const Identifier&, PropertySlot&); - bool symbolTableGet(const Identifier&, PropertyDescriptor&); - bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable); - bool symbolTablePut(ExecState*, const Identifier&, JSValue, bool shouldThrow); - bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes); + bool symbolTableGet(PropertyName, PropertySlot&); + bool symbolTableGet(PropertyName, PropertyDescriptor&); + bool symbolTableGet(PropertyName, PropertySlot&, bool& slotIsWriteable); + bool symbolTablePut(ExecState*, PropertyName, JSValue, bool shouldThrow); + bool symbolTablePutWithAttributes(JSGlobalData&, PropertyName, JSValue, unsigned attributes); - static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&); + static JSValue argumentsGetter(ExecState*, JSValue, PropertyName); NEVER_INLINE PropertySlot::GetValueFunc getArgumentsGetter(); int m_numCapturedArgs; diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp index aa1b8b7d9..9e7aaba51 100644 --- a/Source/JavaScriptCore/runtime/JSArray.cpp +++ b/Source/JavaScriptCore/runtime/JSArray.cpp @@ -535,7 +535,7 @@ void JSArray::setLengthWritable(ExecState* exec, bool writable) } // Defined in ES5.1 15.4.5.1 -bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { JSArray* array = jsCast<JSArray*>(object); @@ -618,10 +618,9 @@ bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, const Identif } // 4. Else if P is an array index (15.4), then - bool isArrayIndex; // a. Let index be ToUint32(P). - unsigned index = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) { + unsigned index = propertyName.asIndex(); + if (index != PropertyName::NotAnIndex) { // b. Reject if index >= oldLen and oldLenDesc.[[Writable]] is false. if (index >= array->length() && !array->isLengthWritable()) return reject(exec, throwException, "Attempting to define numeric property on array with non-writable length property."); @@ -665,7 +664,7 @@ bool JSArray::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, i), slot); } -bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSArray* thisObject = jsCast<JSArray*>(cell); if (propertyName == exec->propertyNames().length) { @@ -673,15 +672,14 @@ bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier return true; } - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) return JSArray::getOwnPropertySlotByIndex(thisObject, exec, i, slot); return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot); } -bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSArray* thisObject = jsCast<JSArray*>(object); if (propertyName == exec->propertyNames().length) { @@ -691,9 +689,8 @@ bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const ArrayStorage* storage = thisObject->m_storage; - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) { + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) { if (i >= storage->m_length) return false; if (i < thisObject->m_vectorLength) { @@ -714,12 +711,11 @@ bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const } // ECMA 15.4.5.1 -void JSArray::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSArray::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSArray* thisObject = jsCast<JSArray*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) { + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) { putByIndex(thisObject, exec, i, value, slot.isStrictMode()); return; } @@ -919,12 +915,11 @@ bool JSArray::putDirectIndexBeyondVectorLength(ExecState* exec, unsigned i, JSVa return true; } -bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSArray* thisObject = jsCast<JSArray*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) return thisObject->methodTable()->deletePropertyByIndex(thisObject, exec, i); if (propertyName == exec->propertyNames().length) diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h index 17c7f3ed7..c1a3a632b 100644 --- a/Source/JavaScriptCore/runtime/JSArray.h +++ b/Source/JavaScriptCore/runtime/JSArray.h @@ -164,11 +164,11 @@ namespace JSC { // - called 'completeInitialization' after all properties have been initialized. static JSArray* tryCreateUninitialized(JSGlobalData&, Structure*, unsigned initialLength); - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool throwException); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool throwException); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); // This is similar to the JSObject::putDirect* methods: // - the prototype chain is not consulted @@ -281,9 +281,9 @@ namespace JSC { protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags; - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); @@ -357,16 +357,6 @@ namespace JSC { inline bool isJSArray(JSCell* cell) { return cell->classInfo() == &JSArray::s_info; } inline bool isJSArray(JSValue v) { return v.isCell() && isJSArray(v.asCell()); } - // Rule from ECMA 15.2 about what an array index is. - // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1. - inline unsigned Identifier::toArrayIndex(bool& ok) const - { - unsigned i = toUInt32(ok); - if (ok && i >= 0xFFFFFFFFU) - ok = false; - return i; - } - // The definition of MAX_STORAGE_VECTOR_LENGTH is dependant on the definition storageSize // function below - the MAX_STORAGE_VECTOR_LENGTH limit is defined such that the storage // size calculation cannot overflow. (sizeof(ArrayStorage) - sizeof(WriteBarrier<Unknown>)) + diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp index 5fee47c24..3f6430871 100644 --- a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp @@ -76,7 +76,7 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec) return JSValue::encode(construct(exec, targetFunction, constructType, constructData, args)); } -JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const Identifier& name) +JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const UString& name) { ConstructData constructData; ConstructType constructType = JSC::getConstructData(targetFunction, constructData); @@ -107,7 +107,7 @@ JSBoundFunction::JSBoundFunction(ExecState* exec, JSGlobalObject* globalObject, { } -void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const Identifier& name) +void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const UString& name) { Base::finishCreation(exec, executable, length, name); ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.h b/Source/JavaScriptCore/runtime/JSBoundFunction.h index e54d45883..dd1229272 100644 --- a/Source/JavaScriptCore/runtime/JSBoundFunction.h +++ b/Source/JavaScriptCore/runtime/JSBoundFunction.h @@ -37,7 +37,7 @@ class JSBoundFunction : public JSFunction { public: typedef JSFunction Base; - static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const Identifier&); + static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const UString&); static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue proto); @@ -61,7 +61,7 @@ protected: private: JSBoundFunction(ExecState*, JSGlobalObject*, Structure*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs); - void finishCreation(ExecState*, NativeExecutable*, int, const Identifier&); + void finishCreation(ExecState*, NativeExecutable*, int, const UString&); WriteBarrier<JSObject> m_targetFunction; WriteBarrier<Unknown> m_boundThis; diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp index 7f9ba88a2..06c1f7c4d 100644 --- a/Source/JavaScriptCore/runtime/JSCell.cpp +++ b/Source/JavaScriptCore/runtime/JSCell.cpp @@ -71,7 +71,7 @@ ConstructType JSCell::getConstructData(JSCell*, ConstructData&) return ConstructTypeNone; } -bool JSCell::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& identifier, PropertySlot& slot) +bool JSCell::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName identifier, PropertySlot& slot) { // This is not a general purpose implementation of getOwnPropertySlot. // It should only be called by JSValue::get. @@ -95,7 +95,7 @@ bool JSCell::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned i return true; } -void JSCell::put(JSCell* cell, ExecState* exec, const Identifier& identifier, JSValue value, PutPropertySlot& slot) +void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue value, PutPropertySlot& slot) { if (cell->isString()) { JSValue(cell).putToPrimitive(exec, identifier, value, slot); @@ -116,7 +116,7 @@ void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSVa thisObject->methodTable()->putByIndex(thisObject, exec, identifier, value, shouldThrow); } -bool JSCell::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& identifier) +bool JSCell::deleteProperty(JSCell* cell, ExecState* exec, PropertyName identifier) { JSObject* thisObject = cell->toObject(exec, exec->lexicalGlobalObject()); return thisObject->methodTable()->deleteProperty(thisObject, exec, identifier); @@ -195,18 +195,18 @@ bool JSCell::hasInstance(JSObject*, ExecState*, JSValue, JSValue) return false; } -void JSCell::putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned) +void JSCell::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned) { ASSERT_NOT_REACHED(); } -bool JSCell::defineOwnProperty(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool) +bool JSCell::defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool) { ASSERT_NOT_REACHED(); return false; } -bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) +bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&) { ASSERT_NOT_REACHED(); return false; diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h index 431e67145..fa675fbca 100644 --- a/Source/JavaScriptCore/runtime/JSCell.h +++ b/Source/JavaScriptCore/runtime/JSCell.h @@ -106,10 +106,10 @@ namespace JSC { const ClassInfo* classInfo() const; const ClassInfo* validatedClassInfo() const; const MethodTable* methodTable() const; - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static JSObject* toThisObject(JSCell*, ExecState*); @@ -121,7 +121,7 @@ namespace JSC { // fastGetOwnPropertySlot to getOwnPropertySlot. Callers should always // call this function, not its slower virtual counterpart. (For integer // property names, we want a similar interface with appropriate optimizations.) - bool fastGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool fastGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&); JSValue fastGetOwnProperty(ExecState*, const UString&); static ptrdiff_t structureOffset() @@ -150,7 +150,7 @@ namespace JSC { void finishCreation(JSGlobalData&, Structure*, CreatingEarlyCellTag); // Base implementation; for non-object classes implements getPropertySlot. - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); // Dummy implementations of override-able static functions for classes to put in their MethodTable @@ -159,9 +159,9 @@ namespace JSC { static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); static UString className(const JSObject*); static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue prototypeProperty); - static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); private: friend class LLIntOffsetsExtractor; diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp index 563325ab0..f2d9c81e2 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSFunction.cpp @@ -59,7 +59,7 @@ bool JSFunction::isHostFunctionNonInline() const return isHostFunction(); } -JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const Identifier& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) +JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const UString& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) { NativeExecutable* executable; #if !ENABLE(JIT) @@ -92,12 +92,12 @@ JSFunction::JSFunction(ExecState* exec, FunctionExecutable* executable, ScopeCha { } -void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const Identifier& name) +void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const UString& name) { Base::finishCreation(exec->globalData()); ASSERT(inherits(&s_info)); m_executable.set(exec->globalData(), this, executable); - putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); + putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum); putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); } @@ -183,14 +183,14 @@ CallType JSFunction::getCallData(JSCell* cell, CallData& callData) return CallTypeJS; } -JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, PropertyName) { JSFunction* thisObj = jsCast<JSFunction*>(slotBase); ASSERT(!thisObj->isHostFunction()); return exec->interpreter()->retrieveArgumentsFromVMCode(exec, thisObj); } -JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, PropertyName) { JSFunction* thisObj = jsCast<JSFunction*>(slotBase); ASSERT(!thisObj->isHostFunction()); @@ -205,14 +205,14 @@ JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, const Identi return throwTypeError(exec, "Function.caller used to retrieve strict caller"); } -JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, const Identifier&) +JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, PropertyName) { JSFunction* thisObj = jsCast<JSFunction*>(slotBase); ASSERT(!thisObj->isHostFunction()); return jsNumber(thisObj->jsExecutable()->parameterCount()); } -bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSFunction* thisObject = jsCast<JSFunction*>(cell); if (thisObject->isHostFunction()) @@ -267,7 +267,7 @@ bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identif return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); } -bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSFunction* thisObject = jsCast<JSFunction*>(object); if (thisObject->isHostFunction()) @@ -330,7 +330,7 @@ void JSFunction::getOwnPropertyNames(JSObject* object, ExecState* exec, Property Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSFunction::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSFunction* thisObject = jsCast<JSFunction*>(cell); if (thisObject->isHostFunction()) { @@ -343,6 +343,10 @@ void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyNa PropertySlot slot; thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot); thisObject->m_cachedInheritorID.clear(); + // Don't allow this to be cached, since a [[Put]] must clear m_cachedInheritorID. + PutPropertySlot dontCache; + Base::put(thisObject, exec, propertyName, value, dontCache); + return; } if (thisObject->jsExecutable()->isStrictMode() && (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().caller)) { // This will trigger the property to be reified, if this is not already the case! @@ -359,7 +363,7 @@ void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyNa Base::put(thisObject, exec, propertyName, value, slot); } -bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSFunction* thisObject = jsCast<JSFunction*>(cell); // For non-host functions, don't let these properties by deleted - except by DefineOwnProperty. @@ -372,7 +376,7 @@ bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& return Base::deleteProperty(thisObject, exec, propertyName); } -bool JSFunction::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool JSFunction::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { JSFunction* thisObject = jsCast<JSFunction*>(object); if (thisObject->isHostFunction()) @@ -455,7 +459,7 @@ UString getCalculatedDisplayName(CallFrame* callFrame, JSObject* object) return function->calculatedDisplayName(callFrame); if (InternalFunction* function = jsDynamicCast<InternalFunction*>(object)) return function->calculatedDisplayName(callFrame); - return callFrame->globalData().propertyNames->emptyIdentifier.ustring(); + return ""; } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSFunction.h b/Source/JavaScriptCore/runtime/JSFunction.h index 9de66d721..56faf00de 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.h +++ b/Source/JavaScriptCore/runtime/JSFunction.h @@ -55,7 +55,7 @@ namespace JSC { public: typedef JSNonFinalObject Base; - JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const Identifier& name, NativeFunction nativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor); + JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const UString& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor); static JSFunction* create(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChain) { @@ -139,19 +139,19 @@ namespace JSC { JS_EXPORT_PRIVATE JSFunction(ExecState*, JSGlobalObject*, Structure*); JSFunction(ExecState*, FunctionExecutable*, ScopeChainNode*); - void finishCreation(ExecState*, NativeExecutable*, int length, const Identifier& name); + void finishCreation(ExecState*, NativeExecutable*, int length, const UString& name); void finishCreation(ExecState*, FunctionExecutable*, ScopeChainNode*); Structure* cacheInheritorID(ExecState*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode = ExcludeDontEnumProperties); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static void visitChildren(JSCell*, SlotVisitor&); @@ -160,9 +160,9 @@ namespace JSC { JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const; - static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&); - static JSValue callerGetter(ExecState*, JSValue, const Identifier&); - static JSValue lengthGetter(ExecState*, JSValue, const Identifier&); + static JSValue argumentsGetter(ExecState*, JSValue, PropertyName); + static JSValue callerGetter(ExecState*, JSValue, PropertyName); + static JSValue lengthGetter(ExecState*, JSValue, PropertyName); WriteBarrier<ExecutableBase> m_executable; WriteBarrier<ScopeChainNode> m_scopeChain; diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp index b08c7dfa2..91ff9cefb 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp @@ -173,6 +173,9 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread { interpreter = new Interpreter; + if (isSharedInstance()) + turnOffVerifier(); + // Need to be careful to keep everything consistent here IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); JSLock lock(SilenceAssertionsOnly); diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index 0f74a8061..da55c0191 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -142,7 +142,7 @@ void JSGlobalObject::init(JSObject* thisValue) reset(prototype()); } -void JSGlobalObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSGlobalObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(cell); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -152,7 +152,7 @@ void JSGlobalObject::put(JSCell* cell, ExecState* exec, const Identifier& proper JSVariableObject::put(thisObject, exec, propertyName, value, slot); } -void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -170,7 +170,7 @@ void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, const I } } -bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); PropertySlot slot; @@ -205,8 +205,8 @@ void JSGlobalObject::reset(JSValue prototype) m_applyFunction.set(exec->globalData(), this, applyFunction); m_objectPrototype.set(exec->globalData(), this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(exec->globalData(), this, jsNull()))); GetterSetter* protoAccessor = GetterSetter::create(exec); - protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, Identifier(), globalFuncProtoGetter)); - protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, Identifier(), globalFuncProtoSetter)); + protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoGetter)); + protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoSetter)); m_objectPrototype->putDirectAccessor(exec->globalData(), exec->propertyNames().underscoreProto, protoAccessor, Accessor | DontEnum); m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get()); @@ -293,7 +293,7 @@ void JSGlobalObject::reset(JSValue prototype) putDirectWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum); putDirectWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum); - m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, 1, exec->propertyNames().eval, globalFuncEval)); + m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, 1, exec->propertyNames().eval.ustring(), globalFuncEval)); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().eval, m_evalFunction.get(), DontEnum); putDirectWithoutTransition(exec->globalData(), Identifier(exec, "JSON"), JSONObject::create(exec, this, JSONObject::createStructure(exec->globalData(), this, m_objectPrototype.get())), DontEnum); @@ -311,7 +311,7 @@ void JSGlobalObject::reset(JSValue prototype) void JSGlobalObject::createThrowTypeError(ExecState* exec) { - JSFunction* thrower = JSFunction::create(exec, this, 0, Identifier(), globalFuncThrowTypeError); + JSFunction* thrower = JSFunction::create(exec, this, 0, "", globalFuncThrowTypeError); GetterSetter* getterSetter = GetterSetter::create(exec); getterSetter->setGetter(exec->globalData(), thrower); getterSetter->setSetter(exec->globalData(), thrower); @@ -431,7 +431,7 @@ void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count) } } -bool JSGlobalObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSGlobalObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(cell); if (getStaticFunctionSlot<JSVariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, slot)) @@ -439,7 +439,7 @@ bool JSGlobalObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Ide return thisObject->symbolTableGet(propertyName, slot); } -bool JSGlobalObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSGlobalObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); if (getStaticFunctionDescriptor<JSVariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, descriptor)) diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index d9fc81dc4..a330f5f1c 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -199,20 +199,20 @@ namespace JSC { JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&); - JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); - bool hasOwnPropertyForWrite(ExecState*, const Identifier&); - JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); + bool hasOwnPropertyForWrite(ExecState*, PropertyName); + JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); + JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); - JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes); - JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes); - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, PropertyName, JSObject* getterFunc, unsigned attributes); + JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, PropertyName, JSObject* setterFunc, unsigned attributes); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); // We use this in the code generator as we perform symbol table // lookups prior to initializing the properties - bool symbolTableHasProperty(const Identifier& propertyName); + bool symbolTableHasProperty(PropertyName); // The following accessors return pristine values, even if a script // replaces the global object's associated property. @@ -365,7 +365,7 @@ namespace JSC { m_registerArraySize = count; } - inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, const Identifier& propertyName) + inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, PropertyName propertyName) { PropertySlot slot; if (JSVariableObject::getOwnPropertySlot(this, exec, propertyName, slot)) @@ -374,7 +374,7 @@ namespace JSC { return symbolTableGet(propertyName, slot, slotIsWriteable); } - inline bool JSGlobalObject::symbolTableHasProperty(const Identifier& propertyName) + inline bool JSGlobalObject::symbolTableHasProperty(PropertyName propertyName) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); return !entry.isNull(); diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.cpp b/Source/JavaScriptCore/runtime/JSNotAnObject.cpp index 337e3a70c..f75fa1f96 100644 --- a/Source/JavaScriptCore/runtime/JSNotAnObject.cpp +++ b/Source/JavaScriptCore/runtime/JSNotAnObject.cpp @@ -47,7 +47,7 @@ JSValue JSNotAnObject::defaultValue(const JSObject*, ExecState* exec, PreferredP } // JSObject methods -bool JSNotAnObject::getOwnPropertySlot(JSCell*, ExecState* exec, const Identifier&, PropertySlot&) +bool JSNotAnObject::getOwnPropertySlot(JSCell*, ExecState* exec, PropertyName, PropertySlot&) { ASSERT_UNUSED(exec, exec->hadException()); return false; @@ -59,13 +59,13 @@ bool JSNotAnObject::getOwnPropertySlotByIndex(JSCell*, ExecState* exec, unsigned return false; } -bool JSNotAnObject::getOwnPropertyDescriptor(JSObject*, ExecState* exec, const Identifier&, PropertyDescriptor&) +bool JSNotAnObject::getOwnPropertyDescriptor(JSObject*, ExecState* exec, PropertyName, PropertyDescriptor&) { ASSERT_UNUSED(exec, exec->hadException()); return false; } -void JSNotAnObject::put(JSCell*, ExecState* exec, const Identifier& , JSValue, PutPropertySlot&) +void JSNotAnObject::put(JSCell*, ExecState* exec, PropertyName , JSValue, PutPropertySlot&) { ASSERT_UNUSED(exec, exec->hadException()); } @@ -75,7 +75,7 @@ void JSNotAnObject::putByIndex(JSCell*, ExecState* exec, unsigned, JSValue, bool ASSERT_UNUSED(exec, exec->hadException()); } -bool JSNotAnObject::deleteProperty(JSCell*, ExecState* exec, const Identifier&) +bool JSNotAnObject::deleteProperty(JSCell*, ExecState* exec, PropertyName) { ASSERT_UNUSED(exec, exec->hadException()); return false; diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.h b/Source/JavaScriptCore/runtime/JSNotAnObject.h index 5f80688b0..9980e4aab 100644 --- a/Source/JavaScriptCore/runtime/JSNotAnObject.h +++ b/Source/JavaScriptCore/runtime/JSNotAnObject.h @@ -68,14 +68,14 @@ namespace JSC { static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); // JSObject methods - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp index 436e78353..de9977d6e 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.cpp +++ b/Source/JavaScriptCore/runtime/JSONObject.cpp @@ -595,12 +595,12 @@ const ClassInfo JSONObject::s_info = { "JSON", &JSNonFinalObject::s_info, 0, Exe // ECMA 15.8 -bool JSONObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSONObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::jsonTable(exec), jsCast<JSONObject*>(cell), propertyName, slot); } -bool JSONObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSONObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::jsonTable(exec), jsCast<JSONObject*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/JSONObject.h b/Source/JavaScriptCore/runtime/JSONObject.h index 29535f6d0..3b8647714 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.h +++ b/Source/JavaScriptCore/runtime/JSONObject.h @@ -56,8 +56,8 @@ namespace JSC { private: JSONObject(JSGlobalObject*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index a8c6c3f3f..baba28b46 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -120,7 +120,7 @@ bool JSObject::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned } // ECMA 8.6.2.2 -void JSObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSObject* thisObject = jsCast<JSObject*>(cell); ASSERT(value); @@ -192,7 +192,7 @@ void JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot); } -void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); PutPropertySlot slot; @@ -221,7 +221,7 @@ bool JSObject::allowsAccessFrom(ExecState* exec) return globalObject->globalObjectMethodTable()->allowsAccessFrom(globalObject, exec); } -void JSObject::putDirectAccessor(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSObject::putDirectAccessor(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(value.isGetterSetter() && (attributes & Accessor)); @@ -240,7 +240,7 @@ void JSObject::putDirectAccessor(JSGlobalData& globalData, const Identifier& pro structure()->setHasGetterSetterProperties(propertyName == globalData.propertyNames->underscoreProto); } -bool JSObject::hasProperty(ExecState* exec, const Identifier& propertyName) const +bool JSObject::hasProperty(ExecState* exec, PropertyName propertyName) const { PropertySlot slot; return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); @@ -253,7 +253,7 @@ bool JSObject::hasProperty(ExecState* exec, unsigned propertyName) const } // ECMA 8.6.2.5 -bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSObject* thisObject = jsCast<JSObject*>(cell); @@ -278,7 +278,7 @@ bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& p return true; } -bool JSObject::hasOwnProperty(ExecState* exec, const Identifier& propertyName) const +bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const { PropertySlot slot; return const_cast<JSObject*>(this)->methodTable()->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot); @@ -290,7 +290,7 @@ bool JSObject::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned pro return thisObject->methodTable()->deleteProperty(thisObject, exec, Identifier::from(exec, propertyName)); } -static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSObject* object, const Identifier& propertyName) +static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSObject* object, PropertyName propertyName) { JSValue function = object->get(exec, propertyName); CallData callData; @@ -344,7 +344,7 @@ JSValue JSObject::defaultValue(const JSObject* object, ExecState* exec, Preferre return throwError(exec, createTypeError(exec, "No default value")); } -const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const +const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, PropertyName propertyName) const { for (const ClassInfo* info = classInfo(); info; info = info->parentClass) { if (const HashTable* propHashTable = info->propHashTable(exec)) { @@ -381,7 +381,7 @@ bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyN return descriptor.enumerable(); } -bool JSObject::getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificValue) const +bool JSObject::getPropertySpecificValue(ExecState* exec, PropertyName propertyName, JSCell*& specificValue) const { unsigned attributes; if (structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) @@ -510,7 +510,7 @@ void JSObject::reifyStaticFunctionsForDelete(ExecState* exec) structure()->setStaticFunctionsReified(); } -void JSObject::removeDirect(JSGlobalData& globalData, const Identifier& propertyName) +void JSObject::removeDirect(JSGlobalData& globalData, PropertyName propertyName) { if (structure()->get(globalData, propertyName) == WTF::notFound) return; @@ -552,7 +552,7 @@ Structure* JSObject::createInheritorID(JSGlobalData& globalData) return m_inheritorID.get(); } -void JSObject::allocatePropertyStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize) +PropertyStorage JSObject::growPropertyStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize) { ASSERT(newSize > oldSize); @@ -580,10 +580,10 @@ void JSObject::allocatePropertyStorage(JSGlobalData& globalData, size_t oldSize, } ASSERT(newPropertyStorage); - m_propertyStorage.set(globalData, this, newPropertyStorage); + return newPropertyStorage; } -bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { unsigned attributes = 0; JSCell* cell = 0; @@ -594,7 +594,7 @@ bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const return true; } -bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSObject::getPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSObject* object = this; while (true) { @@ -607,7 +607,7 @@ bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& property } } -static bool putDescriptor(ExecState* exec, JSObject* target, const Identifier& propertyName, PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor) +static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName propertyName, PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor) { if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) { if (descriptor.isGenericDescriptor() && oldDescriptor.isAccessorDescriptor()) { @@ -662,7 +662,7 @@ private: JSGlobalData& m_globalData; }; -bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { // Track on the globaldata that we're in define property. // Currently DefineOwnProperty uses delete to remove properties when they are being replaced diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h index 7345bb700..0a4f1c745 100644 --- a/Source/JavaScriptCore/runtime/JSObject.h +++ b/Source/JavaScriptCore/runtime/JSObject.h @@ -75,7 +75,7 @@ namespace JSC { friend class JIT; friend class JSCell; friend class MarkedBlock; - JS_EXPORT_PRIVATE friend bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot); + JS_EXPORT_PRIVATE friend bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject*, PropertyName, PropertySlot&); enum PutMode { PutModePut, @@ -95,39 +95,39 @@ namespace JSC { Structure* inheritorID(JSGlobalData&); - JSValue get(ExecState*, const Identifier& propertyName) const; + JSValue get(ExecState*, PropertyName) const; JSValue get(ExecState*, unsigned propertyName) const; - bool getPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool getPropertySlot(ExecState*, PropertyName, PropertySlot&); bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); - JS_EXPORT_PRIVATE bool getPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&); + JS_EXPORT_PRIVATE bool getPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); bool allowsAccessFrom(ExecState*); - JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); // putDirect is effectively an unchecked vesion of 'defineOwnProperty': // - the prototype chain is not consulted // - accessors are not called. // - attributes will be respected (after the call the property will exist with the given attributes) - JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); - void putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attributes = 0); - void putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&); - void putDirectWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attributes = 0); - void putDirectAccessor(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attributes); + JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + void putDirect(JSGlobalData&, PropertyName, JSValue, unsigned attributes = 0); + void putDirect(JSGlobalData&, PropertyName, JSValue, PutPropertySlot&); + void putDirectWithoutTransition(JSGlobalData&, PropertyName, JSValue, unsigned attributes = 0); + void putDirectAccessor(JSGlobalData&, PropertyName, JSValue, unsigned attributes); bool propertyIsEnumerable(ExecState*, const Identifier& propertyName) const; - JS_EXPORT_PRIVATE bool hasProperty(ExecState*, const Identifier& propertyName) const; + JS_EXPORT_PRIVATE bool hasProperty(ExecState*, PropertyName) const; JS_EXPORT_PRIVATE bool hasProperty(ExecState*, unsigned propertyName) const; - bool hasOwnProperty(ExecState*, const Identifier& propertyName) const; + bool hasOwnProperty(ExecState*, PropertyName) const; - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); JS_EXPORT_PRIVATE static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); JS_EXPORT_PRIVATE static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); @@ -148,22 +148,22 @@ namespace JSC { JS_EXPORT_PRIVATE static JSObject* toThisObject(JSCell*, ExecState*); JSObject* unwrappedObject(); - bool getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificFunction) const; + bool getPropertySpecificValue(ExecState*, PropertyName, JSCell*& specificFunction) const; // This get function only looks at the property map. - JSValue getDirect(JSGlobalData& globalData, const Identifier& propertyName) const + JSValue getDirect(JSGlobalData& globalData, PropertyName propertyName) const { size_t offset = structure()->get(globalData, propertyName); return offset != WTF::notFound ? getDirectOffset(offset) : JSValue(); } - WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName) + WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, PropertyName propertyName) { size_t offset = structure()->get(globalData, propertyName); return offset != WTF::notFound ? locationForOffset(offset) : 0; } - WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes) + WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, PropertyName propertyName, unsigned& attributes) { JSCell* specificFunction; size_t offset = structure()->get(globalData, propertyName, attributes, specificFunction); @@ -177,7 +177,7 @@ namespace JSC { void transitionTo(JSGlobalData&, Structure*); - void removeDirect(JSGlobalData&, const Identifier& propertyName); + void removeDirect(JSGlobalData&, PropertyName); bool hasCustomProperties() { return structure()->didTransition(); } bool hasGetterSetterProperties() { return structure()->hasGetterSetterProperties(); } @@ -186,14 +186,14 @@ namespace JSC { // - provides no special handling for __proto__ // - does not walk the prototype chain (to check for accessors or non-writable properties). // This is used by JSActivation. - bool putOwnDataProperty(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&); + bool putOwnDataProperty(JSGlobalData&, PropertyName, JSValue, PutPropertySlot&); // Fast access to known property offsets. JSValue getDirectOffset(size_t offset) const { return propertyStorage()[offset].get(); } void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); } void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); } - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); bool isGlobalObject() const; bool isVariableObject() const; @@ -212,8 +212,9 @@ namespace JSC { bool staticFunctionsReified() { return structure()->staticFunctionsReified(); } void reifyStaticFunctionsForDelete(ExecState* exec); - JS_EXPORT_PRIVATE void allocatePropertyStorage(JSGlobalData&, size_t oldSize, size_t newSize); + JS_EXPORT_PRIVATE PropertyStorage growPropertyStorage(JSGlobalData&, size_t oldSize, size_t newSize); bool isUsingInlineStorage() const { return static_cast<const void*>(m_propertyStorage.get()) == static_cast<const void*>(this + 1); } + void setPropertyStorage(JSGlobalData&, PropertyStorage, Structure*); void* addressOfPropertyStorage() { @@ -294,12 +295,12 @@ namespace JSC { } template<PutMode> - bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); + bool putDirectInternal(JSGlobalData&, PropertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); - bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool inlineGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&); JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location); - const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const; + const HashEntry* findPropertyHashEntry(ExecState*, PropertyName) const; Structure* createInheritorID(JSGlobalData&); StorageBarrier m_propertyStorage; @@ -452,6 +453,14 @@ inline bool JSObject::isGlobalThis() const return structure()->typeInfo().type() == GlobalThisType; } +inline void JSObject::setPropertyStorage(JSGlobalData& globalData, PropertyStorage storage, Structure* structure) +{ + ASSERT(storage); + ASSERT(structure); + setStructure(globalData, structure); + m_propertyStorage.set(globalData, this, storage); +} + inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure) { return JSFinalObject::create(exec, structure); @@ -539,7 +548,7 @@ inline JSObject* JSValue::toThisObject(ExecState* exec) const return isCell() ? asCell()->methodTable()->toThisObject(asCell(), exec) : toThisObjectSlowCase(exec); } -ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) { if (structure()->hasGetterSetterProperties() && location->isGetterSetter()) @@ -555,12 +564,12 @@ ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Ide // It may seem crazy to inline a function this large, especially a virtual function, // but it makes a big difference to property lookup that derived classes can inline their // base class call to this. -ALWAYS_INLINE bool JSObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return jsCast<JSObject*>(cell)->inlineGetOwnPropertySlot(exec, propertyName, slot); } -ALWAYS_INLINE bool JSCell::fastGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSCell::fastGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (!structure()->typeInfo().overridesGetOwnPropertySlot()) return asObject(this)->inlineGetOwnPropertySlot(exec, propertyName, slot); @@ -585,7 +594,7 @@ ALWAYS_INLINE JSValue JSCell::fastGetOwnProperty(ExecState* exec, const UString& // It may seem crazy to inline a function this large but it makes a big difference // since this is function very hot in variable lookup -ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSObject* object = this; while (true) { @@ -611,7 +620,7 @@ ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyN } } -inline JSValue JSObject::get(ExecState* exec, const Identifier& propertyName) const +inline JSValue JSObject::get(ExecState* exec, PropertyName propertyName) const { PropertySlot slot(this); if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot)) @@ -630,7 +639,7 @@ inline JSValue JSObject::get(ExecState* exec, unsigned propertyName) const } template<JSObject::PutMode mode> -inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, PutPropertySlot& slot, JSCell* specificFunction) +inline bool JSObject::putDirectInternal(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes, PutPropertySlot& slot, JSCell* specificFunction) { ASSERT(value); ASSERT(value.isGetterSetter() == !!(attributes & Accessor)); @@ -663,10 +672,11 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi if ((mode == PutModePut) && !isExtensible()) return false; - size_t currentCapacity = structure()->propertyStorageCapacity(); + PropertyStorage newStorage = propertyStorage(); + if (structure()->shouldGrowPropertyStorage()) + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), structure()->suggestedNewPropertyStorageSize()); offset = structure()->addPropertyWithoutTransition(globalData, propertyName, attributes, specificFunction); - if (currentCapacity != structure()->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure()->propertyStorageCapacity()); + setPropertyStorage(globalData, newStorage, structure()); ASSERT(offset < structure()->propertyStorageCapacity()); putDirectOffset(globalData, offset, value); @@ -678,12 +688,13 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi size_t offset; size_t currentCapacity = structure()->propertyStorageCapacity(); - if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(this->structure(), propertyName, attributes, specificFunction, offset)) { + if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(this->structure(), propertyName, attributes, specificFunction, offset)) { + PropertyStorage newStorage = propertyStorage(); if (currentCapacity != structure->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity()); + newStorage = growPropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity()); ASSERT(offset < structure->propertyStorageCapacity()); - setStructure(globalData, structure); + setPropertyStorage(globalData, newStorage, structure); putDirectOffset(globalData, offset, value); // This is a new property; transitions with specific values are not currently cachable, // so leave the slot in an uncachable state. @@ -727,13 +738,14 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi if ((mode == PutModePut) && !isExtensible()) return false; - Structure* structure = Structure::addPropertyTransition(globalData, this->structure(), propertyName, attributes, specificFunction, offset); + PropertyStorage newStorage = propertyStorage(); + if (structure()->shouldGrowPropertyStorage()) + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), structure()->suggestedNewPropertyStorageSize()); - if (currentCapacity != structure->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity()); + Structure* structure = Structure::addPropertyTransition(globalData, this->structure(), propertyName, attributes, specificFunction, offset); ASSERT(offset < structure->propertyStorageCapacity()); - setStructure(globalData, structure); + setPropertyStorage(globalData, newStorage, structure); putDirectOffset(globalData, offset, value); // This is a new property; transitions with specific values are not currently cachable, // so leave the slot in an uncachable state. @@ -742,7 +754,7 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi return true; } -inline bool JSObject::putOwnDataProperty(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +inline bool JSObject::putOwnDataProperty(JSGlobalData& globalData, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { ASSERT(value); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -751,34 +763,36 @@ inline bool JSObject::putOwnDataProperty(JSGlobalData& globalData, const Identif return putDirectInternal<PutModePut>(globalData, propertyName, value, 0, slot, getJSFunction(value)); } -inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +inline void JSObject::putDirect(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); PutPropertySlot slot; putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, value, attributes, slot, getJSFunction(value)); } -inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +inline void JSObject::putDirect(JSGlobalData& globalData, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { ASSERT(!value.isGetterSetter()); putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, value, 0, slot, getJSFunction(value)); } -inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); - size_t currentCapacity = structure()->propertyStorageCapacity(); + PropertyStorage newStorage = propertyStorage(); + if (structure()->shouldGrowPropertyStorage()) + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), structure()->suggestedNewPropertyStorageSize()); size_t offset = structure()->addPropertyWithoutTransition(globalData, propertyName, attributes, getJSFunction(value)); - if (currentCapacity != structure()->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure()->propertyStorageCapacity()); + setPropertyStorage(globalData, newStorage, structure()); putDirectOffset(globalData, offset, value); } inline void JSObject::transitionTo(JSGlobalData& globalData, Structure* newStructure) { + PropertyStorage newStorage = propertyStorage(); if (structure()->propertyStorageCapacity() != newStructure->propertyStorageCapacity()) - allocatePropertyStorage(globalData, structure()->propertyStorageCapacity(), newStructure->propertyStorageCapacity()); - setStructure(globalData, newStructure); + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), newStructure->propertyStorageCapacity()); + setPropertyStorage(globalData, newStorage, newStructure); } inline JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const @@ -786,13 +800,13 @@ inline JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType pre return methodTable()->defaultValue(this, exec, preferredType); } -inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName) const +inline JSValue JSValue::get(ExecState* exec, PropertyName propertyName) const { PropertySlot slot(asValue()); return get(exec, propertyName, slot); } -inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) const +inline JSValue JSValue::get(ExecState* exec, PropertyName propertyName, PropertySlot& slot) const { if (UNLIKELY(!isCell())) { JSObject* prototype = synthesizePrototype(exec); @@ -836,7 +850,7 @@ inline JSValue JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot } } -inline void JSValue::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +inline void JSValue::put(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { if (UNLIKELY(!isCell())) { putToPrimitive(exec, propertyName, value, slot); diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp index f8942b5f8..fc4c27bab 100644 --- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp +++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp @@ -54,7 +54,7 @@ JSObject* JSStaticScopeObject::toThisObject(JSCell*, ExecState* exec) return exec->globalThisValue(); } -void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(cell); if (slot.isStrictMode()) { @@ -78,7 +78,7 @@ void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, const Identifier& p ASSERT_NOT_REACHED(); } -void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(object); if (thisObject->symbolTablePutWithAttributes(exec->globalData(), propertyName, value, attributes)) @@ -87,7 +87,7 @@ void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, co ASSERT_NOT_REACHED(); } -bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, const Identifier& propertyName, PropertySlot& slot) +bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, PropertyName propertyName, PropertySlot& slot) { return jsCast<JSStaticScopeObject*>(cell)->symbolTableGet(propertyName, slot); } diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h index bbf03a347..f351349a6 100644 --- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h +++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h @@ -44,10 +44,10 @@ namespace JSC{ static void visitChildren(JSCell*, SlotVisitor&); bool isDynamicScope(bool& requiresDynamicChecks) const; static JSObject* toThisObject(JSCell*, ExecState*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static void putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); + static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(StaticScopeObjectType, StructureFlags), &s_info); } diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp index 904cc4d3e..7faa393c3 100644 --- a/Source/JavaScriptCore/runtime/JSString.cpp +++ b/Source/JavaScriptCore/runtime/JSString.cpp @@ -257,7 +257,7 @@ JSObject* JSString::toThisObject(JSCell* cell, ExecState* exec) return StringObject::create(exec, exec->lexicalGlobalObject(), jsCast<JSString*>(cell)); } -bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSString* thisObject = jsCast<JSString*>(cell); // The semantics here are really getPropertySlot, not getOwnPropertySlot. @@ -275,16 +275,16 @@ bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifie return true; } -bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSString::getStringPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { descriptor.setDescriptor(jsNumber(m_length), DontEnum | DontDelete | ReadOnly); return true; } - bool isStrictUInt32; - unsigned i = propertyName.toUInt32(isStrictUInt32); - if (isStrictUInt32 && i < m_length) { + unsigned i = propertyName.asIndex(); + if (i < m_length) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! descriptor.setDescriptor(getIndex(exec, i), DontDelete | ReadOnly); return true; } diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h index c95233deb..4ba9b79ad 100644 --- a/Source/JavaScriptCore/runtime/JSString.h +++ b/Source/JavaScriptCore/runtime/JSString.h @@ -67,7 +67,6 @@ namespace JSC { friend class JSGlobalData; friend class SpecializedThunkJIT; friend class JSRopeString; - friend class MarkStack; friend struct ThunkHelpers; typedef JSCell Base; @@ -92,7 +91,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = length; m_is8Bit = m_value.impl()->is8Bit(); - m_isHashConstSingleton = false; } void finishCreation(JSGlobalData& globalData, size_t length, size_t cost) @@ -101,7 +99,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = length; m_is8Bit = m_value.impl()->is8Bit(); - m_isHashConstSingleton = false; Heap::heap(this)->reportExtraMemoryCost(cost); } @@ -111,7 +108,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = 0; m_is8Bit = true; - m_isHashConstSingleton = false; } public: @@ -143,9 +139,9 @@ namespace JSC { JSObject* toObject(ExecState*, JSGlobalObject*) const; double toNumber(ExecState*) const; - bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool getStringPropertySlot(ExecState*, PropertyName, PropertySlot&); bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); - bool getStringPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&); + bool getStringPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&); bool canGetIndex(unsigned i) { return i < m_length; } JSString* getIndex(ExecState*, unsigned); @@ -165,13 +161,9 @@ namespace JSC { protected: bool isRope() const { return m_value.isNull(); } bool is8Bit() const { return m_is8Bit; } - bool isHashConstSingleton() const { return m_isHashConstSingleton; } - void clearHashConstSingleton() { m_isHashConstSingleton = false; } - void setHashConstSingleton() { m_isHashConstSingleton = true; } // A string is represented either by a UString or a rope of fibers. bool m_is8Bit : 1; - bool m_isHashConstSingleton : 1; unsigned m_length; mutable UString m_value; @@ -181,7 +173,7 @@ namespace JSC { static JSObject* toThisObject(JSCell*, ExecState*); // Actually getPropertySlot, not getOwnPropertySlot (see JSCell). - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); UString& string() { ASSERT(!isRope()); return m_value; } @@ -241,7 +233,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = s1->length() + s2->length(); m_is8Bit = (s1->is8Bit() && s2->is8Bit()); - m_isHashConstSingleton = false; m_fibers[0].set(globalData, this, s1); m_fibers[1].set(globalData, this, s2); } @@ -251,7 +242,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = s1->length() + s2->length() + s3->length(); m_is8Bit = (s1->is8Bit() && s2->is8Bit() && s3->is8Bit()); - m_isHashConstSingleton = false; m_fibers[0].set(globalData, this, s1); m_fibers[1].set(globalData, this, s2); m_fibers[2].set(globalData, this, s3); @@ -449,16 +439,16 @@ namespace JSC { inline JSString* jsNontrivialString(ExecState* exec, const char* s) { return jsNontrivialString(&exec->globalData(), s); } inline JSString* jsOwnedString(ExecState* exec, const UString& s) { return jsOwnedString(&exec->globalData(), s); } - ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) + ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().length) { slot.setValue(jsNumber(m_length)); return true; } - bool isStrictUInt32; - unsigned i = propertyName.toUInt32(isStrictUInt32); - if (isStrictUInt32 && i < m_length) { + unsigned i = propertyName.asIndex(); + if (i < m_length) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! slot.setValue(getIndex(exec, i)); return true; } diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp index 088f214b9..628642f71 100644 --- a/Source/JavaScriptCore/runtime/JSValue.cpp +++ b/Source/JavaScriptCore/runtime/JSValue.cpp @@ -109,7 +109,7 @@ JSObject* JSValue::synthesizePrototype(ExecState* exec) const } // ECMA 8.7.2 -void JSValue::putToPrimitive(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSGlobalData& globalData = exec->globalData(); diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index 7facb9353..40cf69979 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -36,12 +36,12 @@ namespace JSC { class ExecState; - class Identifier; class JSCell; class JSGlobalData; class JSGlobalObject; class JSObject; class JSString; + class PropertyName; class PropertySlot; class PutPropertySlot; class UString; @@ -219,12 +219,12 @@ namespace JSC { float toFloat(ExecState* exec) const { return static_cast<float>(toNumber(exec)); } // Object operations, with the toObject operation included. - JSValue get(ExecState*, const Identifier& propertyName) const; - JSValue get(ExecState*, const Identifier& propertyName, PropertySlot&) const; + JSValue get(ExecState*, PropertyName) const; + JSValue get(ExecState*, PropertyName, PropertySlot&) const; JSValue get(ExecState*, unsigned propertyName) const; JSValue get(ExecState*, unsigned propertyName, PropertySlot&) const; - void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); - void putToPrimitive(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + void put(ExecState*, PropertyName, JSValue, PutPropertySlot&); + void putToPrimitive(ExecState*, PropertyName, JSValue, PutPropertySlot&); void putByIndex(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); JSObject* toThisObject(ExecState*) const; diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.cpp b/Source/JavaScriptCore/runtime/JSVariableObject.cpp index 8ca695074..3a4df7464 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.cpp +++ b/Source/JavaScriptCore/runtime/JSVariableObject.cpp @@ -42,7 +42,7 @@ void JSVariableObject::destroy(JSCell* cell) jsCast<JSVariableObject*>(cell)->JSVariableObject::~JSVariableObject(); } -bool JSVariableObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSVariableObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSVariableObject* thisObject = jsCast<JSVariableObject*>(cell); if (thisObject->symbolTable().contains(propertyName.impl())) @@ -63,7 +63,7 @@ void JSVariableObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Pr JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertyDescriptor& descriptor) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (!entry.isNull()) { @@ -73,7 +73,7 @@ bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDe return false; } -void JSVariableObject::putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned) +void JSVariableObject::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned) { ASSERT_NOT_REACHED(); } diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.h b/Source/JavaScriptCore/runtime/JSVariableObject.h index bcfe4ab89..8b7587b5c 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.h +++ b/Source/JavaScriptCore/runtime/JSVariableObject.h @@ -52,9 +52,9 @@ namespace JSC { JS_EXPORT_PRIVATE static void destroy(JSCell*); - static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); + static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier&); + JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); bool isDynamicScope(bool& requiresDynamicChecks) const; @@ -89,18 +89,18 @@ namespace JSC { PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts); void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray); - bool symbolTableGet(const Identifier&, PropertySlot&); - JS_EXPORT_PRIVATE bool symbolTableGet(const Identifier&, PropertyDescriptor&); - bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable); - bool symbolTablePut(ExecState*, const Identifier&, JSValue, bool shouldThrow); - bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes); + bool symbolTableGet(PropertyName, PropertySlot&); + JS_EXPORT_PRIVATE bool symbolTableGet(PropertyName, PropertyDescriptor&); + bool symbolTableGet(PropertyName, PropertySlot&, bool& slotIsWriteable); + bool symbolTablePut(ExecState*, PropertyName, JSValue, bool shouldThrow); + bool symbolTablePutWithAttributes(JSGlobalData&, PropertyName, JSValue, unsigned attributes); SymbolTable* m_symbolTable; // Maps name -> offset from "r" in register file. WriteBarrier<Unknown>* m_registers; // "r" in the register file. OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file. }; - inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot) + inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (!entry.isNull()) { @@ -110,7 +110,7 @@ namespace JSC { return false; } - inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot, bool& slotIsWriteable) + inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot, bool& slotIsWriteable) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (!entry.isNull()) { @@ -121,7 +121,7 @@ namespace JSC { return false; } - inline bool JSVariableObject::symbolTablePut(ExecState* exec, const Identifier& propertyName, JSValue value, bool shouldThrow) + inline bool JSVariableObject::symbolTablePut(ExecState* exec, PropertyName propertyName, JSValue value, bool shouldThrow) { JSGlobalData& globalData = exec->globalData(); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -138,7 +138,7 @@ namespace JSC { return true; } - inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) + inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); diff --git a/Source/JavaScriptCore/runtime/Lookup.cpp b/Source/JavaScriptCore/runtime/Lookup.cpp index b935eb260..30d982d2c 100644 --- a/Source/JavaScriptCore/runtime/Lookup.cpp +++ b/Source/JavaScriptCore/runtime/Lookup.cpp @@ -64,7 +64,7 @@ void HashTable::deleteTable() const } } -bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot) +bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot) { ASSERT(thisObj->globalObject()); ASSERT(entry->attributes() & Function); @@ -76,7 +76,7 @@ bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* if (thisObj->staticFunctionsReified()) return false; - JSFunction* function = JSFunction::create(exec, thisObj->globalObject(), entry->functionLength(), propertyName, entry->function(), entry->intrinsic()); + JSFunction* function = JSFunction::create(exec, thisObj->globalObject(), entry->functionLength(), propertyName.ustring(), entry->function(), entry->intrinsic()); thisObj->putDirect(exec->globalData(), propertyName, function, entry->attributes()); location = thisObj->getDirectLocation(exec->globalData(), propertyName); } diff --git a/Source/JavaScriptCore/runtime/Lookup.h b/Source/JavaScriptCore/runtime/Lookup.h index 64d06b503..d6806ae0c 100644 --- a/Source/JavaScriptCore/runtime/Lookup.h +++ b/Source/JavaScriptCore/runtime/Lookup.h @@ -129,13 +129,13 @@ namespace JSC { JS_EXPORT_PRIVATE void deleteTable() const; // Find an entry in the table, and return the entry. - ALWAYS_INLINE const HashEntry* entry(JSGlobalData* globalData, const Identifier& identifier) const + ALWAYS_INLINE const HashEntry* entry(JSGlobalData* globalData, PropertyName identifier) const { initializeIfNeeded(globalData); return entry(identifier); } - ALWAYS_INLINE const HashEntry* entry(ExecState* exec, const Identifier& identifier) const + ALWAYS_INLINE const HashEntry* entry(ExecState* exec, PropertyName identifier) const { initializeIfNeeded(exec); return entry(identifier); @@ -199,7 +199,7 @@ namespace JSC { } private: - ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const + ALWAYS_INLINE const HashEntry* entry(PropertyName identifier) const { ASSERT(table); @@ -221,7 +221,7 @@ namespace JSC { JS_EXPORT_PRIVATE void createTable(JSGlobalData*) const; }; - JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, const Identifier& propertyName, PropertySlot&); + JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, PropertyName, PropertySlot&); /** * This method does it all (looking in the hashtable, checking for function @@ -230,7 +230,7 @@ namespace JSC { * unknown property). */ template <class ThisImp, class ParentImp> - inline bool getStaticPropertySlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot) + inline bool getStaticPropertySlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot) { const HashEntry* entry = table->entry(exec, propertyName); @@ -245,7 +245,7 @@ namespace JSC { } template <class ThisImp, class ParentImp> - inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor) + inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor) { const HashEntry* entry = table->entry(exec, propertyName); @@ -271,7 +271,7 @@ namespace JSC { * a dummy getValueProperty. */ template <class ParentImp> - inline bool getStaticFunctionSlot(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot) + inline bool getStaticFunctionSlot(ExecState* exec, const HashTable* table, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot) { if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot)) return true; @@ -289,7 +289,7 @@ namespace JSC { * a dummy getValueProperty. */ template <class ParentImp> - inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor) + inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor) { if (ParentImp::getOwnPropertyDescriptor(static_cast<ParentImp*>(thisObj), exec, propertyName, descriptor)) return true; @@ -310,7 +310,7 @@ namespace JSC { * Using this instead of getStaticPropertySlot removes the need for a FuncImp class. */ template <class ThisImp, class ParentImp> - inline bool getStaticValueSlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot) + inline bool getStaticValueSlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot) { const HashEntry* entry = table->entry(exec, propertyName); @@ -328,7 +328,7 @@ namespace JSC { * Using this instead of getStaticPropertyDescriptor removes the need for a FuncImp class. */ template <class ThisImp, class ParentImp> - inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor) + inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor) { const HashEntry* entry = table->entry(exec, propertyName); @@ -348,7 +348,7 @@ namespace JSC { * is found it sets the value and returns true, else it returns false. */ template <class ThisImp> - inline bool lookupPut(ExecState* exec, const Identifier& propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, bool shouldThrow = false) + inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, bool shouldThrow = false) { const HashEntry* entry = table->entry(exec, propertyName); @@ -373,7 +373,7 @@ namespace JSC { * then it calls put() on the ParentImp class. */ template <class ThisImp, class ParentImp> - inline void lookupPut(ExecState* exec, const Identifier& propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, PutPropertySlot& slot) + inline void lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, PutPropertySlot& slot) { if (!lookupPut<ThisImp>(exec, propertyName, value, table, thisObj, slot.isStrictMode())) ParentImp::put(thisObj, exec, propertyName, value, slot); // not found: forward to parent diff --git a/Source/JavaScriptCore/runtime/MathObject.cpp b/Source/JavaScriptCore/runtime/MathObject.cpp index 58b09122d..9d83290a5 100644 --- a/Source/JavaScriptCore/runtime/MathObject.cpp +++ b/Source/JavaScriptCore/runtime/MathObject.cpp @@ -106,12 +106,12 @@ void MathObject::finishCreation(ExecState* exec, JSGlobalObject* globalObject) putDirectWithoutTransition(exec->globalData(), Identifier(exec, "SQRT2"), jsNumber(sqrt(2.0)), DontDelete | DontEnum | ReadOnly); } -bool MathObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool MathObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::mathTable(exec), jsCast<MathObject*>(cell), propertyName, slot); } -bool MathObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool MathObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::mathTable(exec), jsCast<MathObject*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/MathObject.h b/Source/JavaScriptCore/runtime/MathObject.h index d8da039d8..f4082f087 100644 --- a/Source/JavaScriptCore/runtime/MathObject.h +++ b/Source/JavaScriptCore/runtime/MathObject.h @@ -38,8 +38,8 @@ namespace JSC { object->finishCreation(exec, globalObject); return object; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h index 41e4235fa..76aea9da8 100644 --- a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h +++ b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h @@ -53,7 +53,7 @@ namespace JSC { protected: void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name) { - Base::finishCreation(exec->globalData(), Identifier(exec, name)); + Base::finishCreation(exec->globalData(), name); ASSERT(inherits(&s_info)); NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this); diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.cpp b/Source/JavaScriptCore/runtime/NumberConstructor.cpp index e1ff62f32..03d616073 100644 --- a/Source/JavaScriptCore/runtime/NumberConstructor.cpp +++ b/Source/JavaScriptCore/runtime/NumberConstructor.cpp @@ -30,11 +30,11 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(NumberConstructor); -static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&); +static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName); } // namespace JSC @@ -63,7 +63,7 @@ NumberConstructor::NumberConstructor(JSGlobalObject* globalObject, Structure* st void NumberConstructor::finishCreation(ExecState* exec, NumberPrototype* numberPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, numberPrototype->s_info.className)); + Base::finishCreation(exec->globalData(), numberPrototype->s_info.className); ASSERT(inherits(&s_info)); // Number.Prototype @@ -73,42 +73,42 @@ void NumberConstructor::finishCreation(ExecState* exec, NumberPrototype* numberP putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool NumberConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool NumberConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(cell), propertyName, slot); } -bool NumberConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool NumberConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(object), propertyName, descriptor); } -void NumberConstructor::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void NumberConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { lookupPut<NumberConstructor, InternalFunction>(exec, propertyName, value, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(cell), slot); } -static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName) { return jsNaN(); } -static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName) { return jsNumber(-std::numeric_limits<double>::infinity()); } -static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName) { return jsNumber(std::numeric_limits<double>::infinity()); } -static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName) { return jsNumber(1.7976931348623157E+308); } -static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName) { return jsNumber(5E-324); } diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.h b/Source/JavaScriptCore/runtime/NumberConstructor.h index 4ee5b0716..75f55f88e 100644 --- a/Source/JavaScriptCore/runtime/NumberConstructor.h +++ b/Source/JavaScriptCore/runtime/NumberConstructor.h @@ -38,10 +38,10 @@ namespace JSC { return constructor; } - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); JSValue getValueProperty(ExecState*, int token) const; static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.cpp b/Source/JavaScriptCore/runtime/NumberPrototype.cpp index 060a80107..1df7b6951 100644 --- a/Source/JavaScriptCore/runtime/NumberPrototype.cpp +++ b/Source/JavaScriptCore/runtime/NumberPrototype.cpp @@ -84,12 +84,12 @@ void NumberPrototype::finishCreation(ExecState* exec, JSGlobalObject*) ASSERT(inherits(&s_info)); } -bool NumberPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool NumberPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<NumberObject>(exec, ExecState::numberPrototypeTable(exec), jsCast<NumberPrototype*>(cell), propertyName, slot); } -bool NumberPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool NumberPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<NumberObject>(exec, ExecState::numberPrototypeTable(exec), jsCast<NumberPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.h b/Source/JavaScriptCore/runtime/NumberPrototype.h index d63cc3a6f..d7caecf3f 100644 --- a/Source/JavaScriptCore/runtime/NumberPrototype.h +++ b/Source/JavaScriptCore/runtime/NumberPrototype.h @@ -49,8 +49,8 @@ namespace JSC { private: NumberPrototype(ExecState*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp index b7dd71655..5a6fcddf0 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -84,19 +84,19 @@ ObjectConstructor::ObjectConstructor(JSGlobalObject* globalObject, Structure* st void ObjectConstructor::finishCreation(ExecState* exec, ObjectPrototype* objectPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, "Object")); + Base::finishCreation(exec->globalData(), Identifier(exec, "Object").ustring()); // ECMA 15.2.3.1 putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool ObjectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ObjectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::objectConstructorTable(exec), jsCast<ObjectConstructor*>(cell), propertyName, slot); } -bool ObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::objectConstructorTable(exec), jsCast<ObjectConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h index 87c6414c4..c89134599 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.h +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h @@ -38,8 +38,8 @@ namespace JSC { return constructor; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp index e980ac590..6faa16848 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp @@ -77,28 +77,22 @@ void ObjectPrototype::finishCreation(JSGlobalData& globalData, JSGlobalObject*) ASSERT(inherits(&s_info)); } -void ObjectPrototype::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void ObjectPrototype::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { ObjectPrototype* thisObject = jsCast<ObjectPrototype*>(cell); Base::put(cell, exec, propertyName, value, slot); - if (thisObject->m_hasNoPropertiesWithUInt32Names) { - bool isUInt32; - propertyName.toUInt32(isUInt32); - thisObject->m_hasNoPropertiesWithUInt32Names = !isUInt32; - } + if (thisObject->m_hasNoPropertiesWithUInt32Names && propertyName.asIndex() != PropertyName::NotAnIndex) + thisObject->m_hasNoPropertiesWithUInt32Names = false; } -bool ObjectPrototype::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool ObjectPrototype::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { ObjectPrototype* thisObject = jsCast<ObjectPrototype*>(object); bool result = Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow); - if (thisObject->m_hasNoPropertiesWithUInt32Names) { - bool isUInt32; - propertyName.toUInt32(isUInt32); - thisObject->m_hasNoPropertiesWithUInt32Names = !isUInt32; - } + if (thisObject->m_hasNoPropertiesWithUInt32Names && propertyName.asIndex() != PropertyName::NotAnIndex) + thisObject->m_hasNoPropertiesWithUInt32Names = false; return result; } @@ -111,12 +105,12 @@ bool ObjectPrototype::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, u return Base::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot); } -bool ObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<JSNonFinalObject>(exec, ExecState::objectPrototypeTable(exec), jsCast<ObjectPrototype*>(cell), propertyName, slot); } -bool ObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSNonFinalObject>(exec, ExecState::objectPrototypeTable(exec), jsCast<ObjectPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.h b/Source/JavaScriptCore/runtime/ObjectPrototype.h index b9b8a30d4..d46cb91c3 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.h +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.h @@ -50,12 +50,12 @@ namespace JSC { private: ObjectPrototype(ExecState*, Structure*); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); bool m_hasNoPropertiesWithUInt32Names; }; diff --git a/Source/JavaScriptCore/runtime/PropertyName.h b/Source/JavaScriptCore/runtime/PropertyName.h new file mode 100644 index 000000000..d2258b471 --- /dev/null +++ b/Source/JavaScriptCore/runtime/PropertyName.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PropertyName_h +#define PropertyName_h + +#include "Identifier.h" + +namespace JSC { + +template <typename CharType> +ALWAYS_INLINE uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length) +{ + // An empty string is not a number. + if (!length) + return UINT_MAX; + + // Get the first character, turning it into a digit. + uint32_t value = characters[0] - '0'; + if (value > 9) + return UINT_MAX; + + // Check for leading zeros. If the first characher is 0, then the + // length of the string must be one - e.g. "042" is not equal to "42". + if (!value && length > 1) + return UINT_MAX; + + while (--length) { + // Multiply value by 10, checking for overflow out of 32 bits. + if (value > 0xFFFFFFFFU / 10) + return UINT_MAX; + value *= 10; + + // Get the next character, turning it into a digit. + uint32_t newValue = *(++characters) - '0'; + if (newValue > 9) + return UINT_MAX; + + // Add in the old value, checking for overflow out of 32 bits. + newValue += value; + if (newValue < value) + return UINT_MAX; + value = newValue; + } + + return value; +} + +ALWAYS_INLINE uint32_t toUInt32FromStringImpl(StringImpl* impl) +{ + if (impl->is8Bit()) + return toUInt32FromCharacters(impl->characters8(), impl->length()); + return toUInt32FromCharacters(impl->characters16(), impl->length()); +} + +class PropertyName { +public: + PropertyName(const Identifier& propertyName) + : m_impl(propertyName.impl()) + { + } + + StringImpl* impl() const { return m_impl; } + UString ustring() const { return m_impl; } + + static const uint32_t NotAnIndex = UINT_MAX; + uint32_t asIndex() + { + return toUInt32FromStringImpl(m_impl); + } + +private: + StringImpl* m_impl; +}; + +inline bool operator==(PropertyName a, const Identifier& b) +{ + return a.impl() == b.impl(); +} + +inline bool operator==(const Identifier& a, PropertyName b) +{ + return a.impl() == b.impl(); +} + +inline bool operator==(PropertyName a, PropertyName b) +{ + return a.impl() == b.impl(); +} + +inline bool operator!=(PropertyName a, const Identifier& b) +{ + return a.impl() != b.impl(); +} + +inline bool operator!=(const Identifier& a, PropertyName b) +{ + return a.impl() != b.impl(); +} + +inline bool operator!=(PropertyName a, PropertyName b) +{ + return a.impl() != b.impl(); +} + +} + +#endif diff --git a/Source/JavaScriptCore/runtime/PropertySlot.h b/Source/JavaScriptCore/runtime/PropertySlot.h index cfedf7876..131cf7a92 100644 --- a/Source/JavaScriptCore/runtime/PropertySlot.h +++ b/Source/JavaScriptCore/runtime/PropertySlot.h @@ -21,8 +21,8 @@ #ifndef PropertySlot_h #define PropertySlot_h -#include "Identifier.h" #include "JSValue.h" +#include "PropertyName.h" #include "Register.h" #include <wtf/Assertions.h> #include <wtf/NotFound.h> @@ -61,10 +61,10 @@ namespace JSC { clearValue(); } - typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, const Identifier&); + typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, PropertyName); typedef JSValue (*GetIndexValueFunc)(ExecState*, JSValue slotBase, unsigned); - JSValue getValue(ExecState* exec, const Identifier& propertyName) const + JSValue getValue(ExecState* exec, PropertyName propertyName) const { if (m_getValue == JSC_VALUE_MARKER) return m_value; diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp index fd03db569..879511ac2 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -28,21 +28,21 @@ namespace JSC { -static JSValue regExpConstructorInput(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorMultiline(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorLastMatch(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorLastParen(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorLeftContext(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorRightContext(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar1(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar2(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar3(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar4(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar5(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar6(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar7(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar8(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar9(ExecState*, JSValue, const Identifier&); +static JSValue regExpConstructorInput(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorMultiline(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorLastMatch(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorLastParen(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorLeftContext(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorRightContext(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar1(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar2(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar3(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar4(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar5(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar6(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar7(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar8(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar9(ExecState*, JSValue, PropertyName); static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue); static void setRegExpConstructorMultiline(ExecState*, JSObject*, JSValue); @@ -92,7 +92,7 @@ RegExpConstructor::RegExpConstructor(JSGlobalObject* globalObject, Structure* st void RegExpConstructor::finishCreation(ExecState* exec, RegExpPrototype* regExpPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, "RegExp")); + Base::finishCreation(exec->globalData(), Identifier(exec, "RegExp").ustring()); ASSERT(inherits(&s_info)); // ECMA 15.10.5.1 RegExp.prototype @@ -154,92 +154,92 @@ JSValue RegExpConstructor::getRightContext(ExecState* exec) return m_cachedResult.lastResult(exec, this)->rightContext(exec); } -bool RegExpConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool RegExpConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(cell), propertyName, slot); } -bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(object), propertyName, descriptor); } -JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 1); } -JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 2); } -JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 3); } -JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 4); } -JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 5); } -JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 6); } -JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 7); } -JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 8); } -JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 9); } -JSValue regExpConstructorInput(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpConstructorInput(ExecState*, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->input(); } -JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpConstructor(slotBase)->multiline()); } -JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 0); } -JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getLastParen(exec); } -JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getLeftContext(exec); } -JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getRightContext(exec); } -void RegExpConstructor::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void RegExpConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { lookupPut<RegExpConstructor, InternalFunction>(exec, propertyName, value, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(cell), slot); } diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.h b/Source/JavaScriptCore/runtime/RegExpConstructor.h index 0093f9484..d714f2167 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.h +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.h @@ -48,10 +48,10 @@ namespace JSC { return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); } - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h index 595457bca..f26411f5f 100644 --- a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h +++ b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h @@ -81,7 +81,7 @@ namespace JSC { reifyMatchProperty(exec); } - static bool getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) + static bool getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); thisObject->reifyAllPropertiesIfNecessary(exec); @@ -98,14 +98,14 @@ namespace JSC { return JSArray::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot); } - static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) + static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object); thisObject->reifyAllPropertiesIfNecessary(exec); return JSArray::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); } - static void put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot) + static void put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue v, PutPropertySlot& slot) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); thisObject->reifyAllPropertiesIfNecessary(exec); @@ -119,7 +119,7 @@ namespace JSC { JSArray::putByIndex(thisObject, exec, propertyName, v, shouldThrow); } - static bool deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) + static bool deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); thisObject->reifyAllPropertiesIfNecessary(exec); @@ -140,7 +140,7 @@ namespace JSC { JSArray::getOwnPropertyNames(thisObject, exec, arr, mode); } - static bool defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) + static bool defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object); thisObject->reifyAllPropertiesIfNecessary(exec); diff --git a/Source/JavaScriptCore/runtime/RegExpObject.cpp b/Source/JavaScriptCore/runtime/RegExpObject.cpp index da4ea0446..8aeeb9edc 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.cpp +++ b/Source/JavaScriptCore/runtime/RegExpObject.cpp @@ -37,10 +37,10 @@ namespace JSC { -static JSValue regExpObjectGlobal(ExecState*, JSValue, const Identifier&); -static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, const Identifier&); -static JSValue regExpObjectMultiline(ExecState*, JSValue, const Identifier&); -static JSValue regExpObjectSource(ExecState*, JSValue, const Identifier&); +static JSValue regExpObjectGlobal(ExecState*, JSValue, PropertyName); +static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, PropertyName); +static JSValue regExpObjectMultiline(ExecState*, JSValue, PropertyName); +static JSValue regExpObjectSource(ExecState*, JSValue, PropertyName); } // namespace JSC @@ -88,7 +88,7 @@ void RegExpObject::visitChildren(JSCell* cell, SlotVisitor& visitor) visitor.append(&thisObject->m_lastIndex); } -bool RegExpObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool RegExpObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().lastIndex) { RegExpObject* regExp = asRegExpObject(cell); @@ -98,7 +98,7 @@ bool RegExpObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Ident return getStaticValueSlot<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), jsCast<RegExpObject*>(cell), propertyName, slot); } -bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().lastIndex) { RegExpObject* regExp = asRegExpObject(object); @@ -108,7 +108,7 @@ bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, c return getStaticValueDescriptor<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), jsCast<RegExpObject*>(object), propertyName, descriptor); } -bool RegExpObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool RegExpObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { if (propertyName == exec->propertyNames().lastIndex) return false; @@ -136,7 +136,7 @@ static bool reject(ExecState* exec, bool throwException, const char* message) return false; } -bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { if (propertyName == exec->propertyNames().lastIndex) { RegExpObject* regExp = asRegExpObject(object); @@ -163,22 +163,22 @@ bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, const Id return Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow); } -JSValue regExpObjectGlobal(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpObjectGlobal(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpObject(slotBase)->regExp()->global()); } -JSValue regExpObjectIgnoreCase(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpObjectIgnoreCase(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpObject(slotBase)->regExp()->ignoreCase()); } -JSValue regExpObjectMultiline(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpObjectMultiline(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpObject(slotBase)->regExp()->multiline()); } -JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, PropertyName) { UString pattern = asRegExpObject(slotBase)->regExp()->pattern(); unsigned length = pattern.length(); @@ -268,7 +268,7 @@ JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, const Identifier&) return jsString(exec, result.toUString()); } -void RegExpObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void RegExpObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().lastIndex) { asRegExpObject(cell)->setLastIndex(exec, value, slot.isStrictMode()); diff --git a/Source/JavaScriptCore/runtime/RegExpObject.h b/Source/JavaScriptCore/runtime/RegExpObject.h index a7dd54705..d1df2b202 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.h +++ b/Source/JavaScriptCore/runtime/RegExpObject.h @@ -70,9 +70,9 @@ namespace JSC { bool test(ExecState* exec, JSString* string) { return match(exec, string); } JSValue exec(ExecState*, JSString*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static JS_EXPORTDATA const ClassInfo s_info; @@ -89,10 +89,10 @@ namespace JSC { static void visitChildren(JSCell*, SlotVisitor&); - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); JS_EXPORT_PRIVATE static void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); private: MatchResult match(ExecState*, JSString*); diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp index fba4de2b4..24c7c8027 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -67,12 +67,12 @@ RegExpPrototype::RegExpPrototype(JSGlobalObject* globalObject, Structure* struct { } -bool RegExpPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool RegExpPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), jsCast<RegExpPrototype*>(cell), propertyName, slot); } -bool RegExpPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool RegExpPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), jsCast<RegExpPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.h b/Source/JavaScriptCore/runtime/RegExpPrototype.h index 6702592fd..78c6ae1d4 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.h +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.h @@ -49,8 +49,8 @@ namespace JSC { static const unsigned StructureFlags = OverridesGetOwnPropertySlot | RegExpObject::StructureFlags; private: - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp index fbd9d5fbd..8b47a5d70 100644 --- a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp +++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp @@ -37,7 +37,7 @@ StrictEvalActivation::StrictEvalActivation(ExecState* exec) { } -bool StrictEvalActivation::deleteProperty(JSCell*, ExecState*, const Identifier&) +bool StrictEvalActivation::deleteProperty(JSCell*, ExecState*, PropertyName) { return false; } diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.h b/Source/JavaScriptCore/runtime/StrictEvalActivation.h index a7b6d3e96..d73eedf5a 100644 --- a/Source/JavaScriptCore/runtime/StrictEvalActivation.h +++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.h @@ -41,7 +41,7 @@ public: return activation; } - static bool deleteProperty(JSCell*, ExecState*, const Identifier&); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static JSObject* toThisObject(JSCell*, ExecState*); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) diff --git a/Source/JavaScriptCore/runtime/StringConstructor.cpp b/Source/JavaScriptCore/runtime/StringConstructor.cpp index e03a87f03..460343761 100644 --- a/Source/JavaScriptCore/runtime/StringConstructor.cpp +++ b/Source/JavaScriptCore/runtime/StringConstructor.cpp @@ -55,17 +55,17 @@ StringConstructor::StringConstructor(JSGlobalObject* globalObject, Structure* st void StringConstructor::finishCreation(ExecState* exec, StringPrototype* stringPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, stringPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), stringPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool StringConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool StringConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<InternalFunction>(exec, ExecState::stringConstructorTable(exec), jsCast<StringConstructor*>(cell), propertyName, slot); } -bool StringConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool StringConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::stringConstructorTable(exec), jsCast<StringConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/StringConstructor.h b/Source/JavaScriptCore/runtime/StringConstructor.h index 6f553cdbb..11f70d499 100644 --- a/Source/JavaScriptCore/runtime/StringConstructor.h +++ b/Source/JavaScriptCore/runtime/StringConstructor.h @@ -54,8 +54,8 @@ namespace JSC { static ConstructType getConstructData(JSCell*, ConstructData&); static CallType getCallData(JSCell*, CallData&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp index d7e1c8a17..1dac06b46 100644 --- a/Source/JavaScriptCore/runtime/StringObject.cpp +++ b/Source/JavaScriptCore/runtime/StringObject.cpp @@ -43,7 +43,7 @@ void StringObject::finishCreation(JSGlobalData& globalData, JSString* string) setInternalValue(globalData, string); } -bool StringObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool StringObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { StringObject* thisObject = jsCast<StringObject*>(cell); if (thisObject->internalValue()->getStringPropertySlot(exec, propertyName, slot)) @@ -59,7 +59,7 @@ bool StringObject::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsi return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot); } -bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { StringObject* thisObject = jsCast<StringObject*>(object); if (thisObject->internalValue()->getStringPropertyDescriptor(exec, propertyName, descriptor)) @@ -67,7 +67,7 @@ bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, c return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); } -void StringObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void StringObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().length) { if (slot.isStrictMode()) @@ -77,7 +77,7 @@ void StringObject::put(JSCell* cell, ExecState* exec, const Identifier& property JSObject::put(cell, exec, propertyName, value, slot); } -bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { StringObject* thisObject = jsCast<StringObject*>(object); @@ -119,15 +119,16 @@ bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, const Id return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); } -bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { StringObject* thisObject = jsCast<StringObject*>(cell); if (propertyName == exec->propertyNames().length) return false; - bool isStrictUInt32; - unsigned i = propertyName.toUInt32(isStrictUInt32); - if (isStrictUInt32 && thisObject->internalValue()->canGetIndex(i)) + unsigned i = propertyName.asIndex(); + if (thisObject->internalValue()->canGetIndex(i)) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! return false; + } return JSObject::deleteProperty(thisObject, exec, propertyName); } diff --git a/Source/JavaScriptCore/runtime/StringObject.h b/Source/JavaScriptCore/runtime/StringObject.h index bad5595c3..7089e8983 100644 --- a/Source/JavaScriptCore/runtime/StringObject.h +++ b/Source/JavaScriptCore/runtime/StringObject.h @@ -45,15 +45,15 @@ namespace JSC { } static StringObject* create(ExecState*, JSGlobalObject*, JSString*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); static const JS_EXPORTDATA ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/StringPrototype.cpp b/Source/JavaScriptCore/runtime/StringPrototype.cpp index 81129f2a2..001e5e8b0 100644 --- a/Source/JavaScriptCore/runtime/StringPrototype.cpp +++ b/Source/JavaScriptCore/runtime/StringPrototype.cpp @@ -147,12 +147,12 @@ void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject*, JSString* putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); } -bool StringPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool StringPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<StringObject>(exec, ExecState::stringTable(exec), jsCast<StringPrototype*>(cell), propertyName, slot); } -bool StringPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool StringPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<StringObject>(exec, ExecState::stringTable(exec), jsCast<StringPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/StringPrototype.h b/Source/JavaScriptCore/runtime/StringPrototype.h index 113f21f2a..b846c7bb3 100644 --- a/Source/JavaScriptCore/runtime/StringPrototype.h +++ b/Source/JavaScriptCore/runtime/StringPrototype.h @@ -42,8 +42,8 @@ namespace JSC { return prototype; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp index ac4b4f1fe..693f3f317 100644 --- a/Source/JavaScriptCore/runtime/Structure.cpp +++ b/Source/JavaScriptCore/runtime/Structure.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "Structure.h" -#include "Identifier.h" #include "JSObject.h" #include "JSPropertyNameIterator.h" #include "Lookup.h" @@ -267,7 +266,14 @@ void Structure::growPropertyStorageCapacity() m_propertyStorageCapacity *= 2; } -void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Identifier& propertyName) +size_t Structure::suggestedNewPropertyStorageSize() +{ + if (isUsingInlineStorage()) + return JSObject::baseExternalStorageCapacity; + return m_propertyStorageCapacity * 2; +} + +void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, PropertyName propertyName) { StringImpl* rep = propertyName.impl(); @@ -281,7 +287,7 @@ void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Iden entry->specificValue.clear(); } -Structure* Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) +Structure* Structure::addPropertyTransitionToExistingStructure(Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { ASSERT(!structure->isDictionary()); ASSERT(structure->isObject()); @@ -298,7 +304,7 @@ Structure* Structure::addPropertyTransitionToExistingStructure(Structure* struct return 0; } -Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) +Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { // If we have a specific function, we may have got to this point if there is // already a transition with the correct property name and attributes, but @@ -355,7 +361,7 @@ Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* return transition; } -Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, size_t& offset) +Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, size_t& offset) { ASSERT(!structure->isUncacheableDictionary()); @@ -381,7 +387,7 @@ Structure* Structure::changePrototypeTransition(JSGlobalData& globalData, Struct return transition; } -Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Structure* structure, const Identifier& replaceFunction) +Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Structure* structure, PropertyName replaceFunction) { ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount); Structure* transition = create(globalData, structure); @@ -404,7 +410,7 @@ Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Stru return transition; } -Structure* Structure::attributeChangeTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes) +Structure* Structure::attributeChangeTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, unsigned attributes) { if (!structure->isUncacheableDictionary()) { Structure* transition = create(globalData, structure); @@ -562,7 +568,7 @@ Structure* Structure::flattenDictionaryStructure(JSGlobalData& globalData, JSObj return this; } -size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue) +size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, PropertyName propertyName, unsigned attributes, JSCell* specificValue) { ASSERT(!m_enumerationCache); @@ -579,7 +585,7 @@ size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, const I return offset; } -size_t Structure::removePropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName) +size_t Structure::removePropertyWithoutTransition(JSGlobalData& globalData, PropertyName propertyName) { ASSERT(isUncacheableDictionary()); ASSERT(!m_enumerationCache); @@ -636,13 +642,15 @@ PassOwnPtr<PropertyTable> Structure::copyPropertyTableForPinning(JSGlobalData& g return adoptPtr(m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : new PropertyTable(m_offset == noOffset ? 0 : m_offset)); } -size_t Structure::get(JSGlobalData& globalData, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue) +size_t Structure::get(JSGlobalData& globalData, PropertyName propertyName, unsigned& attributes, JSCell*& specificValue) { + ASSERT(structure()->classInfo() == &s_info); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return WTF::notFound; - PropertyMapEntry* entry = m_propertyTable->find(propertyName).first; + PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first; if (!entry) return WTF::notFound; @@ -651,13 +659,12 @@ size_t Structure::get(JSGlobalData& globalData, StringImpl* propertyName, unsign return entry->offset; } -bool Structure::despecifyFunction(JSGlobalData& globalData, const Identifier& propertyName) +bool Structure::despecifyFunction(JSGlobalData& globalData, PropertyName propertyName) { materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return false; - ASSERT(!propertyName.isNull()); PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first; if (!entry) return false; @@ -678,9 +685,8 @@ void Structure::despecifyAllFunctions(JSGlobalData& globalData) iter->specificValue.clear(); } -size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue) +size_t Structure::putSpecificValue(JSGlobalData& globalData, PropertyName propertyName, unsigned attributes, JSCell* specificValue) { - ASSERT(!propertyName.isNull()); ASSERT(get(globalData, propertyName) == notFound); checkConsistency(); @@ -705,10 +711,8 @@ size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& p return newOffset; } -size_t Structure::remove(const Identifier& propertyName) +size_t Structure::remove(PropertyName propertyName) { - ASSERT(!propertyName.isNull()); - checkConsistency(); StringImpl* rep = propertyName.impl(); diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index ee580e245..230f59d65 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -27,11 +27,11 @@ #define Structure_h #include "ClassInfo.h" -#include "Identifier.h" #include "JSCell.h" #include "JSType.h" #include "JSValue.h" #include "PropertyMapHashTable.h" +#include "PropertyName.h" #include "PropertyNameArray.h" #include "Protect.h" #include "StructureTransitionTable.h" @@ -86,12 +86,12 @@ namespace JSC { public: static void dumpStatistics(); - JS_EXPORT_PRIVATE static Structure* addPropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); - JS_EXPORT_PRIVATE static Structure* addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); - static Structure* removePropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, size_t& offset); + JS_EXPORT_PRIVATE static Structure* addPropertyTransition(JSGlobalData&, Structure*, PropertyName, unsigned attributes, JSCell* specificValue, size_t& offset); + JS_EXPORT_PRIVATE static Structure* addPropertyTransitionToExistingStructure(Structure*, PropertyName, unsigned attributes, JSCell* specificValue, size_t& offset); + static Structure* removePropertyTransition(JSGlobalData&, Structure*, PropertyName, size_t& offset); JS_EXPORT_PRIVATE static Structure* changePrototypeTransition(JSGlobalData&, Structure*, JSValue prototype); - JS_EXPORT_PRIVATE static Structure* despecifyFunctionTransition(JSGlobalData&, Structure*, const Identifier&); - static Structure* attributeChangeTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes); + JS_EXPORT_PRIVATE static Structure* despecifyFunctionTransition(JSGlobalData&, Structure*, PropertyName); + static Structure* attributeChangeTransition(JSGlobalData&, Structure*, PropertyName, unsigned attributes); static Structure* toCacheableDictionaryTransition(JSGlobalData&, Structure*); static Structure* toUncacheableDictionaryTransition(JSGlobalData&, Structure*); static Structure* sealTransition(JSGlobalData&, Structure*); @@ -102,14 +102,16 @@ namespace JSC { bool isFrozen(JSGlobalData&); bool isExtensible() const { return !m_preventExtensions; } bool didTransition() const { return m_didTransition; } + bool shouldGrowPropertyStorage() { return propertyStorageCapacity() == propertyStorageSize(); } + JS_EXPORT_PRIVATE size_t suggestedNewPropertyStorageSize(); Structure* flattenDictionaryStructure(JSGlobalData&, JSObject*); static void destroy(JSCell*); // These should be used with caution. - JS_EXPORT_PRIVATE size_t addPropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue); - size_t removePropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName); + JS_EXPORT_PRIVATE size_t addPropertyWithoutTransition(JSGlobalData&, PropertyName, unsigned attributes, JSCell* specificValue); + size_t removePropertyWithoutTransition(JSGlobalData&, PropertyName); void setPrototypeWithoutTransition(JSGlobalData& globalData, JSValue prototype) { m_prototype.set(globalData, this, prototype); } bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; } @@ -136,15 +138,9 @@ namespace JSC { unsigned propertyStorageSize() const { ASSERT(structure()->classInfo() == &s_info); return (m_propertyTable ? m_propertyTable->propertyStorageSize() : static_cast<unsigned>(m_offset + 1)); } bool isUsingInlineStorage() const; - size_t get(JSGlobalData&, const Identifier& propertyName); + size_t get(JSGlobalData&, PropertyName); size_t get(JSGlobalData&, const UString& name); - JS_EXPORT_PRIVATE size_t get(JSGlobalData&, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue); - size_t get(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue) - { - ASSERT(!propertyName.isNull()); - ASSERT(structure()->classInfo() == &s_info); - return get(globalData, propertyName.impl(), attributes, specificValue); - } + JS_EXPORT_PRIVATE size_t get(JSGlobalData&, PropertyName, unsigned& attributes, JSCell*& specificValue); bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } bool hasReadOnlyOrGetterSetterPropertiesExcludingProto() const { return m_hasReadOnlyOrGetterSetterPropertiesExcludingProto; } @@ -163,7 +159,7 @@ namespace JSC { bool isEmpty() const { return m_propertyTable ? m_propertyTable->isEmpty() : m_offset == noOffset; } - JS_EXPORT_PRIVATE void despecifyDictionaryFunction(JSGlobalData&, const Identifier& propertyName); + JS_EXPORT_PRIVATE void despecifyDictionaryFunction(JSGlobalData&, PropertyName); void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; } void setEnumerationCache(JSGlobalData&, JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h. @@ -216,7 +212,7 @@ namespace JSC { private: friend class LLIntOffsetsExtractor; - + JS_EXPORT_PRIVATE Structure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*); Structure(JSGlobalData&); Structure(JSGlobalData&, const Structure*); @@ -236,13 +232,13 @@ namespace JSC { } DictionaryKind; static Structure* toDictionaryTransition(JSGlobalData&, Structure*, DictionaryKind); - size_t putSpecificValue(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue); - size_t remove(const Identifier& propertyName); + size_t putSpecificValue(JSGlobalData&, PropertyName, unsigned attributes, JSCell* specificValue); + size_t remove(PropertyName); void createPropertyMap(unsigned keyCount = 0); void checkConsistency(); - bool despecifyFunction(JSGlobalData&, const Identifier&); + bool despecifyFunction(JSGlobalData&, PropertyName); void despecifyAllFunctions(JSGlobalData&); PassOwnPtr<PropertyTable> copyPropertyTable(JSGlobalData&, Structure* owner); @@ -314,7 +310,7 @@ namespace JSC { unsigned m_staticFunctionReified; }; - inline size_t Structure::get(JSGlobalData& globalData, const Identifier& propertyName) + inline size_t Structure::get(JSGlobalData& globalData, PropertyName propertyName) { ASSERT(structure()->classInfo() == &s_info); materializePropertyMapIfNecessary(globalData); |