Avoid duplicate computations of ExecState::vm().
https://bugs.webkit.org/show_bug.cgi?id=176647
Reviewed by Saam Barati.
Source/JavaScriptCore:
Because while computing ExecState::vm() is cheap, it is not free.
This patch also:
1. gets rids of some convenience methods in CallFrame that implicitly does a
ExecState::vm() computation. This minimizes the chance of us accidentally
computing ExecState::vm() more than necessary.
2. passes vm (when available) to methodTable().
3. passes vm (when available) to JSLockHolder.
* API/JSBase.cpp:
(JSCheckScriptSyntax):
(JSGarbageCollect):
(JSReportExtraMemoryCost):
(JSSynchronousGarbageCollectForDebugging):
(JSSynchronousEdenCollectForDebugging):
* API/JSCallbackConstructor.h:
(JSC::JSCallbackConstructor::create):
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::create):
* API/JSContext.mm:
(-[JSContext setException:]):
* API/JSContextRef.cpp:
(JSContextGetGlobalObject):
(JSContextCreateBacktrace):
* API/JSManagedValue.mm:
(-[JSManagedValue value]):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
(JSObjectSetPrototype):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectGetPrivateProperty):
(JSObjectSetPrivateProperty):
(JSObjectDeletePrivateProperty):
(JSObjectIsFunction):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
(JSObjectCopyPropertyNames):
(JSPropertyNameAccumulatorAddName):
* API/JSScriptRef.cpp:
* API/JSTypedArray.cpp:
(JSValueGetTypedArrayType):
(JSObjectMakeTypedArrayWithArrayBuffer):
(JSObjectMakeTypedArrayWithArrayBufferAndOffset):
(JSObjectGetTypedArrayBytesPtr):
(JSObjectGetTypedArrayBuffer):
(JSObjectMakeArrayBufferWithBytesNoCopy):
(JSObjectGetArrayBufferBytesPtr):
* API/JSWeakObjectMapRefPrivate.cpp:
* API/JSWrapperMap.mm:
(constructorHasInstance):
(makeWrapper):
* API/ObjCCallbackFunction.mm:
(objCCallbackFunctionForInvocation):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::jettison):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::addConstant):
(JSC::CodeBlock::replaceConstant):
* bytecode/PutByIdStatus.cpp:
(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeFor):
* dfg/DFGDesiredWatchpoints.cpp:
(JSC::DFG::ArrayBufferViewWatchpointAdaptor::add):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::globalThisObjectFor):
* dfg/DFGOperations.cpp:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileFTLOSRExit):
* ftl/FTLOperations.cpp:
(JSC::FTL::operationPopulateObjectInOSR):
(JSC::FTL::operationMaterializeObjectInOSR):
* heap/GCAssertions.h:
* inspector/InjectedScriptHost.cpp:
(Inspector::InjectedScriptHost::wrapper):
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::subtype):
(Inspector::constructInternalProperty):
(Inspector::JSInjectedScriptHost::getInternalProperties):
(Inspector::JSInjectedScriptHost::weakMapEntries):
(Inspector::JSInjectedScriptHost::weakSetEntries):
(Inspector::JSInjectedScriptHost::iteratorEntries):
* inspector/JSJavaScriptCallFrame.cpp:
(Inspector::valueForScopeLocation):
(Inspector::JSJavaScriptCallFrame::scopeDescriptions):
(Inspector::toJS):
* inspector/ScriptCallStackFactory.cpp:
(Inspector::extractSourceInformationFromException):
(Inspector::createScriptArguments):
* interpreter/CachedCall.h:
(JSC::CachedCall::CachedCall):
* interpreter/CallFrame.h:
(JSC::ExecState::atomicStringTable const): Deleted.
(JSC::ExecState::propertyNames const): Deleted.
(JSC::ExecState::emptyList const): Deleted.
(JSC::ExecState::interpreter): Deleted.
(JSC::ExecState::heap): Deleted.
* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeProgram):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeModuleProgram):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JITOperations.cpp:
* jit/JITWorklist.cpp:
(JSC::JITWorklist::compileNow):
* jsc.cpp:
(WTF::RuntimeArray::create):
(WTF::RuntimeArray::getOwnPropertySlot):
(WTF::DOMJITGetter::DOMJITAttribute::slowCall):
(WTF::DOMJITFunctionObject::unsafeFunction):
(WTF::DOMJITCheckSubClassObject::unsafeFunction):
(GlobalObject::moduleLoaderFetch):
(functionDumpCallFrame):
(functionCreateRoot):
(functionGetElement):
(functionSetElementRoot):
(functionCreateSimpleObject):
(functionSetHiddenValue):
(functionCreateProxy):
(functionCreateImpureGetter):
(functionCreateCustomGetterObject):
(functionCreateDOMJITNodeObject):
(functionCreateDOMJITGetterObject):
(functionCreateDOMJITGetterComplexObject):
(functionCreateDOMJITFunctionObject):
(functionCreateDOMJITCheckSubClassObject):
(functionGCAndSweep):
(functionFullGC):
(functionEdenGC):
(functionHeapSize):
(functionShadowChickenFunctionsOnStack):
(functionSetGlobalConstRedeclarationShouldNotThrow):
(functionJSCOptions):
(functionFailNextNewCodeBlock):
(functionMakeMasquerader):
(functionDumpTypesForAllVariables):
(functionFindTypeForExpression):
(functionReturnTypeFor):
(functionDumpBasicBlockExecutionRanges):
(functionBasicBlockExecutionCount):
(functionDrainMicrotasks):
(functionGenerateHeapSnapshot):
(functionEnsureArrayStorage):
(functionStartSamplingProfiler):
(runInteractive):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* parser/ModuleAnalyzer.cpp:
(JSC::ModuleAnalyzer::ModuleAnalyzer):
* profiler/ProfilerBytecode.cpp:
(JSC::Profiler::Bytecode::toJS const):
* profiler/ProfilerBytecodeSequence.cpp:
(JSC::Profiler::BytecodeSequence::addSequenceProperties const):
* profiler/ProfilerBytecodes.cpp:
(JSC::Profiler::Bytecodes::toJS const):
* profiler/ProfilerCompilation.cpp:
(JSC::Profiler::Compilation::toJS const):
* profiler/ProfilerCompiledBytecode.cpp:
(JSC::Profiler::CompiledBytecode::toJS const):
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::toJS const):
* profiler/ProfilerEvent.cpp:
(JSC::Profiler::Event::toJS const):
* profiler/ProfilerOSRExit.cpp:
(JSC::Profiler::OSRExit::toJS const):
* profiler/ProfilerOrigin.cpp:
(JSC::Profiler::Origin::toJS const):
* profiler/ProfilerProfiledBytecodes.cpp:
(JSC::Profiler::ProfiledBytecodes::toJS const):
* runtime/AbstractModuleRecord.cpp:
(JSC::identifierToJSValue):
(JSC::AbstractModuleRecord::resolveExportImpl):
(JSC::getExportedNames):
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
* runtime/BooleanConstructor.cpp:
(JSC::constructBooleanFromImmediateBoolean):
* runtime/CallData.cpp:
(JSC::call):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::tryCachePutToScopeGlobal):
(JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal):
* runtime/Completion.cpp:
(JSC::checkSyntax):
(JSC::evaluate):
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
(JSC::linkAndEvaluateModule):
(JSC::importModule):
* runtime/ConstructData.cpp:
(JSC::construct):
* runtime/DatePrototype.cpp:
(JSC::dateProtoFuncToJSON):
* runtime/DirectArguments.h:
(JSC::DirectArguments::length const):
* runtime/DirectEvalExecutable.cpp:
(JSC::DirectEvalExecutable::create):
* runtime/ErrorPrototype.cpp:
(JSC::errorProtoFuncToString):
* runtime/ExceptionHelpers.cpp:
(JSC::createUndefinedVariableError):
(JSC::errorDescriptionForValue):
* runtime/FunctionConstructor.cpp:
(JSC::constructFunction):
* runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::getOwnPropertyNames):
* runtime/IdentifierInlines.h:
(JSC::Identifier::add):
* runtime/IndirectEvalExecutable.cpp:
(JSC::IndirectEvalExecutable::create):
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::finishCreation):
(JSC::InternalFunction::createSubclassStructureSlow):
* runtime/JSArray.cpp:
(JSC::JSArray::getOwnPropertySlot):
(JSC::JSArray::put):
(JSC::JSArray::deleteProperty):
(JSC::JSArray::getOwnNonIndexPropertyNames):
(JSC::JSArray::isIteratorProtocolFastAndNonObservable):
* runtime/JSArray.h:
(JSC::JSArray::shiftCountForShift):
* runtime/JSCJSValue.cpp:
(JSC::JSValue::dumpForBacktrace const):
* runtime/JSDataView.cpp:
(JSC::JSDataView::getOwnPropertySlot):
(JSC::JSDataView::deleteProperty):
(JSC::JSDataView::getOwnNonIndexPropertyNames):
* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::deleteProperty):
(JSC::JSFunction::reifyName):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* runtime/JSInternalPromise.cpp:
(JSC::JSInternalPromise::then):
* runtime/JSLexicalEnvironment.cpp:
(JSC::JSLexicalEnvironment::deleteProperty):
* runtime/JSMap.cpp:
(JSC::JSMap::isIteratorProtocolFastAndNonObservable):
* runtime/JSMapIterator.h:
(JSC::JSMapIterator::advanceIter):
* runtime/JSModuleEnvironment.cpp:
(JSC::JSModuleEnvironment::getOwnNonIndexPropertyNames):
* runtime/JSModuleLoader.cpp:
(JSC::printableModuleKey):
(JSC::JSModuleLoader::provide):
(JSC::JSModuleLoader::loadAndEvaluateModule):
(JSC::JSModuleLoader::loadModule):
(JSC::JSModuleLoader::linkAndEvaluateModule):
(JSC::JSModuleLoader::requestImportModule):
* runtime/JSModuleNamespaceObject.h:
* runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::evaluate):
* runtime/JSONObject.cpp:
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Stringifier::Holder::appendNextProperty):
* runtime/JSObject.cpp:
(JSC::JSObject::calculatedClassName):
(JSC::JSObject::putByIndex):
(JSC::JSObject::ordinaryToPrimitive const):
(JSC::JSObject::toPrimitive const):
(JSC::JSObject::hasInstance):
(JSC::JSObject::getOwnPropertyNames):
(JSC::JSObject::putDirectIndexSlowOrBeyondVectorLength):
(JSC::getCustomGetterSetterFunctionForGetterSetter):
(JSC::JSObject::getOwnPropertyDescriptor):
(JSC::JSObject::getMethod):
* runtime/JSObject.h:
(JSC::JSObject::createRawObject):
(JSC::JSFinalObject::create):
* runtime/JSObjectInlines.h:
(JSC::JSObject::canPerformFastPutInline):
(JSC::JSObject::putInlineForJSObject):
(JSC::JSObject::hasOwnProperty const):
* runtime/JSScope.cpp:
(JSC::isUnscopable):
(JSC::JSScope::resolveScopeForHoistingFuncDeclInEval):
* runtime/JSSet.cpp:
(JSC::JSSet::isIteratorProtocolFastAndNonObservable):
* runtime/JSSetIterator.h:
(JSC::JSSetIterator::advanceIter):
* runtime/JSString.cpp:
(JSC::JSString::getStringPropertyDescriptor):
* runtime/JSString.h:
(JSC::JSString::getStringPropertySlot):
* runtime/MapConstructor.cpp:
(JSC::constructMap):
* runtime/ModuleProgramExecutable.cpp:
(JSC::ModuleProgramExecutable::create):
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncToLocaleString):
* runtime/ProgramExecutable.h:
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::getOwnPropertySlot):
(JSC::RegExpObject::deleteProperty):
(JSC::RegExpObject::getOwnNonIndexPropertyNames):
(JSC::RegExpObject::getPropertyNames):
(JSC::RegExpObject::getGenericPropertyNames):
(JSC::RegExpObject::put):
* runtime/ScopedArguments.h:
(JSC::ScopedArguments::length const):
* runtime/StrictEvalActivation.h:
(JSC::StrictEvalActivation::create):
* runtime/StringObject.cpp:
(JSC::isStringOwnProperty):
(JSC::StringObject::deleteProperty):
(JSC::StringObject::getOwnNonIndexPropertyNames):
* tools/JSDollarVMPrototype.cpp:
(JSC::JSDollarVMPrototype::gc):
(JSC::JSDollarVMPrototype::edenGC):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::evaluate):
Source/WebCore:
No new tests because this is only a refactoring patch. There is no
significant behavior change.
* Modules/mediastream/SDPProcessor.cpp:
(WebCore::SDPProcessor::callScript const):
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::installReplacement):
* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCustomElementInterface.cpp:
(WebCore::constructCustomElementSynchronously):
(WebCore::JSCustomElementInterface::upgradeElement):
(WebCore::JSCustomElementInterface::invokeCallback):
* bindings/js/JSDOMConvertRecord.h:
* bindings/js/JSDOMMapLike.h:
(WebCore::forwardSizeToMapLike):
(WebCore::forwardEntriesToMapLike):
(WebCore::forwardKeysToMapLike):
(WebCore::forwardValuesToMapLike):
(WebCore::forwardGetToMapLike):
(WebCore::forwardHasToMapLike):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
(WebCore::addCrossOriginWindowOwnPropertyNames):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::reportMemoryForDocumentIfFrameless):
* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJSNewlyCreated):
* bindings/js/JSLocationCustom.cpp:
(WebCore::getOwnPropertySlotCommon):
(WebCore::putCommon):
(WebCore::addCrossOriginLocationPropertyNames):
(WebCore::addCrossOriginLocationOwnPropertyNames):
(WebCore::JSLocation::defineOwnProperty):
(WebCore::JSLocationPrototype::put):
(WebCore::JSLocationPrototype::defineOwnProperty):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSInterfaceName.cpp:
(WebCore::setJSInterfaceNameConstructor):
* bindings/scripts/test/JS/JSMapLike.cpp:
(WebCore::setJSMapLikeConstructor):
* bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
(WebCore::setJSReadOnlyMapLikeConstructor):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::setJSTestActiveDOMObjectConstructor):
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::setJSTestCEReactionsConstructor):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::setJSTestCEReactionsStringifierConstructor):
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
(WebCore::setJSTestCallTracerConstructor):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
(WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
(WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
(WebCore::setJSTestDOMJITConstructor):
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
(WebCore::setJSTestEnabledBySettingConstructor):
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::setJSTestEventConstructorConstructor):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::setJSTestEventTargetConstructor):
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::setJSTestExceptionConstructor):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::setJSTestGenerateIsReachableConstructor):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::setJSTestGlobalObjectConstructor):
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
(WebCore::setJSTestIndexedSetterNoIdentifierConstructor):
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
(WebCore::setJSTestIndexedSetterThrowingExceptionConstructor):
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
(WebCore::setJSTestIndexedSetterWithIdentifierConstructor):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::setJSTestInterfaceConstructor):
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
(WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
* bindings/scripts/test/JS/JSTestIterable.cpp:
(WebCore::setJSTestIterableConstructor):
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::setJSTestJSBuiltinConstructorConstructor):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::setJSTestMediaQueryListListenerConstructor):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
(WebCore::setJSTestNamedAndIndexedSetterNoIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
(WebCore::setJSTestNamedAndIndexedSetterThrowingExceptionConstructor):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
(WebCore::setJSTestNamedAndIndexedSetterWithIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::setJSTestNamedConstructorConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
(WebCore::setJSTestNamedDeleterNoIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
(WebCore::setJSTestNamedDeleterThrowingExceptionConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
(WebCore::setJSTestNamedDeleterWithIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
(WebCore::setJSTestNamedDeleterWithIndexedGetterConstructor):
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
(WebCore::setJSTestNamedGetterCallWithConstructor):
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
(WebCore::setJSTestNamedGetterNoIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
(WebCore::setJSTestNamedGetterWithIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
(WebCore::setJSTestNamedSetterNoIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
(WebCore::setJSTestNamedSetterThrowingExceptionConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
(WebCore::setJSTestNamedSetterWithIdentifierConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
(WebCore::setJSTestNamedSetterWithIndexedGetterConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
(WebCore::setJSTestNamedSetterWithIndexedGetterAndSetterConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
(WebCore::setJSTestNamedSetterWithOverrideBuiltinsConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
(WebCore::setJSTestNamedSetterWithUnforgablePropertiesConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
(WebCore::setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::setJSTestNodeConstructor):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjConstructor):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::setJSTestOverloadedConstructorsConstructor):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::setJSTestOverrideBuiltinsConstructor):
* bindings/scripts/test/JS/JSTestPluginInterface.cpp:
(WebCore::setJSTestPluginInterfaceConstructor):
* bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
(WebCore::setJSTestPromiseRejectionEventConstructor):
* bindings/scripts/test/JS/JSTestSerialization.cpp:
(WebCore::setJSTestSerializationConstructor):
* bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
(WebCore::setJSTestSerializationIndirectInheritanceConstructor):
* bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
(WebCore::setJSTestSerializationInheritConstructor):
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
(WebCore::setJSTestSerializationInheritFinalConstructor):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
* bindings/scripts/test/JS/JSTestStringifier.cpp:
(WebCore::setJSTestStringifierConstructor):
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
(WebCore::setJSTestStringifierAnonymousOperationConstructor):
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
(WebCore::setJSTestStringifierNamedOperationConstructor):
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
(WebCore::setJSTestStringifierOperationImplementedAsConstructor):
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
(WebCore::setJSTestStringifierOperationNamedToStringConstructor):
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
(WebCore::setJSTestStringifierReadOnlyAttributeConstructor):
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
(WebCore::setJSTestStringifierReadWriteAttributeConstructor):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::setJSTestTypedefsConstructor):
* bridge/NP_jsobject.cpp:
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_Enumerate):
* bridge/c/c_instance.cpp:
(JSC::Bindings::CRuntimeMethod::create):
* bridge/objc/WebScriptObject.mm:
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject setWebScriptValueAtIndex:value:]):
* bridge/objc/objc_instance.mm:
(ObjCRuntimeMethod::create):
* bridge/objc/objc_runtime.h:
(JSC::Bindings::ObjcFallbackObjectImp::create):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::getOwnPropertyNames):
(JSC::RuntimeArray::getOwnPropertySlot):
(JSC::RuntimeArray::put):
* bridge/runtime_array.h:
(JSC::RuntimeArray::create):
* bridge/runtime_method.cpp:
(JSC::RuntimeMethod::getOwnPropertySlot):
* bridge/runtime_method.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateCaptionContainer):
(WebCore::HTMLMediaElement::setControllerJSProperty):
(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
* testing/Internals.cpp:
(WebCore::Internals::cloneArrayBuffer):
Source/WebKit:
* WebProcess/Plugins/Netscape/JSNPMethod.h:
(WebKit::JSNPMethod::create):
* WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::NPJSObject::setProperty):
(WebKit::NPJSObject::removeProperty):
(WebKit::NPJSObject::enumerate):
Source/WebKitLegacy/mac:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::invokeDefault):
(WebKit::NetscapePluginInstanceProxy::construct):
(WebKit::NetscapePluginInstanceProxy::setProperty):
(WebKit::NetscapePluginInstanceProxy::removeProperty):
(WebKit::NetscapePluginInstanceProxy::enumerate):
* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyRuntimeMethod::create):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@221822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp b/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
index 12bc246..c39a167 100644
--- a/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
+++ b/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
@@ -138,9 +138,10 @@
static JSValue identifierToJSValue(ExecState* exec, const Identifier& identifier)
{
+ VM& vm = exec->vm();
if (identifier.isSymbol())
- return Symbol::create(exec->vm(), static_cast<SymbolImpl&>(*identifier.impl()));
- return jsString(&exec->vm(), identifier.impl());
+ return Symbol::create(vm, static_cast<SymbolImpl&>(*identifier.impl()));
+ return jsString(&vm, identifier.impl());
}
AbstractModuleRecord* AbstractModuleRecord::hostResolveImportedModule(ExecState* exec, const Identifier& moduleName)
@@ -494,7 +495,8 @@
// section 15.2.1.16.3, step 6
// If the "default" name is not resolved in the current module, we need to throw an error and stop resolution immediately,
// Rationale to this error: A default export cannot be provided by an export *.
- if (query.exportName == exec->propertyNames().defaultKeyword.impl())
+ VM& vm = exec->vm();
+ if (query.exportName == vm.propertyNames->defaultKeyword.impl())
return false;
// step 7, If exportStarSet contains module, then return null.
@@ -660,6 +662,7 @@
static void getExportedNames(ExecState* exec, AbstractModuleRecord* root, IdentifierSet& exportedNames)
{
+ VM& vm = exec->vm();
HashSet<AbstractModuleRecord*> exportStarSet;
Vector<AbstractModuleRecord*, 8> pendingModules;
@@ -673,7 +676,7 @@
for (const auto& pair : moduleRecord->exportEntries()) {
const AbstractModuleRecord::ExportEntry& exportEntry = pair.value;
- if (moduleRecord == root || exec->propertyNames().defaultKeyword != exportEntry.exportName)
+ if (moduleRecord == root || vm.propertyNames->defaultKeyword != exportEntry.exportName)
exportedNames.add(exportEntry.exportName.impl());
}
diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
index de02b7d..2e2d563 100644
--- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -410,7 +410,7 @@
// 4. Return the result of calling the [[Call]] internal method of func providing array as the this value and an empty arguments list.
if (!isJSArray(thisObject) || callType != CallType::Host || callData.native.function != arrayProtoFuncJoin) {
scope.release();
- return JSValue::encode(call(exec, function, callType, callData, thisObject, exec->emptyList()));
+ return JSValue::encode(call(exec, function, callType, callData, thisObject, *vm.emptyList));
}
ASSERT(isJSArray(thisValue));
@@ -490,7 +490,7 @@
CallData callData;
CallType callType = getCallData(conversionFunction, callData);
if (callType != CallType::None) {
- element = call(exec, conversionFunction, callType, callData, element, exec->emptyList());
+ element = call(exec, conversionFunction, callType, callData, element, *vm.emptyList);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
}
stringJoiner.append(*exec, element);
diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
index 2a5b716..97b61ba 100644
--- a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
@@ -76,8 +76,9 @@
JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSGlobalObject* globalObject, JSValue immediateBooleanValue)
{
- BooleanObject* obj = BooleanObject::create(exec->vm(), globalObject->booleanObjectStructure());
- obj->setInternalValue(exec->vm(), immediateBooleanValue);
+ VM& vm = exec->vm();
+ BooleanObject* obj = BooleanObject::create(vm, globalObject->booleanObjectStructure());
+ obj->setInternalValue(vm, immediateBooleanValue);
return obj;
}
diff --git a/Source/JavaScriptCore/runtime/CallData.cpp b/Source/JavaScriptCore/runtime/CallData.cpp
index be85971..226249e 100644
--- a/Source/JavaScriptCore/runtime/CallData.cpp
+++ b/Source/JavaScriptCore/runtime/CallData.cpp
@@ -36,8 +36,9 @@
JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
{
+ VM& vm = exec->vm();
ASSERT(callType == CallType::JS || callType == CallType::Host);
- return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args);
+ return vm.interpreter->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args);
}
JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args, NakedPtr<Exception>& returnedException)
diff --git a/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp b/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
index ffcae0c..fe753ea 100644
--- a/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
+++ b/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
@@ -235,7 +235,7 @@
JSFunction* constructor = jsCast<JSFunction*>(constructorAsObject);
auto& cacheWriteBarrier = pc[4].u.jsCell;
if (!cacheWriteBarrier)
- cacheWriteBarrier.set(exec->vm(), exec->codeBlock(), constructor);
+ cacheWriteBarrier.set(vm, exec->codeBlock(), constructor);
else if (cacheWriteBarrier.unvalidatedGet() != JSCell::seenMultipleCalleeObjects() && cacheWriteBarrier.get() != constructor)
cacheWriteBarrier.setWithoutWriteBarrier(JSCell::seenMultipleCalleeObjects());
@@ -244,7 +244,7 @@
result = constructEmptyObject(exec, structure);
} else {
// http://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor
- JSValue proto = constructorAsObject->get(exec, exec->propertyNames().prototype);
+ JSValue proto = constructorAsObject->get(exec, vm.propertyNames->prototype);
CHECK_EXCEPTION();
if (proto.isObject())
result = constructEmptyObject(exec, asObject(proto));
@@ -907,7 +907,6 @@
JSValue subscript = OP_C(4).jsValue();
if (LIKELY(baseValue.isCell() && subscript.isString())) {
- VM& vm = exec->vm();
Structure& structure = *baseValue.asCell()->structure(vm);
if (JSCell::canUseFastGetOwnProperty(structure)) {
if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
diff --git a/Source/JavaScriptCore/runtime/CommonSlowPaths.h b/Source/JavaScriptCore/runtime/CommonSlowPaths.h
index fa2824f..f4d6ebe 100644
--- a/Source/JavaScriptCore/runtime/CommonSlowPaths.h
+++ b/Source/JavaScriptCore/runtime/CommonSlowPaths.h
@@ -154,10 +154,11 @@
return;
}
- scope->structure()->didCachePropertyReplacement(exec->vm(), slot.cachedOffset());
+ VM& vm = exec->vm();
+ scope->structure()->didCachePropertyReplacement(vm, slot.cachedOffset());
ConcurrentJSLocker locker(codeBlock->m_lock);
- pc[5].u.structure.set(exec->vm(), codeBlock, scope->structure());
+ pc[5].u.structure.set(vm, codeBlock, scope->structure());
pc[6].u.operand = slot.cachedOffset();
}
}
@@ -193,7 +194,7 @@
Structure* structure = scope->structure(vm);
{
ConcurrentJSLocker locker(codeBlock->m_lock);
- pc[5].u.structure.set(exec->vm(), codeBlock, structure);
+ pc[5].u.structure.set(vm, codeBlock, structure);
pc[6].u.operand = slot.cachedOffset();
}
structure->startWatchingPropertyForReplacements(vm, slot.cachedOffset());
diff --git a/Source/JavaScriptCore/runtime/Completion.cpp b/Source/JavaScriptCore/runtime/Completion.cpp
index 7dc8935..3512e53 100644
--- a/Source/JavaScriptCore/runtime/Completion.cpp
+++ b/Source/JavaScriptCore/runtime/Completion.cpp
@@ -46,8 +46,9 @@
bool checkSyntax(ExecState* exec, const SourceCode& source, JSValue* returnedException)
{
- JSLockHolder lock(exec);
- RELEASE_ASSERT(exec->vm().atomicStringTable() == Thread::current().atomicStringTable());
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable());
ProgramExecutable* program = ProgramExecutable::create(exec, source);
JSObject* error = program->checkSyntax(exec);
@@ -99,7 +100,7 @@
if (!thisValue || thisValue.isUndefinedOrNull())
thisValue = exec->vmEntryGlobalObject();
JSObject* thisObj = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode));
- JSValue result = exec->interpreter()->executeProgram(source, exec, thisObj);
+ JSValue result = vm.interpreter->executeProgram(source, exec, thisObj);
if (scope.exception()) {
returnedException = scope.exception();
@@ -165,9 +166,10 @@
JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const String& moduleName, JSValue scriptFetcher)
{
- JSLockHolder lock(exec);
- RELEASE_ASSERT(exec->vm().atomicStringTable() == Thread::current().atomicStringTable());
- RELEASE_ASSERT(!exec->vm().isCollectorBusyOnCurrentThread());
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable());
+ RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread());
return loadAndEvaluateModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName), scriptFetcher);
}
@@ -203,9 +205,10 @@
JSInternalPromise* loadModule(ExecState* exec, const String& moduleName, JSValue scriptFetcher)
{
- JSLockHolder lock(exec);
- RELEASE_ASSERT(exec->vm().atomicStringTable() == Thread::current().atomicStringTable());
- RELEASE_ASSERT(!exec->vm().isCollectorBusyOnCurrentThread());
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable());
+ RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread());
return loadModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName), scriptFetcher);
}
@@ -232,19 +235,21 @@
JSValue linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey, JSValue scriptFetcher)
{
- JSLockHolder lock(exec);
- RELEASE_ASSERT(exec->vm().atomicStringTable() == Thread::current().atomicStringTable());
- RELEASE_ASSERT(!exec->vm().isCollectorBusyOnCurrentThread());
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable());
+ RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread());
JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
- return globalObject->moduleLoader()->linkAndEvaluateModule(exec, identifierToJSValue(exec->vm(), moduleKey), scriptFetcher);
+ return globalObject->moduleLoader()->linkAndEvaluateModule(exec, identifierToJSValue(vm, moduleKey), scriptFetcher);
}
JSInternalPromise* importModule(ExecState* exec, const Identifier& moduleKey, JSValue scriptFetcher)
{
- JSLockHolder lock(exec);
- RELEASE_ASSERT(exec->vm().atomicStringTable() == Thread::current().atomicStringTable());
- RELEASE_ASSERT(!exec->vm().isCollectorBusyOnCurrentThread());
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable());
+ RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread());
return exec->vmEntryGlobalObject()->moduleLoader()->requestImportModule(exec, moduleKey, scriptFetcher);
}
diff --git a/Source/JavaScriptCore/runtime/ConstructData.cpp b/Source/JavaScriptCore/runtime/ConstructData.cpp
index 94e672f..062e11c 100644
--- a/Source/JavaScriptCore/runtime/ConstructData.cpp
+++ b/Source/JavaScriptCore/runtime/ConstructData.cpp
@@ -51,8 +51,9 @@
JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue newTarget)
{
+ VM& vm = exec->vm();
ASSERT(constructType == ConstructType::JS || constructType == ConstructType::Host);
- return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, newTarget);
+ return vm.interpreter->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, newTarget);
}
JSObject* profiledConstruct(ExecState* exec, ProfilingReason reason, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue newTarget)
diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp
index 0cd78a6..247a899 100644
--- a/Source/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp
@@ -1168,7 +1168,7 @@
if (callType == CallType::None)
return throwVMTypeError(exec, scope, ASCIILiteral("toISOString is not a function"));
- JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList());
+ JSValue result = call(exec, asObject(toISOValue), callType, callData, object, *vm.emptyList);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
if (result.isObject())
return throwVMTypeError(exec, scope, ASCIILiteral("toISOString did not return a primitive value"));
diff --git a/Source/JavaScriptCore/runtime/DirectArguments.h b/Source/JavaScriptCore/runtime/DirectArguments.h
index 97cc2ac..81773a5 100644
--- a/Source/JavaScriptCore/runtime/DirectArguments.h
+++ b/Source/JavaScriptCore/runtime/DirectArguments.h
@@ -74,8 +74,10 @@
uint32_t length(ExecState* exec) const
{
- if (UNLIKELY(m_mappedArguments))
- return get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (UNLIKELY(m_mappedArguments)) {
+ VM& vm = exec->vm();
+ return get(exec, vm.propertyNames->length).toUInt32(exec);
+ }
return m_length;
}
diff --git a/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp b/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp
index 277ff4d..96016c0 100644
--- a/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp
+++ b/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp
@@ -46,7 +46,7 @@
return 0;
}
- auto* executable = new (NotNull, allocateCell<DirectEvalExecutable>(*exec->heap())) DirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
+ auto* executable = new (NotNull, allocateCell<DirectEvalExecutable>(vm.heap)) DirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
executable->finishCreation(vm);
ParserError error;
diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
index b685666..38777c6 100644
--- a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -85,7 +85,7 @@
return JSValue::encode(earlyReturnValue);
// 3. Let name be the result of calling the [[Get]] internal method of O with argument "name".
- JSValue name = thisObj->get(exec, exec->propertyNames().name);
+ JSValue name = thisObj->get(exec, vm.propertyNames->name);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
// 4. If name is undefined, then let name be "Error"; else let name be ToString(name).
@@ -98,7 +98,7 @@
}
// 5. Let msg be the result of calling the [[Get]] internal method of O with argument "message".
- JSValue message = thisObj->get(exec, exec->propertyNames().message);
+ JSValue message = thisObj->get(exec, vm.propertyNames->message);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
// (sic)
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
index e76d5cb..a3b4a3e 100644
--- a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -83,7 +83,8 @@
JSObject* createUndefinedVariableError(ExecState* exec, const Identifier& ident)
{
if (ident.isPrivateName()) {
- String message(makeString("Can't find private variable: @", exec->propertyNames().lookUpPublicName(ident).string()));
+ VM& vm = exec->vm();
+ String message(makeString("Can't find private variable: @", vm.propertyNames->lookUpPublicName(ident).string()));
return createReferenceError(exec, message);
}
String message(makeString("Can't find variable: ", ident.string()));
@@ -97,10 +98,11 @@
if (v.isSymbol())
return jsNontrivialString(exec, asSymbol(v)->descriptiveString());
if (v.isObject()) {
+ VM& vm = exec->vm();
CallData callData;
JSObject* object = asObject(v);
- if (object->methodTable()->getCallData(object, callData) != CallType::None)
- return exec->vm().smallStrings.functionString();
+ if (object->methodTable(vm)->getCallData(object, callData) != CallType::None)
+ return vm.smallStrings.functionString();
return jsString(exec, JSObject::calculatedClassName(object));
}
return v.toString(exec);
diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
index 7711d5e1..9496ce6 100644
--- a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -210,7 +210,8 @@
// ECMA 15.3.2 The Function Constructor
JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args, FunctionConstructionMode functionConstructionMode, JSValue newTarget)
{
- return constructFunction(exec, globalObject, args, exec->propertyNames().anonymous, exec->callerSourceOrigin(), String(), TextPosition(), functionConstructionMode, newTarget);
+ VM& vm = exec->vm();
+ return constructFunction(exec, globalObject, args, vm.propertyNames->anonymous, exec->callerSourceOrigin(), String(), TextPosition(), functionConstructionMode, newTarget);
}
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h b/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
index 0b262f6..ed4e96c 100644
--- a/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
+++ b/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
@@ -102,10 +102,11 @@
}
if (mode.includeDontEnumProperties() && !thisObject->overrodeThings()) {
- array.add(exec->propertyNames().length);
- array.add(exec->propertyNames().callee);
+ VM& vm = exec->vm();
+ array.add(vm.propertyNames->length);
+ array.add(vm.propertyNames->callee);
if (array.includeSymbolProperties())
- array.add(exec->propertyNames().iteratorSymbol);
+ array.add(vm.propertyNames->iteratorSymbol);
}
Base::getOwnPropertyNames(thisObject, exec, array, mode);
}
diff --git a/Source/JavaScriptCore/runtime/IdentifierInlines.h b/Source/JavaScriptCore/runtime/IdentifierInlines.h
index 8d9ffa6..9b226a2 100644
--- a/Source/JavaScriptCore/runtime/IdentifierInlines.h
+++ b/Source/JavaScriptCore/runtime/IdentifierInlines.h
@@ -60,7 +60,8 @@
#ifndef NDEBUG
checkCurrentAtomicStringTable(exec);
#endif
- return *AtomicStringImpl::addWithStringTableProvider(*exec, r);
+ VM& vm = exec->vm();
+ return *AtomicStringImpl::addWithStringTableProvider(vm, r);
}
inline Ref<StringImpl> Identifier::add(VM* vm, StringImpl* r)
{
diff --git a/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp b/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp
index db9269e..50ab3739 100644
--- a/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp
+++ b/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp
@@ -46,7 +46,7 @@
return 0;
}
- auto* executable = new (NotNull, allocateCell<IndirectEvalExecutable>(*exec->heap())) IndirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
+ auto* executable = new (NotNull, allocateCell<IndirectEvalExecutable>(vm.heap)) IndirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
executable->finishCreation(vm);
ParserError error;
diff --git a/Source/JavaScriptCore/runtime/InternalFunction.cpp b/Source/JavaScriptCore/runtime/InternalFunction.cpp
index 58f168e..71587a3 100644
--- a/Source/JavaScriptCore/runtime/InternalFunction.cpp
+++ b/Source/JavaScriptCore/runtime/InternalFunction.cpp
@@ -45,7 +45,7 @@
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
- ASSERT(methodTable()->getCallData != InternalFunction::info()->methodTable.getCallData);
+ ASSERT(methodTable(vm)->getCallData != InternalFunction::info()->methodTable.getCallData);
JSString* nameString = jsString(&vm, name);
m_originalName.set(vm, this, nameString);
if (nameVisibility == NameVisibility::Visible)
@@ -112,12 +112,12 @@
return structure;
// Note, Reflect.construct might cause the profile to churn but we don't care.
- JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype);
+ JSValue prototypeValue = newTarget.get(exec, vm.propertyNames->prototype);
RETURN_IF_EXCEPTION(scope, nullptr);
if (JSObject* prototype = jsDynamicCast<JSObject*>(vm, prototypeValue))
return targetFunction->rareData(vm)->createInternalFunctionAllocationStructureFromBase(vm, lexicalGlobalObject, prototype, baseClass);
} else {
- JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype);
+ JSValue prototypeValue = newTarget.get(exec, vm.propertyNames->prototype);
RETURN_IF_EXCEPTION(scope, nullptr);
if (JSObject* prototype = jsDynamicCast<JSObject*>(vm, prototypeValue)) {
// This only happens if someone Reflect.constructs our builtin constructor with another builtin constructor as the new.target.
diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp
index 8d8a6f3..9c16b28 100644
--- a/Source/JavaScriptCore/runtime/JSArray.cpp
+++ b/Source/JavaScriptCore/runtime/JSArray.cpp
@@ -243,8 +243,9 @@
bool JSArray::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
+ VM& vm = exec->vm();
JSArray* thisObject = jsCast<JSArray*>(object);
- if (propertyName == exec->propertyNames().length) {
+ if (propertyName == vm.propertyNames->length) {
unsigned attributes = thisObject->isLengthWritable() ? DontDelete | DontEnum : DontDelete | DontEnum | ReadOnly;
slot.setValue(thisObject, attributes, jsNumber(thisObject->length()));
return true;
@@ -266,7 +267,7 @@
return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
}
- if (propertyName == exec->propertyNames().length) {
+ if (propertyName == vm.propertyNames->length) {
if (!thisObject->isLengthWritable())
return false;
unsigned newLength = value.toUInt32(exec);
@@ -285,9 +286,10 @@
bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
+ VM& vm = exec->vm();
JSArray* thisObject = jsCast<JSArray*>(cell);
- if (propertyName == exec->propertyNames().length)
+ if (propertyName == vm.propertyNames->length)
return false;
return JSObject::deleteProperty(thisObject, exec, propertyName);
@@ -302,10 +304,11 @@
void JSArray::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
+ VM& vm = exec->vm();
JSArray* thisObject = jsCast<JSArray*>(object);
if (mode.includeDontEnumProperties())
- propertyNames.add(exec->propertyNames().length);
+ propertyNames.add(vm.propertyNames->length);
JSObject::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
}
@@ -1431,7 +1434,8 @@
if (structure->storedPrototype() != globalObject->arrayPrototype())
return false;
- if (getDirectOffset(globalObject->vm(), globalObject->vm().propertyNames->iteratorSymbol) != invalidOffset)
+ VM& vm = globalObject->vm();
+ if (getDirectOffset(vm, vm.propertyNames->iteratorSymbol) != invalidOffset)
return false;
return true;
diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h
index e180cd0..5eaab13 100644
--- a/Source/JavaScriptCore/runtime/JSArray.h
+++ b/Source/JavaScriptCore/runtime/JSArray.h
@@ -112,7 +112,8 @@
bool shiftCountForShift(ExecState* exec, unsigned startIndex, unsigned count)
{
- return shiftCountWithArrayStorage(exec->vm(), startIndex, count, ensureArrayStorage(exec->vm()));
+ VM& vm = exec->vm();
+ return shiftCountWithArrayStorage(vm, startIndex, count, ensureArrayStorage(vm));
}
bool shiftCountForSplice(ExecState* exec, unsigned& startIndex, unsigned count)
{
diff --git a/Source/JavaScriptCore/runtime/JSCJSValue.cpp b/Source/JavaScriptCore/runtime/JSCJSValue.cpp
index acab267..2deb8dd 100644
--- a/Source/JavaScriptCore/runtime/JSCJSValue.cpp
+++ b/Source/JavaScriptCore/runtime/JSCJSValue.cpp
@@ -299,14 +299,15 @@
else if (isDouble())
out.printf("%lf", asDouble());
else if (isCell()) {
- if (asCell()->inherits(*asCell()->vm(), JSString::info())) {
+ VM& vm = *asCell()->vm();
+ if (asCell()->inherits(vm, JSString::info())) {
JSString* string = asString(asCell());
const StringImpl* impl = string->tryGetValueImpl();
if (impl)
out.print("\"", impl, "\"");
else
out.print("(unresolved string)");
- } else if (asCell()->inherits(*asCell()->vm(), Structure::info())) {
+ } else if (asCell()->inherits(vm, Structure::info())) {
out.print("Structure[ ", asCell()->structure()->classInfo()->className);
#if USE(JSVALUE64)
out.print(" ID: ", asCell()->structureID());
diff --git a/Source/JavaScriptCore/runtime/JSDataView.cpp b/Source/JavaScriptCore/runtime/JSDataView.cpp
index f3708ba..f33257e 100644
--- a/Source/JavaScriptCore/runtime/JSDataView.cpp
+++ b/Source/JavaScriptCore/runtime/JSDataView.cpp
@@ -105,12 +105,13 @@
bool JSDataView::getOwnPropertySlot(
JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
+ VM& vm = exec->vm();
JSDataView* thisObject = jsCast<JSDataView*>(object);
- if (propertyName == exec->propertyNames().byteLength) {
+ if (propertyName == vm.propertyNames->byteLength) {
slot.setValue(thisObject, DontEnum | ReadOnly, jsNumber(thisObject->m_length));
return true;
}
- if (propertyName == exec->propertyNames().byteOffset) {
+ if (propertyName == vm.propertyNames->byteOffset) {
slot.setValue(thisObject, DontEnum | ReadOnly, jsNumber(thisObject->byteOffset()));
return true;
}
@@ -156,9 +157,10 @@
bool JSDataView::deleteProperty(
JSCell* cell, ExecState* exec, PropertyName propertyName)
{
+ VM& vm = exec->vm();
JSDataView* thisObject = jsCast<JSDataView*>(cell);
- if (propertyName == exec->propertyNames().byteLength
- || propertyName == exec->propertyNames().byteOffset)
+ if (propertyName == vm.propertyNames->byteLength
+ || propertyName == vm.propertyNames->byteOffset)
return false;
return Base::deleteProperty(thisObject, exec, propertyName);
@@ -167,11 +169,12 @@
void JSDataView::getOwnNonIndexPropertyNames(
JSObject* object, ExecState* exec, PropertyNameArray& array, EnumerationMode mode)
{
+ VM& vm = exec->vm();
JSDataView* thisObject = jsCast<JSDataView*>(object);
if (mode.includeDontEnumProperties()) {
- array.add(exec->propertyNames().byteOffset);
- array.add(exec->propertyNames().byteLength);
+ array.add(vm.propertyNames->byteOffset);
+ array.add(vm.propertyNames->byteLength);
}
Base::getOwnNonIndexPropertyNames(thisObject, exec, array, mode);
diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp
index f79c2c0..5163e8e 100644
--- a/Source/JavaScriptCore/runtime/JSFunction.cpp
+++ b/Source/JavaScriptCore/runtime/JSFunction.cpp
@@ -375,7 +375,7 @@
slot.setValue(thisObject, attributes, thisObject->getDirect(offset), offset);
}
- if (propertyName == exec->propertyNames().arguments) {
+ if (propertyName == vm.propertyNames->arguments) {
if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties())
return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
@@ -383,7 +383,7 @@
return true;
}
- if (propertyName == exec->propertyNames().caller) {
+ if (propertyName == vm.propertyNames->caller) {
if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties())
return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
@@ -487,10 +487,10 @@
// For non-host functions, don't let these properties by deleted - except by DefineOwnProperty.
FunctionExecutable* executable = thisObject->jsExecutable();
- if (propertyName == exec->propertyNames().caller || propertyName == exec->propertyNames().arguments)
+ if (propertyName == vm.propertyNames->caller || propertyName == vm.propertyNames->arguments)
return !executable->hasCallerAndArgumentsProperties();
- if (propertyName == exec->propertyNames().prototype && !executable->isArrowFunction())
+ if (propertyName == vm.propertyNames->prototype && !executable->isArrowFunction())
return false;
thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName);
@@ -649,8 +649,8 @@
// https://tc39.github.io/ecma262/#sec-exports-runtime-semantics-evaluation
// When the ident is "*default*", we need to set "default" for the ecma name.
// This "*default*" name is never shown to users.
- if (ecmaName == exec->propertyNames().builtinNames().starDefaultPrivateName())
- name = exec->propertyNames().defaultKeyword.string();
+ if (ecmaName == vm.propertyNames->builtinNames().starDefaultPrivateName())
+ name = vm.propertyNames->defaultKeyword.string();
else
name = ecmaName.string();
reifyName(vm, exec, name);
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index ce57b1a..b46819b 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -502,7 +502,7 @@
if (!eval)
return JSValue::encode(jsUndefined());
- return JSValue::encode(exec->interpreter()->execute(eval, exec, calleeGlobalObject->globalThis(), calleeGlobalObject->globalScope()));
+ return JSValue::encode(vm.interpreter->execute(eval, exec, calleeGlobalObject->globalThis(), calleeGlobalObject->globalScope()));
}
EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
diff --git a/Source/JavaScriptCore/runtime/JSInternalPromise.cpp b/Source/JavaScriptCore/runtime/JSInternalPromise.cpp
index 5d72ce3..2f60c6e 100644
--- a/Source/JavaScriptCore/runtime/JSInternalPromise.cpp
+++ b/Source/JavaScriptCore/runtime/JSInternalPromise.cpp
@@ -52,7 +52,8 @@
JSInternalPromise* JSInternalPromise::then(ExecState* exec, JSFunction* onFulfilled, JSFunction* onRejected)
{
- JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().thenPublicName()));
+ VM& vm = exec->vm();
+ JSObject* function = jsCast<JSObject*>(get(exec, vm.propertyNames->builtinNames().thenPublicName()));
CallData callData;
CallType callType = JSC::getCallData(function, callData);
ASSERT(callType != CallType::None);
diff --git a/Source/JavaScriptCore/runtime/JSLexicalEnvironment.cpp b/Source/JavaScriptCore/runtime/JSLexicalEnvironment.cpp
index 96754f0..0548a64 100644
--- a/Source/JavaScriptCore/runtime/JSLexicalEnvironment.cpp
+++ b/Source/JavaScriptCore/runtime/JSLexicalEnvironment.cpp
@@ -100,7 +100,8 @@
bool JSLexicalEnvironment::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
- if (propertyName == exec->propertyNames().arguments)
+ VM& vm = exec->vm();
+ if (propertyName == vm.propertyNames->arguments)
return false;
return Base::deleteProperty(cell, exec, propertyName);
diff --git a/Source/JavaScriptCore/runtime/JSMap.cpp b/Source/JavaScriptCore/runtime/JSMap.cpp
index 8aca572..12b7b70 100644
--- a/Source/JavaScriptCore/runtime/JSMap.cpp
+++ b/Source/JavaScriptCore/runtime/JSMap.cpp
@@ -59,7 +59,8 @@
if (structure->storedPrototype() != globalObject->mapPrototype())
return false;
- if (getDirectOffset(globalObject->vm(), globalObject->vm().propertyNames->iteratorSymbol) != invalidOffset)
+ VM& vm = globalObject->vm();
+ if (getDirectOffset(vm, vm.propertyNames->iteratorSymbol) != invalidOffset)
return false;
return true;
diff --git a/Source/JavaScriptCore/runtime/JSMapIterator.h b/Source/JavaScriptCore/runtime/JSMapIterator.h
index 576309b..66a8e3a 100644
--- a/Source/JavaScriptCore/runtime/JSMapIterator.h
+++ b/Source/JavaScriptCore/runtime/JSMapIterator.h
@@ -56,14 +56,15 @@
HashMapBucketType* prev = m_iter.get();
if (!prev)
return nullptr;
+ VM& vm = exec->vm();
HashMapBucketType* bucket = m_iter->next();
while (bucket && bucket->deleted())
bucket = bucket->next();
if (!bucket) {
- setIterator(exec->vm(), nullptr);
+ setIterator(vm, nullptr);
return nullptr;
}
- setIterator(exec->vm(), bucket); // We keep m_iter on the last value since the first thing we do in this function is call next().
+ setIterator(vm, bucket); // We keep m_iter on the last value since the first thing we do in this function is call next().
return bucket;
}
bool next(ExecState* exec, JSValue& value)
diff --git a/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp b/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
index f996209..119d699 100644
--- a/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
+++ b/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
@@ -102,9 +102,10 @@
{
JSModuleEnvironment* thisObject = jsCast<JSModuleEnvironment*>(cell);
if (propertyNamesArray.includeStringProperties()) {
+ VM& vm = exec->vm();
for (const auto& pair : thisObject->moduleRecord()->importEntries()) {
const AbstractModuleRecord::ImportEntry& importEntry = pair.value;
- if (!importEntry.isNamespace(exec->vm()))
+ if (!importEntry.isNamespace(vm))
propertyNamesArray.add(importEntry.localName);
}
}
diff --git a/Source/JavaScriptCore/runtime/JSModuleLoader.cpp b/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
index 950728e..7d2a4f0 100644
--- a/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
+++ b/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
@@ -72,15 +72,16 @@
static String printableModuleKey(ExecState* exec, JSValue key)
{
+ VM& vm = exec->vm();
if (key.isString() || key.isSymbol())
return key.toPropertyKey(exec).impl();
- return exec->propertyNames().emptyIdentifier.impl();
+ return vm.propertyNames->emptyIdentifier.impl();
}
JSValue JSModuleLoader::provide(ExecState* exec, JSValue key, Status status, const SourceCode& sourceCode)
{
VM& vm = exec->vm();
- JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().providePublicName()));
+ JSObject* function = jsCast<JSObject*>(get(exec, vm.propertyNames->builtinNames().providePublicName()));
CallData callData;
CallType callType = JSC::getCallData(function, callData);
ASSERT(callType != CallType::None);
@@ -96,7 +97,8 @@
JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue referrer, JSValue scriptFetcher)
{
- JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().loadAndEvaluateModulePublicName()));
+ VM& vm = exec->vm();
+ JSObject* function = jsCast<JSObject*>(get(exec, vm.propertyNames->builtinNames().loadAndEvaluateModulePublicName()));
CallData callData;
CallType callType = JSC::getCallData(function, callData);
ASSERT(callType != CallType::None);
@@ -111,7 +113,8 @@
JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue referrer, JSValue scriptFetcher)
{
- JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().loadModulePublicName()));
+ VM& vm = exec->vm();
+ JSObject* function = jsCast<JSObject*>(get(exec, vm.propertyNames->builtinNames().loadModulePublicName()));
CallData callData;
CallType callType = JSC::getCallData(function, callData);
ASSERT(callType != CallType::None);
@@ -126,7 +129,8 @@
JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey, JSValue scriptFetcher)
{
- JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().linkAndEvaluateModulePublicName()));
+ VM& vm = exec->vm();
+ JSObject* function = jsCast<JSObject*>(get(exec, vm.propertyNames->builtinNames().linkAndEvaluateModulePublicName()));
CallData callData;
CallType callType = JSC::getCallData(function, callData);
ASSERT(callType != CallType::None);
@@ -140,7 +144,8 @@
JSInternalPromise* JSModuleLoader::requestImportModule(ExecState* exec, const Identifier& moduleKey, JSValue scriptFetcher)
{
- auto* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().requestImportModulePublicName()));
+ VM& vm = exec->vm();
+ auto* function = jsCast<JSObject*>(get(exec, vm.propertyNames->builtinNames().requestImportModulePublicName()));
CallData callData;
auto callType = JSC::getCallData(function, callData);
ASSERT(callType != CallType::None);
diff --git a/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h b/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h
index 17e4846..6c28b66 100644
--- a/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h
+++ b/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h
@@ -37,11 +37,12 @@
static JSModuleNamespaceObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, AbstractModuleRecord* moduleRecord, Vector<std::pair<Identifier, AbstractModuleRecord::Resolution>>&& resolutions)
{
+ VM& vm = exec->vm();
JSModuleNamespaceObject* object =
new (
NotNull,
- allocateCell<JSModuleNamespaceObject>(exec->vm().heap, JSModuleNamespaceObject::allocationSize(resolutions.size())))
- JSModuleNamespaceObject(exec->vm(), structure);
+ allocateCell<JSModuleNamespaceObject>(vm.heap, JSModuleNamespaceObject::allocationSize(resolutions.size())))
+ JSModuleNamespaceObject(vm, structure);
object->finishCreation(exec, globalObject, moduleRecord, WTFMove(resolutions));
return object;
}
diff --git a/Source/JavaScriptCore/runtime/JSModuleRecord.cpp b/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
index abe9958..990ae82 100644
--- a/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
+++ b/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
@@ -205,9 +205,10 @@
{
if (!m_moduleProgramExecutable)
return jsUndefined();
+ VM& vm = exec->vm();
ModuleProgramExecutable* executable = m_moduleProgramExecutable.get();
m_moduleProgramExecutable.clear();
- return exec->interpreter()->executeModuleProgram(executable, exec, m_moduleEnvironment.get());
+ return vm.interpreter->executeModuleProgram(executable, exec, m_moduleEnvironment.get());
}
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp
index 02f3d67..0cf361f 100644
--- a/Source/JavaScriptCore/runtime/JSONObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSONObject.cpp
@@ -259,7 +259,7 @@
return;
}
- m_replacerCallType = m_replacer.asObject()->methodTable()->getCallData(m_replacer.asObject().get(), m_replacerCallData);
+ m_replacerCallType = m_replacer.asObject()->methodTable(vm)->getCallData(m_replacer.asObject().get(), m_replacerCallData);
}
Local<Unknown> Stringifier::stringify(Handle<Unknown> value)
@@ -378,7 +378,7 @@
JSObject* object = asObject(value);
CallData callData;
- if (object->methodTable()->getCallData(object, callData) != CallType::None) {
+ if (object->methodTable(vm)->getCallData(object, callData) != CallType::None) {
if (holder.isArray()) {
builder.appendLiteral("null");
return StringifySucceeded;
@@ -485,7 +485,7 @@
m_propertyNames = stringifier.m_arrayReplacerPropertyNames.data();
else {
PropertyNameArray objectPropertyNames(exec, PropertyNameMode::Strings);
- m_object->methodTable()->getOwnPropertyNames(m_object.get(), exec, objectPropertyNames, EnumerationMode());
+ m_object->methodTable(vm)->getOwnPropertyNames(m_object.get(), exec, objectPropertyNames, EnumerationMode());
RETURN_IF_EXCEPTION(scope, false);
m_propertyNames = objectPropertyNames.releaseData();
}
@@ -515,7 +515,7 @@
value = asArray(m_object.get())->getIndexQuickly(index);
else {
PropertySlot slot(m_object.get(), PropertySlot::InternalMethodType::Get);
- if (m_object->methodTable()->getOwnPropertySlotByIndex(m_object.get(), exec, index, slot))
+ if (m_object->methodTable(vm)->getOwnPropertySlotByIndex(m_object.get(), exec, index, slot))
value = slot.getValue(exec, index);
else
value = jsUndefined();
@@ -534,7 +534,7 @@
// Get the value.
PropertySlot slot(m_object.get(), PropertySlot::InternalMethodType::Get);
Identifier& propertyName = m_propertyNames->propertyNameVector()[index];
- if (!m_object->methodTable()->getOwnPropertySlot(m_object.get(), exec, propertyName, slot))
+ if (!m_object->methodTable(vm)->getOwnPropertySlot(m_object.get(), exec, propertyName, slot))
return true;
JSValue value = slot.getValue(exec, propertyName);
RETURN_IF_EXCEPTION(scope, false);
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp
index 031c0c62..95c15cf 100644
--- a/Source/JavaScriptCore/runtime/JSObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -533,7 +533,7 @@
ExecState* exec = globalObject->globalExec();
PropertySlot slot(object->getPrototypeDirect(), PropertySlot::InternalMethodType::VMInquiry);
- PropertyName constructor(exec->propertyNames().constructor);
+ PropertyName constructor(vm.propertyNames->constructor);
if (object->getPropertySlot(exec, constructor, slot)) {
if (slot.isValue()) {
JSValue constructorValue = slot.getValue(exec, constructor);
@@ -554,7 +554,7 @@
scope.clearException();
if (prototypeFunctionName.isNull() || prototypeFunctionName == "Object") {
- String tableClassName = object->methodTable()->className(object);
+ String tableClassName = object->methodTable(vm)->className(object);
if (!tableClassName.isNull() && tableClassName != "Object")
return tableClassName;
@@ -817,6 +817,7 @@
bool JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
{
+ VM& vm = exec->vm();
JSObject* thisObject = jsCast<JSObject*>(cell);
if (propertyName > MAX_ARRAY_INDEX) {
@@ -829,14 +830,14 @@
break;
case ALL_UNDECIDED_INDEXING_TYPES: {
- thisObject->convertUndecidedForValue(exec->vm(), value);
+ thisObject->convertUndecidedForValue(vm, value);
// Reloop.
return putByIndex(cell, exec, propertyName, value, shouldThrow);
}
case ALL_INT32_INDEXING_TYPES: {
if (!value.isInt32()) {
- thisObject->convertInt32ForValue(exec->vm(), value);
+ thisObject->convertInt32ForValue(vm, value);
return putByIndex(cell, exec, propertyName, value, shouldThrow);
}
FALLTHROUGH;
@@ -846,7 +847,7 @@
Butterfly* butterfly = thisObject->butterfly();
if (propertyName >= butterfly->vectorLength())
break;
- butterfly->contiguous()[propertyName].set(exec->vm(), thisObject, value);
+ butterfly->contiguous()[propertyName].set(vm, thisObject, value);
if (propertyName >= butterfly->publicLength())
butterfly->setPublicLength(propertyName + 1);
return true;
@@ -854,13 +855,13 @@
case ALL_DOUBLE_INDEXING_TYPES: {
if (!value.isNumber()) {
- thisObject->convertDoubleToContiguous(exec->vm());
+ thisObject->convertDoubleToContiguous(vm);
// Reloop.
return putByIndex(cell, exec, propertyName, value, shouldThrow);
}
double valueAsDouble = value.asNumber();
if (valueAsDouble != valueAsDouble) {
- thisObject->convertDoubleToContiguous(exec->vm());
+ thisObject->convertDoubleToContiguous(vm);
// Reloop.
return putByIndex(cell, exec, propertyName, value, shouldThrow);
}
@@ -891,7 +892,7 @@
} else if (!valueSlot)
++storage->m_numValuesInVector;
- valueSlot.set(exec->vm(), thisObject, value);
+ valueSlot.set(vm, thisObject, value);
return true;
}
@@ -920,7 +921,7 @@
++storage->m_numValuesInVector;
}
- valueSlot.set(exec->vm(), thisObject, value);
+ valueSlot.set(vm, thisObject, value);
return true;
}
@@ -1945,20 +1946,20 @@
JSValue value;
if (hint == PreferString) {
- value = callToPrimitiveFunction(exec, this, exec->propertyNames().toString, hint);
+ value = callToPrimitiveFunction(exec, this, vm.propertyNames->toString, hint);
ASSERT(!scope.exception() || scope.exception() == value.asCell());
if (value)
return value;
- value = callToPrimitiveFunction(exec, this, exec->propertyNames().valueOf, hint);
+ value = callToPrimitiveFunction(exec, this, vm.propertyNames->valueOf, hint);
ASSERT(!scope.exception() || scope.exception() == value.asCell());
if (value)
return value;
} else {
- value = callToPrimitiveFunction(exec, this, exec->propertyNames().valueOf, hint);
+ value = callToPrimitiveFunction(exec, this, vm.propertyNames->valueOf, hint);
ASSERT(!scope.exception() || scope.exception() == value.asCell());
if (value)
return value;
- value = callToPrimitiveFunction(exec, this, exec->propertyNames().toString, hint);
+ value = callToPrimitiveFunction(exec, this, vm.propertyNames->toString, hint);
ASSERT(!scope.exception() || scope.exception() == value.asCell());
if (value)
return value;
@@ -1979,12 +1980,12 @@
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- JSValue value = callToPrimitiveFunction<TypeHintMode::TakesHint>(exec, this, exec->propertyNames().toPrimitiveSymbol, preferredType);
+ JSValue value = callToPrimitiveFunction<TypeHintMode::TakesHint>(exec, this, vm.propertyNames->toPrimitiveSymbol, preferredType);
RETURN_IF_EXCEPTION(scope, { });
if (value)
return value;
- return this->methodTable(exec->vm())->defaultValue(this, exec, preferredType);
+ return this->methodTable(vm)->defaultValue(this, exec, preferredType);
}
bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const
@@ -2043,7 +2044,7 @@
TypeInfo info = structure(vm)->typeInfo();
if (info.implementsDefaultHasInstance()) {
- JSValue prototype = get(exec, exec->propertyNames().prototype);
+ JSValue prototype = get(exec, vm.propertyNames->prototype);
RETURN_IF_EXCEPTION(scope, false);
return defaultHasInstance(exec, value, prototype);
}
@@ -2057,7 +2058,7 @@
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- JSValue hasInstanceValue = get(exec, exec->propertyNames().hasInstanceSymbol);
+ JSValue hasInstanceValue = get(exec, vm.propertyNames->hasInstanceSymbol);
RETURN_IF_EXCEPTION(scope, false);
return hasInstance(exec, value, hasInstanceValue);
@@ -2127,9 +2128,10 @@
void JSObject::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
+ VM& vm = exec->vm();
if (!mode.includeJSObjectProperties()) {
// We still have to get non-indexed properties from any subclasses of JSObject that have them.
- object->methodTable(exec->vm())->getOwnNonIndexPropertyNames(object, exec, propertyNames, mode);
+ object->methodTable(vm)->getOwnNonIndexPropertyNames(object, exec, propertyNames, mode);
return;
}
@@ -2198,7 +2200,7 @@
}
}
- object->methodTable(exec->vm())->getOwnNonIndexPropertyNames(object, exec, propertyNames, mode);
+ object->methodTable(vm)->getOwnNonIndexPropertyNames(object, exec, propertyNames, mode);
}
void JSObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
@@ -2862,7 +2864,7 @@
}
case ALL_UNDECIDED_INDEXING_TYPES: {
- convertUndecidedForValue(exec->vm(), value);
+ convertUndecidedForValue(vm, value);
// Reloop.
return putDirectIndex(exec, i, value, attributes, mode);
}
@@ -3211,11 +3213,12 @@
static JSCustomGetterSetterFunction* getCustomGetterSetterFunctionForGetterSetter(ExecState* exec, PropertyName propertyName, CustomGetterSetter* getterSetter, JSCustomGetterSetterFunction::Type type)
{
+ VM& vm = exec->vm();
auto key = std::make_pair(getterSetter, (int)type);
- JSCustomGetterSetterFunction* customGetterSetterFunction = exec->vm().customGetterSetterFunctionMap.get(key);
+ JSCustomGetterSetterFunction* customGetterSetterFunction = vm.customGetterSetterFunctionMap.get(key);
if (!customGetterSetterFunction) {
- customGetterSetterFunction = JSCustomGetterSetterFunction::create(exec->vm(), exec->lexicalGlobalObject(), getterSetter, type, propertyName.publicName());
- exec->vm().customGetterSetterFunctionMap.set(key, customGetterSetterFunction);
+ customGetterSetterFunction = JSCustomGetterSetterFunction::create(vm, exec->lexicalGlobalObject(), getterSetter, type, propertyName.publicName());
+ vm.customGetterSetterFunctionMap.set(key, customGetterSetterFunction);
}
return customGetterSetterFunction;
}
@@ -3253,10 +3256,10 @@
if (slot.isCustomAccessor())
getterSetter = slot.customGetterSetter();
else {
- JSValue maybeGetterSetter = thisObject->getDirect(exec->vm(), propertyName);
+ JSValue maybeGetterSetter = thisObject->getDirect(vm, propertyName);
if (!maybeGetterSetter) {
thisObject->reifyAllStaticProperties(exec);
- maybeGetterSetter = thisObject->getDirect(exec->vm(), propertyName);
+ maybeGetterSetter = thisObject->getDirect(vm, propertyName);
}
ASSERT(maybeGetterSetter);
@@ -3622,7 +3625,7 @@
return jsUndefined();
}
- callType = method.asCell()->methodTable()->getCallData(method.asCell(), callData);
+ callType = method.asCell()->methodTable(vm)->getCallData(method.asCell(), callData);
if (callType == CallType::None) {
throwVMTypeError(exec, scope, errorMessage);
return jsUndefined();
diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h
index 968c54a..4be8636 100644
--- a/Source/JavaScriptCore/runtime/JSObject.h
+++ b/Source/JavaScriptCore/runtime/JSObject.h
@@ -1004,7 +1004,7 @@
template<PutMode>
bool putDirectInternal(VM&, PropertyName, JSValue, unsigned attr, PutPropertySlot&);
- bool canPerformFastPutInline(ExecState* exec, VM&, PropertyName);
+ bool canPerformFastPutInline(VM&, PropertyName);
JS_EXPORT_PRIVATE NEVER_INLINE bool putInlineSlow(ExecState*, PropertyName, JSValue, PutPropertySlot&);
@@ -1147,28 +1147,30 @@
inline JSObject* JSObject::createRawObject(
ExecState* exec, Structure* structure, Butterfly* butterfly)
{
+ VM& vm = exec->vm();
JSObject* finalObject = new (
NotNull,
allocateCell<JSFinalObject>(
- *exec->heap(),
+ vm.heap,
JSFinalObject::allocationSize(structure->inlineCapacity())
)
- ) JSObject(exec->vm(), structure, butterfly);
- finalObject->finishCreation(exec->vm());
+ ) JSObject(vm, structure, butterfly);
+ finalObject->finishCreation(vm);
return finalObject;
}
inline JSFinalObject* JSFinalObject::create(
ExecState* exec, Structure* structure, Butterfly* butterfly)
{
+ VM& vm = exec->vm();
JSFinalObject* finalObject = new (
NotNull,
allocateCell<JSFinalObject>(
- *exec->heap(),
+ vm.heap,
allocationSize(structure->inlineCapacity())
)
- ) JSFinalObject(exec->vm(), structure, butterfly);
- finalObject->finishCreation(exec->vm());
+ ) JSFinalObject(vm, structure, butterfly);
+ finalObject->finishCreation(vm);
return finalObject;
}
diff --git a/Source/JavaScriptCore/runtime/JSObjectInlines.h b/Source/JavaScriptCore/runtime/JSObjectInlines.h
index f49a302..e48e9b9 100644
--- a/Source/JavaScriptCore/runtime/JSObjectInlines.h
+++ b/Source/JavaScriptCore/runtime/JSObjectInlines.h
@@ -60,9 +60,9 @@
}
}
-ALWAYS_INLINE bool JSObject::canPerformFastPutInline(ExecState* exec, VM& vm, PropertyName propertyName)
+ALWAYS_INLINE bool JSObject::canPerformFastPutInline(VM& vm, PropertyName propertyName)
{
- if (UNLIKELY(propertyName == exec->propertyNames().underscoreProto))
+ if (UNLIKELY(propertyName == vm.propertyNames->underscoreProto))
return false;
// Check if there are any setters or getters in the prototype chain
@@ -211,7 +211,7 @@
if (std::optional<uint32_t> index = parseIndex(propertyName))
return putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode());
- if (thisObject->canPerformFastPutInline(exec, vm, propertyName)) {
+ if (thisObject->canPerformFastPutInline(vm, propertyName)) {
ASSERT(!thisObject->structure(vm)->prototypeChainMayInterceptStoreTo(vm, propertyName));
if (!thisObject->putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot))
return typeError(exec, scope, slot.isStrictMode(), ASCIILiteral(ReadonlyPropertyWriteError));
@@ -226,10 +226,11 @@
// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty
ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName, PropertySlot& slot) const
{
+ VM& vm = exec->vm();
ASSERT(slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty);
- if (LIKELY(const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot == JSObject::getOwnPropertySlot))
+ if (LIKELY(const_cast<JSObject*>(this)->methodTable(vm)->getOwnPropertySlot == JSObject::getOwnPropertySlot))
return JSObject::getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
- return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
+ return const_cast<JSObject*>(this)->methodTable(vm)->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
}
ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const
diff --git a/Source/JavaScriptCore/runtime/JSScope.cpp b/Source/JavaScriptCore/runtime/JSScope.cpp
index 6bd82cf..36dead5 100644
--- a/Source/JavaScriptCore/runtime/JSScope.cpp
+++ b/Source/JavaScriptCore/runtime/JSScope.cpp
@@ -201,7 +201,7 @@
if (scope->type() != WithScopeType)
return false;
- JSValue unscopables = object->get(exec, exec->propertyNames().unscopablesSymbol);
+ JSValue unscopables = object->get(exec, vm.propertyNames->unscopablesSymbol);
RETURN_IF_EXCEPTION(throwScope, false);
if (!unscopables.isObject())
return false;
@@ -258,6 +258,7 @@
JSValue JSScope::resolveScopeForHoistingFuncDeclInEval(ExecState* exec, JSScope* scope, const Identifier& ident)
{
+ VM& vm = exec->vm();
auto returnPredicate = [&] (JSScope* scope) -> bool {
return scope->isVarScope();
};
@@ -267,8 +268,8 @@
JSObject* object = resolve(exec, scope, ident, returnPredicate, skipPredicate);
bool result = false;
- if (JSScope* scope = jsDynamicCast<JSScope*>(exec->vm(), object)) {
- if (SymbolTable* scopeSymbolTable = scope->symbolTable(exec->vm())) {
+ if (JSScope* scope = jsDynamicCast<JSScope*>(vm, object)) {
+ if (SymbolTable* scopeSymbolTable = scope->symbolTable(vm)) {
result = scope->isGlobalObject()
? JSObject::isExtensible(object, exec)
: scopeSymbolTable->scopeType() == SymbolTable::ScopeType::VarScope;
diff --git a/Source/JavaScriptCore/runtime/JSSet.cpp b/Source/JavaScriptCore/runtime/JSSet.cpp
index e4f4a16..abee613 100644
--- a/Source/JavaScriptCore/runtime/JSSet.cpp
+++ b/Source/JavaScriptCore/runtime/JSSet.cpp
@@ -59,7 +59,8 @@
if (structure->storedPrototype() != globalObject->jsSetPrototype())
return false;
- if (getDirectOffset(globalObject->vm(), globalObject->vm().propertyNames->iteratorSymbol) != invalidOffset)
+ VM& vm = globalObject->vm();
+ if (getDirectOffset(vm, vm.propertyNames->iteratorSymbol) != invalidOffset)
return false;
return true;
diff --git a/Source/JavaScriptCore/runtime/JSSetIterator.h b/Source/JavaScriptCore/runtime/JSSetIterator.h
index 051a989..bd33705 100644
--- a/Source/JavaScriptCore/runtime/JSSetIterator.h
+++ b/Source/JavaScriptCore/runtime/JSSetIterator.h
@@ -56,14 +56,15 @@
HashMapBucketType* prev = m_iter.get();
if (!prev)
return nullptr;
+ VM& vm = exec->vm();
HashMapBucketType* bucket = m_iter->next();
while (bucket && bucket->deleted())
bucket = bucket->next();
if (!bucket) {
- setIterator(exec->vm(), nullptr);
+ setIterator(vm, nullptr);
return nullptr;
}
- setIterator(exec->vm(), bucket); // We keep m_iter on the last value since the first thing we do in this function is call next().
+ setIterator(vm, bucket); // We keep m_iter on the last value since the first thing we do in this function is call next().
return bucket;
}
diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp
index 04969f3..d87c6ed 100644
--- a/Source/JavaScriptCore/runtime/JSString.cpp
+++ b/Source/JavaScriptCore/runtime/JSString.cpp
@@ -442,7 +442,8 @@
bool JSString::getStringPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
- if (propertyName == exec->propertyNames().length) {
+ VM& vm = exec->vm();
+ if (propertyName == vm.propertyNames->length) {
descriptor.setDescriptor(jsNumber(length()), DontEnum | DontDelete | ReadOnly);
return true;
}
diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h
index e604184..cf52d07 100644
--- a/Source/JavaScriptCore/runtime/JSString.h
+++ b/Source/JavaScriptCore/runtime/JSString.h
@@ -669,7 +669,8 @@
ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
- if (propertyName == exec->propertyNames().length) {
+ VM& vm = exec->vm();
+ if (propertyName == vm.propertyNames->length) {
slot.setValue(this, DontEnum | DontDelete | ReadOnly, jsNumber(length()));
return true;
}
diff --git a/Source/JavaScriptCore/runtime/MapConstructor.cpp b/Source/JavaScriptCore/runtime/MapConstructor.cpp
index 7985083..0a50770 100644
--- a/Source/JavaScriptCore/runtime/MapConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/MapConstructor.cpp
@@ -76,7 +76,7 @@
JSMap* map = JSMap::create(exec, vm, mapStructure);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- JSValue adderFunction = map->JSObject::get(exec, exec->propertyNames().set);
+ JSValue adderFunction = map->JSObject::get(exec, vm.propertyNames->set);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
CallData adderFunctionCallData;
diff --git a/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp b/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
index b55e83f..d4e8306 100644
--- a/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
+++ b/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
@@ -58,7 +58,7 @@
auto scope = DECLARE_THROW_SCOPE(vm);
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- ModuleProgramExecutable* executable = new (NotNull, allocateCell<ModuleProgramExecutable>(*exec->heap())) ModuleProgramExecutable(exec, source);
+ ModuleProgramExecutable* executable = new (NotNull, allocateCell<ModuleProgramExecutable>(vm.heap)) ModuleProgramExecutable(exec, source);
executable->finishCreation(exec->vm());
ParserError error;
diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
index 66c488e..aa350fb 100644
--- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -306,7 +306,7 @@
// Return the result of calling the [[Call]] internal method of toString passing the this value and no arguments.
scope.release();
- return JSValue::encode(call(exec, toString, callType, callData, thisValue, exec->emptyList()));
+ return JSValue::encode(call(exec, toString, callType, callData, thisValue, *vm.emptyList));
}
EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
diff --git a/Source/JavaScriptCore/runtime/ProgramExecutable.h b/Source/JavaScriptCore/runtime/ProgramExecutable.h
index b67fe82..d17482a 100644
--- a/Source/JavaScriptCore/runtime/ProgramExecutable.h
+++ b/Source/JavaScriptCore/runtime/ProgramExecutable.h
@@ -37,8 +37,9 @@
static ProgramExecutable* create(ExecState* exec, const SourceCode& source)
{
- ProgramExecutable* executable = new (NotNull, allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source);
- executable->finishCreation(exec->vm());
+ VM& vm = exec->vm();
+ ProgramExecutable* executable = new (NotNull, allocateCell<ProgramExecutable>(vm.heap)) ProgramExecutable(exec, source);
+ executable->finishCreation(vm);
return executable;
}
diff --git a/Source/JavaScriptCore/runtime/RegExpObject.cpp b/Source/JavaScriptCore/runtime/RegExpObject.cpp
index 8de93b0..af69849 100644
--- a/Source/JavaScriptCore/runtime/RegExpObject.cpp
+++ b/Source/JavaScriptCore/runtime/RegExpObject.cpp
@@ -62,7 +62,8 @@
bool RegExpObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
- if (propertyName == exec->propertyNames().lastIndex) {
+ VM& vm = exec->vm();
+ if (propertyName == vm.propertyNames->lastIndex) {
RegExpObject* regExp = asRegExpObject(object);
unsigned attributes = regExp->m_lastIndexIsWritable ? DontDelete | DontEnum : DontDelete | DontEnum | ReadOnly;
slot.setValue(regExp, attributes, regExp->getLastIndex());
@@ -73,29 +74,33 @@
bool RegExpObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
- if (propertyName == exec->propertyNames().lastIndex)
+ VM& vm = exec->vm();
+ if (propertyName == vm.propertyNames->lastIndex)
return false;
return Base::deleteProperty(cell, exec, propertyName);
}
void RegExpObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
+ VM& vm = exec->vm();
if (mode.includeDontEnumProperties())
- propertyNames.add(exec->propertyNames().lastIndex);
+ propertyNames.add(vm.propertyNames->lastIndex);
Base::getOwnNonIndexPropertyNames(object, exec, propertyNames, mode);
}
void RegExpObject::getPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
+ VM& vm = exec->vm();
if (mode.includeDontEnumProperties())
- propertyNames.add(exec->propertyNames().lastIndex);
+ propertyNames.add(vm.propertyNames->lastIndex);
Base::getPropertyNames(object, exec, propertyNames, mode);
}
void RegExpObject::getGenericPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
+ VM& vm = exec->vm();
if (mode.includeDontEnumProperties())
- propertyNames.add(exec->propertyNames().lastIndex);
+ propertyNames.add(vm.propertyNames->lastIndex);
Base::getGenericPropertyNames(object, exec, propertyNames, mode);
}
@@ -144,12 +149,13 @@
bool RegExpObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
+ VM& vm = exec->vm();
RegExpObject* thisObject = jsCast<RegExpObject*>(cell);
if (UNLIKELY(isThisValueAltered(slot, thisObject)))
return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
- if (propertyName == exec->propertyNames().lastIndex) {
+ if (propertyName == vm.propertyNames->lastIndex) {
bool result = asRegExpObject(cell)->setLastIndex(exec, value, slot.isStrictMode());
slot.setCustomValue(asRegExpObject(cell), slot.isStrictMode()
? regExpObjectSetLastIndexStrict
diff --git a/Source/JavaScriptCore/runtime/ScopedArguments.h b/Source/JavaScriptCore/runtime/ScopedArguments.h
index 53e2738..3900847 100644
--- a/Source/JavaScriptCore/runtime/ScopedArguments.h
+++ b/Source/JavaScriptCore/runtime/ScopedArguments.h
@@ -72,8 +72,9 @@
uint32_t length(ExecState* exec) const
{
+ VM& vm = exec->vm();
if (UNLIKELY(m_overrodeThings))
- return get(exec, exec->propertyNames().length).toUInt32(exec);
+ return get(exec, vm.propertyNames->length).toUInt32(exec);
return internalLength();
}
diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.h b/Source/JavaScriptCore/runtime/StrictEvalActivation.h
index d800e96..b1a5f9e 100644
--- a/Source/JavaScriptCore/runtime/StrictEvalActivation.h
+++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.h
@@ -36,8 +36,9 @@
static StrictEvalActivation* create(ExecState* exec, JSScope* currentScope)
{
- StrictEvalActivation* lexicalEnvironment = new (NotNull, allocateCell<StrictEvalActivation>(*exec->heap())) StrictEvalActivation(exec, currentScope);
- lexicalEnvironment->finishCreation(exec->vm());
+ VM& vm = exec->vm();
+ StrictEvalActivation* lexicalEnvironment = new (NotNull, allocateCell<StrictEvalActivation>(vm.heap)) StrictEvalActivation(exec, currentScope);
+ lexicalEnvironment->finishCreation(vm);
return lexicalEnvironment;
}
diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp
index 7ef3745..6332c11 100644
--- a/Source/JavaScriptCore/runtime/StringObject.cpp
+++ b/Source/JavaScriptCore/runtime/StringObject.cpp
@@ -96,7 +96,8 @@
static bool isStringOwnProperty(ExecState* exec, StringObject* object, PropertyName propertyName)
{
- if (propertyName == exec->propertyNames().length)
+ VM& vm = exec->vm();
+ if (propertyName == vm.propertyNames->length)
return true;
if (std::optional<uint32_t> index = parseIndex(propertyName)) {
if (object->internalValue()->canGetIndex(index.value()))
@@ -132,8 +133,9 @@
bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
+ VM& vm = exec->vm();
StringObject* thisObject = jsCast<StringObject*>(cell);
- if (propertyName == exec->propertyNames().length)
+ if (propertyName == vm.propertyNames->length)
return false;
std::optional<uint32_t> index = parseIndex(propertyName);
if (index && thisObject->internalValue()->canGetIndex(index.value()))
@@ -162,9 +164,10 @@
void StringObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
+ VM& vm = exec->vm();
StringObject* thisObject = jsCast<StringObject*>(object);
if (mode.includeDontEnumProperties())
- propertyNames.add(exec->propertyNames().length);
+ propertyNames.add(vm.propertyNames->length);
return JSObject::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
}