Create a RELEASE_AND_RETURN macro for ExceptionScopes
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2018 23:23:08 +0000 (23:23 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2018 23:23:08 +0000 (23:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190163

Reviewed by Mark Lam.

The new RELEASE_AND_RETURN does all the work for cases
where you want to return the result of some expression
without explicitly checking for an exception. This is
much like the existing RETURN_IF_EXCEPTION macro.

Source/JavaScriptCore:

* dfg/DFGOperations.cpp:
(JSC::DFG::newTypedArrayWithSize):
* interpreter/Interpreter.cpp:
(JSC::eval):
* jit/JITOperations.cpp:
(JSC::getByVal):
* jsc.cpp:
(functionDollarAgentReceiveBroadcast):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::setUpCall):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::varargsSetup):
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::toJSON const):
* runtime/AbstractModuleRecord.cpp:
(JSC::AbstractModuleRecord::hostResolveImportedModule):
* runtime/ArrayConstructor.cpp:
(JSC::constructArrayWithSizeQuirk):
* runtime/ArrayPrototype.cpp:
(JSC::getProperty):
(JSC::fastJoin):
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoPrivateFuncConcatMemcpy):
* runtime/BigIntConstructor.cpp:
(JSC::toBigInt):
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::opInByVal):
* runtime/ConstructData.cpp:
(JSC::construct):
* runtime/DateConstructor.cpp:
(JSC::dateParse):
* runtime/DatePrototype.cpp:
(JSC::dateProtoFuncToPrimitiveSymbol):
* runtime/DirectArguments.h:
* runtime/ErrorConstructor.cpp:
(JSC::Interpreter::constructWithErrorConstructor):
* runtime/ErrorPrototype.cpp:
(JSC::errorProtoFuncToString):
* runtime/ExceptionScope.h:
* runtime/FunctionConstructor.cpp:
(JSC::constructFunction):
* runtime/FunctionPrototype.cpp:
(JSC::functionProtoFuncToString):
* runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::defineOwnProperty):
* runtime/GetterSetter.cpp:
(JSC::callGetter):
* runtime/IntlCollatorConstructor.cpp:
(JSC::IntlCollatorConstructorFuncSupportedLocalesOf):
* runtime/IntlCollatorPrototype.cpp:
(JSC::IntlCollatorFuncCompare):
(JSC::IntlCollatorPrototypeFuncResolvedOptions):
* runtime/IntlDateTimeFormatConstructor.cpp:
(JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf):
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatFuncFormatDateTime):
(JSC::IntlDateTimeFormatPrototypeFuncFormatToParts):
(JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions):
* runtime/IntlNumberFormatConstructor.cpp:
(JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf):
* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatFuncFormatNumber):
(JSC::IntlNumberFormatPrototypeFuncFormatToParts):
(JSC::IntlNumberFormatPrototypeFuncResolvedOptions):
* runtime/IntlObject.cpp:
(JSC::intlNumberOption):
* runtime/IntlObjectInlines.h:
(JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor):
* runtime/IntlPluralRules.cpp:
(JSC::IntlPluralRules::resolvedOptions):
* runtime/IntlPluralRulesConstructor.cpp:
(JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf):
* runtime/IntlPluralRulesPrototype.cpp:
(JSC::IntlPluralRulesPrototypeFuncSelect):
(JSC::IntlPluralRulesPrototypeFuncResolvedOptions):
* runtime/JSArray.cpp:
(JSC::JSArray::defineOwnProperty):
(JSC::JSArray::put):
(JSC::JSArray::setLength):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
* runtime/JSArrayBufferPrototype.cpp:
(JSC::arrayBufferProtoGetterFuncByteLength):
(JSC::sharedArrayBufferProtoGetterFuncByteLength):
* runtime/JSArrayInlines.h:
(JSC::toLength):
* runtime/JSBoundFunction.cpp:
(JSC::boundFunctionCall):
(JSC::boundFunctionConstruct):
* runtime/JSCJSValue.cpp:
(JSC::JSValue::putToPrimitive):
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::toIndex const):
(JSC::JSValue::toPropertyKey const):
(JSC::JSValue::get const):
(JSC::JSValue::getPropertySlot const):
(JSC::JSValue::getOwnPropertySlot const):
(JSC::JSValue::equalSlowCaseInline):
* runtime/JSDataView.cpp:
(JSC::JSDataView::put):
(JSC::JSDataView::defineOwnProperty):
* runtime/JSFunction.cpp:
(JSC::JSFunction::put):
(JSC::JSFunction::defineOwnProperty):
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayViewWithArguments):
(JSC::constructGenericTypedArrayView):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::set):
(JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
* runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
(JSC::speciesConstruct):
(JSC::genericTypedArrayViewProtoFuncJoin):
(JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::put):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::decode):
(JSC::globalFuncEval):
(JSC::globalFuncProtoGetter):
* runtime/JSInternalPromise.cpp:
(JSC::JSInternalPromise::then):
* runtime/JSModuleEnvironment.cpp:
(JSC::JSModuleEnvironment::put):
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::provideFetch):
(JSC::JSModuleLoader::loadAndEvaluateModule):
(JSC::JSModuleLoader::loadModule):
(JSC::JSModuleLoader::linkAndEvaluateModule):
(JSC::JSModuleLoader::requestImportModule):
(JSC::JSModuleLoader::getModuleNamespaceObject):
(JSC::moduleLoaderRequestedModules):
* runtime/JSONObject.cpp:
(JSC::Stringifier::stringify):
(JSC::Stringifier::toJSON):
(JSC::Walker::walk):
(JSC::JSONProtoFuncStringify):
* runtime/JSObject.cpp:
(JSC::ordinarySetSlow):
(JSC::JSObject::putInlineSlow):
(JSC::JSObject::toPrimitive const):
(JSC::JSObject::hasInstance):
(JSC::JSObject::toNumber const):
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::defineOwnNonIndexProperty):
* runtime/JSObject.h:
(JSC::JSObject::get const):
* runtime/JSObjectInlines.h:
(JSC::JSObject::getPropertySlot const):
(JSC::JSObject::putInlineForJSObject):
* runtime/MapConstructor.cpp:
(JSC::constructMap):
* runtime/NativeErrorConstructor.cpp:
(JSC::Interpreter::constructWithNativeErrorConstructor):
* runtime/ObjectConstructor.cpp:
(JSC::constructObject):
(JSC::objectConstructorGetPrototypeOf):
(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorGetOwnPropertyDescriptors):
(JSC::objectConstructorGetOwnPropertyNames):
(JSC::objectConstructorGetOwnPropertySymbols):
(JSC::objectConstructorKeys):
(JSC::objectConstructorDefineProperty):
(JSC::objectConstructorDefineProperties):
(JSC::objectConstructorCreate):
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncToLocaleString):
(JSC::objectProtoFuncToString):
* runtime/Operations.cpp:
(JSC::jsAddSlowCase):
* runtime/Operations.h:
(JSC::jsString):
(JSC::jsLess):
(JSC::jsLessEq):
* runtime/ParseInt.h:
(JSC::toStringView):
* runtime/ProxyConstructor.cpp:
(JSC::constructProxyObject):
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::toStringName):
(JSC::performProxyGet):
(JSC::ProxyObject::performInternalMethodGetOwnProperty):
(JSC::ProxyObject::performHasProperty):
(JSC::ProxyObject::getOwnPropertySlotCommon):
(JSC::ProxyObject::performPut):
(JSC::ProxyObject::putByIndexCommon):
(JSC::performProxyCall):
(JSC::performProxyConstruct):
(JSC::ProxyObject::performDelete):
(JSC::ProxyObject::performPreventExtensions):
(JSC::ProxyObject::performIsExtensible):
(JSC::ProxyObject::performDefineOwnProperty):
(JSC::ProxyObject::performSetPrototype):
(JSC::ProxyObject::performGetPrototype):
* runtime/ReflectObject.cpp:
(JSC::reflectObjectConstruct):
(JSC::reflectObjectDefineProperty):
(JSC::reflectObjectGet):
(JSC::reflectObjectGetOwnPropertyDescriptor):
(JSC::reflectObjectGetPrototypeOf):
(JSC::reflectObjectOwnKeys):
(JSC::reflectObjectSet):
* runtime/RegExpConstructor.cpp:
(JSC::constructRegExp):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::defineOwnProperty):
(JSC::RegExpObject::matchGlobal):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncTestFast):
(JSC::regExpProtoFuncExec):
(JSC::regExpProtoFuncToString):
* runtime/ScriptExecutable.cpp:
(JSC::ScriptExecutable::newCodeBlockFor):
* runtime/SetConstructor.cpp:
(JSC::constructSet):
* runtime/SparseArrayValueMap.cpp:
(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayEntry::put):
* runtime/StringConstructor.cpp:
(JSC::stringFromCharCode):
(JSC::stringFromCodePoint):
* runtime/StringObject.cpp:
(JSC::StringObject::put):
(JSC::StringObject::putByIndex):
(JSC::StringObject::defineOwnProperty):
* runtime/StringPrototype.cpp:
(JSC::jsSpliceSubstrings):
(JSC::jsSpliceSubstringsWithSeparators):
(JSC::removeUsingRegExpSearch):
(JSC::replaceUsingRegExpSearch):
(JSC::operationStringProtoFuncReplaceRegExpEmptyStr):
(JSC::replaceUsingStringSearch):
(JSC::repeatCharacter):
(JSC::replace):
(JSC::stringProtoFuncReplaceUsingRegExp):
(JSC::stringProtoFuncReplaceUsingStringSearch):
(JSC::stringProtoFuncSplitFast):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::toLocaleCase):
(JSC::trimString):
(JSC::stringProtoFuncIncludes):
(JSC::builtinStringIncludesInternal):
(JSC::normalize):
(JSC::stringProtoFuncNormalize):
* runtime/SymbolPrototype.cpp:
(JSC::symbolProtoFuncToString):
(JSC::symbolProtoFuncValueOf):
* tools/JSDollarVM.cpp:
(WTF::functionWasmStreamingParserAddBytes):
(JSC::functionGetPrivateProperty):
* wasm/js/WebAssemblyCompileErrorConstructor.cpp:
(JSC::constructJSWebAssemblyCompileError):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::constructJSWebAssemblyModule):
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyTableConstructor.cpp:
(JSC::constructJSWebAssemblyTable):
* wasm/js/WebAssemblyWrapperFunction.cpp:
(JSC::callWebAssemblyWrapperFunction):

Source/WebCore:

No new tests since this is a refactor.

* bridge/runtime_array.cpp:
(JSC::RuntimeArray::put):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@236697 268f45cc-cd09-0410-ab3c-d52691b4dbfc

81 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGOperations.cpp
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
Source/JavaScriptCore/runtime/ArrayConstructor.cpp
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/BigIntConstructor.cpp
Source/JavaScriptCore/runtime/CommonSlowPaths.h
Source/JavaScriptCore/runtime/ConstructData.cpp
Source/JavaScriptCore/runtime/DateConstructor.cpp
Source/JavaScriptCore/runtime/DatePrototype.cpp
Source/JavaScriptCore/runtime/DirectArguments.h
Source/JavaScriptCore/runtime/ErrorConstructor.cpp
Source/JavaScriptCore/runtime/ErrorPrototype.cpp
Source/JavaScriptCore/runtime/ExceptionScope.h
Source/JavaScriptCore/runtime/FunctionConstructor.cpp
Source/JavaScriptCore/runtime/FunctionPrototype.cpp
Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
Source/JavaScriptCore/runtime/GetterSetter.cpp
Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp
Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp
Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp
Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp
Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp
Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp
Source/JavaScriptCore/runtime/IntlObject.cpp
Source/JavaScriptCore/runtime/IntlObjectInlines.h
Source/JavaScriptCore/runtime/IntlPluralRules.cpp
Source/JavaScriptCore/runtime/IntlPluralRulesConstructor.cpp
Source/JavaScriptCore/runtime/IntlPluralRulesPrototype.cpp
Source/JavaScriptCore/runtime/JSArray.cpp
Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp
Source/JavaScriptCore/runtime/JSArrayInlines.h
Source/JavaScriptCore/runtime/JSBoundFunction.cpp
Source/JavaScriptCore/runtime/JSCJSValue.cpp
Source/JavaScriptCore/runtime/JSCJSValueInlines.h
Source/JavaScriptCore/runtime/JSDataView.cpp
Source/JavaScriptCore/runtime/JSFunction.cpp
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
Source/JavaScriptCore/runtime/JSInternalPromise.cpp
Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
Source/JavaScriptCore/runtime/JSModuleLoader.cpp
Source/JavaScriptCore/runtime/JSONObject.cpp
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/JSObjectInlines.h
Source/JavaScriptCore/runtime/MapConstructor.cpp
Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/ObjectPrototype.cpp
Source/JavaScriptCore/runtime/Operations.cpp
Source/JavaScriptCore/runtime/Operations.h
Source/JavaScriptCore/runtime/ParseInt.h
Source/JavaScriptCore/runtime/ProxyConstructor.cpp
Source/JavaScriptCore/runtime/ProxyObject.cpp
Source/JavaScriptCore/runtime/ReflectObject.cpp
Source/JavaScriptCore/runtime/RegExpConstructor.cpp
Source/JavaScriptCore/runtime/RegExpObject.cpp
Source/JavaScriptCore/runtime/RegExpPrototype.cpp
Source/JavaScriptCore/runtime/ScriptExecutable.cpp
Source/JavaScriptCore/runtime/SetConstructor.cpp
Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
Source/JavaScriptCore/runtime/StringConstructor.cpp
Source/JavaScriptCore/runtime/StringObject.cpp
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/runtime/SymbolPrototype.cpp
Source/JavaScriptCore/tools/JSDollarVM.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.cpp
Source/WebCore/ChangeLog
Source/WebCore/bridge/runtime_array.cpp

index dfd9c53..4a0c668 100644 (file)
@@ -1,3 +1,280 @@
+2018-10-01  Keith Miller  <keith_miller@apple.com>
+
+        Create a RELEASE_AND_RETURN macro for ExceptionScopes
+        https://bugs.webkit.org/show_bug.cgi?id=190163
+
+        Reviewed by Mark Lam.
+
+        The new RELEASE_AND_RETURN does all the work for cases
+        where you want to return the result of some expression
+        without explicitly checking for an exception. This is
+        much like the existing RETURN_IF_EXCEPTION macro.
+
+        * dfg/DFGOperations.cpp:
+        (JSC::DFG::newTypedArrayWithSize):
+        * interpreter/Interpreter.cpp:
+        (JSC::eval):
+        * jit/JITOperations.cpp:
+        (JSC::getByVal):
+        * jsc.cpp:
+        (functionDollarAgentReceiveBroadcast):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::setUpCall):
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        (JSC::LLInt::varargsSetup):
+        * profiler/ProfilerDatabase.cpp:
+        (JSC::Profiler::Database::toJSON const):
+        * runtime/AbstractModuleRecord.cpp:
+        (JSC::AbstractModuleRecord::hostResolveImportedModule):
+        * runtime/ArrayConstructor.cpp:
+        (JSC::constructArrayWithSizeQuirk):
+        * runtime/ArrayPrototype.cpp:
+        (JSC::getProperty):
+        (JSC::fastJoin):
+        (JSC::arrayProtoFuncToString):
+        (JSC::arrayProtoFuncToLocaleString):
+        (JSC::arrayProtoFuncJoin):
+        (JSC::arrayProtoFuncPop):
+        (JSC::arrayProtoPrivateFuncConcatMemcpy):
+        * runtime/BigIntConstructor.cpp:
+        (JSC::toBigInt):
+        * runtime/CommonSlowPaths.h:
+        (JSC::CommonSlowPaths::opInByVal):
+        * runtime/ConstructData.cpp:
+        (JSC::construct):
+        * runtime/DateConstructor.cpp:
+        (JSC::dateParse):
+        * runtime/DatePrototype.cpp:
+        (JSC::dateProtoFuncToPrimitiveSymbol):
+        * runtime/DirectArguments.h:
+        * runtime/ErrorConstructor.cpp:
+        (JSC::Interpreter::constructWithErrorConstructor):
+        * runtime/ErrorPrototype.cpp:
+        (JSC::errorProtoFuncToString):
+        * runtime/ExceptionScope.h:
+        * runtime/FunctionConstructor.cpp:
+        (JSC::constructFunction):
+        * runtime/FunctionPrototype.cpp:
+        (JSC::functionProtoFuncToString):
+        * runtime/GenericArgumentsInlines.h:
+        (JSC::GenericArguments<Type>::defineOwnProperty):
+        * runtime/GetterSetter.cpp:
+        (JSC::callGetter):
+        * runtime/IntlCollatorConstructor.cpp:
+        (JSC::IntlCollatorConstructorFuncSupportedLocalesOf):
+        * runtime/IntlCollatorPrototype.cpp:
+        (JSC::IntlCollatorFuncCompare):
+        (JSC::IntlCollatorPrototypeFuncResolvedOptions):
+        * runtime/IntlDateTimeFormatConstructor.cpp:
+        (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf):
+        * runtime/IntlDateTimeFormatPrototype.cpp:
+        (JSC::IntlDateTimeFormatFuncFormatDateTime):
+        (JSC::IntlDateTimeFormatPrototypeFuncFormatToParts):
+        (JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions):
+        * runtime/IntlNumberFormatConstructor.cpp:
+        (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf):
+        * runtime/IntlNumberFormatPrototype.cpp:
+        (JSC::IntlNumberFormatFuncFormatNumber):
+        (JSC::IntlNumberFormatPrototypeFuncFormatToParts):
+        (JSC::IntlNumberFormatPrototypeFuncResolvedOptions):
+        * runtime/IntlObject.cpp:
+        (JSC::intlNumberOption):
+        * runtime/IntlObjectInlines.h:
+        (JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor):
+        * runtime/IntlPluralRules.cpp:
+        (JSC::IntlPluralRules::resolvedOptions):
+        * runtime/IntlPluralRulesConstructor.cpp:
+        (JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf):
+        * runtime/IntlPluralRulesPrototype.cpp:
+        (JSC::IntlPluralRulesPrototypeFuncSelect):
+        (JSC::IntlPluralRulesPrototypeFuncResolvedOptions):
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::defineOwnProperty):
+        (JSC::JSArray::put):
+        (JSC::JSArray::setLength):
+        (JSC::JSArray::unshiftCountWithAnyIndexingType):
+        * runtime/JSArrayBufferPrototype.cpp:
+        (JSC::arrayBufferProtoGetterFuncByteLength):
+        (JSC::sharedArrayBufferProtoGetterFuncByteLength):
+        * runtime/JSArrayInlines.h:
+        (JSC::toLength):
+        * runtime/JSBoundFunction.cpp:
+        (JSC::boundFunctionCall):
+        (JSC::boundFunctionConstruct):
+        * runtime/JSCJSValue.cpp:
+        (JSC::JSValue::putToPrimitive):
+        * runtime/JSCJSValueInlines.h:
+        (JSC::JSValue::toIndex const):
+        (JSC::JSValue::toPropertyKey const):
+        (JSC::JSValue::get const):
+        (JSC::JSValue::getPropertySlot const):
+        (JSC::JSValue::getOwnPropertySlot const):
+        (JSC::JSValue::equalSlowCaseInline):
+        * runtime/JSDataView.cpp:
+        (JSC::JSDataView::put):
+        (JSC::JSDataView::defineOwnProperty):
+        * runtime/JSFunction.cpp:
+        (JSC::JSFunction::put):
+        (JSC::JSFunction::defineOwnProperty):
+        * runtime/JSGenericTypedArrayViewConstructorInlines.h:
+        (JSC::constructGenericTypedArrayViewWithArguments):
+        (JSC::constructGenericTypedArrayView):
+        * runtime/JSGenericTypedArrayViewInlines.h:
+        (JSC::JSGenericTypedArrayView<Adaptor>::set):
+        (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
+        * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
+        (JSC::speciesConstruct):
+        (JSC::genericTypedArrayViewProtoFuncJoin):
+        (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::put):
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::decode):
+        (JSC::globalFuncEval):
+        (JSC::globalFuncProtoGetter):
+        * runtime/JSInternalPromise.cpp:
+        (JSC::JSInternalPromise::then):
+        * runtime/JSModuleEnvironment.cpp:
+        (JSC::JSModuleEnvironment::put):
+        * runtime/JSModuleLoader.cpp:
+        (JSC::JSModuleLoader::provideFetch):
+        (JSC::JSModuleLoader::loadAndEvaluateModule):
+        (JSC::JSModuleLoader::loadModule):
+        (JSC::JSModuleLoader::linkAndEvaluateModule):
+        (JSC::JSModuleLoader::requestImportModule):
+        (JSC::JSModuleLoader::getModuleNamespaceObject):
+        (JSC::moduleLoaderRequestedModules):
+        * runtime/JSONObject.cpp:
+        (JSC::Stringifier::stringify):
+        (JSC::Stringifier::toJSON):
+        (JSC::Walker::walk):
+        (JSC::JSONProtoFuncStringify):
+        * runtime/JSObject.cpp:
+        (JSC::ordinarySetSlow):
+        (JSC::JSObject::putInlineSlow):
+        (JSC::JSObject::toPrimitive const):
+        (JSC::JSObject::hasInstance):
+        (JSC::JSObject::toNumber const):
+        (JSC::JSObject::defineOwnIndexedProperty):
+        (JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
+        (JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
+        (JSC::JSObject::defineOwnNonIndexProperty):
+        * runtime/JSObject.h:
+        (JSC::JSObject::get const):
+        * runtime/JSObjectInlines.h:
+        (JSC::JSObject::getPropertySlot const):
+        (JSC::JSObject::putInlineForJSObject):
+        * runtime/MapConstructor.cpp:
+        (JSC::constructMap):
+        * runtime/NativeErrorConstructor.cpp:
+        (JSC::Interpreter::constructWithNativeErrorConstructor):
+        * runtime/ObjectConstructor.cpp:
+        (JSC::constructObject):
+        (JSC::objectConstructorGetPrototypeOf):
+        (JSC::objectConstructorGetOwnPropertyDescriptor):
+        (JSC::objectConstructorGetOwnPropertyDescriptors):
+        (JSC::objectConstructorGetOwnPropertyNames):
+        (JSC::objectConstructorGetOwnPropertySymbols):
+        (JSC::objectConstructorKeys):
+        (JSC::objectConstructorDefineProperty):
+        (JSC::objectConstructorDefineProperties):
+        (JSC::objectConstructorCreate):
+        * runtime/ObjectPrototype.cpp:
+        (JSC::objectProtoFuncToLocaleString):
+        (JSC::objectProtoFuncToString):
+        * runtime/Operations.cpp:
+        (JSC::jsAddSlowCase):
+        * runtime/Operations.h:
+        (JSC::jsString):
+        (JSC::jsLess):
+        (JSC::jsLessEq):
+        * runtime/ParseInt.h:
+        (JSC::toStringView):
+        * runtime/ProxyConstructor.cpp:
+        (JSC::constructProxyObject):
+        * runtime/ProxyObject.cpp:
+        (JSC::ProxyObject::toStringName):
+        (JSC::performProxyGet):
+        (JSC::ProxyObject::performInternalMethodGetOwnProperty):
+        (JSC::ProxyObject::performHasProperty):
+        (JSC::ProxyObject::getOwnPropertySlotCommon):
+        (JSC::ProxyObject::performPut):
+        (JSC::ProxyObject::putByIndexCommon):
+        (JSC::performProxyCall):
+        (JSC::performProxyConstruct):
+        (JSC::ProxyObject::performDelete):
+        (JSC::ProxyObject::performPreventExtensions):
+        (JSC::ProxyObject::performIsExtensible):
+        (JSC::ProxyObject::performDefineOwnProperty):
+        (JSC::ProxyObject::performSetPrototype):
+        (JSC::ProxyObject::performGetPrototype):
+        * runtime/ReflectObject.cpp:
+        (JSC::reflectObjectConstruct):
+        (JSC::reflectObjectDefineProperty):
+        (JSC::reflectObjectGet):
+        (JSC::reflectObjectGetOwnPropertyDescriptor):
+        (JSC::reflectObjectGetPrototypeOf):
+        (JSC::reflectObjectOwnKeys):
+        (JSC::reflectObjectSet):
+        * runtime/RegExpConstructor.cpp:
+        (JSC::constructRegExp):
+        * runtime/RegExpObject.cpp:
+        (JSC::RegExpObject::defineOwnProperty):
+        (JSC::RegExpObject::matchGlobal):
+        * runtime/RegExpPrototype.cpp:
+        (JSC::regExpProtoFuncTestFast):
+        (JSC::regExpProtoFuncExec):
+        (JSC::regExpProtoFuncToString):
+        * runtime/ScriptExecutable.cpp:
+        (JSC::ScriptExecutable::newCodeBlockFor):
+        * runtime/SetConstructor.cpp:
+        (JSC::constructSet):
+        * runtime/SparseArrayValueMap.cpp:
+        (JSC::SparseArrayValueMap::putEntry):
+        (JSC::SparseArrayEntry::put):
+        * runtime/StringConstructor.cpp:
+        (JSC::stringFromCharCode):
+        (JSC::stringFromCodePoint):
+        * runtime/StringObject.cpp:
+        (JSC::StringObject::put):
+        (JSC::StringObject::putByIndex):
+        (JSC::StringObject::defineOwnProperty):
+        * runtime/StringPrototype.cpp:
+        (JSC::jsSpliceSubstrings):
+        (JSC::jsSpliceSubstringsWithSeparators):
+        (JSC::removeUsingRegExpSearch):
+        (JSC::replaceUsingRegExpSearch):
+        (JSC::operationStringProtoFuncReplaceRegExpEmptyStr):
+        (JSC::replaceUsingStringSearch):
+        (JSC::repeatCharacter):
+        (JSC::replace):
+        (JSC::stringProtoFuncReplaceUsingRegExp):
+        (JSC::stringProtoFuncReplaceUsingStringSearch):
+        (JSC::stringProtoFuncSplitFast):
+        (JSC::stringProtoFuncToLowerCase):
+        (JSC::stringProtoFuncToUpperCase):
+        (JSC::toLocaleCase):
+        (JSC::trimString):
+        (JSC::stringProtoFuncIncludes):
+        (JSC::builtinStringIncludesInternal):
+        (JSC::normalize):
+        (JSC::stringProtoFuncNormalize):
+        * runtime/SymbolPrototype.cpp:
+        (JSC::symbolProtoFuncToString):
+        (JSC::symbolProtoFuncValueOf):
+        * tools/JSDollarVM.cpp:
+        (WTF::functionWasmStreamingParserAddBytes):
+        (JSC::functionGetPrivateProperty):
+        * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
+        (JSC::constructJSWebAssemblyCompileError):
+        * wasm/js/WebAssemblyModuleConstructor.cpp:
+        (JSC::constructJSWebAssemblyModule):
+        (JSC::WebAssemblyModuleConstructor::createModule):
+        * wasm/js/WebAssemblyTableConstructor.cpp:
+        (JSC::constructJSWebAssemblyTable):
+        * wasm/js/WebAssemblyWrapperFunction.cpp:
+        (JSC::callWebAssemblyWrapperFunction):
+
 2018-10-01  Koby Boyango  <koby.b@mce-sys.com>
 
         [JSC] Add a JSONStringify overload that receives a JSValue space
index 27b8f29..6360e55 100644 (file)
@@ -199,8 +199,7 @@ char* newTypedArrayWithSize(ExecState* exec, Structure* structure, int32_t size,
     if (vector)
         return bitwise_cast<char*>(ViewClass::createWithFastVector(exec, structure, size, vector));
 
-    scope.release();
-    return bitwise_cast<char*>(ViewClass::create(exec, structure, size));
+    RELEASE_AND_RETURN(scope, bitwise_cast<char*>(ViewClass::create(exec, structure, size)));
 }
 
 template <bool strict>
@@ -262,12 +261,9 @@ JSCell* JIT_OPERATION operationObjectCreate(ExecState* exec, EncodedJSValue enco
         return nullptr;
     }
 
-    if (prototype.isObject()) {
-        scope.release();
-        return constructEmptyObject(exec, asObject(prototype));
-    }
-    scope.release();
-    return constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure());
+    if (prototype.isObject())
+        RELEASE_AND_RETURN(scope, constructEmptyObject(exec, asObject(prototype)));
+    RELEASE_AND_RETURN(scope, constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure()));
 }
 
 JSCell* JIT_OPERATION operationObjectCreateObject(ExecState* exec, JSObject* prototype)
@@ -334,8 +330,7 @@ JSCell* JIT_OPERATION operationToObject(ExecState* exec, JSGlobalObject* globalO
         }
     }
 
-    scope.release();
-    return value.toObject(exec, globalObject);
+    RELEASE_AND_RETURN(scope, value.toObject(exec, globalObject));
 }
 
 EncodedJSValue JIT_OPERATION operationValueBitAnd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
@@ -631,17 +626,15 @@ EncodedJSValue JIT_OPERATION operationGetByVal(ExecState* exec, EncodedJSValue e
     if (LIKELY(baseValue.isCell())) {
         JSCell* base = baseValue.asCell();
 
-        if (property.isUInt32()) {
-            scope.release();
-            return getByVal(exec, base, property.asUInt32());
-        }
+        if (property.isUInt32())
+            RELEASE_AND_RETURN(scope, getByVal(exec, base, property.asUInt32()));
+
         if (property.isDouble()) {
             double propertyAsDouble = property.asDouble();
             uint32_t propertyAsUInt32 = static_cast<uint32_t>(propertyAsDouble);
-            if (propertyAsUInt32 == propertyAsDouble && isIndex(propertyAsUInt32)) {
-                scope.release();
-                return getByVal(exec, base, propertyAsUInt32);
-            }
+            if (propertyAsUInt32 == propertyAsDouble && isIndex(propertyAsUInt32))
+                RELEASE_AND_RETURN(scope, getByVal(exec, base, propertyAsUInt32));
+
         } else if (property.isString()) {
             Structure& structure = *base->structure(vm);
             if (JSCell::canUseFastGetOwnProperty(structure)) {
@@ -657,8 +650,7 @@ EncodedJSValue JIT_OPERATION operationGetByVal(ExecState* exec, EncodedJSValue e
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
     auto propertyName = property.toPropertyKey(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(baseValue.get(exec, propertyName));
+    RELEASE_AND_RETURN(scope, JSValue::encode(baseValue.get(exec, propertyName)));
 }
 
 EncodedJSValue JIT_OPERATION operationGetByValCell(ExecState* exec, JSCell* base, EncodedJSValue encodedProperty)
@@ -669,17 +661,15 @@ EncodedJSValue JIT_OPERATION operationGetByValCell(ExecState* exec, JSCell* base
 
     JSValue property = JSValue::decode(encodedProperty);
 
-    if (property.isUInt32()) {
-        scope.release();
-        return getByVal(exec, base, property.asUInt32());
-    }
+    if (property.isUInt32())
+        RELEASE_AND_RETURN(scope, getByVal(exec, base, property.asUInt32()));
+
     if (property.isDouble()) {
         double propertyAsDouble = property.asDouble();
         uint32_t propertyAsUInt32 = static_cast<uint32_t>(propertyAsDouble);
-        if (propertyAsUInt32 == propertyAsDouble) {
-            scope.release();
-            return getByVal(exec, base, propertyAsUInt32);
-        }
+        if (propertyAsUInt32 == propertyAsDouble)
+            RELEASE_AND_RETURN(scope, getByVal(exec, base, propertyAsUInt32));
+
     } else if (property.isString()) {
         Structure& structure = *base->structure(vm);
         if (JSCell::canUseFastGetOwnProperty(structure)) {
@@ -692,8 +682,7 @@ EncodedJSValue JIT_OPERATION operationGetByValCell(ExecState* exec, JSCell* base
 
     auto propertyName = property.toPropertyKey(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(JSValue(base).get(exec, propertyName));
+    RELEASE_AND_RETURN(scope, JSValue::encode(JSValue(base).get(exec, propertyName)));
 }
 
 ALWAYS_INLINE EncodedJSValue getByValCellInt(ExecState* exec, JSCell* base, int32_t index)
@@ -730,8 +719,7 @@ EncodedJSValue JIT_OPERATION operationGetByValObjectString(ExecState* exec, JSCe
     auto propertyName = asString(string)->toIdentifier(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(getByValObject(exec, vm, asObject(base), propertyName));
+    RELEASE_AND_RETURN(scope, JSValue::encode(getByValObject(exec, vm, asObject(base), propertyName)));
 }
 
 EncodedJSValue JIT_OPERATION operationGetByValObjectSymbol(ExecState* exec, JSCell* base, JSCell* symbol)
@@ -1097,8 +1085,7 @@ EncodedJSValue JIT_OPERATION operationRegExpExec(ExecState* exec, JSGlobalObject
     EXCEPTION_ASSERT(!!scope.exception() == !input);
     if (!input)
         return encodedJSValue();
-    scope.release();
-    return JSValue::encode(regExpObject->execInline(exec, globalObject, input));
+    RELEASE_AND_RETURN(scope, JSValue::encode(regExpObject->execInline(exec, globalObject, input)));
 }
         
 EncodedJSValue JIT_OPERATION operationRegExpExecGeneric(ExecState* exec, JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedArgument)
@@ -1120,8 +1107,7 @@ EncodedJSValue JIT_OPERATION operationRegExpExecGeneric(ExecState* exec, JSGloba
     EXCEPTION_ASSERT(!!scope.exception() == !input);
     if (!input)
         return JSValue::encode(jsUndefined());
-    scope.release();
-    return JSValue::encode(regexp->exec(exec, globalObject, input));
+    RELEASE_AND_RETURN(scope, JSValue::encode(regexp->exec(exec, globalObject, input)));
 }
 
 EncodedJSValue JIT_OPERATION operationRegExpExecNonGlobalOrSticky(ExecState* exec, JSGlobalObject* globalObject, RegExp* regExp, JSString* string)
@@ -1180,20 +1166,18 @@ EncodedJSValue JIT_OPERATION operationRegExpMatchFastGlobalString(ExecState* exe
 
     if (regExp->unicode()) {
         unsigned stringLength = s.length();
-        scope.release();
-        return JSValue::encode(collectMatches(
+        RELEASE_AND_RETURN(scope, JSValue::encode(collectMatches(
             vm, exec, string, s, regExpConstructor, regExp,
             [&] (size_t end) -> size_t {
                 return advanceStringUnicode(s, stringLength, end);
-            }));
+            })));
     }
 
-    scope.release();
-    return JSValue::encode(collectMatches(
+    RELEASE_AND_RETURN(scope, JSValue::encode(collectMatches(
         vm, exec, string, s, regExpConstructor, regExp,
         [&] (size_t end) -> size_t {
             return end + 1;
-        }));
+        })));
 }
 
 EncodedJSValue JIT_OPERATION operationParseIntNoRadixGeneric(ExecState* exec, EncodedJSValue value)
@@ -1288,8 +1272,7 @@ size_t JIT_OPERATION operationRegExpTestGeneric(ExecState* exec, JSGlobalObject*
     EXCEPTION_ASSERT(!!scope.exception() == !input);
     if (!input)
         return false;
-    scope.release();
-    return regexp->test(exec, globalObject, input);
+    RELEASE_AND_RETURN(scope, regexp->test(exec, globalObject, input));
 }
 
 JSCell* JIT_OPERATION operationBitAndBigInt(ExecState* exec, JSCell* op1, JSCell* op2)
@@ -1361,8 +1344,7 @@ EncodedJSValue JIT_OPERATION operationGetByValWithThis(ExecState* exec, EncodedJ
         if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i))
             return JSValue::encode(asString(baseValue)->getIndex(exec, i));
         
-        scope.release();
-        return JSValue::encode(baseValue.get(exec, i, slot));
+        RELEASE_AND_RETURN(scope, JSValue::encode(baseValue.get(exec, i, slot)));
     }
 
     baseValue.requireObjectCoercible(exec);
@@ -1370,8 +1352,7 @@ EncodedJSValue JIT_OPERATION operationGetByValWithThis(ExecState* exec, EncodedJ
 
     auto property = subscript.toPropertyKey(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(baseValue.get(exec, property, slot));
+    RELEASE_AND_RETURN(scope, JSValue::encode(baseValue.get(exec, property, slot)));
 }
 
 void JIT_OPERATION operationPutByIdWithThisStrict(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedThis, EncodedJSValue encodedValue, UniquedStringImpl* impl)
@@ -1994,8 +1975,7 @@ JSCell* JIT_OPERATION operationGetPropertyEnumerator(ExecState* exec, EncodedJSV
     JSObject* baseObject = base.toObject(exec);
     RETURN_IF_EXCEPTION(scope, { });
 
-    scope.release();
-    return propertyNameEnumerator(exec, baseObject);
+    RELEASE_AND_RETURN(scope, propertyNameEnumerator(exec, baseObject));
 }
 
 JSCell* JIT_OPERATION operationGetPropertyEnumeratorCell(ExecState* exec, JSCell* cell)
@@ -2007,8 +1987,7 @@ JSCell* JIT_OPERATION operationGetPropertyEnumeratorCell(ExecState* exec, JSCell
     JSObject* base = cell->toObject(exec, exec->lexicalGlobalObject());
     RETURN_IF_EXCEPTION(scope, { });
 
-    scope.release();
-    return propertyNameEnumerator(exec, base);
+    RELEASE_AND_RETURN(scope, propertyNameEnumerator(exec, base));
 }
 
 JSCell* JIT_OPERATION operationToIndexString(ExecState* exec, int32_t index)
@@ -2080,8 +2059,7 @@ JSString* JIT_OPERATION operationToLowerCase(ExecState* exec, JSString* string,
     String lowercasedString = inputString.is8Bit() ? inputString.convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit(failingIndex) : inputString.convertToLowercaseWithoutLocale();
     if (lowercasedString.impl() == inputString.impl())
         return string;
-    scope.release();
-    return jsString(exec, lowercasedString);
+    RELEASE_AND_RETURN(scope, jsString(exec, lowercasedString));
 }
 
 char* JIT_OPERATION operationInt32ToString(ExecState* exec, int32_t value, int32_t radix)
@@ -2230,8 +2208,7 @@ JSString* JIT_OPERATION operationStrCat2(ExecState* exec, EncodedJSValue a, Enco
     JSString* str2 = JSValue::decode(b).toString(exec);
     scope.assertNoException();
 
-    scope.release();
-    return jsString(exec, str1, str2);
+    RELEASE_AND_RETURN(scope, jsString(exec, str1, str2));
 }
     
 JSString* JIT_OPERATION operationStrCat3(ExecState* exec, EncodedJSValue a, EncodedJSValue b, EncodedJSValue c)
@@ -2250,8 +2227,7 @@ JSString* JIT_OPERATION operationStrCat3(ExecState* exec, EncodedJSValue a, Enco
     JSString* str3 = JSValue::decode(c).toString(exec);
     scope.assertNoException();
 
-    scope.release();
-    return jsString(exec, str1, str2, str3);
+    RELEASE_AND_RETURN(scope, jsString(exec, str1, str2, str3));
 }
 
 char* JIT_OPERATION operationFindSwitchImmTargetForDouble(
@@ -2642,10 +2618,8 @@ JSCell* JIT_OPERATION operationSpreadGeneric(ExecState* exec, JSCell* iterable)
 
     if (isJSArray(iterable)) {
         JSArray* array = jsCast<JSArray*>(iterable);
-        if (array->isIteratorProtocolFastAndNonObservable()) {
-            throwScope.release();
-            return JSFixedArray::createFromArray(exec, vm, array);
-        }
+        if (array->isIteratorProtocolFastAndNonObservable())
+            RELEASE_AND_RETURN(throwScope, JSFixedArray::createFromArray(exec, vm, array));
     }
 
     // FIXME: we can probably make this path faster by having our caller JS code call directly into
@@ -2667,8 +2641,7 @@ JSCell* JIT_OPERATION operationSpreadGeneric(ExecState* exec, JSCell* iterable)
         array = jsCast<JSArray*>(arrayResult);
     }
 
-    throwScope.release();
-    return JSFixedArray::createFromArray(exec, vm, array);
+    RELEASE_AND_RETURN(throwScope, JSFixedArray::createFromArray(exec, vm, array));
 }
 
 JSCell* JIT_OPERATION operationSpreadFastArray(ExecState* exec, JSCell* cell)
@@ -2716,8 +2689,7 @@ EncodedJSValue JIT_OPERATION operationGetDynamicVar(ExecState* exec, JSObject* s
     auto throwScope = DECLARE_THROW_SCOPE(vm);
 
     Identifier ident = Identifier::fromUid(exec, impl);
-    throwScope.release();
-    return JSValue::encode(scope->getPropertySlot(exec, ident, [&] (bool found, PropertySlot& slot) -> JSValue {
+    RELEASE_AND_RETURN(throwScope, JSValue::encode(scope->getPropertySlot(exec, ident, [&] (bool found, PropertySlot& slot) -> JSValue {
         if (!found) {
             GetPutInfo getPutInfo(getPutInfoBits);
             if (getPutInfo.resolveMode() == ThrowIfNotFound)
@@ -2736,7 +2708,7 @@ EncodedJSValue JIT_OPERATION operationGetDynamicVar(ExecState* exec, JSObject* s
         }
 
         return slot.getValue(exec, ident);
-    }));
+    })));
 }
 
 void JIT_OPERATION operationPutDynamicVar(ExecState* exec, JSObject* scope, EncodedJSValue value, UniquedStringImpl* impl, unsigned getPutInfoBits)
@@ -2865,8 +2837,7 @@ EncodedJSValue JIT_OPERATION operationGetPrototypeOf(ExecState* exec, EncodedJSV
         return JSValue::encode(prototype);
     }
 
-    scope.release();
-    return JSValue::encode(thisObject->getPrototype(vm, exec));
+    RELEASE_AND_RETURN(scope, JSValue::encode(thisObject->getPrototype(vm, exec)));
 }
 
 void JIT_OPERATION operationThrowDFG(ExecState* exec, EncodedJSValue valueToThrow)
index bbc69db..6e668c7 100644 (file)
@@ -144,16 +144,14 @@ JSValue eval(CallFrame* callFrame)
         if (!callerCodeBlock->isStrictMode()) {
             if (programSource.is8Bit()) {
                 LiteralParser<LChar> preparser(callFrame, programSource.characters8(), programSource.length(), NonStrictJSON);
-                if (JSValue parsedObject = preparser.tryLiteralParse()) {
-                    scope.release();
-                    return parsedObject;
-                }
+                if (JSValue parsedObject = preparser.tryLiteralParse())
+                    RELEASE_AND_RETURN(scope, parsedObject);
+
             } else {
                 LiteralParser<UChar> preparser(callFrame, programSource.characters16(), programSource.length(), NonStrictJSON);
-                if (JSValue parsedObject = preparser.tryLiteralParse()) {
-                    scope.release();
-                    return parsedObject;
-                }
+                if (JSValue parsedObject = preparser.tryLiteralParse())
+                    RELEASE_AND_RETURN(scope, parsedObject);
+
             }
             RETURN_IF_EXCEPTION(scope, JSValue());
         }
@@ -170,8 +168,7 @@ JSValue eval(CallFrame* callFrame)
 
     JSValue thisValue = callerFrame->thisValue();
     Interpreter* interpreter = vm.interpreter;
-    scope.release();
-    return interpreter->execute(eval, callFrame, thisValue, callerScopeChain);
+    RELEASE_AND_RETURN(scope, interpreter->execute(eval, callFrame, thisValue, callerScopeChain));
 }
 
 unsigned sizeOfVarargs(CallFrame* callFrame, JSValue arguments, uint32_t firstVarArgOffset)
index fd425d8..b5e192c 100644 (file)
@@ -198,8 +198,7 @@ EncodedJSValue JIT_OPERATION operationGetByIdDirect(ExecState* exec, StructureSt
     bool found = baseValue.getOwnPropertySlot(exec, ident, slot);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined());
+    RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined()));
 }
 
 EncodedJSValue JIT_OPERATION operationGetByIdDirectGeneric(ExecState* exec, EncodedJSValue base, UniquedStringImpl* uid)
@@ -215,8 +214,7 @@ EncodedJSValue JIT_OPERATION operationGetByIdDirectGeneric(ExecState* exec, Enco
     bool found = baseValue.getOwnPropertySlot(exec, ident, slot);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined());
+    RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined()));
 }
 
 EncodedJSValue JIT_OPERATION operationGetByIdDirectOptimize(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid)
@@ -235,8 +233,7 @@ EncodedJSValue JIT_OPERATION operationGetByIdDirectOptimize(ExecState* exec, Str
     if (stubInfo->considerCaching(exec->codeBlock(), baseValue.structureOrNull()))
         repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Direct);
 
-    scope.release();
-    return JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined());
+    RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined()));
 }
 
 EncodedJSValue JIT_OPERATION operationGetById(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid)
@@ -1018,8 +1015,7 @@ SlowPathReturnType JIT_OPERATION operationLinkCall(ExecState* execCallee, CallLi
             void* linkedTarget = codePtr.executableAddress();
             return encodeResult(linkedTarget, reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
         }
-        throwScope.release();
-        return handleHostCall(execCallee, calleeAsValue, callLinkInfo);
+        RELEASE_AND_RETURN(throwScope, handleHostCall(execCallee, calleeAsValue, callLinkInfo));
     }
 
     JSFunction* callee = jsCast<JSFunction*>(calleeAsFunctionCell);
@@ -1132,8 +1128,7 @@ inline SlowPathReturnType virtualForWithFunction(
             ASSERT(!!codePtr);
             return encodeResult(codePtr.executableAddress(), reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
         }
-        throwScope.release();
-        return handleHostCall(execCallee, calleeAsValue, callLinkInfo);
+        RELEASE_AND_RETURN(throwScope, handleHostCall(execCallee, calleeAsValue, callLinkInfo));
     }
     
     JSFunction* function = jsCast<JSFunction*>(calleeAsFunctionCell);
@@ -1827,8 +1822,7 @@ static JSValue getByVal(ExecState* exec, JSValue baseValue, JSValue subscript, B
         if (isJSString(baseValue)) {
             if (asString(baseValue)->canGetIndex(i)) {
                 ctiPatchCallByReturnAddress(returnAddress, operationGetByValString);
-                scope.release();
-                return asString(baseValue)->getIndex(exec, i);
+                RELEASE_AND_RETURN(scope, asString(baseValue)->getIndex(exec, i));
             }
             byValInfo->arrayProfile->setOutOfBounds();
         } else if (baseValue.isObject()) {
@@ -1853,8 +1847,7 @@ static JSValue getByVal(ExecState* exec, JSValue baseValue, JSValue subscript, B
             }
         }
 
-        scope.release();
-        return baseValue.get(exec, i);
+        RELEASE_AND_RETURN(scope, baseValue.get(exec, i));
     }
 
     baseValue.requireObjectCoercible(exec);
@@ -1866,8 +1859,7 @@ static JSValue getByVal(ExecState* exec, JSValue baseValue, JSValue subscript, B
     if (byValInfo->stubInfo && (!isStringOrSymbol(subscript) || byValInfo->cachedId != property))
         byValInfo->tookSlowPath = true;
 
-    scope.release();
-    return baseValue.get(exec, property);
+    RELEASE_AND_RETURN(scope, baseValue.get(exec, property));
 }
 
 static OptimizationResult tryGetByValOptimize(ExecState* exec, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress)
@@ -2058,10 +2050,9 @@ EncodedJSValue JIT_OPERATION operationGetByValString(ExecState* exec, EncodedJSV
     JSValue result;
     if (LIKELY(subscript.isUInt32())) {
         uint32_t i = subscript.asUInt32();
-        if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i)) {
-            scope.release();
-            return JSValue::encode(asString(baseValue)->getIndex(exec, i));
-        }
+        if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i))
+            RELEASE_AND_RETURN(scope, JSValue::encode(asString(baseValue)->getIndex(exec, i)));
+
         result = baseValue.get(exec, i);
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
         if (!isJSString(baseValue)) {
@@ -2305,8 +2296,7 @@ EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState* exec, Instruction*
     // ModuleVar is always converted to ClosureVar for get_from_scope.
     ASSERT(getPutInfo.resolveType() != ModuleVar);
 
-    throwScope.release();
-    return JSValue::encode(scope->getPropertySlot(exec, ident, [&] (bool found, PropertySlot& slot) -> JSValue {
+    RELEASE_AND_RETURN(throwScope, JSValue::encode(scope->getPropertySlot(exec, ident, [&] (bool found, PropertySlot& slot) -> JSValue {
         if (!found) {
             if (getPutInfo.resolveMode() == ThrowIfNotFound)
                 throwException(exec, throwScope, createUndefinedVariableError(exec, ident));
@@ -2328,7 +2318,7 @@ EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState* exec, Instruction*
         if (!result)
             return slot.getValue(exec, ident);
         return result;
-    }));
+    })));
 }
 
 void JIT_OPERATION operationPutToScope(ExecState* exec, Instruction* bytecodePC)
index a0b1c87..f6c1e82 100644 (file)
@@ -1766,8 +1766,7 @@ EncodedJSValue JSC_HOST_CALL functionDollarAgentReceiveBroadcast(ExecState* exec
     args.append(jsNumber(message->index()));
     if (UNLIKELY(args.hasOverflowed()))
         return JSValue::encode(throwOutOfMemoryError(exec, scope));
-    scope.release();
-    return JSValue::encode(call(exec, callback, callType, callData, jsNull(), args));
+    RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, callback, callType, callData, jsNull(), args)));
 }
 
 EncodedJSValue JSC_HOST_CALL functionDollarAgentReport(ExecState* exec)
index c1c2c67..eead24d 100644 (file)
@@ -1467,8 +1467,7 @@ inline SlowPathReturnType setUpCall(ExecState* execCallee, Instruction* pc, Code
             PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress());
             LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress(), JSEntryPtrTag);
         }
-        throwScope.release();
-        return handleHostCall(execCallee, pc, calleeAsValue, kind);
+        RELEASE_AND_RETURN(throwScope, handleHostCall(execCallee, pc, calleeAsValue, kind));
     }
     JSFunction* callee = jsCast<JSFunction*>(calleeAsFunctionCell);
     JSScope* scope = callee->scopeUnchecked();
@@ -1543,15 +1542,13 @@ inline SlowPathReturnType genericCall(ExecState* exec, Instruction* pc, CodeSpec
 LLINT_SLOW_PATH_DECL(slow_path_call)
 {
     LLINT_BEGIN_NO_SET_PC();
-    throwScope.release();
-    return genericCall(exec, pc, CodeForCall);
+    RELEASE_AND_RETURN(throwScope, genericCall(exec, pc, CodeForCall));
 }
 
 LLINT_SLOW_PATH_DECL(slow_path_construct)
 {
     LLINT_BEGIN_NO_SET_PC();
-    throwScope.release();
-    return genericCall(exec, pc, CodeForConstruct);
+    RELEASE_AND_RETURN(throwScope, genericCall(exec, pc, CodeForConstruct));
 }
 
 LLINT_SLOW_PATH_DECL(slow_path_size_frame_for_varargs)
@@ -1617,8 +1614,7 @@ inline SlowPathReturnType varargsSetup(ExecState* exec, Instruction* pc, CodeSpe
     execCallee->uncheckedR(CallFrameSlot::callee) = calleeAsValue;
     exec->setCurrentVPC(pc);
 
-    throwScope.release();
-    return setUpCall(execCallee, pc, kind, calleeAsValue);
+    RELEASE_AND_RETURN(throwScope, setUpCall(execCallee, pc, kind, calleeAsValue));
 }
 
 LLINT_SLOW_PATH_DECL(slow_path_call_varargs)
@@ -1651,10 +1647,8 @@ LLINT_SLOW_PATH_DECL(slow_path_call_eval)
     execCallee->setCodeBlock(0);
     exec->setCurrentVPC(pc);
     
-    if (!isHostFunction(calleeAsValue, globalFuncEval)) {
-        throwScope.release();
-        return setUpCall(execCallee, pc, CodeForCall, calleeAsValue);
-    }
+    if (!isHostFunction(calleeAsValue, globalFuncEval))
+        RELEASE_AND_RETURN(throwScope, setUpCall(execCallee, pc, CodeForCall, calleeAsValue));
     
     vm.hostCallReturnValue = eval(execCallee);
     LLINT_CALL_RETURN(exec, execCallee, LLInt::getCodePtr(getHostCallReturnValue), CFunctionPtrTag);
index 911d681..0a78b0c 100644 (file)
@@ -143,8 +143,7 @@ String Database::toJSON() const
 
     auto value = toJS(globalObject->globalExec());
     RETURN_IF_EXCEPTION(scope, String());
-    scope.release();
-    return JSONStringify(globalObject->globalExec(), value, 0);
+    RELEASE_AND_RETURN(scope, JSONStringify(globalObject->globalExec(), value, 0));
 }
 
 bool Database::save(const char* filename) const
index fc03e43..a4ad12c 100644 (file)
@@ -146,8 +146,7 @@ AbstractModuleRecord* AbstractModuleRecord::hostResolveImportedModule(ExecState*
     JSValue moduleNameValue = identifierToJSValue(vm, moduleName);
     JSValue entry = m_dependenciesMap->JSMap::get(exec, moduleNameValue);
     RETURN_IF_EXCEPTION(scope, nullptr);
-    scope.release();
-    return jsCast<AbstractModuleRecord*>(entry.get(exec, Identifier::fromString(exec, "module")));
+    RELEASE_AND_RETURN(scope, jsCast<AbstractModuleRecord*>(entry.get(exec, Identifier::fromString(exec, "module"))));
 }
 
 auto AbstractModuleRecord::resolveImport(ExecState* exec, const Identifier& localName) -> Resolution
index 7525f5f..d82cef3 100644 (file)
@@ -73,18 +73,15 @@ JSArray* constructArrayWithSizeQuirk(ExecState* exec, ArrayAllocationProfile* pr
 {
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
-    if (!length.isNumber()) {
-        scope.release();
-        return constructArrayNegativeIndexed(exec, profile, globalObject, &length, 1, newTarget);
-    }
+    if (!length.isNumber())
+        RELEASE_AND_RETURN(scope, constructArrayNegativeIndexed(exec, profile, globalObject, &length, 1, newTarget));
     
     uint32_t n = length.toUInt32(exec);
     if (n != length.toNumber(exec)) {
         throwException(exec, scope, createRangeError(exec, "Array size is not a small enough positive integer."_s));
         return nullptr;
     }
-    scope.release();
-    return constructEmptyArray(exec, profile, globalObject, n, newTarget);
+    RELEASE_AND_RETURN(scope, constructEmptyArray(exec, profile, globalObject, n, newTarget));
 }
 
 static inline JSArray* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args, JSValue newTarget)
index c147292..c37389a 100644 (file)
@@ -165,12 +165,10 @@ static ALWAYS_INLINE JSValue getProperty(ExecState* exec, JSObject* object, unsi
     EXCEPTION_ASSERT(!scope.exception() || !hasProperty);
     if (!hasProperty)
         return { };
-    if (UNLIKELY(slot.isTaintedByOpaqueObject())) {
-        scope.release();
-        return object->get(exec, index);
-    }
-    scope.release();
-    return slot.getValue(exec, index);
+    if (UNLIKELY(slot.isTaintedByOpaqueObject()))
+        RELEASE_AND_RETURN(scope, object->get(exec, index));
+
+    RELEASE_AND_RETURN(scope, slot.getValue(exec, index));
 }
 
 static ALWAYS_INLINE bool putLength(ExecState* exec, VM& vm, JSObject* obj, JSValue value)
@@ -453,8 +451,7 @@ inline JSValue fastJoin(ExecState& state, JSObject* thisObject, StringView separ
                 joiner.appendEmptyString();
             }
         }
-        scope.release();
-        return joiner.join(state);
+        RELEASE_AND_RETURN(scope, joiner.join(state));
     }
     case ALL_CONTIGUOUS_INDEXING_TYPES: {
         auto& butterfly = *thisObject->butterfly();
@@ -479,8 +476,7 @@ inline JSValue fastJoin(ExecState& state, JSObject* thisObject, StringView separ
                 joiner.appendEmptyString();
             }
         }
-        scope.release();
-        return joiner.join(state);
+        RELEASE_AND_RETURN(scope, joiner.join(state));
     }
     case ALL_DOUBLE_INDEXING_TYPES: {
         auto& butterfly = *thisObject->butterfly();
@@ -505,8 +501,7 @@ inline JSValue fastJoin(ExecState& state, JSObject* thisObject, StringView separ
                 joiner.appendEmptyString();
             }
         }
-        scope.release();
-        return joiner.join(state);
+        RELEASE_AND_RETURN(scope, joiner.join(state));
     }
     }
 
@@ -519,8 +514,7 @@ generalCase:
         joiner.append(state, element);
         RETURN_IF_EXCEPTION(scope, { });
     }
-    scope.release();
-    return joiner.join(state);
+    RELEASE_AND_RETURN(scope, joiner.join(state));
 }
 
 EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
@@ -546,16 +540,12 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
     if (callType == CallType::None)
         customJoinCase = true;
 
-    if (UNLIKELY(customJoinCase)) {
-        scope.release();
-        return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable(vm)->className(thisObject, vm), "]"));
-    }
+    if (UNLIKELY(customJoinCase))
+        RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisObject->methodTable(vm)->className(thisObject, vm), "]")));
 
     // 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, *vm.emptyList));
-    }
+    if (!isJSArray(thisObject) || callType != CallType::Host || callData.native.function != arrayProtoFuncJoin)
+        RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, function, callType, callData, thisObject, *vm.emptyList)));
 
     ASSERT(isJSArray(thisValue));
     JSArray* thisArray = asArray(thisValue);
@@ -604,8 +594,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
 
-    scope.release();
-    return JSValue::encode(joiner.join(*exec));
+    RELEASE_AND_RETURN(scope, JSValue::encode(joiner.join(*exec)));
 }
 
 EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
@@ -653,8 +642,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
 
-    scope.release();
-    return JSValue::encode(stringJoiner.join(*exec));
+    RELEASE_AND_RETURN(scope, JSValue::encode(stringJoiner.join(*exec)));
 }
 
 static JSValue slowJoin(ExecState& exec, JSObject* thisObject, JSString* separator, uint64_t length)
@@ -736,15 +724,13 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
             JSString* jsSeparator = jsSingleCharacterString(exec, comma);
             RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-            scope.release();
-            return JSValue::encode(slowJoin(*exec, thisObject, jsSeparator, length64));
+            RELEASE_AND_RETURN(scope, JSValue::encode(slowJoin(*exec, thisObject, jsSeparator, length64)));
         }
 
         unsigned unsignedLength = static_cast<unsigned>(length);
         ASSERT(static_cast<double>(unsignedLength) == length);
 
-        scope.release();
-        return JSValue::encode(fastJoin(*exec, thisObject, { &comma, 1 }, unsignedLength));
+        RELEASE_AND_RETURN(scope, JSValue::encode(fastJoin(*exec, thisObject, { &comma, 1 }, unsignedLength)));
     }
 
     // 4. Let sep be ? ToString(separator).
@@ -755,15 +741,13 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
         uint64_t length64 = static_cast<uint64_t>(length);
         ASSERT(static_cast<double>(length64) == length);
 
-        scope.release();
-        return JSValue::encode(slowJoin(*exec, thisObject, jsSeparator, length64));
+        RELEASE_AND_RETURN(scope, JSValue::encode(slowJoin(*exec, thisObject, jsSeparator, length64)));
     }
 
     auto viewWithString = jsSeparator->viewWithUnderlyingString(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(fastJoin(*exec, thisObject, viewWithString.view, length));
+    RELEASE_AND_RETURN(scope, JSValue::encode(fastJoin(*exec, thisObject, viewWithString.view, length)));
 }
 
 EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
@@ -773,10 +757,8 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
 
     JSValue thisValue = exec->thisValue().toThis(exec, StrictMode);
 
-    if (isJSArray(thisValue)) {
-        scope.release();
-        return JSValue::encode(asArray(thisValue)->pop(exec));
-    }
+    if (isJSArray(thisValue))
+        RELEASE_AND_RETURN(scope, JSValue::encode(asArray(thisValue)->pop(exec)));
 
     JSObject* thisObj = thisValue.toObject(exec);
     EXCEPTION_ASSERT(!!scope.exception() == !thisObj);
@@ -1457,10 +1439,8 @@ EncodedJSValue JSC_HOST_CALL arrayProtoPrivateFuncConcatMemcpy(ExecState* exec)
         return JSValue::encode(jsNull());
 
     JSValue second = exec->uncheckedArgument(1);
-    if (!isJSArray(second)) {
-        scope.release();
-        return concatAppendOne(exec, vm, firstArray, second);
-    }
+    if (!isJSArray(second))
+        RELEASE_AND_RETURN(scope, concatAppendOne(exec, vm, firstArray, second));
 
     JSArray* secondArray = jsCast<JSArray*>(second);
     
index 6aa95ea..ba92ba9 100644 (file)
@@ -98,20 +98,17 @@ static EncodedJSValue toBigInt(ExecState& state, JSValue argument)
     
     auto scope = DECLARE_THROW_SCOPE(vm);
     
-    if (argument.isBoolean()) {
-        scope.release();
-        return JSValue::encode(JSBigInt::createFrom(vm, argument.asBoolean()));
-    }
+    if (argument.isBoolean())
+        RELEASE_AND_RETURN(scope, JSValue::encode(JSBigInt::createFrom(vm, argument.asBoolean())));
     
     if (argument.isUndefinedOrNull() || argument.isNumber() || argument.isSymbol())
         return throwVMTypeError(&state, scope, "Invalid argument type in ToBigInt operation"_s);
     
     ASSERT(argument.isString());
     
-    scope.release();
-    return toStringView(&state, argument, [&] (StringView view) {
+    RELEASE_AND_RETURN(scope, toStringView(&state, argument, [&] (StringView view) {
         return JSValue::encode(JSBigInt::parseInt(&state, view));
-    });
+    }));
 }
 
 static EncodedJSValue JSC_HOST_CALL callBigIntConstructor(ExecState* state)
index 1ece895..eb10fd7 100644 (file)
@@ -103,14 +103,12 @@ inline bool opInByVal(ExecState* exec, JSValue baseVal, JSValue propName, ArrayP
     if (propName.getUInt32(i)) {
         if (arrayProfile)
             arrayProfile->observeIndexedRead(vm, baseObj, i);
-        scope.release();
-        return baseObj->hasProperty(exec, i);
+        RELEASE_AND_RETURN(scope, baseObj->hasProperty(exec, i));
     }
 
     auto property = propName.toPropertyKey(exec);
     RETURN_IF_EXCEPTION(scope, false);
-    scope.release();
-    return baseObj->hasProperty(exec, property);
+    RELEASE_AND_RETURN(scope, baseObj->hasProperty(exec, property));
 }
 
 inline void tryCachePutToScopeGlobal(
index 3aebbd0..878b089 100644 (file)
@@ -44,8 +44,7 @@ JSObject* construct(ExecState* exec, JSValue constructorObject, const ArgList& a
     if (constructType == ConstructType::None)
         return throwTypeError(exec, scope, errorMessage);
 
-    scope.release();
-    return construct(exec, constructorObject, constructType, constructData, args, constructorObject);
+    RELEASE_AND_RETURN(scope, construct(exec, constructorObject, constructType, constructData, args, constructorObject));
 }
 
 
index e38e5ed..dbaf636 100644 (file)
@@ -169,8 +169,7 @@ EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec)
     auto scope = DECLARE_THROW_SCOPE(vm);
     String dateStr = exec->argument(0).toWTFString(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(jsNumber(parseDate(exec, vm, dateStr)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsNumber(parseDate(exec, vm, dateStr))));
 }
 
 EncodedJSValue JSC_HOST_CALL dateNow(ExecState*)
index 5ead376..c2d42a0 100644 (file)
@@ -636,8 +636,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncToPrimitiveSymbol(ExecState* exec)
     if (type == NoPreference)
         type = PreferString;
 
-    scope.release();
-    return JSValue::encode(thisObject->ordinaryToPrimitive(exec, type));
+    RELEASE_AND_RETURN(scope, JSValue::encode(thisObject->ordinaryToPrimitive(exec, type)));
 }
 
 EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec)
index 1a2cc6f..2a78fd0 100644 (file)
@@ -79,8 +79,7 @@ public:
             auto scope = DECLARE_THROW_SCOPE(vm);
             JSValue value = get(exec, vm.propertyNames->length);
             RETURN_IF_EXCEPTION(scope, 0);
-            scope.release();
-            return value.toUInt32(exec);
+            RELEASE_AND_RETURN(scope, value.toUInt32(exec));
         }
         return m_length;
     }
index 02b1b86..b09c058 100644 (file)
@@ -59,8 +59,7 @@ EncodedJSValue JSC_HOST_CALL Interpreter::constructWithErrorConstructor(ExecStat
     JSValue message = exec->argument(0);
     Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), jsCast<InternalFunction*>(exec->jsCallee())->globalObject(vm)->errorStructure());
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)));
 }
 
 EncodedJSValue JSC_HOST_CALL Interpreter::callErrorConstructor(ExecState* exec)
index 06f0c20..0e620c6 100644 (file)
@@ -120,8 +120,7 @@ EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
         return JSValue::encode(name.isString() ? name : jsString(exec, nameString));
 
     // 10. Return the result of concatenating name, ":", a single space character, and msg.
-    scope.release();
-    return JSValue::encode(jsMakeNontrivialString(exec, nameString, ": ", messageString));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, nameString, ": ", messageString)));
 }
 
 } // namespace JSC
index 080ea59..a30a291 100644 (file)
@@ -93,4 +93,9 @@ protected:
             return value__; \
     } while (false)
 
+#define RELEASE_AND_RETURN(scope__, expression__) do { \
+        scope__.release(); \
+        return expression__; \
+    } while (false)
+
 } // namespace JSC
index fc30fcf..34fb118 100644 (file)
@@ -71,8 +71,7 @@ JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const
 
     if (!globalObject->evalEnabled())
         return throwException(exec, scope, createEvalError(exec, globalObject->evalDisabledErrorMessage()));
-    scope.release();
-    return constructFunctionSkippingEvalEnabledCheck(exec, globalObject, args, functionName, sourceOrigin, sourceURL, position, -1, functionConstructionMode, newTarget);
+    RELEASE_AND_RETURN(scope, constructFunctionSkippingEvalEnabledCheck(exec, globalObject, args, functionName, sourceOrigin, sourceURL, position, -1, functionConstructionMode, newTarget));
 }
 
 JSObject* constructFunctionSkippingEvalEnabledCheck(
index 8fc3013..d1513c9 100644 (file)
@@ -87,10 +87,8 @@ EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
     JSValue thisValue = exec->thisValue();
     if (thisValue.inherits<JSFunction>(vm)) {
         JSFunction* function = jsCast<JSFunction*>(thisValue);
-        if (function->isHostOrBuiltinFunction()) {
-            scope.release();
-            return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(vm), "() {\n    [native code]\n}"));
-        }
+        if (function->isHostOrBuiltinFunction())
+            RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(vm), "() {\n    [native code]\n}")));
 
         FunctionExecutable* executable = function->jsExecutable();
         if (executable->isClass()) {
@@ -141,22 +139,18 @@ EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
         StringView source = executable->source().provider()->getRange(
             executable->parametersStartOffset(),
             executable->parametersStartOffset() + executable->source().length());
-        scope.release();
-        return JSValue::encode(jsMakeNontrivialString(exec, functionHeader, function->name(vm), source));
+        RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, functionHeader, function->name(vm), source)));
     }
 
     if (thisValue.inherits<InternalFunction>(vm)) {
         InternalFunction* function = jsCast<InternalFunction*>(thisValue);
-        scope.release();
-        return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(), "() {\n    [native code]\n}"));
+        RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(), "() {\n    [native code]\n}")));
     }
 
     if (thisValue.isObject()) {
         JSObject* object = asObject(thisValue);
-        if (object->isFunction(vm)) {
-            scope.release();
-            return JSValue::encode(jsMakeNontrivialString(exec, "function ", object->classInfo(vm)->className, "() {\n    [native code]\n}"));
-        }
+        if (object->isFunction(vm))
+            RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, "function ", object->classInfo(vm)->className, "() {\n    [native code]\n}")));
     }
 
     return throwVMTypeError(exec, scope);
index 25eba92..40dbc60 100644 (file)
@@ -254,8 +254,7 @@ bool GenericArguments<Type>::defineOwnProperty(JSObject* object, ExecState* exec
     }
 
     // Now just let the normal object machinery do its thing.
-    scope.release();
-    return Base::defineOwnProperty(object, exec, ident, descriptor, shouldThrow);
+    RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, ident, descriptor, shouldThrow));
 }
 
 template<typename Type>
index c5a5243..998d184 100644 (file)
@@ -57,8 +57,7 @@ JSValue callGetter(ExecState* exec, JSValue base, JSValue getterSetter)
 
     CallData callData;
     CallType callType = getter->methodTable(vm)->getCallData(getter, callData);
-    scope.release();
-    return call(exec, getter, callType, callData, base, ArgList());
+    RELEASE_AND_RETURN(scope, call(exec, getter, callType, callData, base, ArgList()));
 }
 
 bool callSetter(ExecState* exec, JSValue base, JSValue getterSetter, JSValue value, ECMAMode ecmaMode)
index 79c50fc..af15bbb 100644 (file)
@@ -141,8 +141,7 @@ EncodedJSValue JSC_HOST_CALL IntlCollatorConstructorFuncSupportedLocalesOf(ExecS
 
     // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options).
     JSGlobalObject* globalObject = state->jsCallee()->globalObject(vm);
-    scope.release();
-    return JSValue::encode(supportedLocales(*state, globalObject->intlCollatorAvailableLocales(), requestedLocales, state->argument(1)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(supportedLocales(*state, globalObject->intlCollatorAvailableLocales(), requestedLocales, state->argument(1))));
 }
 
 void IntlCollatorConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
index 90bfefe..35269d0 100644 (file)
@@ -104,8 +104,7 @@ static EncodedJSValue JSC_HOST_CALL IntlCollatorFuncCompare(ExecState* state)
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
     auto yViewWithString = y->viewWithUnderlyingString(state);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(collator->compareStrings(*state, xViewWithString.view, yViewWithString.view));
+    RELEASE_AND_RETURN(scope, JSValue::encode(collator->compareStrings(*state, xViewWithString.view, yViewWithString.view)));
 }
 
 EncodedJSValue JSC_HOST_CALL IntlCollatorPrototypeGetterCompare(ExecState* state)
@@ -147,8 +146,7 @@ EncodedJSValue JSC_HOST_CALL IntlCollatorPrototypeFuncResolvedOptions(ExecState*
     if (!collator)
         return JSValue::encode(throwTypeError(state, scope, "Intl.Collator.prototype.resolvedOptions called on value that's not an object initialized as a Collator"_s));
 
-    scope.release();
-    return JSValue::encode(collator->resolvedOptions(*state));
+    RELEASE_AND_RETURN(scope, JSValue::encode(collator->resolvedOptions(*state)));
 }
 
 } // namespace JSC
index 5fcbffe..ed48baf 100644 (file)
@@ -142,8 +142,7 @@ EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatConstructorFuncSupportedLocalesOf
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     // 3. Return SupportedLocales(availableLocales, requestedLocales, options).
-    scope.release();
-    return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1))));
 }
 
 void IntlDateTimeFormatConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
index af91573..1e4d760 100644 (file)
@@ -111,8 +111,7 @@ static EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatFuncFormatDateTime(ExecSta
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
 
-    scope.release();
-    return JSValue::encode(format->format(*state, value));
+    RELEASE_AND_RETURN(scope, JSValue::encode(format->format(*state, value)));
 }
 
 EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeGetterFormat(ExecState* state)
@@ -176,8 +175,7 @@ EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeFuncFormatToParts(ExecSt
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
 
-    scope.release();
-    return JSValue::encode(dateTimeFormat->formatToParts(*state, value));
+    RELEASE_AND_RETURN(scope, JSValue::encode(dateTimeFormat->formatToParts(*state, value)));
 }
 #endif
 
@@ -200,8 +198,7 @@ EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeFuncResolvedOptions(Exec
     if (!dateTimeFormat)
         return JSValue::encode(throwTypeError(state, scope, "Intl.DateTimeFormat.prototype.resolvedOptions called on value that's not an object initialized as a DateTimeFormat"_s));
 
-    scope.release();
-    return JSValue::encode(dateTimeFormat->resolvedOptions(*state));
+    RELEASE_AND_RETURN(scope, JSValue::encode(dateTimeFormat->resolvedOptions(*state)));
 }
 
 } // namespace JSC
index fb7be3c..03ef39a 100644 (file)
@@ -142,8 +142,7 @@ EncodedJSValue JSC_HOST_CALL IntlNumberFormatConstructorFuncSupportedLocalesOf(E
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     // 3. Return SupportedLocales(availableLocales, requestedLocales, options).
-    scope.release();
-    return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1))));
 }
 
 void IntlNumberFormatConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
index 1d52aa4..679fe68 100644 (file)
@@ -106,8 +106,7 @@ static EncodedJSValue JSC_HOST_CALL IntlNumberFormatFuncFormatNumber(ExecState*
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     // 6. Return FormatNumber(nf, x).
-    scope.release();
-    return JSValue::encode(numberFormat->formatNumber(*state, number));
+    RELEASE_AND_RETURN(scope, JSValue::encode(numberFormat->formatNumber(*state, number)));
 }
 
 EncodedJSValue JSC_HOST_CALL IntlNumberFormatPrototypeGetterFormat(ExecState* state)
@@ -163,8 +162,7 @@ EncodedJSValue JSC_HOST_CALL IntlNumberFormatPrototypeFuncFormatToParts(ExecStat
     double value = state->argument(0).toNumber(state);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(numberFormat->formatToParts(*state, value));
+    RELEASE_AND_RETURN(scope, JSValue::encode(numberFormat->formatToParts(*state, value)));
 }
 #endif
 
@@ -187,8 +185,7 @@ EncodedJSValue JSC_HOST_CALL IntlNumberFormatPrototypeFuncResolvedOptions(ExecSt
     if (!numberFormat)
         return JSValue::encode(throwTypeError(state, scope, "Intl.NumberFormat.prototype.resolvedOptions called on value that's not an object initialized as a NumberFormat"_s));
 
-    scope.release();
-    return JSValue::encode(numberFormat->resolvedOptions(*state));
+    RELEASE_AND_RETURN(scope, JSValue::encode(numberFormat->resolvedOptions(*state)));
 }
 
 } // namespace JSC
index b19e95c..7a18b3d 100644 (file)
@@ -212,8 +212,7 @@ unsigned intlNumberOption(ExecState& state, JSValue options, PropertyName proper
     JSValue value = opts->get(&state, property);
     RETURN_IF_EXCEPTION(scope, 0);
 
-    scope.release();
-    return intlDefaultNumberOption(state, value, property, minimum, maximum, fallback);
+    RELEASE_AND_RETURN(scope, intlDefaultNumberOption(state, value, property, minimum, maximum, fallback));
 }
 
 unsigned intlDefaultNumberOption(ExecState& state, JSValue value, PropertyName property, unsigned minimum, unsigned maximum, unsigned fallback)
index 6bbd000..d875cf1 100644 (file)
@@ -57,8 +57,7 @@ JSValue constructIntlInstanceWithWorkaroundForLegacyIntlConstructor(ExecState& s
             return thisObject;
         }
     }
-    scope.release();
-    return factory(vm);
+    RELEASE_AND_RETURN(scope, factory(vm));
 }
 
 } // namespace JSC
index 4af5726..5ff9c0b 100644 (file)
@@ -235,8 +235,7 @@ JSObject* IntlPluralRules::resolvedOptions(ExecState& exec)
     options->putDirect(vm, Identifier::fromString(&vm, "pluralCategories"), categories);
 #endif
 
-    scope.release();
-    return options;
+    RELEASE_AND_RETURN(scope, options);
 }
 
 JSValue IntlPluralRules::select(ExecState& exec, double value)
index 7597bd7..2ae8b06 100644 (file)
@@ -124,8 +124,7 @@ EncodedJSValue JSC_HOST_CALL IntlPluralRulesConstructorFuncSupportedLocalesOf(Ex
     Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0));
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1))));
 }
 
 void IntlPluralRulesConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
index 0cc95d7..92a4367 100644 (file)
@@ -92,8 +92,7 @@ EncodedJSValue JSC_HOST_CALL IntlPluralRulesPrototypeFuncSelect(ExecState* state
     double value = state->argument(0).toNumber(state);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(pluralRules->select(*state, value));
+    RELEASE_AND_RETURN(scope, JSValue::encode(pluralRules->select(*state, value)));
 }
 
 EncodedJSValue JSC_HOST_CALL IntlPluralRulesPrototypeFuncResolvedOptions(ExecState* state)
@@ -108,8 +107,7 @@ EncodedJSValue JSC_HOST_CALL IntlPluralRulesPrototypeFuncResolvedOptions(ExecSta
     if (!pluralRules)
         return JSValue::encode(throwTypeError(state, scope, "Intl.PluralRules.prototype.resolvedOptions called on value that's not an object initialized as a PluralRules"_s));
 
-    scope.release();
-    return JSValue::encode(pluralRules->resolvedOptions(*state));
+    RELEASE_AND_RETURN(scope, JSValue::encode(pluralRules->resolvedOptions(*state)));
 }
 
 } // namespace JSC
index a9e1e54..cddbbe2 100644 (file)
@@ -253,12 +253,10 @@ bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName
         // e.i. Set oldLenDesc.[[Value]] to index + 1.
         // e.ii. Call the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", oldLenDesc, and false as arguments. This call will always return true.
         // f. Return true.
-        scope.release();
-        return array->defineOwnIndexedProperty(exec, index, descriptor, throwException);
+        RELEASE_AND_RETURN(scope, array->defineOwnIndexedProperty(exec, index, descriptor, throwException));
     }
 
-    scope.release();
-    return array->JSObject::defineOwnNonIndexProperty(exec, propertyName, descriptor, throwException);
+    RELEASE_AND_RETURN(scope, array->JSObject::defineOwnNonIndexProperty(exec, propertyName, descriptor, throwException));
 }
 
 bool JSArray::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
@@ -282,10 +280,8 @@ bool JSArray::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSVa
 
     JSArray* thisObject = jsCast<JSArray*>(cell);
 
-    if (UNLIKELY(isThisValueAltered(slot, thisObject))) {
-        scope.release();
-        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
-    }
+    if (UNLIKELY(isThisValueAltered(slot, thisObject)))
+        RELEASE_AND_RETURN(scope, ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode()));
 
     thisObject->ensureWritable(vm);
 
@@ -300,12 +296,10 @@ bool JSArray::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSVa
             throwException(exec, scope, createRangeError(exec, "Invalid array length"_s));
             return false;
         }
-        scope.release();
-        return thisObject->setLength(exec, newLength, slot.isStrictMode());
+        RELEASE_AND_RETURN(scope, thisObject->setLength(exec, newLength, slot.isStrictMode()));
     }
 
-    scope.release();
-    return JSObject::put(thisObject, exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, JSObject::put(thisObject, exec, propertyName, value, slot));
 }
 
 bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
@@ -589,10 +583,9 @@ bool JSArray::setLength(ExecState* exec, unsigned newLength, bool throwException
         if (!newLength)
             return true;
         if (newLength >= MIN_SPARSE_ARRAY_INDEX) {
-            scope.release();
-            return setLengthWithArrayStorage(
+            RELEASE_AND_RETURN(scope, setLengthWithArrayStorage(
                 exec, newLength, throwException,
-                ensureArrayStorage(vm));
+                ensureArrayStorage(vm)));
         }
         createInitialUndecided(vm, newLength);
         return true;
@@ -615,10 +608,9 @@ bool JSArray::setLength(ExecState* exec, unsigned newLength, bool throwException
         if (newLength > MAX_STORAGE_VECTOR_LENGTH // This check ensures that we can do fast push.
             || (newLength >= MIN_SPARSE_ARRAY_INDEX
                 && !isDenseEnoughForVector(newLength, countElements()))) {
-            scope.release();
-            return setLengthWithArrayStorage(
+            RELEASE_AND_RETURN(scope, setLengthWithArrayStorage(
                 exec, newLength, throwException,
-                ensureArrayStorage(vm));
+                ensureArrayStorage(vm)));
         }
         if (newLength > butterfly->publicLength()) {
             if (!ensureLength(vm, newLength)) {
@@ -648,8 +640,7 @@ bool JSArray::setLength(ExecState* exec, unsigned newLength, bool throwException
         
     case ArrayWithArrayStorage:
     case ArrayWithSlowPutArrayStorage:
-        scope.release();
-        return setLengthWithArrayStorage(exec, newLength, throwException, arrayStorage());
+        RELEASE_AND_RETURN(scope, setLengthWithArrayStorage(exec, newLength, throwException, arrayStorage()));
         
     default:
         CRASH();
@@ -1092,10 +1083,8 @@ bool JSArray::unshiftCountWithAnyIndexingType(ExecState* exec, unsigned startInd
         
         // We may have to walk the entire array to do the unshift. We're willing to do so
         // only if it's not horribly slow.
-        if (oldLength - startIndex >= MIN_SPARSE_ARRAY_INDEX) {
-            scope.release();
-            return unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm));
-        }
+        if (oldLength - startIndex >= MIN_SPARSE_ARRAY_INDEX)
+            RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm)));
 
         Checked<unsigned, RecordOverflow> checkedLength(oldLength);
         checkedLength += count;
@@ -1116,10 +1105,8 @@ bool JSArray::unshiftCountWithAnyIndexingType(ExecState* exec, unsigned startInd
         // through shifting and then realize we should have been in ArrayStorage mode.
         for (unsigned i = oldLength; i-- > startIndex;) {
             JSValue v = butterfly->contiguous().at(this, i).get();
-            if (UNLIKELY(!v)) {
-                scope.release();
-                return unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm));
-            }
+            if (UNLIKELY(!v))
+                RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm)));
         }
 
         for (unsigned i = oldLength; i-- > startIndex;) {
@@ -1145,10 +1132,8 @@ bool JSArray::unshiftCountWithAnyIndexingType(ExecState* exec, unsigned startInd
         
         // We may have to walk the entire array to do the unshift. We're willing to do so
         // only if it's not horribly slow.
-        if (oldLength - startIndex >= MIN_SPARSE_ARRAY_INDEX) {
-            scope.release();
-            return unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm));
-        }
+        if (oldLength - startIndex >= MIN_SPARSE_ARRAY_INDEX)
+            RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm)));
 
         Checked<unsigned, RecordOverflow> checkedLength(oldLength);
         checkedLength += count;
@@ -1169,10 +1154,8 @@ bool JSArray::unshiftCountWithAnyIndexingType(ExecState* exec, unsigned startInd
         // through shifting and then realize we should have been in ArrayStorage mode.
         for (unsigned i = oldLength; i-- > startIndex;) {
             double v = butterfly->contiguousDouble().at(this, i);
-            if (UNLIKELY(v != v)) {
-                scope.release();
-                return unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm));
-            }
+            if (UNLIKELY(v != v))
+                RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(exec, startIndex, count, ensureArrayStorage(vm)));
         }
 
         for (unsigned i = oldLength; i-- > startIndex;) {
@@ -1191,8 +1174,7 @@ bool JSArray::unshiftCountWithAnyIndexingType(ExecState* exec, unsigned startInd
         
     case ArrayWithArrayStorage:
     case ArrayWithSlowPutArrayStorage:
-        scope.release();
-        return unshiftCountWithArrayStorage(exec, startIndex, count, arrayStorage());
+        RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(exec, startIndex, count, arrayStorage()));
         
     default:
         CRASH();
index 28811cc..6c0b971 100644 (file)
@@ -82,9 +82,7 @@ static EncodedJSValue JSC_HOST_CALL arrayBufferProtoGetterFuncByteLength(ExecSta
     if (thisObject->isShared())
         return throwVMTypeError(exec, scope, "Receiver should not be a shared array buffer"_s);
 
-    scope.release();
-
-    return JSValue::encode(jsNumber(thisObject->impl()->byteLength()));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsNumber(thisObject->impl()->byteLength())));
 }
 
 // http://tc39.github.io/ecmascript_sharedmem/shmem.html#StructuredData.SharedArrayBuffer.prototype.get_byteLength
@@ -102,9 +100,7 @@ static EncodedJSValue JSC_HOST_CALL sharedArrayBufferProtoGetterFuncByteLength(E
     if (!thisObject->isShared())
         return throwVMTypeError(exec, scope, "Receiver should be a shared array buffer"_s);
 
-    scope.release();
-
-    return JSValue::encode(jsNumber(thisObject->impl()->byteLength()));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsNumber(thisObject->impl()->byteLength())));
 }
 
 const ClassInfo JSArrayBufferPrototype::s_info = {
index 5095735..169bed2 100644 (file)
@@ -100,8 +100,7 @@ ALWAYS_INLINE double toLength(ExecState* exec, JSObject* obj)
 
     JSValue lengthValue = obj->get(exec, vm.propertyNames->length);
     RETURN_IF_EXCEPTION(scope, PNaN);
-    scope.release();
-    return lengthValue.toLength(exec);
+    RELEASE_AND_RETURN(scope, lengthValue.toLength(exec));
 }
 
 ALWAYS_INLINE void JSArray::pushInline(ExecState* exec, JSValue value)
index 2cbdb93..ff49eaf 100644 (file)
@@ -79,8 +79,7 @@ EncodedJSValue JSC_HOST_CALL boundFunctionCall(ExecState* exec)
     CallData callData;
     CallType callType = getCallData(vm, targetFunction, callData);
     ASSERT(callType != CallType::None);
-    scope.release();
-    return JSValue::encode(call(exec, targetFunction, callType, callData, boundFunction->boundThis(), args));
+    RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, targetFunction, callType, callData, boundFunction->boundThis(), args)));
 }
 
 EncodedJSValue JSC_HOST_CALL boundThisNoArgsFunctionConstruct(ExecState* exec)
@@ -123,8 +122,7 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec)
     ConstructData constructData;
     ConstructType constructType = getConstructData(vm, targetFunction, constructData);
     ASSERT(constructType != ConstructType::None);
-    scope.release();
-    return JSValue::encode(construct(exec, targetFunction, constructType, constructData, args));
+    RELEASE_AND_RETURN(scope, JSValue::encode(construct(exec, targetFunction, constructType, constructData, args)));
 }
 
 EncodedJSValue JSC_HOST_CALL isBoundFunction(ExecState* exec)
index 9681962..1361579 100644 (file)
@@ -152,10 +152,8 @@ bool JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
-    if (std::optional<uint32_t> index = parseIndex(propertyName)) {
-        scope.release();
-        return putToPrimitiveByIndex(exec, index.value(), value, slot.isStrictMode());
-    }
+    if (std::optional<uint32_t> index = parseIndex(propertyName))
+        RELEASE_AND_RETURN(scope, putToPrimitiveByIndex(exec, index.value(), value, slot.isStrictMode()));
 
     // Check if there are any setters or getters in the prototype chain
     JSObject* obj = synthesizePrototype(exec);
@@ -181,10 +179,8 @@ bool JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue
                 return typeError(exec, scope, slot.isStrictMode(), ReadonlyPropertyWriteError);
 
             JSValue gs = obj->getDirect(offset);
-            if (gs.isGetterSetter()) {
-                scope.release();
-                return callSetter(exec, *this, gs, value, slot.isStrictMode() ? StrictMode : NotStrictMode);
-            }
+            if (gs.isGetterSetter())
+                RELEASE_AND_RETURN(scope, callSetter(exec, *this, gs, value, slot.isStrictMode() ? StrictMode : NotStrictMode));
 
             if (gs.isCustomGetterSetter())
                 return callCustomSetter(exec, gs, attributes & PropertyAttribute::CustomAccessor, obj, slot.thisValue(), value);
index b885daf..6cf3a22 100644 (file)
@@ -74,8 +74,7 @@ inline uint32_t JSValue::toIndex(ExecState* exec, const char* errorName) const
 
     if (isInt32())
         return asInt32();
-    scope.release();
-    return JSC::toInt32(d);
+    RELEASE_AND_RETURN(scope, JSC::toInt32(d));
 }
 
 inline bool JSValue::isUInt32() const
@@ -647,19 +646,15 @@ ALWAYS_INLINE Identifier JSValue::toPropertyKey(ExecState* exec) const
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
-    if (isString()) {
-        scope.release();
-        return asString(*this)->toIdentifier(exec);
-    }
+    if (isString())
+        RELEASE_AND_RETURN(scope, asString(*this)->toIdentifier(exec));
 
     JSValue primitive = toPrimitive(exec, PreferString);
     RETURN_IF_EXCEPTION(scope, vm.propertyNames->emptyIdentifier);
-    if (primitive.isSymbol()) {
-        scope.release();
-        return Identifier::fromUid(asSymbol(primitive)->privateName());
-    }
-    scope.release();
-    return primitive.toString(exec)->toIdentifier(exec);
+    if (primitive.isSymbol())
+        RELEASE_AND_RETURN(scope, Identifier::fromUid(asSymbol(primitive)->privateName()));
+
+    RELEASE_AND_RETURN(scope, primitive.toString(exec)->toIdentifier(exec));
 }
 
 inline JSValue JSValue::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const
@@ -843,8 +838,7 @@ ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, PropertyName propertyName, P
     EXCEPTION_ASSERT(!scope.exception() || !hasSlot);
     if (!hasSlot)
         return jsUndefined();
-    scope.release();
-    return slot.getValue(exec, propertyName);
+    RELEASE_AND_RETURN(scope, slot.getValue(exec, propertyName));
 }
 
 template<typename CallbackWhenNoException>
@@ -860,8 +854,7 @@ ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot
     auto scope = DECLARE_THROW_SCOPE(exec->vm());
     bool found = getPropertySlot(exec, propertyName, slot);
     RETURN_IF_EXCEPTION(scope, { });
-    scope.release();
-    return callback(found, slot);
+    RELEASE_AND_RETURN(scope, callback(found, slot));
 }
 
 ALWAYS_INLINE bool JSValue::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) const
@@ -884,8 +877,7 @@ ALWAYS_INLINE bool JSValue::getPropertySlot(ExecState* exec, PropertyName proper
     } else
         object = asObject(asCell());
 
-    scope.release();
-    return object->getPropertySlot(exec, propertyName, slot);
+    RELEASE_AND_RETURN(scope, object->getPropertySlot(exec, propertyName, slot));
 }
 
 ALWAYS_INLINE bool JSValue::getOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) const
@@ -894,16 +886,14 @@ ALWAYS_INLINE bool JSValue::getOwnPropertySlot(ExecState* exec, PropertyName pro
     // and if it's a string there are special properties to check first.
     auto scope = DECLARE_THROW_SCOPE(exec->vm());
     if (UNLIKELY(!isObject())) {
-        if (isString()) {
-            scope.release();
-            return asString(*this)->getStringPropertySlot(exec, propertyName, slot);
-        }
+        if (isString())
+            RELEASE_AND_RETURN(scope, asString(*this)->getStringPropertySlot(exec, propertyName, slot));
+
         if (isUndefinedOrNull())
             throwException(exec, scope, createNotAnObjectError(exec, *this));
         return false;
     }
-    scope.release();
-    return asObject(asCell())->getOwnPropertySlotInline(exec, propertyName, slot);
+    RELEASE_AND_RETURN(scope, asObject(asCell())->getOwnPropertySlotInline(exec, propertyName, slot));
 }
 
 ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, unsigned propertyName) const
@@ -922,10 +912,8 @@ ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, unsigned propertyName, Prope
         if (isString()) {
             bool hasProperty = asString(*this)->getStringPropertySlot(exec, propertyName, slot);
             RETURN_IF_EXCEPTION(scope, { });
-            if (hasProperty) {
-                scope.release();
-                return slot.getValue(exec, propertyName);
-            }
+            if (hasProperty)
+                RELEASE_AND_RETURN(scope, slot.getValue(exec, propertyName));
         }
         object = synthesizePrototype(exec);
         EXCEPTION_ASSERT(!!scope.exception() == !object);
@@ -938,8 +926,7 @@ ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, unsigned propertyName, Prope
     EXCEPTION_ASSERT(!scope.exception() || !hasSlot);
     if (!hasSlot)
         return jsUndefined();
-    scope.release();
-    return slot.getValue(exec, propertyName);
+    RELEASE_AND_RETURN(scope, slot.getValue(exec, propertyName));
 }
 
 ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, uint64_t propertyName) const
@@ -1005,10 +992,8 @@ ALWAYS_INLINE bool JSValue::equalSlowCaseInline(ExecState* exec, JSValue v1, JSV
 
         bool s1 = v1.isString();
         bool s2 = v2.isString();
-        if (s1 && s2) {
-            scope.release();
-            return asString(v1)->equal(exec, asString(v2));
-        }
+        if (s1 && s2)
+            RELEASE_AND_RETURN(scope, asString(v1)->equal(exec, asString(v2)));
 
         if (v1.isBigInt() && s2) {
             JSBigInt* n = JSBigInt::stringToBigInt(exec, asString(v2)->value(exec));
index a7f57ce..5ba963b 100644 (file)
@@ -127,17 +127,14 @@ bool JSDataView::put(
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSDataView* thisObject = jsCast<JSDataView*>(cell);
 
-    if (UNLIKELY(isThisValueAltered(slot, thisObject))) {
-        scope.release();
-        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
-    }
+    if (UNLIKELY(isThisValueAltered(slot, thisObject)))
+        RELEASE_AND_RETURN(scope, ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode()));
 
     if (propertyName == vm.propertyNames->byteLength
         || propertyName == vm.propertyNames->byteOffset)
         return typeError(exec, scope, slot.isStrictMode(), "Attempting to write to read-only typed array property."_s);
 
-    scope.release();
-    return Base::put(thisObject, exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
 }
 
 bool JSDataView::defineOwnProperty(
@@ -151,8 +148,7 @@ bool JSDataView::defineOwnProperty(
         || propertyName == vm.propertyNames->byteOffset)
         return typeError(exec, scope, shouldThrow, "Attempting to define read-only typed array property."_s);
 
-    scope.release();
-    return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
+    RELEASE_AND_RETURN(scope, Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow));
 }
 
 bool JSDataView::deleteProperty(
index 5143f7e..e809a57 100644 (file)
@@ -497,17 +497,15 @@ bool JSFunction::put(JSCell* cell, ExecState* exec, PropertyName propertyName, J
 
     JSFunction* thisObject = jsCast<JSFunction*>(cell);
 
-    if (UNLIKELY(isThisValueAltered(slot, thisObject))) {
-        scope.release();
-        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
-    }
+    if (UNLIKELY(isThisValueAltered(slot, thisObject)))
+        RELEASE_AND_RETURN(scope, ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode()));
+
 
     if (thisObject->isHostOrBuiltinFunction()) {
         PropertyStatus propertyType = thisObject->reifyLazyPropertyForHostOrBuiltinIfNeeded(vm, exec, propertyName);
         if (isLazy(propertyType))
             slot.disableCaching();
-        scope.release();
-        return Base::put(thisObject, exec, propertyName, value, slot);
+        RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
     }
 
     if (propertyName == vm.propertyNames->prototype) {
@@ -518,23 +516,20 @@ bool JSFunction::put(JSCell* cell, ExecState* exec, PropertyName propertyName, J
         thisObject->methodTable(vm)->getOwnPropertySlot(thisObject, exec, propertyName, getSlot);
         if (thisObject->m_rareData)
             thisObject->m_rareData->clear("Store to prototype property of a function");
-        scope.release();
-        return Base::put(thisObject, exec, propertyName, value, slot);
+        RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
     }
 
     if (propertyName == vm.propertyNames->arguments || propertyName == vm.propertyNames->caller) {
-        if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties()) {
-            scope.release();
-            return Base::put(thisObject, exec, propertyName, value, slot);
-        }
+        if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties())
+            RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
+
         slot.disableCaching();
         return typeError(exec, scope, slot.isStrictMode(), ReadonlyPropertyWriteError);
     }
     PropertyStatus propertyType = thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName);
     if (isLazy(propertyType))
         slot.disableCaching();
-    scope.release();
-    return Base::put(thisObject, exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
 }
 
 bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
@@ -567,8 +562,7 @@ bool JSFunction::defineOwnProperty(JSObject* object, ExecState* exec, PropertyNa
     JSFunction* thisObject = jsCast<JSFunction*>(object);
     if (thisObject->isHostOrBuiltinFunction()) {
         thisObject->reifyLazyPropertyForHostOrBuiltinIfNeeded(vm, exec, propertyName);
-        scope.release();
-        return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
+        RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException));
     }
 
     if (propertyName == vm.propertyNames->prototype) {
@@ -578,27 +572,23 @@ bool JSFunction::defineOwnProperty(JSObject* object, ExecState* exec, PropertyNa
         thisObject->methodTable(vm)->getOwnPropertySlot(thisObject, exec, propertyName, slot);
         if (thisObject->m_rareData)
             thisObject->m_rareData->clear("Store to prototype property of a function");
-        scope.release();
-        return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
+        RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException));
     }
 
     bool valueCheck;
     if (propertyName == vm.propertyNames->arguments) {
-        if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties()) {
-            scope.release();
-            return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
-        }
+        if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties())
+            RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException));
+
         valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveArguments(exec, thisObject));
     } else if (propertyName == vm.propertyNames->caller) {
-        if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties()) {
-            scope.release();
-            return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
-        }
+        if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties())
+            RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException));
+
         valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveCallerFunction(exec, thisObject));
     } else {
         thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName);
-        scope.release();
-        return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
+        RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException));
     }
      
     if (descriptor.configurablePresent() && descriptor.configurable())
index 279a781..85a764a 100644 (file)
@@ -133,8 +133,7 @@ inline JSObject* constructGenericTypedArrayViewWithArguments(ExecState* exec, St
             length = (buffer->byteLength() - offset) / ViewClass::elementSize;
         }
 
-        scope.release();
-        return ViewClass::create(exec, structure, WTFMove(buffer), offset, length);
+        RELEASE_AND_RETURN(scope, ViewClass::create(exec, structure, WTFMove(buffer), offset, length));
     }
     ASSERT(!offset && !lengthOpt);
     
@@ -171,8 +170,7 @@ inline JSObject* constructGenericTypedArrayViewWithArguments(ExecState* exec, St
                     || lengthSlot.isAccessor() || lengthSlot.isCustom() || lengthSlot.isTaintedByOpaqueObject()
                     || hasAnyArrayStorage(object->indexingType()))) {
 
-                    scope.release();
-                    return constructGenericTypedArrayViewFromIterator<ViewClass>(exec, structure, object, iteratorFunc);
+                    RELEASE_AND_RETURN(scope, constructGenericTypedArrayViewFromIterator<ViewClass>(exec, structure, object, iteratorFunc));
             }
 
             if (lengthSlot.isUnset())
@@ -200,8 +198,7 @@ inline JSObject* constructGenericTypedArrayViewWithArguments(ExecState* exec, St
 
     unsigned length = firstValue.toIndex(exec, "length");
     RETURN_IF_EXCEPTION(scope, nullptr);
-    scope.release();
-    return ViewClass::create(exec, structure, length);
+    RELEASE_AND_RETURN(scope, ViewClass::create(exec, structure, length));
 }
 
 template<typename ViewClass>
@@ -221,8 +218,7 @@ EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* exec)
         if (ViewClass::TypedArrayStorageType == TypeDataView)
             return throwVMTypeError(exec, scope, "DataView constructor requires at least one argument."_s);
 
-        scope.release();
-        return JSValue::encode(ViewClass::create(exec, structure, 0));
+        RELEASE_AND_RETURN(scope, JSValue::encode(ViewClass::create(exec, structure, 0)));
     }
 
     JSValue firstValue = exec->uncheckedArgument(0);
@@ -247,8 +243,7 @@ EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* exec)
         }
     }
 
-    scope.release();
-    return JSValue::encode(constructGenericTypedArrayViewWithArguments<ViewClass>(exec, structure, JSValue::encode(firstValue), offset, length));
+    RELEASE_AND_RETURN(scope, JSValue::encode(constructGenericTypedArrayViewWithArguments<ViewClass>(exec, structure, JSValue::encode(firstValue), offset, length)));
 }
 
 template<typename ViewClass>
index 5b2d1fb..ca18844 100644 (file)
@@ -262,41 +262,32 @@ bool JSGenericTypedArrayView<Adaptor>::set(
     
     switch (ci->typedArrayStorageType) {
     case TypeInt8:
-        scope.release();
-        return setWithSpecificType<Int8Adaptor>(
-            exec, offset, jsCast<JSInt8Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Int8Adaptor>(
+            exec, offset, jsCast<JSInt8Array*>(object), objectOffset, length, type));
     case TypeInt16:
-        scope.release();
-        return setWithSpecificType<Int16Adaptor>(
-            exec, offset, jsCast<JSInt16Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Int16Adaptor>(
+            exec, offset, jsCast<JSInt16Array*>(object), objectOffset, length, type));
     case TypeInt32:
-        scope.release();
-        return setWithSpecificType<Int32Adaptor>(
-            exec, offset, jsCast<JSInt32Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Int32Adaptor>(
+            exec, offset, jsCast<JSInt32Array*>(object), objectOffset, length, type));
     case TypeUint8:
-        scope.release();
-        return setWithSpecificType<Uint8Adaptor>(
-            exec, offset, jsCast<JSUint8Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Uint8Adaptor>(
+            exec, offset, jsCast<JSUint8Array*>(object), objectOffset, length, type));
     case TypeUint8Clamped:
-        scope.release();
-        return setWithSpecificType<Uint8ClampedAdaptor>(
-            exec, offset, jsCast<JSUint8ClampedArray*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Uint8ClampedAdaptor>(
+            exec, offset, jsCast<JSUint8ClampedArray*>(object), objectOffset, length, type));
     case TypeUint16:
-        scope.release();
-        return setWithSpecificType<Uint16Adaptor>(
-            exec, offset, jsCast<JSUint16Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Uint16Adaptor>(
+            exec, offset, jsCast<JSUint16Array*>(object), objectOffset, length, type));
     case TypeUint32:
-        scope.release();
-        return setWithSpecificType<Uint32Adaptor>(
-            exec, offset, jsCast<JSUint32Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Uint32Adaptor>(
+            exec, offset, jsCast<JSUint32Array*>(object), objectOffset, length, type));
     case TypeFloat32:
-        scope.release();
-        return setWithSpecificType<Float32Adaptor>(
-            exec, offset, jsCast<JSFloat32Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Float32Adaptor>(
+            exec, offset, jsCast<JSFloat32Array*>(object), objectOffset, length, type));
     case TypeFloat64:
-        scope.release();
-        return setWithSpecificType<Float64Adaptor>(
-            exec, offset, jsCast<JSFloat64Array*>(object), objectOffset, length, type);
+        RELEASE_AND_RETURN(scope, setWithSpecificType<Float64Adaptor>(
+            exec, offset, jsCast<JSFloat64Array*>(object), objectOffset, length, type));
     case NotTypedArray:
     case TypeDataView: {
         bool success = validateRange(exec, offset, length);
@@ -414,14 +405,12 @@ bool JSGenericTypedArrayView<Adaptor>::defineOwnProperty(
 
         if (descriptor.value()) {
             PutPropertySlot unused(JSValue(thisObject), shouldThrow);
-            scope.release();
-            return thisObject->put(thisObject, exec, propertyName, descriptor.value(), unused);
+            RELEASE_AND_RETURN(scope, thisObject->put(thisObject, exec, propertyName, descriptor.value(), unused));
         }
         return true;
     }
     
-    scope.release();
-    return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
+    RELEASE_AND_RETURN(scope, Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow));
 }
 
 template<typename Adaptor>
index 7c9e6ce..e549f3b 100644 (file)
@@ -51,10 +51,9 @@ inline JSArrayBufferView* speciesConstruct(ExecState* exec, JSObject* exemplar,
     JSValue constructor = exemplar->get(exec, vm.propertyNames->constructor);
     RETURN_IF_EXCEPTION(scope, nullptr);
 
-    if (constructor.isUndefined()) {
-        scope.release();
-        return defaultConstructor();
-    }
+    if (constructor.isUndefined())
+        RELEASE_AND_RETURN(scope, defaultConstructor());
+
     if (!constructor.isObject()) {
         throwTypeError(exec, scope, "constructor Property should not be null"_s);
         return nullptr;
@@ -63,10 +62,9 @@ inline JSArrayBufferView* speciesConstruct(ExecState* exec, JSObject* exemplar,
     JSValue species = constructor.get(exec, vm.propertyNames->speciesSymbol);
     RETURN_IF_EXCEPTION(scope, nullptr);
 
-    if (species.isUndefinedOrNull()) {
-        scope.release();
-        return defaultConstructor();
-    }
+    if (species.isUndefinedOrNull())
+        RELEASE_AND_RETURN(scope, defaultConstructor());
+
 
     JSValue result = construct(exec, species, args, "species is not a constructor");
     RETURN_IF_EXCEPTION(scope, nullptr);
@@ -279,8 +277,7 @@ EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncJoin(VM& vm, ExecStat
             joiner.append(*exec, thisObject->getIndexQuickly(i));
             RETURN_IF_EXCEPTION(scope, encodedJSValue());
         }
-        scope.release();
-        return JSValue::encode(joiner.join(*exec));
+        RELEASE_AND_RETURN(scope, JSValue::encode(joiner.join(*exec)));
     };
 
     JSValue separatorValue = exec->argument(0);
@@ -553,11 +550,10 @@ EncodedJSValue JSC_HOST_CALL genericTypedArrayViewPrivateFuncSubarrayCreate(VM&v
     if (species == defaultConstructor) {
         Structure* structure = callee->globalObject(vm)->typedArrayStructure(ViewClass::TypedArrayStorageType);
 
-        scope.release();
-        return JSValue::encode(ViewClass::create(
+        RELEASE_AND_RETURN(scope, JSValue::encode(ViewClass::create(
             exec, structure, WTFMove(arrayBuffer),
             thisObject->byteOffset() + offset * ViewClass::elementSize,
-            length));
+            length)));
     }
 
     MarkedArgumentBuffer args;
index 3363dde..7bceaf2 100644 (file)
@@ -1097,10 +1097,8 @@ bool JSGlobalObject::put(JSCell* cell, ExecState* exec, PropertyName propertyNam
     JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(cell);
     ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject));
 
-    if (UNLIKELY(isThisValueAltered(slot, thisObject))) {
-        scope.release();
-        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
-    }
+    if (UNLIKELY(isThisValueAltered(slot, thisObject)))
+        RELEASE_AND_RETURN(scope, ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode()));
 
     bool shouldThrowReadOnlyError = slot.isStrictMode();
     bool ignoreReadOnlyErrors = false;
@@ -1109,8 +1107,7 @@ bool JSGlobalObject::put(JSCell* cell, ExecState* exec, PropertyName propertyNam
     EXCEPTION_ASSERT((!!scope.exception() == (done && !putResult)) || !shouldThrowReadOnlyError);
     if (done)
         return putResult;
-    scope.release();
-    return Base::put(thisObject, exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
 }
 
 bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
index 882af97..eaf130e 100644 (file)
@@ -229,8 +229,7 @@ static JSValue decode(ExecState* exec, const CharType* characters, int length, c
         k++;
         builder.append(c);
     }
-    scope.release();
-    return jsString(&vm, builder.toString());
+    RELEASE_AND_RETURN(scope, jsString(&vm, builder.toString()));
 }
 
 static JSValue decode(ExecState* exec, const Bitmap<256>& doNotUnescape, bool strict)
@@ -504,8 +503,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
     if (!eval)
         return encodedJSValue();
 
-    scope.release();
-    return JSValue::encode(vm.interpreter->execute(eval, exec, calleeGlobalObject->globalThis(), calleeGlobalObject->globalScope()));
+    RELEASE_AND_RETURN(scope, JSValue::encode(vm.interpreter->execute(eval, exec, calleeGlobalObject->globalThis(), calleeGlobalObject->globalScope())));
 }
 
 EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
@@ -714,8 +712,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState* exec)
         return JSValue::encode(prototype);
     }
 
-    scope.release();
-    return JSValue::encode(thisObject->getPrototype(vm, exec));
+    RELEASE_AND_RETURN(scope, JSValue::encode(thisObject->getPrototype(vm, exec)));
 }
 
 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState* exec)
index 12f5294..528d7c2 100644 (file)
@@ -66,8 +66,7 @@ JSInternalPromise* JSInternalPromise::then(ExecState* exec, JSFunction* onFulfil
     arguments.append(onRejected ? onRejected : jsUndefined());
     ASSERT(!arguments.hasOverflowed());
 
-    scope.release();
-    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
+    RELEASE_AND_RETURN(scope, jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments)));
 }
 
 } // namespace JSC
index 5050634..8cb0e5f 100644 (file)
@@ -123,8 +123,7 @@ bool JSModuleEnvironment::put(JSCell* cell, ExecState* exec, PropertyName proper
         throwTypeError(exec, scope, ReadonlyPropertyWriteError);
         return false;
     }
-    scope.release();
-    return Base::put(thisObject, exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, Base::put(thisObject, exec, propertyName, value, slot));
 }
 
 bool JSModuleEnvironment::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
index 4553829..b0221f3 100644 (file)
@@ -138,8 +138,7 @@ JSValue JSModuleLoader::provideFetch(ExecState* exec, JSValue key, const SourceC
     arguments.append(JSSourceCode::create(vm, WTFMove(source)));
     ASSERT(!arguments.hasOverflowed());
 
-    scope.release();
-    return call(exec, function, callType, callData, this, arguments);
+    RELEASE_AND_RETURN(scope, call(exec, function, callType, callData, this, arguments));
 }
 
 JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue parameters, JSValue scriptFetcher)
@@ -159,8 +158,7 @@ JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValu
     arguments.append(scriptFetcher);
     ASSERT(!arguments.hasOverflowed());
 
-    scope.release();
-    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
+    RELEASE_AND_RETURN(scope, jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments)));
 }
 
 JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue parameters, JSValue scriptFetcher)
@@ -180,8 +178,7 @@ JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleNam
     arguments.append(scriptFetcher);
     ASSERT(!arguments.hasOverflowed());
 
-    scope.release();
-    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
+    RELEASE_AND_RETURN(scope, jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments)));
 }
 
 JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey, JSValue scriptFetcher)
@@ -200,8 +197,7 @@ JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey
     arguments.append(scriptFetcher);
     ASSERT(!arguments.hasOverflowed());
 
-    scope.release();
-    return call(exec, function, callType, callData, this, arguments);
+    RELEASE_AND_RETURN(scope, call(exec, function, callType, callData, this, arguments));
 }
 
 JSInternalPromise* JSModuleLoader::requestImportModule(ExecState* exec, const Identifier& moduleKey, JSValue parameters, JSValue scriptFetcher)
@@ -221,8 +217,7 @@ JSInternalPromise* JSModuleLoader::requestImportModule(ExecState* exec, const Id
     arguments.append(scriptFetcher);
     ASSERT(!arguments.hasOverflowed());
 
-    scope.release();
-    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
+    RELEASE_AND_RETURN(scope, jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments)));
 }
 
 JSInternalPromise* JSModuleLoader::importModule(ExecState* exec, JSString* moduleName, JSValue parameters, const SourceOrigin& referrer)
@@ -333,8 +328,7 @@ JSModuleNamespaceObject* JSModuleLoader::getModuleNamespaceObject(ExecState* exe
         return nullptr;
     }
 
-    scope.release();
-    return moduleRecord->getModuleNamespace(exec);
+    RELEASE_AND_RETURN(scope, moduleRecord->getModuleNamespace(exec));
 }
 
 // ------------------------------ Functions --------------------------------
@@ -395,10 +389,8 @@ EncodedJSValue JSC_HOST_CALL moduleLoaderRequestedModules(ExecState* exec)
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
     auto* moduleRecord = jsDynamicCast<AbstractModuleRecord*>(vm, exec->argument(0));
-    if (!moduleRecord) {
-        scope.release();
-        return JSValue::encode(constructEmptyArray(exec, nullptr));
-    }
+    if (!moduleRecord) 
+        RELEASE_AND_RETURN(scope, JSValue::encode(constructEmptyArray(exec, nullptr)));
 
     JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size());
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
index 7404e71..2998702 100644 (file)
@@ -280,8 +280,7 @@ JSValue Stringifier::stringify(JSValue value)
     if (UNLIKELY(stringifyResult != StringifySucceeded))
         return jsUndefined();
 
-    scope.release();
-    return jsString(m_exec, result.toString());
+    RELEASE_AND_RETURN(scope, jsString(m_exec, result.toString()));
 }
 
 ALWAYS_INLINE JSValue Stringifier::toJSON(JSObject* object, const PropertyNameForFunctionCall& propertyName)
@@ -298,8 +297,7 @@ ALWAYS_INLINE JSValue Stringifier::toJSON(JSObject* object, const PropertyNameFo
 
     JSValue toJSONFunction = slot.getValue(m_exec, vm.propertyNames->toJSON);
     RETURN_IF_EXCEPTION(scope, { });
-    scope.release();
-    return toJSONImpl(vm, object, toJSONFunction, propertyName);
+    RELEASE_AND_RETURN(scope, toJSONImpl(vm, object, toJSONFunction, propertyName));
 }
 
 JSValue Stringifier::toJSONImpl(VM& vm, JSObject* object, JSValue toJSONFunction, const PropertyNameForFunctionCall& propertyName)
@@ -778,8 +776,7 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
     PutPropertySlot slot(finalHolder);
     finalHolder->methodTable(vm)->put(finalHolder, m_exec, vm.propertyNames->emptyIdentifier, outValue, slot);
     RETURN_IF_EXCEPTION(scope, { });
-    scope.release();
-    return callReviver(finalHolder, jsEmptyString(m_exec), outValue);
+    RELEASE_AND_RETURN(scope, callReviver(finalHolder, jsEmptyString(m_exec), outValue));
 }
 
 // ECMA-262 v5 15.12.2
@@ -836,8 +833,7 @@ EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
         return throwVMError(exec, scope, createError(exec, "No input to stringify"_s));
     Stringifier stringifier(exec, exec->argument(1), exec->argument(2));
     RETURN_IF_EXCEPTION(scope, { });
-    scope.release();
-    return JSValue::encode(stringifier.stringify(exec->uncheckedArgument(0)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(stringifier.stringify(exec->uncheckedArgument(0))));
 }
 
 JSValue JSONParse(ExecState* exec, const String& json)
index 59cfb6d..48be232 100644 (file)
@@ -657,8 +657,7 @@ bool ordinarySetSlow(ExecState* exec, JSObject* object, PropertyName propertyNam
         if (current->type() == ProxyObjectType && propertyName != vm.propertyNames->underscoreProto) {
             ProxyObject* proxy = jsCast<ProxyObject*>(current);
             PutPropertySlot slot(receiver, shouldThrow);
-            scope.release();
-            return proxy->ProxyObject::put(proxy, exec, propertyName, value, slot);
+            RELEASE_AND_RETURN(scope, proxy->ProxyObject::put(proxy, exec, propertyName, value, slot));
         }
 
         // 9.1.9.1-2 Let ownDesc be ? O.[[GetOwnProperty]](P).
@@ -716,14 +715,12 @@ bool ordinarySetSlow(ExecState* exec, JSObject* object, PropertyName propertyNam
             valueDescriptor.setValue(value);
 
             // 9.1.9.1-4-d-iv Return ? Receiver.[[DefineOwnProperty]](P, valueDesc).
-            scope.release();
-            return receiverObject->methodTable(vm)->defineOwnProperty(receiverObject, exec, propertyName, valueDescriptor, shouldThrow);
+            RELEASE_AND_RETURN(scope, receiverObject->methodTable(vm)->defineOwnProperty(receiverObject, exec, propertyName, valueDescriptor, shouldThrow));
         }
 
         // 9.1.9.1-4-e Else Receiver does not currently have a property P,
         // 9.1.9.1-4-e-i Return ? CreateDataProperty(Receiver, P, V).
-        scope.release();
-        return receiverObject->methodTable(vm)->defineOwnProperty(receiverObject, exec, propertyName, PropertyDescriptor(value, static_cast<unsigned>(PropertyAttribute::None)), shouldThrow);
+        RELEASE_AND_RETURN(scope, receiverObject->methodTable(vm)->defineOwnProperty(receiverObject, exec, propertyName, PropertyDescriptor(value, static_cast<unsigned>(PropertyAttribute::None)), shouldThrow));
     }
 
     // 9.1.9.1-5 Assert: IsAccessorDescriptor(ownDesc) is true.
@@ -802,10 +799,8 @@ bool JSObject::putInlineSlow(ExecState* exec, PropertyName propertyName, JSValue
         }
         if (!obj->staticPropertiesReified(vm)) {
             if (obj->classInfo(vm)->hasStaticSetterOrReadonlyProperties()) {
-                if (auto entry = obj->findPropertyHashEntry(vm, propertyName)) {
-                    scope.release();
-                    return putEntry(exec, entry->table->classForThis, entry->value, obj, this, propertyName, value, slot);
-                }
+                if (auto entry = obj->findPropertyHashEntry(vm, propertyName))
+                    RELEASE_AND_RETURN(scope, putEntry(exec, entry->table->classForThis, entry->value, obj, this, propertyName, value, slot));
             }
         }
         if (obj->type() == ProxyObjectType && propertyName != vm.propertyNames->underscoreProto) {
@@ -813,8 +808,7 @@ bool JSObject::putInlineSlow(ExecState* exec, PropertyName propertyName, JSValue
             // We need to do more because this is observable behavior.
             // https://bugs.webkit.org/show_bug.cgi?id=155012
             ProxyObject* proxy = jsCast<ProxyObject*>(obj);
-            scope.release();
-            return proxy->ProxyObject::put(proxy, exec, propertyName, value, slot);
+            RELEASE_AND_RETURN(scope, proxy->ProxyObject::put(proxy, exec, propertyName, value, slot));
         }
         JSValue prototype = obj->getPrototype(vm, exec);
         RETURN_IF_EXCEPTION(scope, false);
@@ -2141,8 +2135,7 @@ JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredT
     if (value)
         return value;
 
-    scope.release();
-    return this->methodTable(vm)->defaultValue(this, exec, preferredType);
+    RELEASE_AND_RETURN(scope, this->methodTable(vm)->defaultValue(this, exec, preferredType));
 }
 
 bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const
@@ -2204,13 +2197,11 @@ bool JSObject::hasInstance(ExecState* exec, JSValue value, JSValue hasInstanceVa
     if (info.implementsDefaultHasInstance()) {
         JSValue prototype = get(exec, vm.propertyNames->prototype);
         RETURN_IF_EXCEPTION(scope, false);
-        scope.release();
-        return defaultHasInstance(exec, value, prototype);
-    }
-    if (info.implementsHasInstance()) {
-        scope.release();
-        return methodTable(vm)->customHasInstance(this, exec, value);
+        RELEASE_AND_RETURN(scope, defaultHasInstance(exec, value, prototype));
     }
+    if (info.implementsHasInstance())
+        RELEASE_AND_RETURN(scope, methodTable(vm)->customHasInstance(this, exec, value));
+
     throwException(exec, scope, createInvalidInstanceofParameterErrorNotFunction(exec, this));
     return false;
 }
@@ -2222,8 +2213,7 @@ bool JSObject::hasInstance(ExecState* exec, JSValue value)
     JSValue hasInstanceValue = get(exec, vm.propertyNames->hasInstanceSymbol);
     RETURN_IF_EXCEPTION(scope, false);
 
-    scope.release();
-    return hasInstance(exec, value, hasInstanceValue);
+    RELEASE_AND_RETURN(scope, hasInstance(exec, value, hasInstanceValue));
 }
 
 bool JSObject::defaultHasInstance(ExecState* exec, JSValue value, JSValue proto)
@@ -2384,8 +2374,7 @@ double JSObject::toNumber(ExecState* exec) const
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSValue primitive = toPrimitive(exec, PreferNumber);
     RETURN_IF_EXCEPTION(scope, 0.0); // should be picked up soon in Nodes.cpp
-    scope.release();
-    return primitive.toNumber(exec);
+    RELEASE_AND_RETURN(scope, primitive.toNumber(exec));
 }
 
 JSString* JSObject::toString(ExecState* exec) const
@@ -2549,8 +2538,7 @@ bool JSObject::defineOwnIndexedProperty(ExecState* exec, unsigned index, const P
         // state (i.e. defineOwnProperty could be used to set a value without needing to entering 'SparseMode').
         if (!descriptor.attributes() && descriptor.value() && canDoFastPutDirectIndex(vm, this)) {
             ASSERT(!descriptor.isAccessorDescriptor());
-            scope.release();
-            return putDirectIndex(exec, index, descriptor.value(), 0, throwException ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
+            RELEASE_AND_RETURN(scope, putDirectIndex(exec, index, descriptor.value(), 0, throwException ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow));
         }
         
         ensureArrayStorageExistsAndEnterDictionaryIndexingMode(vm);
@@ -2811,8 +2799,7 @@ bool JSObject::putByIndexBeyondVectorLengthWithArrayStorage(ExecState* exec, uns
         }
         // We don't want to, or can't use a vector to hold this property - allocate a sparse map & add the value.
         map = allocateSparseIndexMap(vm);
-        scope.release();
-        return map->putEntry(exec, this, i, value, shouldThrow);
+        RELEASE_AND_RETURN(scope, map->putEntry(exec, this, i, value, shouldThrow));
     }
 
     // Update m_length if necessary.
@@ -2828,10 +2815,8 @@ bool JSObject::putByIndexBeyondVectorLengthWithArrayStorage(ExecState* exec, uns
     // We are currently using a map - check whether we still want to be doing so.
     // We will continue  to use a sparse map if SparseMode is set, a vector would be too sparse, or if allocation fails.
     unsigned numValuesInArray = storage->m_numValuesInVector + map->size();
-    if (map->sparseMode() || !isDenseEnoughForVector(length, numValuesInArray) || !increaseVectorLength(vm, length)) {
-        scope.release();
-        return map->putEntry(exec, this, i, value, shouldThrow);
-    }
+    if (map->sparseMode() || !isDenseEnoughForVector(length, numValuesInArray) || !increaseVectorLength(vm, length))
+        RELEASE_AND_RETURN(scope, map->putEntry(exec, this, i, value, shouldThrow));
 
     // Reread m_storage after increaseVectorLength, update m_numValuesInVector.
     storage = arrayStorage();
@@ -2952,8 +2937,7 @@ bool JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage(ExecState* exec,
         }
         // We don't want to, or can't use a vector to hold this property - allocate a sparse map & add the value.
         map = allocateSparseIndexMap(vm);
-        scope.release();
-        return map->putDirect(exec, this, i, value, attributes, mode);
+        RELEASE_AND_RETURN(scope, map->putDirect(exec, this, i, value, attributes, mode));
     }
 
     // Update m_length if necessary.
@@ -2973,10 +2957,8 @@ bool JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage(ExecState* exec,
     // We are currently using a map - check whether we still want to be doing so.
     // We will continue  to use a sparse map if SparseMode is set, a vector would be too sparse, or if allocation fails.
     unsigned numValuesInArray = storage->m_numValuesInVector + map->size();
-    if (map->sparseMode() || attributes || !isDenseEnoughForVector(length, numValuesInArray) || !increaseVectorLength(vm, length)) {
-        scope.release();
-        return map->putDirect(exec, this, i, value, attributes, mode);
-    }
+    if (map->sparseMode() || attributes || !isDenseEnoughForVector(length, numValuesInArray) || !increaseVectorLength(vm, length))
+        RELEASE_AND_RETURN(scope, map->putDirect(exec, this, i, value, attributes, mode));
 
     // Reread m_storage after increaseVectorLength, update m_numValuesInVector.
     storage = arrayStorage();
@@ -3645,8 +3627,7 @@ bool JSObject::defineOwnNonIndexProperty(ExecState* exec, PropertyName propertyN
     bool isCurrentDefined = getOwnPropertyDescriptor(exec, propertyName, current);
     bool isExtensible = this->isExtensible(exec);
     RETURN_IF_EXCEPTION(throwScope, false);
-    throwScope.release();
-    return validateAndApplyPropertyDescriptor(exec, this, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException);
+    RELEASE_AND_RETURN(throwScope, validateAndApplyPropertyDescriptor(exec, this, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException));
 }
 
 bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool throwException)
index 568b266..2523b79 100644 (file)
@@ -1454,10 +1454,9 @@ inline JSValue JSObject::get(ExecState* exec, PropertyName propertyName) const
     PropertySlot slot(this, PropertySlot::InternalMethodType::Get);
     bool hasProperty = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
     EXCEPTION_ASSERT(!scope.exception() || !hasProperty);
-    if (hasProperty) {
-        scope.release();
-        return slot.getValue(exec, propertyName);
-    }
+    if (hasProperty)
+        RELEASE_AND_RETURN(scope, slot.getValue(exec, propertyName));
+
     return jsUndefined();
 }
 
@@ -1468,10 +1467,9 @@ inline JSValue JSObject::get(ExecState* exec, unsigned propertyName) const
     PropertySlot slot(this, PropertySlot::InternalMethodType::Get);
     bool hasProperty = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
     EXCEPTION_ASSERT(!scope.exception() || !hasProperty);
-    if (hasProperty) {
-        scope.release();
-        return slot.getValue(exec, propertyName);
-    }
+    if (hasProperty)
+        RELEASE_AND_RETURN(scope, slot.getValue(exec, propertyName));
+
     return jsUndefined();
 }
 
index 64c19e2..8cced91 100644 (file)
@@ -101,8 +101,7 @@ ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot
     auto scope = DECLARE_THROW_SCOPE(vm);
     bool found = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
     RETURN_IF_EXCEPTION(scope, { });
-    scope.release();
-    return callback(found, slot);
+    RELEASE_AND_RETURN(scope, callback(found, slot));
 }
 
 ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
@@ -222,17 +221,13 @@ ALWAYS_INLINE bool JSObject::putInlineForJSObject(JSCell* cell, ExecState* exec,
     ASSERT(value);
     ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject));
 
-    if (UNLIKELY(isThisValueAltered(slot, thisObject))) {
-        scope.release();
-        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
-    }
+    if (UNLIKELY(isThisValueAltered(slot, thisObject)))
+        RELEASE_AND_RETURN(scope, ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode()));
 
     // Try indexed put first. This is required for correctness, since loads on property names that appear like
     // valid indices will never look in the named property storage.
-    if (std::optional<uint32_t> index = parseIndex(propertyName)) {
-        scope.release();
-        return putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode());
-    }
+    if (std::optional<uint32_t> index = parseIndex(propertyName))
+        RELEASE_AND_RETURN(scope, putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode()));
 
     if (thisObject->canPerformFastPutInline(vm, propertyName)) {
         ASSERT(!thisObject->prototypeChainMayInterceptStoreTo(vm, propertyName));
@@ -241,8 +236,7 @@ ALWAYS_INLINE bool JSObject::putInlineForJSObject(JSCell* cell, ExecState* exec,
         return true;
     }
 
-    scope.release();
-    return thisObject->putInlineSlow(exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, thisObject->putInlineSlow(exec, propertyName, value, slot));
 }
 
 // HasOwnProperty(O, P) from section 7.3.11 in the spec.
index ee85e01..78e534b 100644 (file)
@@ -72,16 +72,12 @@ static EncodedJSValue JSC_HOST_CALL constructMap(ExecState* exec)
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     JSValue iterable = exec->argument(0);
-    if (iterable.isUndefinedOrNull()) {
-        scope.release();
-        return JSValue::encode(JSMap::create(exec, vm, mapStructure));
-    }
+    if (iterable.isUndefinedOrNull())
+        RELEASE_AND_RETURN(scope, JSValue::encode(JSMap::create(exec, vm, mapStructure)));
 
     if (auto* iterableMap = jsDynamicCast<JSMap*>(vm, iterable)) {
-        if (iterableMap->canCloneFastAndNonObservable(mapStructure)) {
-            scope.release();
-            return JSValue::encode(iterableMap->clone(exec, vm, mapStructure));
-        }
+        if (iterableMap->canCloneFastAndNonObservable(mapStructure))
+            RELEASE_AND_RETURN(scope, JSValue::encode(iterableMap->clone(exec, vm, mapStructure)));
     }
 
     JSMap* map = JSMap::create(exec, vm, mapStructure);
index 5fd3a67..8f3dd70 100644 (file)
@@ -69,8 +69,7 @@ EncodedJSValue JSC_HOST_CALL Interpreter::constructWithNativeErrorConstructor(Ex
     Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), jsCast<NativeErrorConstructor*>(exec->jsCallee())->errorStructure());
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
     ASSERT(errorStructure);
-    scope.release();
-    return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)));
 }
 
 EncodedJSValue JSC_HOST_CALL Interpreter::callNativeErrorConstructor(ExecState* exec)
index 3f9f81c..72f5ccc 100644 (file)
@@ -139,8 +139,7 @@ static ALWAYS_INLINE JSObject* constructObject(ExecState* exec, JSValue newTarge
         return constructEmptyObject(exec, globalObject->objectStructureForObjectConstructor());
 
     // 3. Return ToObject(value).
-    scope.release();
-    return arg.toObject(exec, globalObject);
+    RELEASE_AND_RETURN(scope, arg.toObject(exec, globalObject));
 }
 
 static EncodedJSValue JSC_HOST_CALL constructWithObjectConstructor(ExecState* exec)
@@ -159,8 +158,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSObject* object = exec->argument(0).toObject(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(object->getPrototype(vm, exec));
+    RELEASE_AND_RETURN(scope, JSValue::encode(object->getPrototype(vm, exec)));
 }
 
 EncodedJSValue JSC_HOST_CALL objectConstructorSetPrototypeOf(ExecState* exec)
@@ -190,10 +188,8 @@ JSValue objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject* obj
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
     PropertyDescriptor descriptor;
-    if (!object->getOwnPropertyDescriptor(exec, propertyName, descriptor)) {
-        scope.release();
-        return jsUndefined();
-    }
+    if (!object->getOwnPropertyDescriptor(exec, propertyName, descriptor))
+        RELEASE_AND_RETURN(scope, jsUndefined());
     RETURN_IF_EXCEPTION(scope, { });
 
     JSObject* result = constructObjectFromPropertyDescriptor(exec, descriptor);
@@ -243,8 +239,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
     auto propertyName = exec->argument(1).toPropertyKey(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName));
+    RELEASE_AND_RETURN(scope, JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName)));
 }
 
 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptors(ExecState* exec)
@@ -253,8 +248,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptors(ExecStat
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSObject* object = exec->argument(0).toObject(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(objectConstructorGetOwnPropertyDescriptors(exec, object));
+    RELEASE_AND_RETURN(scope, JSValue::encode(objectConstructorGetOwnPropertyDescriptors(exec, object)));
 }
 
 // FIXME: Use the enumeration cache.
@@ -264,8 +258,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exe
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSObject* object = exec->argument(0).toObject(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include)));
 }
 
 // FIXME: Use the enumeration cache.
@@ -275,8 +268,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState* e
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSObject* object = exec->argument(0).toObject(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include)));
 }
 
 // FIXME: Use the enumeration cache.
@@ -286,8 +278,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSObject* object = exec->argument(0).toObject(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude)));
 }
 
 EncodedJSValue JSC_HOST_CALL objectConstructorAssign(ExecState* exec)
@@ -601,8 +592,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
     ASSERT((descriptor.attributes() & PropertyAttribute::Accessor) || (!descriptor.isAccessorDescriptor()));
     scope.assertNoException();
     obj->methodTable(vm)->defineOwnProperty(obj, exec, propertyName, descriptor, true);
-    scope.release();
-    return JSValue::encode(obj);
+    RELEASE_AND_RETURN(scope, JSValue::encode(obj));
 }
 
 static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties)
@@ -660,8 +650,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
     EXCEPTION_ASSERT(!!scope.exception() == !props);
     if (UNLIKELY(!props))
         return encodedJSValue();
-    scope.release();
-    return JSValue::encode(defineProperties(exec, targetObj, props));
+    RELEASE_AND_RETURN(scope, JSValue::encode(defineProperties(exec, targetObj, props)));
 }
 
 EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
@@ -679,8 +668,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
         return JSValue::encode(newObject);
     if (!exec->argument(1).isObject())
         return throwVMTypeError(exec, scope, "Property descriptor list must be an Object."_s);
-    scope.release();
-    return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1))));
+    RELEASE_AND_RETURN(scope, JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1)))));
 }
 
 enum class IntegrityLevel {
index 18779f2..275b56f 100644 (file)
@@ -306,8 +306,7 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec)
         return throwVMTypeError(exec, scope);
 
     // 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, *vm.emptyList));
+    RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, toString, callType, callData, thisValue, *vm.emptyList)));
 }
 
 EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
@@ -328,8 +327,7 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
         return JSValue::encode(result);
 
     PropertyName toStringTagSymbol = vm.propertyNames->toStringTagSymbol;
-    scope.release();
-    return JSValue::encode(thisObject->getPropertySlot(exec, toStringTagSymbol, [&] (bool found, PropertySlot& toStringTagSlot) -> JSValue {
+    RELEASE_AND_RETURN(scope, JSValue::encode(thisObject->getPropertySlot(exec, toStringTagSymbol, [&] (bool found, PropertySlot& toStringTagSlot) -> JSValue {
         if (found) {
             JSValue stringTag = toStringTagSlot.getValue(exec, toStringTagSymbol);
             RETURN_IF_EXCEPTION(scope, { });
@@ -356,7 +354,7 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
         auto result = jsNontrivialString(&vm, newString);
         thisObject->structure(vm)->setObjectToStringValue(exec, vm, result, toStringTagSlot);
         return result;
-    }));
+    })));
 }
 
 } // namespace JSC
index 1bc8101..a088ad1 100644 (file)
@@ -54,15 +54,13 @@ NEVER_INLINE JSValue jsAddSlowCase(CallFrame* callFrame, JSValue v1, JSValue v2)
     if (p1.isString()) {
         JSString* p2String = p2.toString(callFrame);
         RETURN_IF_EXCEPTION(scope, { });
-        scope.release();
-        return jsString(callFrame, asString(p1), p2String);
+        RELEASE_AND_RETURN(scope, jsString(callFrame, asString(p1), p2String));
     }
 
     if (p2.isString()) {
         JSString* p1String = p1.toString(callFrame);
         RETURN_IF_EXCEPTION(scope, { });
-        scope.release();
-        return jsString(callFrame, p1String, asString(p2));
+        RELEASE_AND_RETURN(scope, jsString(callFrame, p1String, asString(p2)));
     }
 
     auto leftNumeric = p1.toNumeric(callFrame);
index 0012b26..6e87659 100644 (file)
@@ -62,20 +62,17 @@ ALWAYS_INLINE JSString* jsString(ExecState* exec, JSString* s1, JSString* s2, JS
     auto scope = DECLARE_THROW_SCOPE(vm);
 
     int32_t length1 = s1->length();
-    if (!length1) {
-        scope.release();
-        return jsString(exec, s2, s3);
-    }
+    if (!length1)
+        RELEASE_AND_RETURN(scope, jsString(exec, s2, s3));
+
     int32_t length2 = s2->length();
-    if (!length2) {
-        scope.release();
-        return jsString(exec, s1, s3);
-    }
+    if (!length2)
+        RELEASE_AND_RETURN(scope, jsString(exec, s1, s3));
+
     int32_t length3 = s3->length();
-    if (!length3) {
-        scope.release();
-        return jsString(exec, s1, s2);
-    }
+    if (!length3)
+        RELEASE_AND_RETURN(scope, jsString(exec, s1, s2));
+
 
     if (sumOverflows<int32_t>(length1, length2, length3)) {
         throwOutOfMemoryError(exec, scope);
@@ -98,18 +95,14 @@ ALWAYS_INLINE JSString* jsString(ExecState* exec, const String& u1, const String
         return nullptr;
     }
     
-    if (!length1) {
-        scope.release();
-        return jsString(exec, jsString(vm, u2), jsString(vm, u3));
-    }
-    if (!length2) {
-        scope.release();
-        return jsString(exec, jsString(vm, u1), jsString(vm, u3));
-    }
-    if (!length3) {
-        scope.release();
-        return jsString(exec, jsString(vm, u1), jsString(vm, u2));
-    }
+    if (!length1)
+        RELEASE_AND_RETURN(scope, jsString(exec, jsString(vm, u2), jsString(vm, u3)));
+
+    if (!length2)
+        RELEASE_AND_RETURN(scope, jsString(exec, jsString(vm, u1), jsString(vm, u3)));
+
+    if (!length3)
+        RELEASE_AND_RETURN(scope, jsString(exec, jsString(vm, u1), jsString(vm, u2)));
 
     if (sumOverflows<int32_t>(length1, length2, length3)) {
         throwOutOfMemoryError(exec, scope);
@@ -270,10 +263,8 @@ ALWAYS_INLINE bool jsLess(CallFrame* callFrame, JSValue v1, JSValue v2)
     RETURN_IF_EXCEPTION(scope, false);
 
     if (wasNotString1 | wasNotString2) {
-        if (p1.isBigInt() || p2.isBigInt()) {
-            scope.release();
-            return bigIntCompare(callFrame, p1, p2, JSBigInt::ComparisonMode::LessThan);
-        }
+        if (p1.isBigInt() || p2.isBigInt())
+            RELEASE_AND_RETURN(scope, bigIntCompare(callFrame, p1, p2, JSBigInt::ComparisonMode::LessThan));
 
         return n1 < n2;
     }
@@ -317,10 +308,8 @@ ALWAYS_INLINE bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2)
     RETURN_IF_EXCEPTION(scope, false);
 
     if (wasNotString1 | wasNotString2) {
-        if (p1.isBigInt() || p2.isBigInt()) {
-            scope.release();
-            return bigIntCompare(callFrame, p1, p2, JSBigInt::ComparisonMode::LessThanOrEqual);
-        }
+        if (p1.isBigInt() || p2.isBigInt())
+            RELEASE_AND_RETURN(scope, bigIntCompare(callFrame, p1, p2, JSBigInt::ComparisonMode::LessThanOrEqual));
 
         return n1 <= n2;
     }
index f310158..a9cd412 100644 (file)
@@ -222,8 +222,7 @@ static ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(StringView)
         return { };
     auto viewWithString = string->viewWithUnderlyingString(exec);
     RETURN_IF_EXCEPTION(scope, { });
-    scope.release();
-    return callback(viewWithString.view);
+    RELEASE_AND_RETURN(scope, callback(viewWithString.view));
 }
 
 // Mapping from integers 0..35 to digit identifying this value, for radix 2..36.
index a27b978..cec0e41 100644 (file)
@@ -102,8 +102,7 @@ static EncodedJSValue JSC_HOST_CALL constructProxyObject(ExecState* exec)
     ArgList args(exec);
     JSValue target = args.at(0);
     JSValue handler = args.at(1);
-    scope.release();
-    return JSValue::encode(ProxyObject::create(exec, exec->lexicalGlobalObject(), target, handler));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ProxyObject::create(exec, exec->lexicalGlobalObject(), target, handler)));
 }
 
 static EncodedJSValue JSC_HOST_CALL callProxy(ExecState* exec)
index 7521dc9..eba085b 100644 (file)
@@ -61,10 +61,8 @@ String ProxyObject::toStringName(const JSObject* object, ExecState* exec)
         bool targetIsArray = isArray(exec, target);
         if (UNLIKELY(scope.exception()))
             break;
-        if (targetIsArray) {
-            scope.release();
-            return target->classInfo(vm)->methodTable.toStringName(target, exec);
-        }
+        if (targetIsArray)
+            RELEASE_AND_RETURN(scope, target->classInfo(vm)->methodTable.toStringName(target, exec));
 
         proxy = jsDynamicCast<const ProxyObject*>(vm, target);
     }
@@ -138,10 +136,9 @@ static JSValue performProxyGet(ExecState* exec, ProxyObject* proxyObject, JSValu
         PropertySlot slot(receiver, PropertySlot::InternalMethodType::Get);
         bool hasProperty = target->getPropertySlot(exec, propertyName, slot);
         EXCEPTION_ASSERT(!scope.exception() || !hasProperty);
-        if (hasProperty) {
-            scope.release();
-            return slot.getValue(exec, propertyName);
-        }
+        if (hasProperty)
+            RELEASE_AND_RETURN(scope, slot.getValue(exec, propertyName));
+
         return jsUndefined();
     };
 
@@ -214,10 +211,8 @@ bool ProxyObject::performInternalMethodGetOwnProperty(ExecState* exec, PropertyN
         return target->methodTable(vm)->getOwnPropertySlot(target, exec, propertyName, slot);
     };
 
-    if (propertyName.isPrivateName()) {
-        scope.release();
-        return performDefaultGetOwnProperty();
-    }
+    if (propertyName.isPrivateName())
+        RELEASE_AND_RETURN(scope, performDefaultGetOwnProperty());
 
     JSValue handlerValue = this->handler();
     if (handlerValue.isNull()) {
@@ -230,10 +225,8 @@ bool ProxyObject::performInternalMethodGetOwnProperty(ExecState* exec, PropertyN
     CallType callType;
     JSValue getOwnPropertyDescriptorMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "getOwnPropertyDescriptor"), "'getOwnPropertyDescriptor' property of a Proxy's handler should be callable"_s);
     RETURN_IF_EXCEPTION(scope, false);
-    if (getOwnPropertyDescriptorMethod.isUndefined()) {
-        scope.release();
-        return performDefaultGetOwnProperty();
-    }
+    if (getOwnPropertyDescriptorMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, performDefaultGetOwnProperty());
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -323,10 +316,8 @@ bool ProxyObject::performHasProperty(ExecState* exec, PropertyName propertyName,
         return target->methodTable(vm)->getOwnPropertySlot(target, exec, propertyName, slot);
     };
 
-    if (propertyName.isPrivateName()) {
-        scope.release();
-        return performDefaultHasProperty();
-    }
+    if (propertyName.isPrivateName())
+        RELEASE_AND_RETURN(scope, performDefaultHasProperty());
 
     JSValue handlerValue = this->handler();
     if (handlerValue.isNull()) {
@@ -339,10 +330,8 @@ bool ProxyObject::performHasProperty(ExecState* exec, PropertyName propertyName,
     CallType callType;
     JSValue hasMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->has, "'has' property of a Proxy's handler should be callable"_s);
     RETURN_IF_EXCEPTION(scope, false);
-    if (hasMethod.isUndefined()) {
-        scope.release();
-        return performDefaultHasProperty();
-    }
+    if (hasMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, performDefaultHasProperty());
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -387,14 +376,11 @@ bool ProxyObject::getOwnPropertySlotCommon(ExecState* exec, PropertyName propert
     slot.setIsTaintedByOpaqueObject();
     switch (slot.internalMethodType()) {
     case PropertySlot::InternalMethodType::Get:
-        scope.release();
-        return performGet(exec, propertyName, slot);
+        RELEASE_AND_RETURN(scope, performGet(exec, propertyName, slot));
     case PropertySlot::InternalMethodType::GetOwnProperty:
-        scope.release();
-        return performInternalMethodGetOwnProperty(exec, propertyName, slot);
+        RELEASE_AND_RETURN(scope, performInternalMethodGetOwnProperty(exec, propertyName, slot));
     case PropertySlot::InternalMethodType::HasProperty:
-        scope.release();
-        return performHasProperty(exec, propertyName, slot);
+        RELEASE_AND_RETURN(scope, performHasProperty(exec, propertyName, slot));
     default:
         return false;
     }
@@ -428,10 +414,8 @@ bool ProxyObject::performPut(ExecState* exec, JSValue putValue, JSValue thisValu
         return false;
     }
 
-    if (propertyName.isPrivateName()) {
-        scope.release();
-        return performDefaultPut();
-    }
+    if (propertyName.isPrivateName())
+        RELEASE_AND_RETURN(scope, performDefaultPut());
 
     JSValue handlerValue = this->handler();
     if (handlerValue.isNull()) {
@@ -445,10 +429,8 @@ bool ProxyObject::performPut(ExecState* exec, JSValue putValue, JSValue thisValu
     JSValue setMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->set, "'set' property of a Proxy's handler should be callable"_s);
     RETURN_IF_EXCEPTION(scope, false);
     JSObject* target = this->target();
-    if (setMethod.isUndefined()) {
-        scope.release();
-        return performDefaultPut();
-    }
+    if (setMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, performDefaultPut());
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -505,8 +487,7 @@ bool ProxyObject::putByIndexCommon(ExecState* exec, JSValue thisValue, unsigned
         PutPropertySlot slot(thisValue, isStrictMode); // We must preserve the "this" target of the putByIndex.
         return target->methodTable(vm)->put(target, exec, ident.impl(), putValue, slot);
     };
-    scope.release();
-    return performPut(exec, putValue, thisValue, ident.impl(), performDefaultPut);
+    RELEASE_AND_RETURN(scope, performPut(exec, putValue, thisValue, ident.impl(), performDefaultPut));
 }
 
 bool ProxyObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
@@ -540,8 +521,7 @@ static EncodedJSValue JSC_HOST_CALL performProxyCall(ExecState* exec)
         CallData callData;
         CallType callType = target->methodTable(vm)->getCallData(target, callData);
         RELEASE_ASSERT(callType != CallType::None);
-        scope.release();
-        return JSValue::encode(call(exec, target, callType, callData, exec->thisValue(), ArgList(exec)));
+        RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, target, callType, callData, exec->thisValue(), ArgList(exec))));
     }
 
     JSArray* argArray = constructArray(exec, static_cast<ArrayAllocationProfile*>(nullptr), ArgList(exec));
@@ -551,8 +531,7 @@ static EncodedJSValue JSC_HOST_CALL performProxyCall(ExecState* exec)
     arguments.append(exec->thisValue().toThis(exec, ECMAMode::StrictMode));
     arguments.append(argArray);
     ASSERT(!arguments.hasOverflowed());
-    scope.release();
-    return JSValue::encode(call(exec, applyMethod, callType, callData, handler, arguments));
+    RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, applyMethod, callType, callData, handler, arguments)));
 }
 
 CallType ProxyObject::getCallData(JSCell* cell, CallData& callData)
@@ -593,8 +572,7 @@ static EncodedJSValue JSC_HOST_CALL performProxyConstruct(ExecState* exec)
         ConstructData constructData;
         ConstructType constructType = target->methodTable(vm)->getConstructData(target, constructData);
         RELEASE_ASSERT(constructType != ConstructType::None);
-        scope.release();
-        return JSValue::encode(construct(exec, target, constructType, constructData, ArgList(exec), exec->newTarget()));
+        RELEASE_AND_RETURN(scope, JSValue::encode(construct(exec, target, constructType, constructData, ArgList(exec), exec->newTarget())));
     }
 
     JSArray* argArray = constructArray(exec, static_cast<ArrayAllocationProfile*>(nullptr), ArgList(exec));
@@ -636,10 +614,8 @@ bool ProxyObject::performDelete(ExecState* exec, PropertyName propertyName, Defa
         return false;
     }
 
-    if (propertyName.isPrivateName()) {
-        scope.release();
-        return performDefaultDelete();
-    }
+    if (propertyName.isPrivateName())
+        RELEASE_AND_RETURN(scope, performDefaultDelete());
 
     JSValue handlerValue = this->handler();
     if (handlerValue.isNull()) {
@@ -653,10 +629,8 @@ bool ProxyObject::performDelete(ExecState* exec, PropertyName propertyName, Defa
     JSValue deletePropertyMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "deleteProperty"), "'deleteProperty' property of a Proxy's handler should be callable"_s);
     RETURN_IF_EXCEPTION(scope, false);
     JSObject* target = this->target();
-    if (deletePropertyMethod.isUndefined()) {
-        scope.release();
-        return performDefaultDelete();
-    }
+    if (deletePropertyMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, performDefaultDelete());
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -728,10 +702,8 @@ bool ProxyObject::performPreventExtensions(ExecState* exec)
     JSValue preventExtensionsMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "preventExtensions"), "'preventExtensions' property of a Proxy's handler should be callable"_s);
     RETURN_IF_EXCEPTION(scope, false);
     JSObject* target = this->target();
-    if (preventExtensionsMethod.isUndefined()) {
-        scope.release();
-        return target->methodTable(vm)->preventExtensions(target, exec);
-    }
+    if (preventExtensionsMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, target->methodTable(vm)->preventExtensions(target, exec));
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -783,10 +755,8 @@ bool ProxyObject::performIsExtensible(ExecState* exec)
     RETURN_IF_EXCEPTION(scope, false);
 
     JSObject* target = this->target();
-    if (isExtensibleMethod.isUndefined()) {
-        scope.release();
-        return target->isExtensible(exec);
-    }
+    if (isExtensibleMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, target->isExtensible(exec));
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -832,8 +802,7 @@ bool ProxyObject::performDefineOwnProperty(ExecState* exec, PropertyName propert
 
     JSObject* target = this->target();
     auto performDefaultDefineOwnProperty = [&] {
-        scope.release();
-        return target->methodTable(vm)->defineOwnProperty(target, exec, propertyName, descriptor, shouldThrow);
+        RELEASE_AND_RETURN(scope, target->methodTable(vm)->defineOwnProperty(target, exec, propertyName, descriptor, shouldThrow));
     };
 
     if (propertyName.isPrivateName())
@@ -1090,10 +1059,8 @@ bool ProxyObject::performSetPrototype(ExecState* exec, JSValue prototype, bool s
     RETURN_IF_EXCEPTION(scope, false);
 
     JSObject* target = this->target();
-    if (setPrototypeOfMethod.isUndefined()) {
-        scope.release();
-        return target->setPrototype(vm, exec, prototype, shouldThrowIfCantSet);
-    }
+    if (setPrototypeOfMethod.isUndefined())
+        RELEASE_AND_RETURN(scope, target->setPrototype(vm, exec, prototype, shouldThrowIfCantSet));
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
@@ -1155,10 +1122,8 @@ JSValue ProxyObject::performGetPrototype(ExecState* exec)
     RETURN_IF_EXCEPTION(scope, { });
 
     JSObject* target = this->target();
-    if (getPrototypeOfMethod.isUndefined()) {
-        scope.release();
-        return target->getPrototype(vm, exec);
-    }
+    if (getPrototypeOfMethod.isUndefined()) 
+        RELEASE_AND_RETURN(scope, target->getPrototype(vm, exec));
 
     MarkedArgumentBuffer arguments;
     arguments.append(target);
index 7999e34..6cd763b 100644 (file)
@@ -126,8 +126,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectConstruct(ExecState* exec)
         return encodedJSValue();
     }
 
-    scope.release();
-    return JSValue::encode(construct(exec, target, constructType, constructData, arguments, newTarget));
+    RELEASE_AND_RETURN(scope, JSValue::encode(construct(exec, target, constructType, constructData, arguments, newTarget)));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.defineproperty
@@ -153,8 +152,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectDefineProperty(ExecState* exec)
     // Reflect.defineProperty should not throw an error when the defineOwnProperty operation fails.
     bool shouldThrow = false;
     JSObject* targetObject = asObject(target);
-    scope.release();
-    return JSValue::encode(jsBoolean(targetObject->methodTable(vm)->defineOwnProperty(targetObject, exec, propertyName, descriptor, shouldThrow)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsBoolean(targetObject->methodTable(vm)->defineOwnProperty(targetObject, exec, propertyName, descriptor, shouldThrow))));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.get
@@ -175,8 +173,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectGet(ExecState* exec)
         receiver = exec->argument(2);
 
     PropertySlot slot(receiver, PropertySlot::InternalMethodType::Get);
-    scope.release();
-    return JSValue::encode(target.get(exec, propertyName, slot));
+    RELEASE_AND_RETURN(scope, JSValue::encode(target.get(exec, propertyName, slot)));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.getownpropertydescriptor
@@ -192,8 +189,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectGetOwnPropertyDescriptor(ExecState* ex
     auto key = exec->argument(1).toPropertyKey(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, asObject(target), key));
+    RELEASE_AND_RETURN(scope, JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, asObject(target), key)));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.getprototypeof
@@ -205,8 +201,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectGetPrototypeOf(ExecState* exec)
     JSValue target = exec->argument(0);
     if (!target.isObject())
         return JSValue::encode(throwTypeError(exec, scope, "Reflect.getPrototypeOf requires the first argument be an object"_s));
-    scope.release();
-    return JSValue::encode(asObject(target)->getPrototype(vm, exec));
+    RELEASE_AND_RETURN(scope, JSValue::encode(asObject(target)->getPrototype(vm, exec)));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.isextensible
@@ -233,8 +228,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectOwnKeys(ExecState* exec)
     JSValue target = exec->argument(0);
     if (!target.isObject())
         return JSValue::encode(throwTypeError(exec, scope, "Reflect.ownKeys requires the first argument be an object"_s));
-    scope.release();
-    return JSValue::encode(ownPropertyKeys(exec, jsCast<JSObject*>(target), PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Include));
+    RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(exec, jsCast<JSObject*>(target), PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Include)));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.preventextensions
@@ -273,8 +267,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectSet(ExecState* exec)
     // Do not raise any readonly errors that happen in strict mode.
     bool shouldThrowIfCantSet = false;
     PutPropertySlot slot(receiver, shouldThrowIfCantSet);
-    scope.release();
-    return JSValue::encode(jsBoolean(targetObject->methodTable(vm)->put(targetObject, exec, propertyName, exec->argument(2), slot)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsBoolean(targetObject->methodTable(vm)->put(targetObject, exec, propertyName, exec->argument(2), slot))));
 }
 
 // https://tc39.github.io/ecma262/#sec-reflect.setprototypeof
index 8552469..3467924 100644 (file)
@@ -299,8 +299,7 @@ JSObject* constructRegExp(ExecState* exec, JSGlobalObject* globalObject, const A
         patternArg = pattern;
     }
 
-    scope.release();
-    return regExpCreate(exec, globalObject, newTarget, patternArg, flagsArg);
+    RELEASE_AND_RETURN(scope, regExpCreate(exec, globalObject, newTarget, patternArg, flagsArg));
 }
 
 EncodedJSValue JSC_HOST_CALL esSpecRegExpCreate(ExecState* exec)
index a33c023..8989381 100644 (file)
@@ -134,8 +134,7 @@ bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, Property
         return true;
     }
 
-    scope.release();
-    return Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow);
+    RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow));
 }
 
 static bool regExpObjectSetLastIndexStrict(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue value)
@@ -195,20 +194,18 @@ JSValue RegExpObject::matchGlobal(ExecState* exec, JSGlobalObject* globalObject,
     ASSERT(!s.isNull());
     if (regExp->unicode()) {
         unsigned stringLength = s.length();
-        scope.release();
-        return collectMatches(
+        RELEASE_AND_RETURN(scope, collectMatches(
             vm, exec, string, s, regExpConstructor, regExp,
             [&] (size_t end) -> size_t {
                 return advanceStringUnicode(s, stringLength, end);
-            });
+            }));
     }
 
-    scope.release();
-    return collectMatches(
+    RELEASE_AND_RETURN(scope, collectMatches(
         vm, exec, string, s, regExpConstructor, regExp,
         [&] (size_t end) -> size_t {
             return end + 1;
-        });
+        }));
 }
 
 } // namespace JSC
index 5685f33..a31af63 100644 (file)
@@ -111,8 +111,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncTestFast(ExecState* exec)
     EXCEPTION_ASSERT(!!scope.exception() == !string);
     if (!string)
         return JSValue::encode(jsUndefined());
-    scope.release();
-    return JSValue::encode(jsBoolean(regexp->test(exec, exec->lexicalGlobalObject(), string)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsBoolean(regexp->test(exec, exec->lexicalGlobalObject(), string))));
 }
 
 EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
@@ -128,8 +127,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
     EXCEPTION_ASSERT(!!scope.exception() == !string);
     if (!string)
         return JSValue::encode(jsUndefined());
-    scope.release();
-    return JSValue::encode(regexp->exec(exec, exec->lexicalGlobalObject(), string));
+    RELEASE_AND_RETURN(scope, JSValue::encode(regexp->exec(exec, exec->lexicalGlobalObject(), string)));
 }
 
 EncodedJSValue JSC_HOST_CALL regExpProtoFuncMatchFast(ExecState* exec)
@@ -249,8 +247,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
     String flags = flagsValue.toWTFString(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(jsMakeNontrivialString(exec, '/', source, '/', flags));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(exec, '/', source, '/', flags)));
 }
 
 EncodedJSValue JSC_HOST_CALL regExpProtoGetterGlobal(ExecState* exec)
index 61e106c..5236096 100644 (file)
@@ -269,9 +269,8 @@ CodeBlock* ScriptExecutable::newCodeBlockFor(
         return nullptr;
     }
 
-    throwScope.release();
-    return FunctionCodeBlock::create(vm, executable, unlinkedCodeBlock, scope, 
-        source().provider(), source().startOffset(), startColumn());
+    RELEASE_AND_RETURN(throwScope, FunctionCodeBlock::create(vm, executable, unlinkedCodeBlock, scope, 
+        source().provider(), source().startOffset(), startColumn()));
 }
 
 CodeBlock* ScriptExecutable::newReplacementCodeBlockFor(
index 0412e51..00b7f93 100644 (file)
@@ -72,16 +72,12 @@ static EncodedJSValue JSC_HOST_CALL constructSet(ExecState* exec)
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     JSValue iterable = exec->argument(0);
-    if (iterable.isUndefinedOrNull()) {
-        scope.release();
-        return JSValue::encode(JSSet::create(exec, vm, setStructure));
-    }
+    if (iterable.isUndefinedOrNull()) 
+        RELEASE_AND_RETURN(scope, JSValue::encode(JSSet::create(exec, vm, setStructure)));
 
     if (auto* iterableSet = jsDynamicCast<JSSet*>(vm, iterable)) {
-        if (iterableSet->canCloneFastAndNonObservable(setStructure)) {
-            scope.release();
-            return JSValue::encode(iterableSet->clone(exec, vm, setStructure));
-        }
+        if (iterableSet->canCloneFastAndNonObservable(setStructure)) 
+            RELEASE_AND_RETURN(scope, JSValue::encode(iterableSet->clone(exec, vm, setStructure)));
     }
 
     JSSet* set = JSSet::create(exec, vm, setStructure);
index 86acde5..e3cfa5a 100644 (file)
@@ -113,8 +113,7 @@ bool SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i,
         return typeError(exec, scope, shouldThrow, ReadonlyPropertyWriteError);
     }
     
-    scope.release();
-    return entry.put(exec, array, this, value, shouldThrow);
+    RELEASE_AND_RETURN(scope, entry.put(exec, array, this, value, shouldThrow));
 }
 
 bool SparseArrayValueMap::putDirect(ExecState* exec, JSObject* array, unsigned i, JSValue value, unsigned attributes, PutDirectIndexMode mode)
@@ -204,8 +203,7 @@ bool SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueM
         return true;
     }
 
-    scope.release();
-    return callSetter(exec, thisValue, Base::get(), value, shouldThrow ? StrictMode : NotStrictMode);
+    RELEASE_AND_RETURN(scope, callSetter(exec, thisValue, Base::get(), value, shouldThrow ? StrictMode : NotStrictMode));
 }
 
 JSValue SparseArrayEntry::getNonSparseMode() const
index dc284e1..bd48937 100644 (file)
@@ -89,8 +89,7 @@ static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
         buf[i] = static_cast<UChar>(exec->uncheckedArgument(i).toUInt32(exec));
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
-    scope.release();
-    return JSValue::encode(jsString(exec, WTFMove(impl)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsString(exec, WTFMove(impl))));
 }
 
 JSString* JSC_HOST_CALL stringFromCharCode(ExecState* exec, int32_t arg)
@@ -124,8 +123,7 @@ static EncodedJSValue JSC_HOST_CALL stringFromCodePoint(ExecState* exec)
         }
     }
 
-    scope.release();
-    return JSValue::encode(jsString(exec, builder.toString()));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsString(exec, builder.toString())));
 }
 
 static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec)
index c34dace..504a600 100644 (file)
@@ -67,19 +67,14 @@ bool StringObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName,
 
     StringObject* thisObject = jsCast<StringObject*>(cell);
 
-    if (UNLIKELY(isThisValueAltered(slot, thisObject))) {
-        scope.release();
-        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());
-    }
+    if (UNLIKELY(isThisValueAltered(slot, thisObject))) 
+        RELEASE_AND_RETURN(scope, ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode()));
 
     if (propertyName == vm.propertyNames->length)
         return typeError(exec, scope, slot.isStrictMode(), ReadonlyPropertyWriteError);
-    if (std::optional<uint32_t> index = parseIndex(propertyName)) {
-        scope.release();
-        return putByIndex(cell, exec, index.value(), value, slot.isStrictMode());
-    }
-    scope.release();
-    return JSObject::put(cell, exec, propertyName, value, slot);
+    if (std::optional<uint32_t> index = parseIndex(propertyName)) 
+        RELEASE_AND_RETURN(scope, putByIndex(cell, exec, index.value(), value, slot.isStrictMode()));
+    RELEASE_AND_RETURN(scope, JSObject::put(cell, exec, propertyName, value, slot));
 }
 
 bool StringObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
@@ -90,8 +85,7 @@ bool StringObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyNa
     StringObject* thisObject = jsCast<StringObject*>(cell);
     if (thisObject->internalValue()->canGetIndex(propertyName))
         return typeError(exec, scope, shouldThrow, ReadonlyPropertyWriteError);
-    scope.release();
-    return JSObject::putByIndex(cell, exec, propertyName, value, shouldThrow);
+    RELEASE_AND_RETURN(scope, JSObject::putByIndex(cell, exec, propertyName, value, shouldThrow));
 }
 
 static bool isStringOwnProperty(ExecState* exec, StringObject* object, PropertyName propertyName)
@@ -123,12 +117,10 @@ bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, Property
         ASSERT(isCurrentDefined);
         bool isExtensible = thisObject->isExtensible(exec);
         RETURN_IF_EXCEPTION(scope, false);
-        scope.release();
-        return validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException);
+        RELEASE_AND_RETURN(scope, validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException));
     }
 
-    scope.release();
-    return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
+    RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException));
 }
 
 bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
index a0abe61..c7f5c20 100644 (file)
@@ -326,8 +326,7 @@ static ALWAYS_INLINE JSString* jsSpliceSubstrings(ExecState* exec, JSString* sou
         if (position <= 0 && length >= sourceSize)
             return sourceVal;
         // We could call String::substringSharingImpl(), but this would result in redundant checks.
-        scope.release();
-        return jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length)));
+        RELEASE_AND_RETURN(scope, jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length))));
     }
 
     int totalLength = 0;
@@ -354,8 +353,7 @@ static ALWAYS_INLINE JSString* jsSpliceSubstrings(ExecState* exec, JSString* sou
             }
         }
 
-        scope.release();
-        return jsString(exec, WTFMove(impl));
+        RELEASE_AND_RETURN(scope, jsString(exec, WTFMove(impl)));
     }
 
     UChar* buffer;
@@ -375,8 +373,7 @@ static ALWAYS_INLINE JSString* jsSpliceSubstrings(ExecState* exec, JSString* sou
         }
     }
 
-    scope.release();
-    return jsString(exec, WTFMove(impl));
+    RELEASE_AND_RETURN(scope, jsString(exec, WTFMove(impl)));
 }
 
 static ALWAYS_INLINE JSString* jsSpliceSubstringsWithSeparators(ExecState* exec, JSString* sourceVal, const String& source, const StringRange* substringRanges, int rangeCount, const String* separators, int separatorCount)
@@ -391,8 +388,7 @@ static ALWAYS_INLINE JSString* jsSpliceSubstringsWithSeparators(ExecState* exec,
         if (position <= 0 && length >= sourceSize)
             return sourceVal;
         // We could call String::substringSharingImpl(), but this would result in redundant checks.
-        scope.release();
-        return jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length)));
+        RELEASE_AND_RETURN(scope, jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length))));
     }
 
     Checked<int, RecordOverflow> totalLength = 0;
@@ -439,8 +435,7 @@ static ALWAYS_INLINE JSString* jsSpliceSubstringsWithSeparators(ExecState* exec,
             }
         }        
 
-        scope.release();
-        return jsString(exec, WTFMove(impl));
+        RELEASE_AND_RETURN(scope, jsString(exec, WTFMove(impl)));
     }
 
     UChar* buffer;
@@ -473,8 +468,7 @@ static ALWAYS_INLINE JSString* jsSpliceSubstringsWithSeparators(ExecState* exec,
         }
     }
 
-    scope.release();
-    return jsString(exec, WTFMove(impl));
+    RELEASE_AND_RETURN(scope, jsString(exec, WTFMove(impl)));
 }
 
 #define OUT_OF_MEMORY(exec__, scope__) \
@@ -522,8 +516,7 @@ static ALWAYS_INLINE JSString* removeUsingRegExpSearch(VM& vm, ExecState* exec,
         if (UNLIKELY(!sourceRanges.tryConstructAndAppend(lastIndex, sourceLen - lastIndex)))
             OUT_OF_MEMORY(exec, scope);
     }
-    scope.release();
-    return jsSpliceSubstrings(exec, string, source, sourceRanges.data(), sourceRanges.size());
+    RELEASE_AND_RETURN(scope, jsSpliceSubstrings(exec, string, source, sourceRanges.data(), sourceRanges.size()));
 }
 
 static ALWAYS_INLINE JSString* replaceUsingRegExpSearch(
@@ -545,10 +538,8 @@ static ALWAYS_INLINE JSString* replaceUsingRegExpSearch(
         regExpObject->setLastIndex(exec, 0);
         RETURN_IF_EXCEPTION(scope, nullptr);
 
-        if (callType == CallType::None && !replacementString.length()) {
-            scope.release();
-            return removeUsingRegExpSearch(vm, exec, string, source, regExp);
-        }
+        if (callType == CallType::None && !replacementString.length()) 
+            RELEASE_AND_RETURN(scope, removeUsingRegExpSearch(vm, exec, string, source, regExp));
     }
 
     // FIXME: This is wrong because we may be called directly from the FTL.
@@ -721,8 +712,7 @@ static ALWAYS_INLINE JSString* replaceUsingRegExpSearch(
         if (UNLIKELY(!sourceRanges.tryConstructAndAppend(lastIndex, sourceLen - lastIndex)))
             OUT_OF_MEMORY(exec, scope);
     }
-    scope.release();
-    return jsSpliceSubstringsWithSeparators(exec, string, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size());
+    RELEASE_AND_RETURN(scope, jsSpliceSubstringsWithSeparators(exec, string, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size()));
 }
 
 JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpEmptyStr(
@@ -737,15 +727,13 @@ JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpEmptyStr(
         // ES5.1 15.5.4.10 step 8.a.
         searchValue->setLastIndex(exec, 0);
         RETURN_IF_EXCEPTION(scope, nullptr);
-        scope.release();
-        return removeUsingRegExpSearch(vm, exec, thisValue, thisValue->value(exec), regExp);
+        RELEASE_AND_RETURN(scope, removeUsingRegExpSearch(vm, exec, thisValue, thisValue->value(exec), regExp));
     }
 
     CallData callData;
     String replacementString = emptyString();
-    scope.release();
-    return replaceUsingRegExpSearch(
-        vm, exec, thisValue, searchValue, callData, CallType::None, replacementString, JSValue());
+    RELEASE_AND_RETURN(scope, replaceUsingRegExpSearch(
+        vm, exec, thisValue, searchValue, callData, CallType::None, replacementString, JSValue()));
 }
 
 JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpString(
@@ -772,9 +760,8 @@ static ALWAYS_INLINE JSString* replaceUsingRegExpSearch(VM& vm, ExecState* exec,
         RETURN_IF_EXCEPTION(scope, nullptr);
     }
 
-    scope.release();
-    return replaceUsingRegExpSearch(
-        vm, exec, string, searchValue, callData, callType, replacementString, replaceValue);
+    RELEASE_AND_RETURN(scope, replaceUsingRegExpSearch(
+        vm, exec, string, searchValue, callData, callType, replacementString, replaceValue));
 }
 
 static ALWAYS_INLINE JSString* replaceUsingStringSearch(VM& vm, ExecState* exec, JSString* jsString, JSValue searchValue, JSValue replaceValue)
@@ -815,8 +802,7 @@ static ALWAYS_INLINE JSString* replaceUsingStringSearch(VM& vm, ExecState* exec,
 
     size_t leftLength = stringImpl->length() - matchEnd;
     String rightPart(StringImpl::createSubstringSharingImpl(*stringImpl, matchEnd, leftLength));
-    scope.release();
-    return JSC::jsString(exec, leftPart, middlePart, rightPart);
+    RELEASE_AND_RETURN(scope, JSC::jsString(exec, leftPart, middlePart, rightPart));
 }
 
 static inline bool checkObjectCoercible(JSValue thisValue)
@@ -848,8 +834,7 @@ static inline JSString* repeatCharacter(ExecState& exec, CharacterType character
 
     std::fill_n(buffer, repeatCount, character);
 
-    scope.release();
-    return jsString(&exec, WTFMove(impl));
+    RELEASE_AND_RETURN(scope, jsString(&exec, WTFMove(impl)));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncRepeatCharacter(ExecState* exec)
@@ -905,8 +890,7 @@ ALWAYS_INLINE JSString* replace(
     }
     JSString* string = thisValue.toString(exec);
     RETURN_IF_EXCEPTION(scope, nullptr);
-    scope.release();
-    return replace(vm, exec, string, searchValue, replaceValue);
+    RELEASE_AND_RETURN(scope, replace(vm, exec, string, searchValue, replaceValue));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncReplaceUsingRegExp(ExecState* exec)
@@ -921,8 +905,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplaceUsingRegExp(ExecState* exec)
     if (!searchValue.inherits<RegExpObject>(vm))
         return JSValue::encode(jsUndefined());
 
-    scope.release();
-    return JSValue::encode(replaceUsingRegExpSearch(vm, exec, string, searchValue, exec->argument(1)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(replaceUsingRegExpSearch(vm, exec, string, searchValue, exec->argument(1))));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncReplaceUsingStringSearch(ExecState* exec)
@@ -933,8 +916,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplaceUsingStringSearch(ExecState*
     JSString* string = exec->thisValue().toString(exec);
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
-    scope.release();
-    return JSValue::encode(replaceUsingStringSearch(vm, exec, string, exec->argument(0), exec->argument(1)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(replaceUsingStringSearch(vm, exec, string, exec->argument(0), exec->argument(1))));
 }
 
 JSCell* JIT_OPERATION operationStringProtoFuncReplaceGeneric(
@@ -1308,15 +1290,11 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncSplitFast(ExecState* exec)
             separatorCharacter = separatorImpl->characters16()[0];
 
         if (stringImpl->is8Bit()) {
-            if (splitStringByOneCharacterImpl<LChar>(exec, result, thisValue, input, stringImpl, separatorCharacter, position, resultLength, limit)) {
-                scope.release();
-                return JSValue::encode(result);
-            }
+            if (splitStringByOneCharacterImpl<LChar>(exec, result, thisValue, input, stringImpl, separatorCharacter, position, resultLength, limit)) 
+                RELEASE_AND_RETURN(scope, JSValue::encode(result));
         } else {
-            if (splitStringByOneCharacterImpl<UChar>(exec, result, thisValue, input, stringImpl, separatorCharacter, position, resultLength, limit)) {
-                scope.release();
-                return JSValue::encode(result);
-            }
+            if (splitStringByOneCharacterImpl<UChar>(exec, result, thisValue, input, stringImpl, separatorCharacter, position, resultLength, limit)) 
+                RELEASE_AND_RETURN(scope, JSValue::encode(result));
         }
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     } else {
@@ -1468,8 +1446,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
     String lowercasedString = s.convertToLowercaseWithoutLocale();
     if (lowercasedString.impl() == s.impl())
         return JSValue::encode(sVal);
-    scope.release();
-    return JSValue::encode(jsString(exec, lowercasedString));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsString(exec, lowercasedString)));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
@@ -1486,8 +1463,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
     String uppercasedString = s.convertToUppercaseWithoutLocale();
     if (uppercasedString.impl() == s.impl())
         return JSValue::encode(sVal);
-    scope.release();
-    return JSValue::encode(jsString(exec, uppercasedString));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsString(exec, uppercasedString)));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
@@ -1589,8 +1565,7 @@ static EncodedJSValue toLocaleCase(ExecState* state, int32_t (*convertCase)(UCha
         return throwVMTypeError(state, scope, u_errorName(error));
 
     // 18. Return L.
-    scope.release();
-    return JSValue::encode(jsString(state, lower));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsString(state, lower)));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncToLocaleLowerCase(ExecState* state)
@@ -1639,8 +1614,7 @@ static inline JSValue trimString(ExecState* exec, JSValue thisValue, int trimKin
     if (left == 0 && right == str.length() && thisValue.isString())
         return thisValue;
 
-    scope.release();
-    return jsString(exec, str.substringSharingImpl(left, right - left));
+    RELEASE_AND_RETURN(scope, jsString(exec, str.substringSharingImpl(left, right - left)));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec)
@@ -1777,8 +1751,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncIncludes(ExecState* exec)
 
     JSValue positionArg = exec->argument(1);
 
-    scope.release();
-    return stringIncludesImpl(vm, exec, stringToSearchIn, searchString, positionArg);
+    RELEASE_AND_RETURN(scope, stringIncludesImpl(vm, exec, stringToSearchIn, searchString, positionArg));
 }
 
 EncodedJSValue JSC_HOST_CALL builtinStringIncludesInternal(ExecState* exec)
@@ -1798,8 +1771,7 @@ EncodedJSValue JSC_HOST_CALL builtinStringIncludesInternal(ExecState* exec)
 
     JSValue positionArg = exec->argument(1);
 
-    scope.release();
-    return stringIncludesImpl(vm, exec, stringToSearchIn, searchString, positionArg);
+    RELEASE_AND_RETURN(scope, stringIncludesImpl(vm, exec, stringToSearchIn, searchString, positionArg));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncIterator(ExecState* exec)
@@ -1866,8 +1838,7 @@ static JSValue normalize(ExecState* exec, const UChar* source, size_t sourceLeng
     if (U_FAILURE(status))
         return throwTypeError(exec, scope);
 
-    scope.release();
-    return jsString(exec, WTFMove(impl));
+    RELEASE_AND_RETURN(scope, jsString(exec, WTFMove(impl)));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncNormalize(ExecState* exec)
@@ -1900,8 +1871,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncNormalize(ExecState* exec)
             return throwVMError(exec, scope, createRangeError(exec, "argument does not match any normalization form"_s));
     }
 
-    scope.release();
-    return JSValue::encode(normalize(exec, view.upconvertedCharacters(), view.length(), form));
+    RELEASE_AND_RETURN(scope, JSValue::encode(normalize(exec, view.upconvertedCharacters(), view.length(), form)));
 }
 
 } // namespace JSC
index f4e9d1c..cb99945 100644 (file)
@@ -109,8 +109,7 @@ EncodedJSValue JSC_HOST_CALL symbolProtoFuncToString(ExecState* exec)
     Symbol* symbol = tryExtractSymbol(vm, exec->thisValue());
     if (!symbol)
         return throwVMTypeError(exec, scope, SymbolToStringTypeError);
-    scope.release();
-    return JSValue::encode(jsNontrivialString(&vm, symbol->descriptiveString()));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsNontrivialString(&vm, symbol->descriptiveString())));
 }
 
 EncodedJSValue JSC_HOST_CALL symbolProtoFuncValueOf(ExecState* exec)
@@ -122,8 +121,7 @@ EncodedJSValue JSC_HOST_CALL symbolProtoFuncValueOf(ExecState* exec)
     if (!symbol)
         return throwVMTypeError(exec, scope, SymbolValueOfTypeError);
 
-    scope.release();
-    return JSValue::encode(symbol);
+    RELEASE_AND_RETURN(scope, JSValue::encode(symbol));
 }
 
 } // namespace JSC
index 8a461e7..f967781 100644 (file)
@@ -1151,14 +1151,12 @@ EncodedJSValue JSC_HOST_CALL functionWasmStreamingParserAddBytes(ExecState* exec
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(exec->vm());
     auto* thisObject = jsDynamicCast<WasmStreamingParser*>(vm, exec->thisValue());
-    if (!thisObject) {
-        scope.release();
-        return JSValue::encode(jsBoolean(false));
-    }
+    if (!thisObject)
+        RELEASE_AND_RETURN(scope, JSValue::encode(jsBoolean(false)));
+
     auto data = getWasmBufferFromValue(exec, exec->argument(0));
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(jsNumber(static_cast<int32_t>(thisObject->streamingParser().addBytes(bitwise_cast<const uint8_t*>(data.first), data.second))));
+    RELEASE_AND_RETURN(scope, JSValue::encode(jsNumber(static_cast<int32_t>(thisObject->streamingParser().addBytes(bitwise_cast<const uint8_t*>(data.first), data.second)))));
 }
 
 EncodedJSValue JSC_HOST_CALL functionWasmStreamingParserFinalize(ExecState* exec)
@@ -1810,8 +1808,7 @@ static EncodedJSValue JSC_HOST_CALL functionGetPrivateProperty(ExecState* exec)
     if (!ident)
         return throwVMError(exec, scope, "Unknown private name.");
 
-    scope.release();
-    return JSValue::encode(exec->argument(0).get(exec, *ident));
+    RELEASE_AND_RETURN(scope, JSValue::encode(exec->argument(0).get(exec, *ident)));
 }
 
 static EncodedJSValue JSC_HOST_CALL functionCreateRoot(ExecState* exec)
index 9f5cb65..7eefc7e 100644 (file)
@@ -51,8 +51,7 @@ static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyCompileError(ExecState
     JSValue message = exec->argument(0);
     auto* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), jsCast<InternalFunction*>(exec->jsCallee())->globalObject(vm)->WebAssemblyCompileErrorStructure());
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    scope.release();
-    return JSValue::encode(JSWebAssemblyCompileError::create(exec, vm, structure, message));
+    RELEASE_AND_RETURN(scope, JSValue::encode(JSWebAssemblyCompileError::create(exec, vm, structure, message)));
 }
 
 static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyCompileError(ExecState* exec)
index ca8f925..db049c1 100644 (file)
@@ -166,8 +166,7 @@ static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyModule(ExecState* exec
     Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, exec->argument(0));
     RETURN_IF_EXCEPTION(scope, { });
 
-    scope.release();
-    return JSValue::encode(WebAssemblyModuleConstructor::createModule(exec, WTFMove(source)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(WebAssemblyModuleConstructor::createModule(exec, WTFMove(source))));
 }
 
 static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyModule(ExecState* exec)
@@ -185,8 +184,7 @@ JSWebAssemblyModule* WebAssemblyModuleConstructor::createModule(ExecState* exec,
     auto* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), exec->lexicalGlobalObject()->WebAssemblyModuleStructure());
     RETURN_IF_EXCEPTION(scope, nullptr);
 
-    scope.release();
-    return JSWebAssemblyModule::createStub(vm, exec, structure, Wasm::Module::validateSync(&vm.wasmContext, WTFMove(buffer)));
+    RELEASE_AND_RETURN(scope, JSWebAssemblyModule::createStub(vm, exec, structure, Wasm::Module::validateSync(&vm.wasmContext, WTFMove(buffer))));
 }
 
 WebAssemblyModuleConstructor* WebAssemblyModuleConstructor::create(VM& vm, Structure* structure, WebAssemblyModulePrototype* thisPrototype)
index 41fd134..076c787 100644 (file)
@@ -96,9 +96,7 @@ static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyTable(ExecState* exec)
             createRangeError(exec, "couldn't create Table"_s)));
     }
 
-    throwScope.release();
-
-    return JSValue::encode(JSWebAssemblyTable::create(exec, vm, exec->lexicalGlobalObject()->WebAssemblyTableStructure(), wasmTable.releaseNonNull()));
+    RELEASE_AND_RETURN(throwScope, JSValue::encode(JSWebAssemblyTable::create(exec, vm, exec->lexicalGlobalObject()->WebAssemblyTableStructure(), wasmTable.releaseNonNull())));
 }
 
 static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyTable(ExecState* exec)
index 444efbf..a34625a 100644 (file)
@@ -50,8 +50,7 @@ static EncodedJSValue JSC_HOST_CALL callWebAssemblyWrapperFunction(ExecState* ex
     JSObject* function = wasmFunction->function();
     CallType callType = function->methodTable(vm)->getCallData(function, callData);
     RELEASE_ASSERT(callType != CallType::None);
-    scope.release();
-    return JSValue::encode(call(exec, function, callType, callData, jsUndefined(), ArgList(exec)));
+    RELEASE_AND_RETURN(scope, JSValue::encode(call(exec, function, callType, callData, jsUndefined(), ArgList(exec))));
 }
 
 WebAssemblyWrapperFunction::WebAssemblyWrapperFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure, Wasm::WasmToWasmImportableFunction importableFunction)
index 4d2ff01..fbac03e 100644 (file)
@@ -1,3 +1,20 @@
+2018-10-01  Keith Miller  <keith_miller@apple.com>
+
+        Create a RELEASE_AND_RETURN macro for ExceptionScopes
+        https://bugs.webkit.org/show_bug.cgi?id=190163
+
+        Reviewed by Mark Lam.
+
+        The new RELEASE_AND_RETURN does all the work for cases
+        where you want to return the result of some expression
+        without explicitly checking for an exception. This is
+        much like the existing RETURN_IF_EXCEPTION macro.
+
+        No new tests since this is a refactor.
+
+        * bridge/runtime_array.cpp:
+        (JSC::RuntimeArray::put):
+
 2018-10-01  Daniel Bates  <dabates@apple.com>
 
         Attempt to fix the watchOS build after <https://trac.webkit.org/changeset/236678>
index 4d34c07..59b362a 100644 (file)
@@ -130,8 +130,7 @@ bool RuntimeArray::put(JSCell* cell, ExecState* exec, PropertyName propertyName,
     if (std::optional<uint32_t> index = parseIndex(propertyName))
         return thisObject->getConcreteArray()->setValueAt(exec, index.value(), value);
 
-    scope.release();
-    return JSObject::put(thisObject, exec, propertyName, value, slot);
+    RELEASE_AND_RETURN(scope, JSObject::put(thisObject, exec, propertyName, value, slot));
 }
 
 bool RuntimeArray::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool)