X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..12899fa232562c774004a3a9d7d3149944dec712:/API/JSObjectRef.cpp diff --git a/API/JSObjectRef.cpp b/API/JSObjectRef.cpp index 50ee635..5ba4465 100644 --- a/API/JSObjectRef.cpp +++ b/API/JSObjectRef.cpp @@ -26,13 +26,18 @@ #include "config.h" #include "JSObjectRef.h" +#include "JSObjectRefPrivate.h" #include "APICast.h" +#include "ButterflyInlines.h" +#include "CodeBlock.h" +#include "CopiedSpaceInlines.h" #include "DateConstructor.h" #include "ErrorConstructor.h" #include "FunctionConstructor.h" #include "Identifier.h" #include "InitializeThreading.h" +#include "JSAPIWrapperObject.h" #include "JSArray.h" #include "JSCallbackConstructor.h" #include "JSCallbackFunction.h" @@ -44,10 +49,11 @@ #include "JSRetainPtr.h" #include "JSString.h" #include "JSValueRef.h" +#include "ObjectConstructor.h" #include "ObjectPrototype.h" +#include "Operations.h" #include "PropertyNameArray.h" #include "RegExpConstructor.h" -#include using namespace JSC; @@ -58,7 +64,7 @@ JSClassRef JSClassCreate(const JSClassDefinition* definition) ? OpaqueJSClass::createNoAutomaticPrototype(definition) : OpaqueJSClass::create(definition); - return jsClass.release().releaseRef(); + return jsClass.release().leakRef(); } JSClassRef JSClassRetain(JSClassRef jsClass) @@ -74,60 +80,69 @@ void JSClassRelease(JSClassRef jsClass) JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); if (!jsClass) - return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient + return toRef(constructEmptyObject(exec)); - JSCallbackObject* object = new (exec) JSCallbackObject(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data); + JSCallbackObject* object = JSCallbackObject::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data); if (JSObject* prototype = jsClass->prototype(exec)) - object->setPrototype(prototype); + object->setPrototype(exec->vm(), prototype); return toRef(object); } JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); - - Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); - - return toRef(new (exec) JSCallbackFunction(exec, callAsFunction, nameID)); + APIEntryShim entryShim(exec); + return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->string() : ASCIILiteral("anonymous"))); } JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0; if (!jsPrototype) jsPrototype = exec->lexicalGlobalObject()->objectPrototype(); - JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor); - constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly); + JSCallbackConstructor* constructor = JSCallbackConstructor::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor); + constructor->putDirect(exec->vm(), exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly); return toRef(constructor); } JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); - Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); + Identifier nameID = name ? name->identifier(&exec->vm()) : Identifier(exec, "anonymous"); MarkedArgumentBuffer args; for (unsigned i = 0; i < parameterCount; i++) - args.append(jsString(exec, parameterNames[i]->ustring())); - args.append(jsString(exec, body->ustring())); + args.append(jsString(exec, parameterNames[i]->string())); + args.append(jsString(exec, body->string())); - JSObject* result = constructFunction(exec, args, nameID, sourceURL->ustring(), startingLineNumber); + JSObject* result = constructFunction(exec, exec->lexicalGlobalObject(), args, nameID, sourceURL->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -139,9 +154,12 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* result; if (argumentCount) { @@ -149,9 +167,9 @@ JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSVa for (size_t i = 0; i < argumentCount; ++i) argList.append(toJS(exec, arguments[i])); - result = constructArray(exec, argList); + result = constructArray(exec, static_cast(0), argList); } else - result = constructEmptyArray(exec); + result = constructEmptyArray(exec, 0); if (exec->hadException()) { if (exception) @@ -165,15 +183,18 @@ JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSVa JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) argList.append(toJS(exec, arguments[i])); - JSObject* result = constructDate(exec, argList); + JSObject* result = constructDate(exec, exec->lexicalGlobalObject(), argList); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -186,15 +207,17 @@ JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSVal JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); - MarkedArgumentBuffer argList; - for (size_t i = 0; i < argumentCount; ++i) - argList.append(toJS(exec, arguments[i])); + JSValue message = argumentCount ? toJS(exec, arguments[0]) : jsUndefined(); + Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure(); + JSObject* result = ErrorInstance::create(exec, errorStructure, message); - JSObject* result = constructError(exec, argList); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -207,15 +230,18 @@ JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSVa JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) argList.append(toJS(exec, arguments[i])); - JSObject* result = constructRegExp(exec, argList); + JSObject* result = constructRegExp(exec, exec->lexicalGlobalObject(), argList); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -228,9 +254,12 @@ JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSV JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); return toRef(exec, jsObject->prototype()); @@ -238,36 +267,45 @@ JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); - jsObject->setPrototype(jsValue.isObject() ? jsValue : jsNull()); + jsObject->setPrototypeWithCycleCheck(exec->vm(), jsValue.isObject() ? jsValue : jsNull()); } bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return false; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); - return jsObject->hasProperty(exec, propertyName->identifier(&exec->globalData())); + return jsObject->hasProperty(exec, propertyName->identifier(&exec->vm())); } JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); - JSValue jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData())); + JSValue jsValue = jsObject->get(exec, propertyName->identifier(&exec->vm())); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -278,19 +316,22 @@ JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); - Identifier name(propertyName->identifier(&exec->globalData())); + Identifier name(propertyName->identifier(&exec->vm())); JSValue jsValue = toJS(exec, value); if (attributes && !jsObject->hasProperty(exec, name)) - jsObject->putWithAttributes(exec, name, jsValue, attributes); + jsObject->methodTable()->putDirectVirtual(jsObject, exec, name, jsValue, attributes); else { PutPropertySlot slot; - jsObject->put(exec, name, jsValue, slot); + jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot); } if (exec->hadException()) { @@ -302,9 +343,12 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); @@ -320,14 +364,17 @@ JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsi void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); - jsObject->put(exec, propertyIndex, jsValue); + jsObject->methodTable()->putByIndex(jsObject, exec, propertyIndex, jsValue, false); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -337,13 +384,16 @@ void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned p bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return false; + } ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); - bool result = jsObject->deleteProperty(exec, propertyName->identifier(&exec->globalData())); + bool result = jsObject->methodTable()->deleteProperty(jsObject, exec, propertyName->identifier(&exec->vm())); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); @@ -354,42 +404,123 @@ bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef pr void* JSObjectGetPrivate(JSObjectRef object) { - JSObject* jsObject = toJS(object); + JSObject* jsObject = uncheckedToJS(object); - if (jsObject->inherits(&JSCallbackObject::info)) - return static_cast*>(jsObject)->getPrivate(); - else if (jsObject->inherits(&JSCallbackObject::info)) - return static_cast*>(jsObject)->getPrivate(); + if (jsObject->inherits(&JSCallbackObject::s_info)) + return jsCast*>(jsObject)->getPrivate(); + if (jsObject->inherits(&JSCallbackObject::s_info)) + return jsCast*>(jsObject)->getPrivate(); +#if JSC_OBJC_API_ENABLED + if (jsObject->inherits(&JSCallbackObject::s_info)) + return jsCast*>(jsObject)->getPrivate(); +#endif return 0; } bool JSObjectSetPrivate(JSObjectRef object, void* data) { - JSObject* jsObject = toJS(object); + JSObject* jsObject = uncheckedToJS(object); - if (jsObject->inherits(&JSCallbackObject::info)) { - static_cast*>(jsObject)->setPrivate(data); + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->setPrivate(data); return true; - } else if (jsObject->inherits(&JSCallbackObject::info)) { - static_cast*>(jsObject)->setPrivate(data); + } + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->setPrivate(data); + return true; + } +#if JSC_OBJC_API_ENABLED + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->setPrivate(data); return true; } +#endif return false; } +JSValueRef JSObjectGetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) +{ + ExecState* exec = toJS(ctx); + APIEntryShim entryShim(exec); + JSObject* jsObject = toJS(object); + JSValue result; + Identifier name(propertyName->identifier(&exec->vm())); + if (jsObject->inherits(&JSCallbackObject::s_info)) + result = jsCast*>(jsObject)->getPrivateProperty(name); + else if (jsObject->inherits(&JSCallbackObject::s_info)) + result = jsCast*>(jsObject)->getPrivateProperty(name); +#if JSC_OBJC_API_ENABLED + else if (jsObject->inherits(&JSCallbackObject::s_info)) + result = jsCast*>(jsObject)->getPrivateProperty(name); +#endif + return toRef(exec, result); +} + +bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + APIEntryShim entryShim(exec); + JSObject* jsObject = toJS(object); + JSValue jsValue = value ? toJS(exec, value) : JSValue(); + Identifier name(propertyName->identifier(&exec->vm())); + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->setPrivateProperty(exec->vm(), name, jsValue); + return true; + } + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->setPrivateProperty(exec->vm(), name, jsValue); + return true; + } +#if JSC_OBJC_API_ENABLED + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->setPrivateProperty(exec->vm(), name, jsValue); + return true; + } +#endif + return false; +} + +bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) +{ + ExecState* exec = toJS(ctx); + APIEntryShim entryShim(exec); + JSObject* jsObject = toJS(object); + Identifier name(propertyName->identifier(&exec->vm())); + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->deletePrivateProperty(name); + return true; + } + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->deletePrivateProperty(name); + return true; + } +#if JSC_OBJC_API_ENABLED + if (jsObject->inherits(&JSCallbackObject::s_info)) { + jsCast*>(jsObject)->deletePrivateProperty(name); + return true; + } +#endif + return false; +} + bool JSObjectIsFunction(JSContextRef, JSObjectRef object) { + if (!object) + return false; CallData callData; - return toJS(object)->getCallData(callData) != CallTypeNone; + JSCell* cell = toJS(object); + return cell->methodTable()->getCallData(cell, callData) != CallTypeNone; } JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); + + if (!object) + return 0; JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); @@ -397,12 +528,14 @@ JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObject if (!jsThisObject) jsThisObject = exec->globalThisValue(); + jsThisObject = jsThisObject->methodTable()->toThisObject(jsThisObject, exec); + MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; i++) argList.append(toJS(exec, arguments[i])); CallData callData; - CallType callType = jsObject->getCallData(callData); + CallType callType = jsObject->methodTable()->getCallData(jsObject, callData); if (callType == CallTypeNone) return 0; @@ -418,21 +551,25 @@ JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObject bool JSObjectIsConstructor(JSContextRef, JSObjectRef object) { + if (!object) + return false; JSObject* jsObject = toJS(object); ConstructData constructData; - return jsObject->getConstructData(constructData) != ConstructTypeNone; + return jsObject->methodTable()->getConstructData(jsObject, constructData) != ConstructTypeNone; } JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); + + if (!object) + return 0; JSObject* jsObject = toJS(object); ConstructData constructData; - ConstructType constructType = jsObject->getConstructData(constructData); + ConstructType constructType = jsObject->methodTable()->getConstructData(jsObject, constructData); if (constructType == ConstructTypeNone) return 0; @@ -450,34 +587,39 @@ JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size } struct OpaqueJSPropertyNameArray { - OpaqueJSPropertyNameArray(JSGlobalData* globalData) + WTF_MAKE_FAST_ALLOCATED; +public: + OpaqueJSPropertyNameArray(VM* vm) : refCount(0) - , globalData(globalData) + , vm(vm) { } unsigned refCount; - JSGlobalData* globalData; + VM* vm; Vector > array; }; JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object) { + if (!ctx) { + ASSERT_NOT_REACHED(); + return 0; + } JSObject* jsObject = toJS(object); ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); - JSGlobalData* globalData = &exec->globalData(); + VM* vm = &exec->vm(); - JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(globalData); - PropertyNameArray array(globalData); - jsObject->getPropertyNames(exec, array); + JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(vm); + PropertyNameArray array(vm); + jsObject->methodTable()->getPropertyNames(jsObject, exec, array, ExcludeDontEnumProperties); size_t size = array.size(); propertyNames->array.reserveInitialCapacity(size); for (size_t i = 0; i < size; ++i) - propertyNames->array.append(JSRetainPtr(Adopt, OpaqueJSString::create(array[i].ustring()).releaseRef())); + propertyNames->array.uncheckedAppend(JSRetainPtr(Adopt, OpaqueJSString::create(array[i].string()).leakRef())); return JSPropertyNameArrayRetain(propertyNames); } @@ -491,7 +633,7 @@ JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) { if (--array->refCount == 0) { - JSLock lock(array->globalData->isSharedInstance); + APIEntryShim entryShim(array->vm, false); delete array; } } @@ -509,9 +651,6 @@ JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName) { PropertyNameArray* propertyNames = toJS(array); - - propertyNames->globalData()->heap.registerThread(); - JSLock lock(propertyNames->globalData()->isSharedInstance); - - propertyNames->add(propertyName->identifier(propertyNames->globalData())); + APIEntryShim entryShim(propertyNames->vm()); + propertyNames->add(propertyName->identifier(propertyNames->vm())); }