Changeset 206386 in webkit


Ignore:
Timestamp:
Sep 26, 2016, 12:11:17 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

Added RETURN_IF_EXCEPTION() macro and use it for exception checks.
https://bugs.webkit.org/show_bug.cgi?id=162521

Reviewed by Saam Barati.

Source/JavaScriptCore:

Also, where possible, if the return type is JSValue, changed the returned value
(on exception) to the empty JSValue (instead of sometimes jsUndefined, jsNull,
or the thrown exception value).

There are a few places where I had to continue to return the previously returned
value (instead of the empty JSValue) in order for tests to pass. This is needed
because there are missing exception checks that will need to be added before I
can change those to return the empty JSValue too. Identifying all the places
where those checks need to be added is beyond the scope of this patch. I will
work on adding missing exception checks in a subsequent patch.

In this patch, there is one missing exception check in replaceUsingRegExpSearch()
that was easily identified, and is necessary so that Interpreter::execute()
functions can return JSValue. I've added this missing check.

This patch has passed the JSC and layout tests.

  • dfg/DFGOperations.cpp:

(JSC::DFG::operationPutByValInternal):

  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
(Inspector::JSInjectedScriptHost::getInternalProperties):
(Inspector::JSInjectedScriptHost::weakMapEntries):
(Inspector::JSInjectedScriptHost::weakSetEntries):
(Inspector::JSInjectedScriptHost::iteratorEntries):

  • inspector/JSJavaScriptCallFrame.cpp:

(Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension):

  • interpreter/Interpreter.cpp:

(JSC::eval):
(JSC::sizeOfVarargs):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::functionsOnStack):

  • jit/JITOperations.cpp:

(JSC::getByVal):

  • jsc.cpp:

(WTF::ImpureGetter::getOwnPropertySlot):
(functionRun):
(functionRunString):
(functionLoad):
(functionLoadString):
(functionReadFile):
(functionCheckSyntax):
(functionSetRandomSeed):
(functionLoadModule):
(functionCreateBuiltin):
(functionCheckModuleSyntax):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::getByVal):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • profiler/ProfilerBytecodeSequence.cpp:

(JSC::Profiler::BytecodeSequence::addSequenceProperties):

  • profiler/ProfilerCompilation.cpp:

(JSC::Profiler::Compilation::toJS):

  • profiler/ProfilerDatabase.cpp:

(JSC::Profiler::Database::toJS):

  • profiler/ProfilerOSRExitSite.cpp:

(JSC::Profiler::OSRExitSite::toJS):

  • profiler/ProfilerOriginStack.cpp:

(JSC::Profiler::OriginStack::toJS):

  • runtime/ArrayPrototype.cpp:

(JSC::speciesConstructArray):
(JSC::shift):
(JSC::unshift):
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::slowJoin):
(JSC::fastJoin):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncReverse):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSplice):
(JSC::arrayProtoFuncUnShift):
(JSC::arrayProtoFuncIndexOf):
(JSC::arrayProtoFuncLastIndexOf):
(JSC::moveElements):
(JSC::arrayProtoPrivateFuncConcatMemcpy):

  • runtime/BooleanConstructor.cpp:

(JSC::constructWithBooleanConstructor):

  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::opIn):

  • runtime/Completion.cpp:

(JSC::loadAndEvaluateModule):
(JSC::loadModule):

  • runtime/ConsoleObject.cpp:

(JSC::consoleProtoFuncAssert):
(JSC::consoleProtoFuncProfile):
(JSC::consoleProtoFuncProfileEnd):
(JSC::consoleProtoFuncTakeHeapSnapshot):
(JSC::consoleProtoFuncTime):
(JSC::consoleProtoFuncTimeEnd):

  • runtime/DateConstructor.cpp:

(JSC::constructDate):
(JSC::dateParse):

  • runtime/DatePrototype.cpp:

(JSC::dateProtoFuncToPrimitiveSymbol):
(JSC::dateProtoFuncToJSON):

  • runtime/ErrorConstructor.cpp:

(JSC::Interpreter::constructWithErrorConstructor):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::sanitizedToString):

  • runtime/ErrorPrototype.cpp:

(JSC::errorProtoFuncToString):

  • runtime/ExceptionScope.h:
  • runtime/FunctionConstructor.cpp:

(JSC::constructFunctionSkippingEvalEnabledCheck):

  • runtime/GenericArgumentsInlines.h:

(JSC::GenericArguments<Type>::copyToArguments):

  • runtime/GetterSetter.cpp:

(JSC::callGetter):

  • runtime/HashMapImpl.h:

(JSC::jsMapHash):
(JSC::HashMapImpl::finishCreation):
(JSC::HashMapImpl::findBucket):
(JSC::HashMapImpl::add):
(JSC::HashMapImpl::rehash):

  • runtime/InspectorInstrumentationObject.cpp:

(JSC::inspectorInstrumentationObjectLog):

  • runtime/InternalFunction.cpp:

(JSC::InternalFunction::createSubclassStructure):

  • runtime/IntlCollator.cpp:

(JSC::IntlCollator::initializeCollator):

  • runtime/IntlCollatorConstructor.cpp:

(JSC::constructIntlCollator):
(JSC::IntlCollatorConstructorFuncSupportedLocalesOf):

  • runtime/IntlCollatorPrototype.cpp:

(JSC::IntlCollatorFuncCompare):
(JSC::IntlCollatorPrototypeGetterCompare):

  • runtime/IntlDateTimeFormat.cpp:

(JSC::toDateTimeOptionsAnyDate):
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):

  • runtime/IntlDateTimeFormatConstructor.cpp:

(JSC::constructIntlDateTimeFormat):
(JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf):

  • runtime/IntlDateTimeFormatPrototype.cpp:

(JSC::IntlDateTimeFormatFuncFormatDateTime):
(JSC::IntlDateTimeFormatPrototypeGetterFormat):

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::initializeNumberFormat):

  • runtime/IntlNumberFormatConstructor.cpp:

(JSC::constructIntlNumberFormat):
(JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf):

  • runtime/IntlNumberFormatPrototype.cpp:

(JSC::IntlNumberFormatFuncFormatNumber):
(JSC::IntlNumberFormatPrototypeGetterFormat):

  • runtime/IntlObject.cpp:

(JSC::intlBooleanOption):
(JSC::intlStringOption):
(JSC::intlNumberOption):
(JSC::canonicalizeLocaleList):
(JSC::supportedLocales):

  • runtime/IntlObjectInlines.h:

(JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor):

  • runtime/IteratorOperations.cpp:

(JSC::iteratorNext):
(JSC::iteratorStep):
(JSC::iteratorClose):
(JSC::iteratorForIterable):

  • runtime/IteratorOperations.h:

(JSC::forEachInIterable):

  • runtime/JSArray.cpp:

(JSC::JSArray::pop):
(JSC::JSArray::copyToArguments):

  • runtime/JSArrayBufferConstructor.cpp:

(JSC::constructArrayBuffer):

  • runtime/JSArrayBufferPrototype.cpp:

(JSC::arrayBufferProtoFuncSlice):

  • runtime/JSArrayInlines.h:

(JSC::getLength):
(JSC::toLength):

  • runtime/JSBoundFunction.cpp:

(JSC::getBoundFunctionStructure):
(JSC::JSBoundFunction::create):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::putToPrimitive):
(JSC::JSValue::toStringSlowCase):

  • runtime/JSCJSValueInlines.h:

(JSC::toPreferredPrimitiveType):
(JSC::JSValue::getPropertySlot):
(JSC::JSValue::equalSlowCaseInline):

  • runtime/JSDataViewPrototype.cpp:

(JSC::getData):
(JSC::setData):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::setFunctionName):

  • runtime/JSGenericTypedArrayView.h:

(JSC::JSGenericTypedArrayView::setIndex):

  • runtime/JSGenericTypedArrayViewConstructorInlines.h:

(JSC::constructGenericTypedArrayViewFromIterator):
(JSC::constructGenericTypedArrayViewWithArguments):
(JSC::constructGenericTypedArrayView):

  • runtime/JSGenericTypedArrayViewPrototypeFunctions.h:

(JSC::speciesConstruct):
(JSC::genericTypedArrayViewProtoFuncSet):
(JSC::genericTypedArrayViewProtoFuncCopyWithin):
(JSC::genericTypedArrayViewProtoFuncIncludes):
(JSC::genericTypedArrayViewProtoFuncIndexOf):
(JSC::genericTypedArrayViewProtoFuncJoin):
(JSC::genericTypedArrayViewProtoFuncLastIndexOf):
(JSC::genericTypedArrayViewProtoFuncSlice):
(JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):

  • runtime/JSGlobalObject.h:

(JSC::constructEmptyArray):
(JSC::constructArray):
(JSC::constructArrayNegativeIndexed):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncEval):

  • runtime/JSModuleRecord.cpp:

(JSC::JSModuleRecord::instantiateDeclarations):

  • runtime/JSONObject.cpp:

(JSC::Stringifier::stringify):
(JSC::Stringifier::toJSON):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Stringifier::Holder::appendNextProperty):
(JSC::Walker::walk):
(JSC::JSONProtoFuncParse):

  • runtime/JSObject.cpp:

(JSC::ordinarySetSlow):
(JSC::JSObject::setPrototypeWithCycleCheck):
(JSC::callToPrimitiveFunction):
(JSC::JSObject::defaultHasInstance):
(JSC::JSObject::getPropertyNames):
(JSC::JSObject::toNumber):
(JSC::JSObject::toString):
(JSC::JSObject::defineOwnNonIndexProperty):
(JSC::JSObject::getGenericPropertyNames):
(JSC::JSObject::getMethod):

  • runtime/JSObjectInlines.h:

(JSC::createListFromArrayLike):
(JSC::JSObject::getPropertySlot):
(JSC::JSObject::getNonIndexPropertySlot):

  • runtime/JSPromiseConstructor.cpp:

(JSC::constructPromise):

  • runtime/JSPromiseDeferred.cpp:

(JSC::JSPromiseDeferred::create):

  • runtime/JSPropertyNameEnumerator.h:

(JSC::propertyNameEnumerator):

  • runtime/JSPropertyNameIterator.cpp:

(JSC::JSPropertyNameIterator::create):

  • runtime/JSScope.cpp:

(JSC::isUnscopable):

  • runtime/JSString.cpp:

(JSC::JSString::equalSlowCase):

  • runtime/JSStringJoiner.cpp:

(JSC::JSStringJoiner::join):

  • runtime/LiteralParser.cpp:

(JSC::LiteralParser<CharType>::parse):

  • runtime/MapBase.h:

(JSC::MapBase::finishCreation):

  • runtime/MapConstructor.cpp:

(JSC::constructMap):

  • runtime/MathObject.cpp:

(JSC::mathProtoFuncClz32):
(JSC::mathProtoFuncHypot):
(JSC::mathProtoFuncIMul):

  • runtime/ModuleLoaderPrototype.cpp:

(JSC::moduleLoaderPrototypeParseModule):
(JSC::moduleLoaderPrototypeRequestedModules):
(JSC::moduleLoaderPrototypeModuleDeclarationInstantiation):

  • runtime/NativeErrorConstructor.cpp:

(JSC::Interpreter::constructWithNativeErrorConstructor):

  • runtime/NumberConstructor.cpp:

(JSC::constructWithNumberConstructor):

  • runtime/ObjectConstructor.cpp:

(JSC::constructObject):
(JSC::objectConstructorGetPrototypeOf):
(JSC::objectConstructorSetPrototypeOf):
(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorGetOwnPropertyDescriptors):
(JSC::objectConstructorGetOwnPropertyNames):
(JSC::objectConstructorGetOwnPropertySymbols):
(JSC::objectConstructorKeys):
(JSC::ownEnumerablePropertyKeys):
(JSC::toPropertyDescriptor):
(JSC::objectConstructorDefineProperty):
(JSC::defineProperties):
(JSC::objectConstructorSeal):
(JSC::objectConstructorFreeze):
(JSC::objectConstructorIsSealed):
(JSC::objectConstructorIsFrozen):
(JSC::objectConstructorIsExtensible):
(JSC::ownPropertyKeys):

  • runtime/ObjectConstructor.h:

(JSC::constructObjectFromPropertyDescriptor):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncHasOwnProperty):
(JSC::objectProtoFuncIsPrototypeOf):
(JSC::objectProtoFuncDefineGetter):
(JSC::objectProtoFuncDefineSetter):
(JSC::objectProtoFuncLookupGetter):
(JSC::objectProtoFuncLookupSetter):
(JSC::objectProtoFuncPropertyIsEnumerable):
(JSC::objectProtoFuncToLocaleString):
(JSC::objectProtoFuncToString):

  • runtime/Operations.cpp:

(JSC::jsAddSlowCase):

  • runtime/PropertyDescriptor.cpp:

(JSC::PropertyDescriptor::slowGetterSetter):

  • runtime/ProxyConstructor.cpp:

(JSC::makeRevocableProxy):

  • runtime/ProxyObject.cpp:

(JSC::performProxyGet):
(JSC::ProxyObject::performGet):
(JSC::ProxyObject::performInternalMethodGetOwnProperty):
(JSC::ProxyObject::performHasProperty):
(JSC::ProxyObject::performPut):
(JSC::ProxyObject::putByIndexCommon):
(JSC::performProxyCall):
(JSC::performProxyConstruct):
(JSC::ProxyObject::performDelete):
(JSC::ProxyObject::performPreventExtensions):
(JSC::ProxyObject::performIsExtensible):
(JSC::ProxyObject::performDefineOwnProperty):
(JSC::ProxyObject::performGetOwnPropertyNames):
(JSC::ProxyObject::performSetPrototype):
(JSC::ProxyObject::performGetPrototype):

  • runtime/ReflectObject.cpp:

(JSC::reflectObjectConstruct):
(JSC::reflectObjectDefineProperty):
(JSC::reflectObjectGet):
(JSC::reflectObjectGetOwnPropertyDescriptor):
(JSC::reflectObjectIsExtensible):
(JSC::reflectObjectPreventExtensions):
(JSC::reflectObjectSet):
(JSC::reflectObjectSetPrototypeOf):

  • runtime/RegExpConstructor.cpp:

(JSC::toFlags):
(JSC::regExpCreate):
(JSC::constructRegExp):

  • runtime/RegExpConstructor.h:

(JSC::isRegExp):

  • runtime/RegExpObject.cpp:

(JSC::collectMatches):
(JSC::RegExpObject::matchGlobal):

  • runtime/RegExpPrototype.cpp:

(JSC::regExpProtoFuncCompile):
(JSC::flagsString):
(JSC::regExpProtoFuncToString):
(JSC::regExpProtoGetterFlags):
(JSC::regExpProtoFuncSearchFast):
(JSC::regExpProtoFuncSplitFast):

  • runtime/SetConstructor.cpp:

(JSC::constructSet):

  • runtime/StringConstructor.cpp:

(JSC::stringFromCodePoint):
(JSC::constructWithStringConstructor):

  • runtime/StringObject.cpp:

(JSC::StringObject::defineOwnProperty):

  • runtime/StringPrototype.cpp:

(JSC::replaceUsingRegExpSearch):
(JSC::operationStringProtoFuncReplaceRegExpEmptyStr):
(JSC::replaceUsingStringSearch):
(JSC::replace):
(JSC::stringProtoFuncReplaceUsingRegExp):
(JSC::stringProtoFuncReplaceUsingStringSearch):
(JSC::stringProtoFuncCodePointAt):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplitFast):
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):
(JSC::stringProtoFuncLocaleCompare):
(JSC::toLocaleCase):
(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):
(JSC::stringProtoFuncLink):
(JSC::trimString):
(JSC::stringProtoFuncStartsWith):
(JSC::stringProtoFuncEndsWith):
(JSC::stringIncludesImpl):
(JSC::stringProtoFuncIncludes):
(JSC::builtinStringIncludesInternal):
(JSC::stringProtoFuncNormalize):

  • runtime/SymbolConstructor.cpp:

(JSC::symbolConstructorFor):

  • runtime/TemplateRegistry.cpp:

(JSC::TemplateRegistry::getTemplateObject):

  • runtime/WeakMapConstructor.cpp:

(JSC::constructWeakMap):

  • runtime/WeakSetConstructor.cpp:

(JSC::constructWeakSet):

  • tools/JSDollarVMPrototype.cpp:

(JSC::functionPrint):

Source/WebCore:

No new tests because this patch is mostly refactoring. The only change in
behavior is that functions that have a JSValue return type will now return the
empty JSValue when an exception is thrown. I tested this behavior by running
the existing JSC and layout tests.

  • bindings/js/ArrayValue.cpp:

(WebCore::ArrayValue::get):

  • bindings/js/IDBBindingUtilities.cpp:

(WebCore::toJS):

  • bindings/js/JSApplePaySessionCustom.cpp:

(WebCore::JSApplePaySession::completeShippingMethodSelection):
(WebCore::JSApplePaySession::completeShippingContactSelection):
(WebCore::JSApplePaySession::completePaymentMethodSelection):

  • bindings/js/JSAudioTrackCustom.cpp:

(WebCore::JSAudioTrack::setKind):
(WebCore::JSAudioTrack::setLanguage):

  • bindings/js/JSBlobCustom.cpp:

(WebCore::constructJSBlob):

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):

  • bindings/js/JSCommandLineAPIHostCustom.cpp:

(WebCore::getJSListenerFunctions):

  • bindings/js/JSCryptoAlgorithmDictionary.cpp:

(WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
(WebCore::getHashAlgorithm):
(WebCore::createAesCbcParams):
(WebCore::createAesKeyGenParams):
(WebCore::createHmacKeyParams):
(WebCore::createRsaKeyGenParams):
(WebCore::createRsaOaepParams):

  • bindings/js/JSCryptoKeySerializationJWK.cpp:

(WebCore::getStringFromJSON):
(WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
(WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents):
(WebCore::buildJSONForRSAComponents):
(WebCore::addUsagesToJSON):
(WebCore::JSCryptoKeySerializationJWK::serialize):

  • bindings/js/JSCustomElementInterface.cpp:

(WebCore::constructCustomElementSynchronously):
(WebCore::JSCustomElementInterface::upgradeElement):

  • bindings/js/JSCustomElementRegistryCustom.cpp:

(WebCore::getCustomElementCallback):
(WebCore::JSCustomElementRegistry::define):
(WebCore::whenDefinedPromise):

  • bindings/js/JSDOMBinding.cpp:

(WebCore::valueToUSVString):
(WebCore::hasIteratorMethod):
(WebCore::toSmallerInt):
(WebCore::toSmallerUInt):
(WebCore::toInt32EnforceRange):
(WebCore::toUInt32EnforceRange):
(WebCore::toInt64EnforceRange):
(WebCore::toUInt64EnforceRange):

  • bindings/js/JSDOMBinding.h:

(WebCore::toJSSequence):
(WebCore::toJS):
(WebCore::jsFrozenArray):

  • bindings/js/JSDOMPromise.cpp:

(WebCore::rejectPromiseWithExceptionIfAny):

  • bindings/js/JSDOMStringMapCustom.cpp:

(WebCore::JSDOMStringMap::putDelegate):

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::setLocation):
(WebCore::JSDOMWindow::open):
(WebCore::JSDOMWindow::showModalDialog):
(WebCore::handlePostMessage):
(WebCore::JSDOMWindow::setTimeout):
(WebCore::JSDOMWindow::setInterval):

  • bindings/js/JSDataCueCustom.cpp:

(WebCore::constructJSDataCue):

  • bindings/js/JSDeviceMotionEventCustom.cpp:

(WebCore::readAccelerationArgument):
(WebCore::readRotationRateArgument):
(WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):

  • bindings/js/JSDictionary.cpp:

(WebCore::JSDictionary::tryGetProperty):
(WebCore::JSDictionary::convertValue):

  • bindings/js/JSDictionary.h:

(WebCore::JSDictionary::tryGetPropertyAndResult):

  • bindings/js/JSDocumentCustom.cpp:

(WebCore::JSDocument::getCSSCanvasContext):

  • bindings/js/JSFileCustom.cpp:

(WebCore::constructJSFile):

  • bindings/js/JSGeolocationCustom.cpp:

(WebCore::JSGeolocation::getCurrentPosition):
(WebCore::JSGeolocation::watchPosition):

  • bindings/js/JSHTMLAllCollectionCustom.cpp:

(WebCore::callHTMLAllCollection):

  • bindings/js/JSHTMLCanvasElementCustom.cpp:

(WebCore::JSHTMLCanvasElement::getContext):

  • bindings/js/JSHTMLElementCustom.cpp:

(WebCore::constructJSHTMLElement):

  • bindings/js/JSHistoryCustom.cpp:

(WebCore::JSHistory::pushState):
(WebCore::JSHistory::replaceState):

  • bindings/js/JSIDBDatabaseCustom.cpp:

(WebCore::JSIDBDatabase::createObjectStore):

  • bindings/js/JSMessageEventCustom.cpp:

(WebCore::handleInitMessageEvent):

  • bindings/js/JSMessagePortCustom.cpp:

(WebCore::fillMessagePortArray):

  • bindings/js/JSMessagePortCustom.h:

(WebCore::handlePostMessage):

  • bindings/js/JSMockContentFilterSettingsCustom.cpp:

(WebCore::JSMockContentFilterSettings::setDecisionPoint):
(WebCore::toDecision):
(WebCore::JSMockContentFilterSettings::setDecision):
(WebCore::JSMockContentFilterSettings::setUnblockRequestDecision):

  • bindings/js/JSNodeFilterCustom.cpp:

(WebCore::JSNodeFilter::acceptNode):

  • bindings/js/JSNodeOrString.cpp:

(WebCore::toNodeOrStringVector):

  • bindings/js/JSSQLTransactionCustom.cpp:

(WebCore::JSSQLTransaction::executeSql):

  • bindings/js/JSSVGLengthCustom.cpp:

(WebCore::JSSVGLength::convertToSpecifiedUnits):

  • bindings/js/JSStorageCustom.cpp:

(WebCore::JSStorage::getOwnPropertyNames):

  • bindings/js/JSTextTrackCustom.cpp:

(WebCore::JSTextTrack::setLanguage):

  • bindings/js/JSVideoTrackCustom.cpp:

(WebCore::JSVideoTrack::setKind):
(WebCore::JSVideoTrack::setLanguage):

  • bindings/js/JSWebGL2RenderingContextCustom.cpp:

(WebCore::JSWebGL2RenderingContext::getIndexedParameter):

  • bindings/js/JSWebGLRenderingContextBaseCustom.cpp:

(WebCore::getObjectParameter):
(WebCore::JSWebGLRenderingContextBase::getExtension):
(WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
(WebCore::JSWebGLRenderingContextBase::getParameter):
(WebCore::JSWebGLRenderingContextBase::getProgramParameter):
(WebCore::JSWebGLRenderingContextBase::getShaderParameter):
(WebCore::toVector):
(WebCore::dataFunctionf):
(WebCore::dataFunctionMatrix):

  • bindings/js/JSWebKitSubtleCryptoCustom.cpp:

(WebCore::cryptoKeyFormatFromJSValue):
(WebCore::cryptoKeyUsagesFromJSValue):
(WebCore::JSWebKitSubtleCrypto::generateKey):
(WebCore::importKey):
(WebCore::JSWebKitSubtleCrypto::importKey):
(WebCore::exportKey):
(WebCore::JSWebKitSubtleCrypto::exportKey):
(WebCore::JSWebKitSubtleCrypto::unwrapKey):

  • bindings/js/JSWorkerCustom.cpp:

(WebCore::constructJSWorker):

  • bindings/js/JSWorkerGlobalScopeCustom.cpp:

(WebCore::JSWorkerGlobalScope::importScripts):
(WebCore::JSWorkerGlobalScope::setTimeout):
(WebCore::JSWorkerGlobalScope::setInterval):

  • bindings/js/ReadableStreamDefaultController.cpp:

(WebCore::ReadableStreamDefaultController::invoke):

  • bindings/js/ScheduledAction.cpp:

(WebCore::ScheduledAction::create):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateDictionaryImplementationContent):
(GenerateImplementation):
(GenerateParametersCheck):
(GenerateImplementationFunctionCall):
(GenerateConstructorDefinition):

  • html/HTMLMediaElement.cpp:

(WebCore::controllerJSValue):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):

Location:
trunk/Source
Files:
146 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r206379 r206386  
     12016-09-26  Mark Lam  <mark.lam@apple.com>
     2
     3        Added RETURN_IF_EXCEPTION() macro and use it for exception checks.
     4        https://bugs.webkit.org/show_bug.cgi?id=162521
     5
     6        Reviewed by Saam Barati.
     7
     8        Also, where possible, if the return type is JSValue, changed the returned value
     9        (on exception) to the empty JSValue (instead of sometimes jsUndefined, jsNull,
     10        or the thrown exception value).
     11
     12        There are a few places where I had to continue to return the previously returned
     13        value (instead of the empty JSValue) in order for tests to pass.  This is needed
     14        because there are missing exception checks that will need to be added before I
     15        can change those to return the empty JSValue too.  Identifying all the places
     16        where those checks need to be added is beyond the scope of this patch.  I will
     17        work on adding missing exception checks in a subsequent patch.
     18
     19        In this patch, there is one missing exception check in replaceUsingRegExpSearch()
     20        that was easily identified, and is necessary so that Interpreter::execute()
     21        functions can return JSValue.  I've added this missing check.
     22
     23        This patch has passed the JSC and layout tests.
     24
     25        * dfg/DFGOperations.cpp:
     26        (JSC::DFG::operationPutByValInternal):
     27        * inspector/JSInjectedScriptHost.cpp:
     28        (Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
     29        (Inspector::JSInjectedScriptHost::getInternalProperties):
     30        (Inspector::JSInjectedScriptHost::weakMapEntries):
     31        (Inspector::JSInjectedScriptHost::weakSetEntries):
     32        (Inspector::JSInjectedScriptHost::iteratorEntries):
     33        * inspector/JSJavaScriptCallFrame.cpp:
     34        (Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension):
     35        * interpreter/Interpreter.cpp:
     36        (JSC::eval):
     37        (JSC::sizeOfVarargs):
     38        (JSC::Interpreter::execute):
     39        (JSC::Interpreter::executeCall):
     40        (JSC::Interpreter::executeConstruct):
     41        * interpreter/ShadowChicken.cpp:
     42        (JSC::ShadowChicken::functionsOnStack):
     43        * jit/JITOperations.cpp:
     44        (JSC::getByVal):
     45        * jsc.cpp:
     46        (WTF::ImpureGetter::getOwnPropertySlot):
     47        (functionRun):
     48        (functionRunString):
     49        (functionLoad):
     50        (functionLoadString):
     51        (functionReadFile):
     52        (functionCheckSyntax):
     53        (functionSetRandomSeed):
     54        (functionLoadModule):
     55        (functionCreateBuiltin):
     56        (functionCheckModuleSyntax):
     57        * llint/LLIntSlowPaths.cpp:
     58        (JSC::LLInt::getByVal):
     59        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     60        * profiler/ProfilerBytecodeSequence.cpp:
     61        (JSC::Profiler::BytecodeSequence::addSequenceProperties):
     62        * profiler/ProfilerCompilation.cpp:
     63        (JSC::Profiler::Compilation::toJS):
     64        * profiler/ProfilerDatabase.cpp:
     65        (JSC::Profiler::Database::toJS):
     66        * profiler/ProfilerOSRExitSite.cpp:
     67        (JSC::Profiler::OSRExitSite::toJS):
     68        * profiler/ProfilerOriginStack.cpp:
     69        (JSC::Profiler::OriginStack::toJS):
     70        * runtime/ArrayPrototype.cpp:
     71        (JSC::speciesConstructArray):
     72        (JSC::shift):
     73        (JSC::unshift):
     74        (JSC::arrayProtoFuncToString):
     75        (JSC::arrayProtoFuncToLocaleString):
     76        (JSC::slowJoin):
     77        (JSC::fastJoin):
     78        (JSC::arrayProtoFuncJoin):
     79        (JSC::arrayProtoFuncPop):
     80        (JSC::arrayProtoFuncPush):
     81        (JSC::arrayProtoFuncReverse):
     82        (JSC::arrayProtoFuncShift):
     83        (JSC::arrayProtoFuncSlice):
     84        (JSC::arrayProtoFuncSplice):
     85        (JSC::arrayProtoFuncUnShift):
     86        (JSC::arrayProtoFuncIndexOf):
     87        (JSC::arrayProtoFuncLastIndexOf):
     88        (JSC::moveElements):
     89        (JSC::arrayProtoPrivateFuncConcatMemcpy):
     90        * runtime/BooleanConstructor.cpp:
     91        (JSC::constructWithBooleanConstructor):
     92        * runtime/CommonSlowPaths.h:
     93        (JSC::CommonSlowPaths::opIn):
     94        * runtime/Completion.cpp:
     95        (JSC::loadAndEvaluateModule):
     96        (JSC::loadModule):
     97        * runtime/ConsoleObject.cpp:
     98        (JSC::consoleProtoFuncAssert):
     99        (JSC::consoleProtoFuncProfile):
     100        (JSC::consoleProtoFuncProfileEnd):
     101        (JSC::consoleProtoFuncTakeHeapSnapshot):
     102        (JSC::consoleProtoFuncTime):
     103        (JSC::consoleProtoFuncTimeEnd):
     104        * runtime/DateConstructor.cpp:
     105        (JSC::constructDate):
     106        (JSC::dateParse):
     107        * runtime/DatePrototype.cpp:
     108        (JSC::dateProtoFuncToPrimitiveSymbol):
     109        (JSC::dateProtoFuncToJSON):
     110        * runtime/ErrorConstructor.cpp:
     111        (JSC::Interpreter::constructWithErrorConstructor):
     112        * runtime/ErrorInstance.cpp:
     113        (JSC::ErrorInstance::sanitizedToString):
     114        * runtime/ErrorPrototype.cpp:
     115        (JSC::errorProtoFuncToString):
     116        * runtime/ExceptionScope.h:
     117        * runtime/FunctionConstructor.cpp:
     118        (JSC::constructFunctionSkippingEvalEnabledCheck):
     119        * runtime/GenericArgumentsInlines.h:
     120        (JSC::GenericArguments<Type>::copyToArguments):
     121        * runtime/GetterSetter.cpp:
     122        (JSC::callGetter):
     123        * runtime/HashMapImpl.h:
     124        (JSC::jsMapHash):
     125        (JSC::HashMapImpl::finishCreation):
     126        (JSC::HashMapImpl::findBucket):
     127        (JSC::HashMapImpl::add):
     128        (JSC::HashMapImpl::rehash):
     129        * runtime/InspectorInstrumentationObject.cpp:
     130        (JSC::inspectorInstrumentationObjectLog):
     131        * runtime/InternalFunction.cpp:
     132        (JSC::InternalFunction::createSubclassStructure):
     133        * runtime/IntlCollator.cpp:
     134        (JSC::IntlCollator::initializeCollator):
     135        * runtime/IntlCollatorConstructor.cpp:
     136        (JSC::constructIntlCollator):
     137        (JSC::IntlCollatorConstructorFuncSupportedLocalesOf):
     138        * runtime/IntlCollatorPrototype.cpp:
     139        (JSC::IntlCollatorFuncCompare):
     140        (JSC::IntlCollatorPrototypeGetterCompare):
     141        * runtime/IntlDateTimeFormat.cpp:
     142        (JSC::toDateTimeOptionsAnyDate):
     143        (JSC::IntlDateTimeFormat::initializeDateTimeFormat):
     144        * runtime/IntlDateTimeFormatConstructor.cpp:
     145        (JSC::constructIntlDateTimeFormat):
     146        (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf):
     147        * runtime/IntlDateTimeFormatPrototype.cpp:
     148        (JSC::IntlDateTimeFormatFuncFormatDateTime):
     149        (JSC::IntlDateTimeFormatPrototypeGetterFormat):
     150        * runtime/IntlNumberFormat.cpp:
     151        (JSC::IntlNumberFormat::initializeNumberFormat):
     152        * runtime/IntlNumberFormatConstructor.cpp:
     153        (JSC::constructIntlNumberFormat):
     154        (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf):
     155        * runtime/IntlNumberFormatPrototype.cpp:
     156        (JSC::IntlNumberFormatFuncFormatNumber):
     157        (JSC::IntlNumberFormatPrototypeGetterFormat):
     158        * runtime/IntlObject.cpp:
     159        (JSC::intlBooleanOption):
     160        (JSC::intlStringOption):
     161        (JSC::intlNumberOption):
     162        (JSC::canonicalizeLocaleList):
     163        (JSC::supportedLocales):
     164        * runtime/IntlObjectInlines.h:
     165        (JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor):
     166        * runtime/IteratorOperations.cpp:
     167        (JSC::iteratorNext):
     168        (JSC::iteratorStep):
     169        (JSC::iteratorClose):
     170        (JSC::iteratorForIterable):
     171        * runtime/IteratorOperations.h:
     172        (JSC::forEachInIterable):
     173        * runtime/JSArray.cpp:
     174        (JSC::JSArray::pop):
     175        (JSC::JSArray::copyToArguments):
     176        * runtime/JSArrayBufferConstructor.cpp:
     177        (JSC::constructArrayBuffer):
     178        * runtime/JSArrayBufferPrototype.cpp:
     179        (JSC::arrayBufferProtoFuncSlice):
     180        * runtime/JSArrayInlines.h:
     181        (JSC::getLength):
     182        (JSC::toLength):
     183        * runtime/JSBoundFunction.cpp:
     184        (JSC::getBoundFunctionStructure):
     185        (JSC::JSBoundFunction::create):
     186        * runtime/JSCJSValue.cpp:
     187        (JSC::JSValue::putToPrimitive):
     188        (JSC::JSValue::toStringSlowCase):
     189        * runtime/JSCJSValueInlines.h:
     190        (JSC::toPreferredPrimitiveType):
     191        (JSC::JSValue::getPropertySlot):
     192        (JSC::JSValue::equalSlowCaseInline):
     193        * runtime/JSDataViewPrototype.cpp:
     194        (JSC::getData):
     195        (JSC::setData):
     196        * runtime/JSFunction.cpp:
     197        (JSC::JSFunction::setFunctionName):
     198        * runtime/JSGenericTypedArrayView.h:
     199        (JSC::JSGenericTypedArrayView::setIndex):
     200        * runtime/JSGenericTypedArrayViewConstructorInlines.h:
     201        (JSC::constructGenericTypedArrayViewFromIterator):
     202        (JSC::constructGenericTypedArrayViewWithArguments):
     203        (JSC::constructGenericTypedArrayView):
     204        * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
     205        (JSC::speciesConstruct):
     206        (JSC::genericTypedArrayViewProtoFuncSet):
     207        (JSC::genericTypedArrayViewProtoFuncCopyWithin):
     208        (JSC::genericTypedArrayViewProtoFuncIncludes):
     209        (JSC::genericTypedArrayViewProtoFuncIndexOf):
     210        (JSC::genericTypedArrayViewProtoFuncJoin):
     211        (JSC::genericTypedArrayViewProtoFuncLastIndexOf):
     212        (JSC::genericTypedArrayViewProtoFuncSlice):
     213        (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):
     214        * runtime/JSGlobalObject.h:
     215        (JSC::constructEmptyArray):
     216        (JSC::constructArray):
     217        (JSC::constructArrayNegativeIndexed):
     218        * runtime/JSGlobalObjectFunctions.cpp:
     219        (JSC::globalFuncEval):
     220        * runtime/JSModuleRecord.cpp:
     221        (JSC::JSModuleRecord::instantiateDeclarations):
     222        * runtime/JSONObject.cpp:
     223        (JSC::Stringifier::stringify):
     224        (JSC::Stringifier::toJSON):
     225        (JSC::Stringifier::appendStringifiedValue):
     226        (JSC::Stringifier::Holder::appendNextProperty):
     227        (JSC::Walker::walk):
     228        (JSC::JSONProtoFuncParse):
     229        * runtime/JSObject.cpp:
     230        (JSC::ordinarySetSlow):
     231        (JSC::JSObject::setPrototypeWithCycleCheck):
     232        (JSC::callToPrimitiveFunction):
     233        (JSC::JSObject::defaultHasInstance):
     234        (JSC::JSObject::getPropertyNames):
     235        (JSC::JSObject::toNumber):
     236        (JSC::JSObject::toString):
     237        (JSC::JSObject::defineOwnNonIndexProperty):
     238        (JSC::JSObject::getGenericPropertyNames):
     239        (JSC::JSObject::getMethod):
     240        * runtime/JSObjectInlines.h:
     241        (JSC::createListFromArrayLike):
     242        (JSC::JSObject::getPropertySlot):
     243        (JSC::JSObject::getNonIndexPropertySlot):
     244        * runtime/JSPromiseConstructor.cpp:
     245        (JSC::constructPromise):
     246        * runtime/JSPromiseDeferred.cpp:
     247        (JSC::JSPromiseDeferred::create):
     248        * runtime/JSPropertyNameEnumerator.h:
     249        (JSC::propertyNameEnumerator):
     250        * runtime/JSPropertyNameIterator.cpp:
     251        (JSC::JSPropertyNameIterator::create):
     252        * runtime/JSScope.cpp:
     253        (JSC::isUnscopable):
     254        * runtime/JSString.cpp:
     255        (JSC::JSString::equalSlowCase):
     256        * runtime/JSStringJoiner.cpp:
     257        (JSC::JSStringJoiner::join):
     258        * runtime/LiteralParser.cpp:
     259        (JSC::LiteralParser<CharType>::parse):
     260        * runtime/MapBase.h:
     261        (JSC::MapBase::finishCreation):
     262        * runtime/MapConstructor.cpp:
     263        (JSC::constructMap):
     264        * runtime/MathObject.cpp:
     265        (JSC::mathProtoFuncClz32):
     266        (JSC::mathProtoFuncHypot):
     267        (JSC::mathProtoFuncIMul):
     268        * runtime/ModuleLoaderPrototype.cpp:
     269        (JSC::moduleLoaderPrototypeParseModule):
     270        (JSC::moduleLoaderPrototypeRequestedModules):
     271        (JSC::moduleLoaderPrototypeModuleDeclarationInstantiation):
     272        * runtime/NativeErrorConstructor.cpp:
     273        (JSC::Interpreter::constructWithNativeErrorConstructor):
     274        * runtime/NumberConstructor.cpp:
     275        (JSC::constructWithNumberConstructor):
     276        * runtime/ObjectConstructor.cpp:
     277        (JSC::constructObject):
     278        (JSC::objectConstructorGetPrototypeOf):
     279        (JSC::objectConstructorSetPrototypeOf):
     280        (JSC::objectConstructorGetOwnPropertyDescriptor):
     281        (JSC::objectConstructorGetOwnPropertyDescriptors):
     282        (JSC::objectConstructorGetOwnPropertyNames):
     283        (JSC::objectConstructorGetOwnPropertySymbols):
     284        (JSC::objectConstructorKeys):
     285        (JSC::ownEnumerablePropertyKeys):
     286        (JSC::toPropertyDescriptor):
     287        (JSC::objectConstructorDefineProperty):
     288        (JSC::defineProperties):
     289        (JSC::objectConstructorSeal):
     290        (JSC::objectConstructorFreeze):
     291        (JSC::objectConstructorIsSealed):
     292        (JSC::objectConstructorIsFrozen):
     293        (JSC::objectConstructorIsExtensible):
     294        (JSC::ownPropertyKeys):
     295        * runtime/ObjectConstructor.h:
     296        (JSC::constructObjectFromPropertyDescriptor):
     297        * runtime/ObjectPrototype.cpp:
     298        (JSC::objectProtoFuncHasOwnProperty):
     299        (JSC::objectProtoFuncIsPrototypeOf):
     300        (JSC::objectProtoFuncDefineGetter):
     301        (JSC::objectProtoFuncDefineSetter):
     302        (JSC::objectProtoFuncLookupGetter):
     303        (JSC::objectProtoFuncLookupSetter):
     304        (JSC::objectProtoFuncPropertyIsEnumerable):
     305        (JSC::objectProtoFuncToLocaleString):
     306        (JSC::objectProtoFuncToString):
     307        * runtime/Operations.cpp:
     308        (JSC::jsAddSlowCase):
     309        * runtime/PropertyDescriptor.cpp:
     310        (JSC::PropertyDescriptor::slowGetterSetter):
     311        * runtime/ProxyConstructor.cpp:
     312        (JSC::makeRevocableProxy):
     313        * runtime/ProxyObject.cpp:
     314        (JSC::performProxyGet):
     315        (JSC::ProxyObject::performGet):
     316        (JSC::ProxyObject::performInternalMethodGetOwnProperty):
     317        (JSC::ProxyObject::performHasProperty):
     318        (JSC::ProxyObject::performPut):
     319        (JSC::ProxyObject::putByIndexCommon):
     320        (JSC::performProxyCall):
     321        (JSC::performProxyConstruct):
     322        (JSC::ProxyObject::performDelete):
     323        (JSC::ProxyObject::performPreventExtensions):
     324        (JSC::ProxyObject::performIsExtensible):
     325        (JSC::ProxyObject::performDefineOwnProperty):
     326        (JSC::ProxyObject::performGetOwnPropertyNames):
     327        (JSC::ProxyObject::performSetPrototype):
     328        (JSC::ProxyObject::performGetPrototype):
     329        * runtime/ReflectObject.cpp:
     330        (JSC::reflectObjectConstruct):
     331        (JSC::reflectObjectDefineProperty):
     332        (JSC::reflectObjectGet):
     333        (JSC::reflectObjectGetOwnPropertyDescriptor):
     334        (JSC::reflectObjectIsExtensible):
     335        (JSC::reflectObjectPreventExtensions):
     336        (JSC::reflectObjectSet):
     337        (JSC::reflectObjectSetPrototypeOf):
     338        * runtime/RegExpConstructor.cpp:
     339        (JSC::toFlags):
     340        (JSC::regExpCreate):
     341        (JSC::constructRegExp):
     342        * runtime/RegExpConstructor.h:
     343        (JSC::isRegExp):
     344        * runtime/RegExpObject.cpp:
     345        (JSC::collectMatches):
     346        (JSC::RegExpObject::matchGlobal):
     347        * runtime/RegExpPrototype.cpp:
     348        (JSC::regExpProtoFuncCompile):
     349        (JSC::flagsString):
     350        (JSC::regExpProtoFuncToString):
     351        (JSC::regExpProtoGetterFlags):
     352        (JSC::regExpProtoFuncSearchFast):
     353        (JSC::regExpProtoFuncSplitFast):
     354        * runtime/SetConstructor.cpp:
     355        (JSC::constructSet):
     356        * runtime/StringConstructor.cpp:
     357        (JSC::stringFromCodePoint):
     358        (JSC::constructWithStringConstructor):
     359        * runtime/StringObject.cpp:
     360        (JSC::StringObject::defineOwnProperty):
     361        * runtime/StringPrototype.cpp:
     362        (JSC::replaceUsingRegExpSearch):
     363        (JSC::operationStringProtoFuncReplaceRegExpEmptyStr):
     364        (JSC::replaceUsingStringSearch):
     365        (JSC::replace):
     366        (JSC::stringProtoFuncReplaceUsingRegExp):
     367        (JSC::stringProtoFuncReplaceUsingStringSearch):
     368        (JSC::stringProtoFuncCodePointAt):
     369        (JSC::stringProtoFuncSlice):
     370        (JSC::stringProtoFuncSplitFast):
     371        (JSC::stringProtoFuncSubstr):
     372        (JSC::stringProtoFuncSubstring):
     373        (JSC::stringProtoFuncLocaleCompare):
     374        (JSC::toLocaleCase):
     375        (JSC::stringProtoFuncBig):
     376        (JSC::stringProtoFuncSmall):
     377        (JSC::stringProtoFuncBlink):
     378        (JSC::stringProtoFuncBold):
     379        (JSC::stringProtoFuncFixed):
     380        (JSC::stringProtoFuncItalics):
     381        (JSC::stringProtoFuncStrike):
     382        (JSC::stringProtoFuncSub):
     383        (JSC::stringProtoFuncSup):
     384        (JSC::stringProtoFuncFontcolor):
     385        (JSC::stringProtoFuncFontsize):
     386        (JSC::stringProtoFuncAnchor):
     387        (JSC::stringProtoFuncLink):
     388        (JSC::trimString):
     389        (JSC::stringProtoFuncStartsWith):
     390        (JSC::stringProtoFuncEndsWith):
     391        (JSC::stringIncludesImpl):
     392        (JSC::stringProtoFuncIncludes):
     393        (JSC::builtinStringIncludesInternal):
     394        (JSC::stringProtoFuncNormalize):
     395        * runtime/SymbolConstructor.cpp:
     396        (JSC::symbolConstructorFor):
     397        * runtime/TemplateRegistry.cpp:
     398        (JSC::TemplateRegistry::getTemplateObject):
     399        * runtime/WeakMapConstructor.cpp:
     400        (JSC::constructWeakMap):
     401        * runtime/WeakSetConstructor.cpp:
     402        (JSC::constructWeakSet):
     403        * tools/JSDollarVMPrototype.cpp:
     404        (JSC::functionPrint):
     405
    14062016-09-26  Don Olmstead  <don.olmstead@am.sony.com>
    2407
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r206281 r206386  
    124124    // Don't put to an object if toString throws an exception.
    125125    auto propertyName = property.toPropertyKey(exec);
    126     if (UNLIKELY(scope.exception()))
    127         return;
     126    RETURN_IF_EXCEPTION(scope, void());
    128127
    129128    PutPropertySlot slot(baseValue, strict);
     
    193192
    194193    JSValue proto = constructor->get(exec, exec->propertyNames().prototype);
    195     if (UNLIKELY(scope.exception()))
    196         return nullptr;
     194    RETURN_IF_EXCEPTION(scope, nullptr);
    197195    if (proto.isObject())
    198196        return constructEmptyObject(exec, asObject(proto));
     
    223221
    224222    int32_t a = op1.toInt32(exec);
    225     if (UNLIKELY(scope.exception()))
    226         return JSValue::encode(JSValue());
     223    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    227224    int32_t b = op2.toInt32(exec);
    228225    return JSValue::encode(jsNumber(a & b));
     
    239236
    240237    int32_t a = op1.toInt32(exec);
    241     if (UNLIKELY(scope.exception()))
    242         return JSValue::encode(JSValue());
     238    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    243239    int32_t b = op2.toInt32(exec);
    244240    return JSValue::encode(jsNumber(a | b));
     
    255251
    256252    int32_t a = op1.toInt32(exec);
    257     if (UNLIKELY(scope.exception()))
    258         return JSValue::encode(JSValue());
     253    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    259254    int32_t b = op2.toInt32(exec);
    260255    return JSValue::encode(jsNumber(a ^ b));
     
    271266
    272267    int32_t a = op1.toInt32(exec);
    273     if (UNLIKELY(scope.exception()))
    274         return JSValue::encode(JSValue());
     268    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    275269    uint32_t b = op2.toUInt32(exec);
    276270    return JSValue::encode(jsNumber(a << (b & 0x1f)));
     
    287281
    288282    int32_t a = op1.toInt32(exec);
    289     if (UNLIKELY(scope.exception()))
    290         return JSValue::encode(JSValue());
     283    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    291284    uint32_t b = op2.toUInt32(exec);
    292285    return JSValue::encode(jsNumber(a >> (b & 0x1f)));
     
    303296
    304297    uint32_t a = op1.toUInt32(exec);
    305     if (UNLIKELY(scope.exception()))
    306         return JSValue::encode(JSValue());
     298    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    307299    uint32_t b = op2.toUInt32(exec);
    308300    return JSValue::encode(jsNumber(static_cast<int32_t>(a >> (b & 0x1f))));
     
    335327
    336328    double a = op1.toNumber(exec);
    337     if (UNLIKELY(scope.exception()))
    338         return JSValue::encode(JSValue());
     329    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    339330    double b = op2.toNumber(exec);
    340331    return JSValue::encode(jsNumber(a / b));
     
    349340    JSValue op1 = JSValue::decode(encodedOp1);
    350341    double a = op1.toNumber(exec);
    351     if (UNLIKELY(scope.exception()))
    352         return PNaN;
     342    RETURN_IF_EXCEPTION(scope, PNaN);
    353343    return fabs(a);
    354344}
     
    362352    JSValue op1 = JSValue::decode(encodedOp1);
    363353    uint32_t value = op1.toUInt32(exec);
    364     if (UNLIKELY(scope.exception()))
    365         return 0;
     354    RETURN_IF_EXCEPTION(scope, 0);
    366355    return clz32(value);
    367356}
     
    375364    JSValue op1 = JSValue::decode(encodedOp1);
    376365    double a = op1.toNumber(exec);
    377     if (UNLIKELY(scope.exception()))
    378         return JSValue::encode(JSValue());
     366    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    379367    return cos(a);
    380368}
     
    388376    JSValue op1 = JSValue::decode(encodedOp1);
    389377    double a = op1.toNumber(exec);
    390     if (UNLIKELY(scope.exception()))
    391         return PNaN;
     378    RETURN_IF_EXCEPTION(scope, PNaN);
    392379    return static_cast<float>(a);
    393380}
     
    401388    JSValue op1 = JSValue::decode(encodedOp1);
    402389    double a = op1.toNumber(exec);
    403     if (UNLIKELY(scope.exception()))
    404         return PNaN;
     390    RETURN_IF_EXCEPTION(scope, PNaN);
    405391    return log(a);
    406392}
     
    414400    JSValue op1 = JSValue::decode(encodedOp1);
    415401    double a = op1.toNumber(exec);
    416     if (UNLIKELY(scope.exception()))
    417         return PNaN;
     402    RETURN_IF_EXCEPTION(scope, PNaN);
    418403    return sin(a);
    419404}
     
    427412    JSValue op1 = JSValue::decode(encodedOp1);
    428413    double a = op1.toNumber(exec);
    429     if (UNLIKELY(scope.exception()))
    430         return PNaN;
     414    RETURN_IF_EXCEPTION(scope, PNaN);
    431415    return sqrt(a);
    432416}
     
    440424    JSValue op1 = JSValue::decode(encodedOp1);
    441425    double a = op1.toNumber(exec);
    442     if (UNLIKELY(scope.exception()))
    443         return JSValue::encode(JSValue());
     426    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    444427    return tan(a);
    445428}
     
    453436    JSValue argument = JSValue::decode(encodedArgument);
    454437    double valueOfArgument = argument.toNumber(exec);
    455     if (UNLIKELY(scope.exception()))
    456         return JSValue::encode(JSValue());
     438    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    457439    return JSValue::encode(jsNumber(jsRound(valueOfArgument)));
    458440}
     
    466448    JSValue argument = JSValue::decode(encodedArgument);
    467449    double valueOfArgument = argument.toNumber(exec);
    468     if (UNLIKELY(scope.exception()))
    469         return JSValue::encode(JSValue());
     450    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    470451    return JSValue::encode(jsNumber(floor(valueOfArgument)));
    471452}
     
    479460    JSValue argument = JSValue::decode(encodedArgument);
    480461    double valueOfArgument = argument.toNumber(exec);
    481     if (UNLIKELY(scope.exception()))
    482         return JSValue::encode(JSValue());
     462    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    483463    return JSValue::encode(jsNumber(ceil(valueOfArgument)));
    484464}
     
    492472    JSValue argument = JSValue::decode(encodedArgument);
    493473    double truncatedValueOfArgument = argument.toIntegerPreserveNaN(exec);
    494     if (UNLIKELY(scope.exception()))
    495         return JSValue::encode(JSValue());
     474    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    496475    return JSValue::encode(jsNumber(truncatedValueOfArgument));
    497476}
     
    545524
    546525    baseValue.requireObjectCoercible(exec);
    547     if (UNLIKELY(scope.exception()))
    548         return JSValue::encode(jsUndefined());
     526    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    549527    auto propertyName = property.toPropertyKey(exec);
    550     if (UNLIKELY(scope.exception()))
    551         return JSValue::encode(jsUndefined());
     528    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    552529    return JSValue::encode(baseValue.get(exec, propertyName));
    553530}
     
    579556
    580557    auto propertyName = property.toPropertyKey(exec);
    581     if (UNLIKELY(scope.exception()))
    582         return JSValue::encode(jsUndefined());
     558    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    583559    return JSValue::encode(JSValue(base).get(exec, propertyName));
    584560}
     
    974950
    975951    baseValue.requireObjectCoercible(exec);
    976     if (UNLIKELY(scope.exception()))
    977         return JSValue::encode(JSValue());
     952    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    978953
    979954    auto property = subscript.toPropertyKey(exec);
    980     if (UNLIKELY(scope.exception()))
    981         return JSValue::encode(JSValue());
     955    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    982956    return JSValue::encode(baseValue.get(exec, property, slot));
    983957}
     
    1006980
    1007981    Identifier property = JSValue::decode(encodedSubscript).toPropertyKey(exec);
    1008     if (UNLIKELY(scope.exception()))
    1009         return;
     982    RETURN_IF_EXCEPTION(scope, void());
    1010983    putWithThis<true>(exec, encodedBase, encodedThis, encodedValue, property);
    1011984}
     
    1018991
    1019992    Identifier property = JSValue::decode(encodedSubscript).toPropertyKey(exec);
    1020     if (UNLIKELY(scope.exception()))
    1021         return;
     993    RETURN_IF_EXCEPTION(scope, void());
    1022994    putWithThis<false>(exec, encodedBase, encodedThis, encodedValue, property);
    1023995}
     
    16641636    JSValue key = JSValue::decode(encodedKey);
    16651637    Identifier propertyName = key.toPropertyKey(exec);
    1666     if (UNLIKELY(scope.exception()))
    1667         return false;
     1638    RETURN_IF_EXCEPTION(scope, false);
    16681639
    16691640    PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
    16701641    bool result = thisObject->hasOwnProperty(exec, propertyName.impl(), slot);
    1671     if (UNLIKELY(scope.exception()))
    1672         return false;
     1642    RETURN_IF_EXCEPTION(scope, false);
    16731643
    16741644    HasOwnPropertyCache* hasOwnPropertyCache = vm.hasOwnPropertyCache();
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp

    r205569 r206386  
    104104
    105105    String program = scriptValue.toString(exec)->value(exec);
    106     if (UNLIKELY(scope.exception()))
    107         return jsUndefined();
     106    RETURN_IF_EXCEPTION(scope, JSValue());
    108107
    109108    NakedPtr<Exception> exception;
     
    266265        unsigned index = 0;
    267266        JSArray* array = constructEmptyArray(exec, nullptr);
    268         if (UNLIKELY(scope.exception()))
    269             return jsUndefined();
     267        RETURN_IF_EXCEPTION(scope, JSValue());
    270268        switch (promise->status(exec->vm())) {
    271269        case JSPromise::Status::Pending:
     
    288286        unsigned index = 0;
    289287        JSArray* array = constructEmptyArray(exec, nullptr);
    290         if (UNLIKELY(scope.exception()))
    291             return jsUndefined();
     288        RETURN_IF_EXCEPTION(scope, JSValue());
    292289        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction()));
    293290        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis()));
     
    300297        unsigned index = 0;
    301298        JSArray* array = constructEmptyArray(exec, nullptr, 2);
    302         if (UNLIKELY(scope.exception()))
    303             return jsUndefined();
     299        RETURN_IF_EXCEPTION(scope, JSValue());
    304300        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target()));
    305301        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler()));
     
    314310            unsigned index = 0;
    315311            JSArray* array = constructEmptyArray(exec, nullptr, 2);
    316             if (UNLIKELY(scope.exception()))
    317                 return jsUndefined();
     312            RETURN_IF_EXCEPTION(scope, JSValue());
    318313            array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue));
    319314            array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", kind));
     
    337332        unsigned index = 0;
    338333        JSArray* array = constructEmptyArray(exec, nullptr, 2);
    339         if (UNLIKELY(scope.exception()))
    340             return jsUndefined();
     334        RETURN_IF_EXCEPTION(scope, JSValue());
    341335        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue()));
    342336        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
     
    359353        unsigned index = 0;
    360354        JSArray* array = constructEmptyArray(exec, nullptr, 2);
    361         if (UNLIKELY(scope.exception()))
    362             return jsUndefined();
     355        RETURN_IF_EXCEPTION(scope, JSValue());
    363356        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue()));
    364357        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
     
    369362        unsigned index = 0;
    370363        JSArray* array = constructEmptyArray(exec, nullptr, 1);
    371         if (UNLIKELY(scope.exception()))
    372             return jsUndefined();
     364        RETURN_IF_EXCEPTION(scope, JSValue());
    373365        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec)));
    374366        return array;
     
    378370        unsigned index = 0;
    379371        JSArray* array = constructEmptyArray(exec, nullptr, 1);
    380         if (UNLIKELY(scope.exception()))
    381             return jsUndefined();
     372        RETURN_IF_EXCEPTION(scope, JSValue());
    382373        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue()));
    383374        return array;
     
    421412
    422413    JSArray* array = constructEmptyArray(exec, nullptr);
    423     if (UNLIKELY(scope.exception()))
    424         return jsUndefined();
     414    RETURN_IF_EXCEPTION(scope, JSValue());
    425415    for (auto it = weakMap->weakMapData()->begin(); it != weakMap->weakMapData()->end(); ++it) {
    426416        JSObject* entry = constructEmptyObject(exec);
     
    469459
    470460    JSArray* array = constructEmptyArray(exec, nullptr);
    471     if (UNLIKELY(scope.exception()))
    472         return jsUndefined();
     461    RETURN_IF_EXCEPTION(scope, JSValue());
    473462    for (auto it = weakSet->weakMapData()->begin(); it != weakSet->weakMapData()->end(); ++it) {
    474463        JSObject* entry = constructEmptyObject(exec);
     
    510499    else if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value)) {
    511500        iterator = propertyNameIterator->clone(exec);
    512         if (UNLIKELY(scope.exception()))
    513             return JSValue();
     501        RETURN_IF_EXCEPTION(scope, JSValue());
    514502    } else {
    515503        if (JSObject* iteratorObject = jsDynamicCast<JSObject*>(value)) {
     
    530518
    531519    JSArray* array = constructEmptyArray(exec, nullptr);
    532     if (UNLIKELY(scope.exception()))
    533         return jsUndefined();
     520    RETURN_IF_EXCEPTION(scope, JSValue());
    534521
    535522    for (unsigned i = 0; i < numberToFetch; ++i) {
  • trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp

    r205569 r206386  
    8484
    8585    String script = scriptValue.toString(exec)->value(exec);
    86     if (UNLIKELY(scope.exception()))
    87         return jsUndefined();
     86    RETURN_IF_EXCEPTION(scope, JSValue());
    8887
    8988    NakedPtr<Exception> exception;
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r206267 r206386  
    104104    }
    105105    String programSource = asString(program)->value(callFrame);
    106     if (UNLIKELY(scope.exception()))
    107         return JSValue();
     106    RETURN_IF_EXCEPTION(scope, JSValue());
    108107   
    109108    CallFrame* callerFrame = callFrame->callerFrame();
     
    187186        RELEASE_ASSERT(arguments.isObject());
    188187        length = getLength(callFrame, jsCast<JSObject*>(cell));
    189         if (UNLIKELY(scope.exception()))
    190             return 0;
     188        RETURN_IF_EXCEPTION(scope, 0);
    191189        break;
    192190    }
     
    805803                        PropertySlot slot(globalObject, PropertySlot::InternalMethodType::Get);
    806804                        if (!globalObject->getPropertySlot(callFrame, JSONPPath[i].m_pathEntryName, slot)) {
    807                             if (throwScope.exception())
    808                                 return jsUndefined();
     805                            RETURN_IF_EXCEPTION(throwScope, JSValue());
    809806                            if (entry)
    810807                                return throwException(callFrame, throwScope, createUndefinedVariableError(callFrame, JSONPPath[i].m_pathEntryName));
     
    814811                    } else
    815812                        baseObject = baseObject.get(callFrame, JSONPPath[i].m_pathEntryName);
    816                     if (throwScope.exception())
    817                         return jsUndefined();
     813                    RETURN_IF_EXCEPTION(throwScope, JSValue());
    818814                    continue;
    819815                }
    820816                case JSONPPathEntryTypeLookup: {
    821817                    baseObject = baseObject.get(callFrame, static_cast<unsigned>(JSONPPath[i].m_pathIndex));
    822                     if (throwScope.exception())
    823                         return jsUndefined();
     818                    RETURN_IF_EXCEPTION(throwScope, JSValue());
    824819                    continue;
    825820                }
     
    833828            case JSONPPathEntryTypeCall: {
    834829                JSValue function = baseObject.get(callFrame, JSONPPath.last().m_pathEntryName);
    835                 if (throwScope.exception())
    836                     return jsUndefined();
     830                RETURN_IF_EXCEPTION(throwScope, JSValue());
    837831                CallData callData;
    838832                CallType callType = getCallData(function, callData);
     
    843837                JSValue thisValue = JSONPPath.size() == 1 ? jsUndefined(): baseObject;
    844838                JSONPValue = JSC::call(callFrame, function, callType, callData, thisValue, jsonArg);
    845                 if (throwScope.exception())
    846                     return jsUndefined();
     839                RETURN_IF_EXCEPTION(throwScope, JSValue());
    847840                break;
    848841            }
    849842            case JSONPPathEntryTypeDot: {
    850843                baseObject.put(callFrame, JSONPPath.last().m_pathEntryName, JSONPValue, slot);
    851                 if (throwScope.exception())
    852                     return jsUndefined();
     844                RETURN_IF_EXCEPTION(throwScope, JSValue());
    853845                break;
    854846            }
    855847            case JSONPPathEntryTypeLookup: {
    856848                baseObject.putByIndex(callFrame, JSONPPath.last().m_pathIndex, JSONPValue, slot.isStrictMode());
    857                 if (throwScope.exception())
    858                     return jsUndefined();
     849                RETURN_IF_EXCEPTION(throwScope, JSValue());
    859850                break;
    860851            }
     
    959950        } else {
    960951            result = JSValue::decode(vmEntryToNative(reinterpret_cast<void*>(callData.native.function), &vm, &protoCallFrame));
    961             if (throwScope.exception())
    962                 result = jsNull();
     952            RETURN_IF_EXCEPTION(throwScope, JSValue());
    963953        }
    964954    }
     
    10281018    }
    10291019
    1030     if (UNLIKELY(throwScope.exception()))
    1031         return 0;
     1020    RETURN_IF_EXCEPTION(throwScope, 0);
    10321021    ASSERT(result.isObject());
    10331022    return checkedReturn(asObject(result));
  • trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp

    r205569 r206386  
    439439    auto scope = DECLARE_THROW_SCOPE(vm);
    440440    JSArray* result = constructEmptyArray(exec, 0);
    441     if (UNLIKELY(scope.exception()))
    442         return nullptr;
     441    RETURN_IF_EXCEPTION(scope, nullptr);
    443442
    444443    iterate(
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r206289 r206386  
    277277    PropertySlot slot(base, PropertySlot::InternalMethodType::HasProperty);
    278278    bool result = asObject(base)->getPropertySlot(exec, ident, slot);
    279     if (UNLIKELY(scope.exception()))
    280         return JSValue::encode(jsUndefined());
     279    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    281280   
    282281    RELEASE_ASSERT(accessType == stubInfo->accessType);
     
    513512    auto property = subscript.toPropertyKey(callFrame);
    514513    // Don't put to an object if toString threw an exception.
    515     if (UNLIKELY(scope.exception()))
    516         return;
     514    RETURN_IF_EXCEPTION(scope, void());
    517515
    518516    if (byValInfo->stubInfo && (!isStringOrSymbol(subscript) || byValInfo->cachedId != property))
     
    558556    // Don't put to an object if toString threw an exception.
    559557    auto property = subscript.toPropertyKey(callFrame);
    560     if (UNLIKELY(scope.exception()))
    561         return;
     558    RETURN_IF_EXCEPTION(scope, void());
    562559
    563560    if (Optional<uint32_t> index = parseIndex(property)) {
     
    788785
    789786    JSValue result = eval(execCallee);
    790     if (UNLIKELY(scope.exception()))
    791         return EncodedJSValue();
     787    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    792788   
    793789    return JSValue::encode(result);
     
    14621458    auto scope = DECLARE_THROW_SCOPE(vm);
    14631459    auto propertyKey = subscript.toPropertyKey(exec);
    1464     if (UNLIKELY(scope.exception()))
    1465         return;
     1460    RETURN_IF_EXCEPTION(scope, void());
    14661461
    14671462    if (accessorType == AccessorType::Getter)
     
    16521647
    16531648    baseValue.requireObjectCoercible(exec);
    1654     if (UNLIKELY(scope.exception()))
    1655         return jsUndefined();
     1649    RETURN_IF_EXCEPTION(scope, JSValue());
    16561650    auto property = subscript.toPropertyKey(exec);
    1657     if (UNLIKELY(scope.exception()))
    1658         return jsUndefined();
     1651    RETURN_IF_EXCEPTION(scope, JSValue());
    16591652
    16601653    ASSERT(exec->bytecodeOffset());
     
    18641857    } else {
    18651858        baseValue.requireObjectCoercible(exec);
    1866         if (UNLIKELY(scope.exception()))
    1867             return JSValue::encode(jsUndefined());
     1859        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18681860        auto property = subscript.toPropertyKey(exec);
    1869         if (UNLIKELY(scope.exception()))
    1870             return JSValue::encode(jsUndefined());
     1861        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18711862        result = baseValue.get(exec, property);
    18721863    }
     
    19161907        couldDelete = baseObj->methodTable(vm)->deletePropertyByIndex(baseObj, exec, index);
    19171908    else {
    1918         if (UNLIKELY(scope.exception()))
    1919             return false;
     1909        RETURN_IF_EXCEPTION(scope, false);
    19201910        Identifier property = key.toPropertyKey(exec);
    1921         if (UNLIKELY(scope.exception()))
    1922             return false;
     1911        RETURN_IF_EXCEPTION(scope, false);
    19231912        couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, property);
    19241913    }
     
    21242113    scope->methodTable()->put(scope, exec, ident, value, slot);
    21252114   
    2126     if (UNLIKELY(throwScope.exception()))
    2127         return;
     2115    RETURN_IF_EXCEPTION(throwScope, void());
    21282116
    21292117    CommonSlowPaths::tryCachePutToScopeGlobal(exec, codeBlock, pc, scope, getPutInfo, slot, ident);
     
    23782366
    23792367    double a = op1.toNumber(exec);
    2380     if (UNLIKELY(scope.exception()))
    2381         return JSValue::encode(JSValue());
     2368    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    23822369    double b = op2.toNumber(exec);
    23832370    return JSValue::encode(jsNumber(a * b));
     
    23942381
    23952382    double a = op1.toNumber(exec);
    2396     if (UNLIKELY(scope.exception()))
    2397         return JSValue::encode(JSValue());
     2383    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    23982384    double b = op2.toNumber(exec);
    2399     if (UNLIKELY(scope.exception()))
    2400         return JSValue::encode(JSValue());
     2385    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    24012386   
    24022387    JSValue result = jsNumber(a * b);
     
    25612546
    25622547    double a = op1.toNumber(exec);
    2563     if (UNLIKELY(scope.exception()))
    2564         return JSValue::encode(JSValue());
     2548    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    25652549    double b = op2.toNumber(exec);
    25662550    return JSValue::encode(jsNumber(a - b));
     
    25772561
    25782562    double a = op1.toNumber(exec);
    2579     if (UNLIKELY(scope.exception()))
    2580         return JSValue::encode(JSValue());
     2563    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    25812564    double b = op2.toNumber(exec);
    2582     if (UNLIKELY(scope.exception()))
    2583         return JSValue::encode(JSValue());
     2565    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    25842566   
    25852567    JSValue result = jsNumber(a - b);
  • trunk/Source/JavaScriptCore/jsc.cpp

    r206134 r206386  
    312312            if (thisObject->m_delegate->getPropertySlot(exec, name, slot))
    313313                return true;
    314             if (UNLIKELY(scope.exception()))
    315                 return false;
     314            RETURN_IF_EXCEPTION(scope, false);
    316315        }
    317316
     
    14611460
    14621461    String fileName = exec->argument(0).toWTFString(exec);
    1463     if (UNLIKELY(scope.exception()))
    1464         return JSValue::encode(jsUndefined());
     1462    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    14651463    Vector<char> script;
    14661464    if (!fetchScriptFromLocalFileSystem(fileName, script))
     
    14951493
    14961494    String source = exec->argument(0).toWTFString(exec);
    1497     if (UNLIKELY(scope.exception()))
    1498         return JSValue::encode(jsUndefined());
     1495    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    14991496
    15001497    GlobalObject* globalObject = GlobalObject::create(vm, GlobalObject::createStructure(vm, jsNull()), Vector<String>());
     
    15231520
    15241521    String fileName = exec->argument(0).toWTFString(exec);
    1525     if (UNLIKELY(scope.exception()))
    1526         return JSValue::encode(jsUndefined());
     1522    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15271523    Vector<char> script;
    15281524    if (!fetchScriptFromLocalFileSystem(fileName, script))
     
    15441540
    15451541    String sourceCode = exec->argument(0).toWTFString(exec);
    1546     if (UNLIKELY(scope.exception()))
    1547         return JSValue::encode(jsUndefined());
     1542    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15481543    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    15491544
     
    15611556
    15621557    String fileName = exec->argument(0).toWTFString(exec);
    1563     if (UNLIKELY(scope.exception()))
    1564         return JSValue::encode(jsUndefined());
     1558    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15651559
    15661560    bool isBinary = false;
    15671561    if (exec->argumentCount() > 1) {
    15681562        String type = exec->argument(1).toWTFString(exec);
    1569         if (UNLIKELY(scope.exception()))
    1570             return EncodedJSValue();
     1563        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15711564        if (type != "binary")
    15721565            return throwVMError(exec, scope, "Expected 'binary' as second argument.");
     
    15841577    auto length = content.size();
    15851578    JSObject* result = createUint8TypedArray(exec, structure, ArrayBuffer::createFromBytes(content.releaseBuffer().leakPtr(), length, [] (void* p) { fastFree(p); }), 0, length);
    1586     if (UNLIKELY(scope.exception()))
    1587         return EncodedJSValue();
     1579    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15881580
    15891581    return JSValue::encode(result);
     
    15961588
    15971589    String fileName = exec->argument(0).toWTFString(exec);
    1598     if (UNLIKELY(scope.exception()))
    1599         return JSValue::encode(jsUndefined());
     1590    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16001591    Vector<char> script;
    16011592    if (!fetchScriptFromLocalFileSystem(fileName, script))
     
    16601651
    16611652    unsigned seed = exec->argument(0).toUInt32(exec);
    1662     if (UNLIKELY(scope.exception()))
    1663         return JSValue::encode(jsUndefined());
     1653    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16641654    exec->lexicalGlobalObject()->weakRandom().setSeed(seed);
    16651655    return JSValue::encode(jsUndefined());
     
    19321922
    19331923    String fileName = exec->argument(0).toWTFString(exec);
    1934     if (UNLIKELY(scope.exception()))
    1935         return JSValue::encode(jsUndefined());
     1924    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19361925    Vector<char> script;
    19371926    if (!fetchScriptFromLocalFileSystem(fileName, script))
     
    19391928
    19401929    JSInternalPromise* promise = loadAndEvaluateModule(exec, fileName);
    1941     if (UNLIKELY(scope.exception()))
    1942         return JSValue::encode(jsUndefined());
     1930    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19431931
    19441932    JSValue error;
     
    19641952
    19651953    String functionText = exec->argument(0).toWTFString(exec);
    1966     if (UNLIKELY(scope.exception()))
    1967         return JSValue::encode(JSValue());
     1954    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19681955
    19691956    const SourceCode& source = makeSource(functionText);
     
    19851972
    19861973    String source = exec->argument(0).toWTFString(exec);
    1987     if (UNLIKELY(scope.exception()))
    1988         return JSValue::encode(jsUndefined());
     1974    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19891975
    19901976    StopWatch stopWatch;
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r206267 r206386  
    812812
    813813    baseValue.requireObjectCoercible(exec);
    814     if (scope.exception())
    815         return jsUndefined();
     814    RETURN_IF_EXCEPTION(scope, JSValue());
    816815    auto property = subscript.toPropertyKey(exec);
    817     if (scope.exception())
    818         return jsUndefined();
     816    RETURN_IF_EXCEPTION(scope, JSValue());
    819817    return baseValue.get(exec, property);
    820818}
     
    884882    // Don't put to an object if toString threw an exception.
    885883    auto property = subscript.toPropertyKey(exec);
    886     if (throwScope.exception())
     884    if (UNLIKELY(throwScope.exception()))
    887885        LLINT_END();
    888886
  • trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp

    r205569 r206386  
    11/*
    2  * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2014, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8282    auto scope = DECLARE_THROW_SCOPE(vm);
    8383    JSArray* header = constructEmptyArray(exec, 0);
    84     if (UNLIKELY(scope.exception()))
    85         return;
     84    RETURN_IF_EXCEPTION(scope, void());
    8685    for (unsigned i = 0; i < m_header.size(); ++i)
    8786        header->putDirectIndex(exec, i, jsString(exec, String::fromUTF8(m_header[i])));
     
    8988   
    9089    JSArray* sequence = constructEmptyArray(exec, 0);
    91     if (UNLIKELY(scope.exception()))
    92         return;
     90    RETURN_IF_EXCEPTION(scope, void());
    9391    for (unsigned i = 0; i < m_sequence.size(); ++i)
    9492        sequence->putDirectIndex(exec, i, m_sequence[i].toJS(exec));
  • trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp

    r205569 r206386  
    118118    auto scope = DECLARE_THROW_SCOPE(vm);
    119119    JSObject* result = constructEmptyObject(exec);
    120     if (UNLIKELY(scope.exception()))
    121         return jsUndefined();
     120    RETURN_IF_EXCEPTION(scope, JSValue());
    122121    result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id()));
    123122    result->putDirect(vm, exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind))));
    124123   
    125124    JSArray* profiledBytecodes = constructEmptyArray(exec, 0);
    126     if (UNLIKELY(scope.exception()))
    127         return jsUndefined();
     125    RETURN_IF_EXCEPTION(scope, JSValue());
    128126    for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i)
    129127        profiledBytecodes->putDirectIndex(exec, i, m_profiledBytecodes[i].toJS(exec));
     
    131129   
    132130    JSArray* descriptions = constructEmptyArray(exec, 0);
    133     if (UNLIKELY(scope.exception()))
    134         return jsUndefined();
     131    RETURN_IF_EXCEPTION(scope, JSValue());
    135132    for (unsigned i = 0; i < m_descriptions.size(); ++i)
    136133        descriptions->putDirectIndex(exec, i, m_descriptions[i].toJS(exec));
     
    138135   
    139136    JSArray* counters = constructEmptyArray(exec, 0);
    140     if (UNLIKELY(scope.exception()))
    141         return jsUndefined();
     137    RETURN_IF_EXCEPTION(scope, JSValue());
    142138    for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) {
    143139        JSObject* counterEntry = constructEmptyObject(exec);
     
    149145   
    150146    JSArray* exitSites = constructEmptyArray(exec, 0);
    151     if (UNLIKELY(scope.exception()))
    152         return jsUndefined();
     147    RETURN_IF_EXCEPTION(scope, JSValue());
    153148    for (unsigned i = 0; i < m_osrExitSites.size(); ++i)
    154149        exitSites->putDirectIndex(exec, i, m_osrExitSites[i].toJS(exec));
     
    156151   
    157152    JSArray* exits = constructEmptyArray(exec, 0);
    158     if (UNLIKELY(scope.exception()))
    159         return jsUndefined();
     153    RETURN_IF_EXCEPTION(scope, JSValue());
    160154    for (unsigned i = 0; i < m_osrExits.size(); ++i)
    161155        exits->putDirectIndex(exec, i, m_osrExits[i].toJS(exec));
  • trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp

    r205569 r206386  
    105105   
    106106    JSArray* bytecodes = constructEmptyArray(exec, 0);
    107     if (UNLIKELY(scope.exception()))
    108         return jsUndefined();
     107    RETURN_IF_EXCEPTION(scope, JSValue());
    109108    for (unsigned i = 0; i < m_bytecodes.size(); ++i)
    110109        bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec));
     
    112111   
    113112    JSArray* compilations = constructEmptyArray(exec, 0);
    114     if (UNLIKELY(scope.exception()))
    115         return jsUndefined();
     113    RETURN_IF_EXCEPTION(scope, JSValue());
    116114    for (unsigned i = 0; i < m_compilations.size(); ++i)
    117115        compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec));
     
    119117   
    120118    JSArray* events = constructEmptyArray(exec, 0);
    121     if (UNLIKELY(scope.exception()))
    122         return jsUndefined();
     119    RETURN_IF_EXCEPTION(scope, JSValue());
    123120    for (unsigned i = 0; i < m_events.size(); ++i)
    124121        events->putDirectIndex(exec, i, m_events[i].toJS(exec));
  • trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp

    r205569 r206386  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4040    auto scope = DECLARE_THROW_SCOPE(vm);
    4141    JSArray* result = constructEmptyArray(exec, 0);
    42     if (UNLIKELY(scope.exception()))
    43         return jsUndefined();
     42    RETURN_IF_EXCEPTION(scope, JSValue());
    4443    for (unsigned i = 0; i < m_codeAddresses.size(); ++i)
    4544        result->putDirectIndex(exec, i, jsString(exec, toString(RawPointer(m_codeAddresses[i]))));
  • trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp

    r205569 r206386  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    104104    auto scope = DECLARE_THROW_SCOPE(vm);
    105105    JSArray* result = constructEmptyArray(exec, 0);
    106     if (UNLIKELY(scope.exception()))
    107         return jsUndefined();
     106    RETURN_IF_EXCEPTION(scope, JSValue());
    108107   
    109108    for (unsigned i = 0; i < m_stack.size(); ++i)
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r206281 r206386  
    200200    auto scope = DECLARE_THROW_SCOPE(vm);
    201201
     202    auto exceptionResult = [] () {
     203        return std::make_pair(SpeciesConstructResult::Exception, nullptr);
     204    };
     205
    202206    // ECMA 9.4.2.3: https://tc39.github.io/ecma262/#sec-arrayspeciescreate
    203207    JSValue constructor = jsUndefined();
     
    209213
    210214        constructor = thisObject->get(exec, exec->propertyNames().constructor);
    211         if (UNLIKELY(scope.exception()))
    212             return std::make_pair(SpeciesConstructResult::Exception, nullptr);
     215        RETURN_IF_EXCEPTION(scope, exceptionResult());
    213216        if (constructor.isConstructor()) {
    214217            JSObject* constructorObject = jsCast<JSObject*>(constructor);
     
    218221        if (constructor.isObject()) {
    219222            constructor = constructor.get(exec, exec->propertyNames().speciesSymbol);
    220             if (UNLIKELY(scope.exception()))
    221                 return std::make_pair(SpeciesConstructResult::Exception, nullptr);
     223            RETURN_IF_EXCEPTION(scope, exceptionResult());
    222224            if (constructor.isNull())
    223225                return std::make_pair(SpeciesConstructResult::FastPath, nullptr);;
    224226        }
    225     } else if (UNLIKELY(scope.exception()))
    226         return std::make_pair(SpeciesConstructResult::Exception, nullptr);
     227    } else
     228        RETURN_IF_EXCEPTION(scope, exceptionResult());
    227229
    228230    if (constructor.isUndefined())
     
    232234    args.append(jsNumber(length));
    233235    JSObject* newObject = construct(exec, constructor, args, "Species construction did not get a valid constructor");
    234     if (UNLIKELY(scope.exception()))
    235         return std::make_pair(SpeciesConstructResult::Exception, nullptr);
     236    RETURN_IF_EXCEPTION(scope, exceptionResult());
    236237    return std::make_pair(SpeciesConstructResult::CreatedObject, newObject);
    237238}
     
    288289        unsigned to = k + resultCount;
    289290        if (JSValue value = getProperty(exec, thisObj, from)) {
    290             if (UNLIKELY(scope.exception()))
    291                 return;
     291            RETURN_IF_EXCEPTION(scope, void());
    292292            thisObj->putByIndexInline(exec, to, value, true);
    293             if (UNLIKELY(scope.exception()))
    294                 return;
     293            RETURN_IF_EXCEPTION(scope, void());
    295294        } else if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, to)) {
    296295            throwTypeError(exec, scope, ASCIILiteral("Unable to delete property."));
     
    334333        unsigned to = k + resultCount - 1;
    335334        if (JSValue value = getProperty(exec, thisObj, from)) {
    336             if (UNLIKELY(scope.exception()))
    337                 return;
     335            RETURN_IF_EXCEPTION(scope, void());
    338336            thisObj->putByIndexInline(exec, to, value, true);
    339337        } else if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, to)) {
     
    341339            return;
    342340        }
    343         if (UNLIKELY(scope.exception()))
    344             return;
     341        RETURN_IF_EXCEPTION(scope, void());
    345342    }
    346343}
     
    354351    // 1. Let array be the result of calling ToObject on the this value.
    355352    JSObject* thisObject = thisValue.toObject(exec);
    356     if (UNLIKELY(scope.exception()))
    357         return JSValue::encode(jsUndefined());
     353    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    358354   
    359355    // 2. Let func be the result of calling the [[Get]] internal method of array with argument "join".
    360356    JSValue function = JSValue(thisObject).get(exec, exec->propertyNames().join);
    361     if (UNLIKELY(scope.exception()))
    362         return JSValue::encode(jsUndefined());
     357    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    363358
    364359    // 3. If IsCallable(func) is false, then let func be the standard built-in method Object.prototype.toString (15.2.4.2).
     
    388383
    389384    JSStringJoiner joiner(*exec, ',', length);
    390     if (UNLIKELY(scope.exception()))
    391         return JSValue::encode(jsUndefined());
     385    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    392386
    393387    for (unsigned i = 0; i < length; ++i) {
     
    395389        if (!element) {
    396390            element = thisArray->get(exec, i);
    397             if (UNLIKELY(scope.exception()))
    398                 return JSValue::encode(jsUndefined());
     391            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    399392        }
    400393        joiner.append(*exec, element);
    401         if (UNLIKELY(scope.exception()))
    402             return JSValue::encode(jsUndefined());
     394        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    403395    }
    404396
     
    413405
    414406    JSObject* thisObject = thisValue.toObject(exec);
    415     if (UNLIKELY(scope.exception()))
    416         return JSValue::encode(jsUndefined());
     407    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    417408
    418409    unsigned length = getLength(exec, thisObject);
    419     if (UNLIKELY(scope.exception()))
    420         return JSValue::encode(jsUndefined());
     410    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    421411
    422412    StringRecursionChecker checker(exec, thisObject);
     
    425415
    426416    JSStringJoiner stringJoiner(*exec, ',', length);
    427     if (UNLIKELY(scope.exception()))
    428         return JSValue::encode(jsUndefined());
     417    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    429418
    430419#if ENABLE(INTL)
     
    432421    for (unsigned i = 0; i < length; ++i) {
    433422        JSValue element = thisObject->getIndex(exec, i);
    434         if (UNLIKELY(scope.exception()))
    435             return JSValue::encode(jsUndefined());
     423        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    436424        if (element.isUndefinedOrNull())
    437425            element = jsEmptyString(exec);
    438426        else {
    439427            JSValue conversionFunction = element.get(exec, exec->propertyNames().toLocaleString);
    440             if (UNLIKELY(scope.exception()))
    441                 return JSValue::encode(jsUndefined());
     428            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    442429            CallData callData;
    443430            CallType callType = getCallData(conversionFunction, callData);
    444431            if (callType != CallType::None) {
    445432                element = call(exec, conversionFunction, callType, callData, element, arguments);
    446                 if (UNLIKELY(scope.exception()))
    447                 return JSValue::encode(jsUndefined());
     433                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    448434            }
    449435        }
    450436        stringJoiner.append(*exec, element);
    451         if (UNLIKELY(scope.exception()))
    452             return JSValue::encode(jsUndefined());
     437        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    453438    }
    454439#else // !ENABLE(INTL)
    455440    for (unsigned i = 0; i < length; ++i) {
    456441        JSValue element = thisObject->getIndex(exec, i);
    457         if (UNLIKELY(scope.exception()))
    458             return JSValue::encode(jsUndefined());
     442        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    459443        if (element.isUndefinedOrNull())
    460444            continue;
    461445        JSValue conversionFunction = element.get(exec, exec->propertyNames().toLocaleString);
    462         if (UNLIKELY(scope.exception()))
    463             return JSValue::encode(jsUndefined());
     446        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    464447        CallData callData;
    465448        CallType callType = getCallData(conversionFunction, callData);
    466449        if (callType != CallType::None) {
    467450            element = call(exec, conversionFunction, callType, callData, element, exec->emptyList());
    468             if (UNLIKELY(scope.exception()))
    469                 return JSValue::encode(jsUndefined());
     451            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    470452        }
    471453        stringJoiner.append(*exec, element);
    472         if (UNLIKELY(scope.exception()))
    473             return JSValue::encode(jsUndefined());
     454        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    474455    }
    475456#endif // !ENABLE(INTL)
     
    514495    // 6. Let element0 be Get(O, "0").
    515496    JSValue element0 = thisObject->getIndex(&exec, 0);
    516     if (UNLIKELY(scope.exception()))
    517         return JSValue();
     497    RETURN_IF_EXCEPTION(scope, JSValue());
    518498
    519499    // 7. If element0 is undefined or null, let R be the empty String; otherwise, let R be ? ToString(element0).
     
    523503    else
    524504        r = element0.toString(&exec);
    525     if (UNLIKELY(scope.exception()))
    526         return JSValue();
     505    RETURN_IF_EXCEPTION(scope, JSValue());
    527506
    528507    // 8. Let k be 1.
     
    532511        // b. Let element be ? Get(O, ! ToString(k)).
    533512        JSValue element = thisObject->get(&exec, Identifier::fromString(&exec, AtomicString::number(k)));
    534         if (UNLIKELY(scope.exception()))
    535             return JSValue();
     513        RETURN_IF_EXCEPTION(scope, JSValue());
    536514
    537515        // c. If element is undefined or null, let next be the empty String; otherwise, let next be ? ToString(element).
     
    543521        } else
    544522            next = element.toString(&exec);
    545         if (UNLIKELY(scope.exception()))
    546             return JSValue();
     523        RETURN_IF_EXCEPTION(scope, JSValue());
    547524
    548525        // a. Let S be the String value produced by concatenating R and sep.
    549526        // d. Let R be a String value produced by concatenating S and next.
    550527        r = jsString(&exec, r, separator, next);
    551         if (UNLIKELY(scope.exception()))
    552             return JSValue();
     528        RETURN_IF_EXCEPTION(scope, JSValue());
    553529    }
    554530    // 10. Return R.
     
    581557            break;
    582558        JSStringJoiner joiner(state, separator, length);
    583         if (UNLIKELY(scope.exception()))
    584             return jsUndefined();
     559        RETURN_IF_EXCEPTION(scope, JSValue());
    585560        auto data = butterfly.contiguous().data();
    586561        bool holesKnownToBeOK = false;
     
    605580            break;
    606581        JSStringJoiner joiner(state, separator, length);
    607         if (UNLIKELY(scope.exception()))
    608             return jsUndefined();
     582        RETURN_IF_EXCEPTION(scope, JSValue());
    609583        auto data = butterfly.contiguousDouble().data();
    610584        bool holesKnownToBeOK = false;
     
    628602generalCase:
    629603    JSStringJoiner joiner(state, separator, length);
    630     if (UNLIKELY(scope.exception()))
    631         return jsUndefined();
     604    RETURN_IF_EXCEPTION(scope, JSValue());
    632605    for (unsigned i = 0; i < length; ++i) {
    633606        JSValue element = thisObject->getIndex(&state, i);
    634         if (UNLIKELY(scope.exception()))
    635             return jsUndefined();
     607        RETURN_IF_EXCEPTION(scope, JSValue());
    636608        joiner.append(state, element);
    637         if (UNLIKELY(scope.exception()))
    638             return jsUndefined();
     609        RETURN_IF_EXCEPTION(scope, JSValue());
    639610    }
    640611    return joiner.join(state);
     
    657628    // 2. Let len be ? ToLength(? Get(O, "length")).
    658629    double length = toLength(exec, thisObject);
    659     if (UNLIKELY(scope.exception()))
    660         return JSValue::encode(JSValue());
     630    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    661631
    662632    // 3. If separator is undefined, let separator be the single-element String ",".
     
    669639            ASSERT(static_cast<double>(length64) == length);
    670640            JSString* jsSeparator = jsSingleCharacterString(exec, comma);
    671             if (UNLIKELY(scope.exception()))
    672                 return JSValue::encode(JSValue());
     641            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    673642
    674643            return JSValue::encode(slowJoin(*exec, thisObject, jsSeparator, length64));
     
    682651    // 4. Let sep be ? ToString(separator).
    683652    JSString* jsSeparator = separatorValue.toString(exec);
    684     if (UNLIKELY(scope.exception()))
    685         return JSValue::encode(jsUndefined());
     653    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    686654
    687655    if (UNLIKELY(length > std::numeric_limits<unsigned>::max() || !canUseFastJoin(thisObject))) {
     
    708676        return JSValue::encode(JSValue());
    709677    unsigned length = getLength(exec, thisObj);
    710     if (UNLIKELY(scope.exception()))
    711         return JSValue::encode(jsUndefined());
     678    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    712679
    713680    JSValue result;
     
    717684    } else {
    718685        result = thisObj->get(exec, length - 1);
    719         if (UNLIKELY(scope.exception()))
    720             return JSValue::encode(jsUndefined());
     686        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    721687        if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, length - 1)) {
    722688            throwTypeError(exec, scope, ASCIILiteral("Unable to delete property."));
     
    744710        return JSValue::encode(JSValue());
    745711    unsigned length = getLength(exec, thisObj);
    746     if (UNLIKELY(scope.exception()))
    747         return JSValue::encode(jsUndefined());
     712    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    748713
    749714    for (unsigned n = 0; n < exec->argumentCount(); n++) {
     
    756721            thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot);
    757722        }
    758         if (UNLIKELY(scope.exception()))
    759             return JSValue::encode(jsUndefined());
     723        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    760724    }
    761725   
     
    775739
    776740    unsigned length = getLength(exec, thisObject);
    777     if (UNLIKELY(scope.exception()))
    778         return JSValue::encode(jsUndefined());
     741    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    779742
    780743    switch (thisObject->indexingType()) {
     
    816779        unsigned upper = length - lower - 1;
    817780        bool lowerExists = thisObject->hasProperty(exec, lower);
    818         if (UNLIKELY(scope.exception()))
    819             return JSValue::encode(jsUndefined());
     781        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    820782        JSValue lowerValue;
    821783        if (lowerExists) {
    822784            lowerValue = thisObject->get(exec, lower);
    823             if (UNLIKELY(scope.exception()))
    824                 return JSValue::encode(jsUndefined());
     785            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    825786        }
    826787
    827788        bool upperExists = thisObject->hasProperty(exec, upper);
    828         if (UNLIKELY(scope.exception()))
    829             return JSValue::encode(jsUndefined());
     789        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    830790        JSValue upperValue;
    831791        if (upperExists) {
    832792            upperValue = thisObject->get(exec, upper);
    833             if (UNLIKELY(scope.exception()))
    834                 return JSValue::encode(jsUndefined());
     793            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    835794        }
    836795
    837796        if (upperExists) {
    838797            thisObject->putByIndexInline(exec, lower, upperValue, true);
    839             if (UNLIKELY(scope.exception()))
    840                 return JSValue::encode(JSValue());
     798            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    841799        } else if (!thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, lower)) {
    842800            if (!scope.exception())
     
    847805        if (lowerExists) {
    848806            thisObject->putByIndexInline(exec, upper, lowerValue, true);
    849             if (UNLIKELY(scope.exception()))
    850                 return JSValue::encode(JSValue());
     807            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    851808        } else if (!thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, upper)) {
    852809            if (!scope.exception())
     
    866823        return JSValue::encode(JSValue());
    867824    unsigned length = getLength(exec, thisObj);
    868     if (UNLIKELY(scope.exception()))
    869         return JSValue::encode(jsUndefined());
     825    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    870826
    871827    JSValue result;
     
    876832        result = thisObj->getIndex(exec, 0);
    877833        shift<JSArray::ShiftCountForShift>(exec, thisObj, 0, 1, 0, length);
    878         if (UNLIKELY(scope.exception()))
    879             return JSValue::encode(jsUndefined());
     834        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    880835        putLength(exec, thisObj, jsNumber(length - 1));
    881836    }
     
    892847        return JSValue::encode(JSValue());
    893848    unsigned length = getLength(exec, thisObj);
    894     if (UNLIKELY(scope.exception()))
    895         return JSValue::encode(jsUndefined());
     849    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    896850
    897851    unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, length);
     
    913867    else {
    914868        result = constructEmptyArray(exec, nullptr, end - begin);
    915         if (UNLIKELY(scope.exception()))
    916             return JSValue::encode(jsUndefined());
     869        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    917870    }
    918871
     
    920873    for (unsigned k = begin; k < end; k++, n++) {
    921874        JSValue v = getProperty(exec, thisObj, k);
    922         if (UNLIKELY(scope.exception()))
    923             return JSValue::encode(jsUndefined());
     875        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    924876        if (v)
    925877            result->putDirectIndex(exec, n, v);
     
    940892        return JSValue::encode(JSValue());
    941893    unsigned length = getLength(exec, thisObj);
    942     if (UNLIKELY(scope.exception()))
    943         return JSValue::encode(jsUndefined());
     894    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    944895
    945896    if (!exec->argumentCount()) {
     
    953904        else {
    954905            result = constructEmptyArray(exec, nullptr);
    955             if (UNLIKELY(scope.exception()))
    956                 return JSValue::encode(jsUndefined());
     906            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    957907        }
    958908
     
    989939            for (unsigned k = 0; k < deleteCount; ++k) {
    990940                JSValue v = getProperty(exec, thisObj, k + begin);
    991                 if (UNLIKELY(scope.exception()))
    992                     return JSValue::encode(jsUndefined());
     941                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    993942                if (UNLIKELY(!v))
    994943                    continue;
    995944                result->putByIndexInline(exec, k, v, true);
    996                 if (UNLIKELY(scope.exception()))
    997                     return JSValue::encode(jsUndefined());
     945                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    998946            }
    999947        } else {
     
    1004952            for (unsigned k = 0; k < deleteCount; ++k) {
    1005953                JSValue v = getProperty(exec, thisObj, k + begin);
    1006                 if (UNLIKELY(scope.exception()))
    1007                     return JSValue::encode(jsUndefined());
     954                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1008955                if (UNLIKELY(!v))
    1009956                    continue;
     
    1016963    if (additionalArgs < deleteCount) {
    1017964        shift<JSArray::ShiftCountForSplice>(exec, thisObj, begin, deleteCount, additionalArgs, length);
    1018         if (UNLIKELY(scope.exception()))
    1019             return JSValue::encode(jsUndefined());
     965        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1020966    } else if (additionalArgs > deleteCount) {
    1021967        unshift<JSArray::ShiftCountForSplice>(exec, thisObj, begin, deleteCount, additionalArgs, length);
    1022         if (UNLIKELY(scope.exception()))
    1023             return JSValue::encode(jsUndefined());
     968        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1024969    }
    1025970    for (unsigned k = 0; k < additionalArgs; ++k) {
    1026971        thisObj->putByIndexInline(exec, k + begin, exec->uncheckedArgument(k + 2), true);
    1027         if (UNLIKELY(scope.exception()))
    1028             return JSValue::encode(jsUndefined());
     972        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1029973    }
    1030974   
     
    1043987        return JSValue::encode(JSValue());
    1044988    unsigned length = getLength(exec, thisObj);
    1045     if (UNLIKELY(scope.exception()))
    1046         return JSValue::encode(jsUndefined());
     989    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1047990
    1048991    unsigned nrArgs = exec->argumentCount();
    1049992    if (nrArgs) {
    1050993        unshift<JSArray::ShiftCountForShift>(exec, thisObj, 0, 0, nrArgs, length);
    1051         if (UNLIKELY(scope.exception()))
    1052             return JSValue::encode(jsUndefined());
     994        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1053995    }
    1054996    for (unsigned k = 0; k < nrArgs; ++k) {
    1055997        thisObj->putByIndexInline(exec, k, exec->uncheckedArgument(k), true);
    1056         if (UNLIKELY(scope.exception()))
    1057             return JSValue::encode(jsUndefined());
     998        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    1058999    }
    10591000    JSValue result = jsNumber(length + nrArgs);
     
    10721013        return JSValue::encode(JSValue());
    10731014    unsigned length = getLength(exec, thisObj);
    1074     if (UNLIKELY(scope.exception()))
    1075         return JSValue::encode(jsUndefined());
     1015    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10761016
    10771017    unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length);
     
    10791019    for (; index < length; ++index) {
    10801020        JSValue e = getProperty(exec, thisObj, index);
    1081         if (UNLIKELY(scope.exception()))
    1082             return JSValue::encode(jsUndefined());
     1021        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10831022        if (!e)
    10841023            continue;
    10851024        if (JSValue::strictEqual(exec, searchElement, e))
    10861025            return JSValue::encode(jsNumber(index));
    1087         if (UNLIKELY(scope.exception()))
    1088             return JSValue::encode(jsUndefined());
     1026        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10891027    }
    10901028
     
    11221060        RELEASE_ASSERT(index < length);
    11231061        JSValue e = getProperty(exec, thisObj, index);
    1124         if (UNLIKELY(scope.exception()))
    1125             return JSValue::encode(jsUndefined());
     1062        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11261063        if (!e)
    11271064            continue;
    11281065        if (JSValue::strictEqual(exec, searchElement, e))
    11291066            return JSValue::encode(jsNumber(index));
    1130         if (UNLIKELY(scope.exception()))
    1131             return JSValue::encode(jsUndefined());
     1067        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11321068    } while (index--);
    11331069
     
    11441080            if (value) {
    11451081                target->putDirectIndex(exec, targetOffset + i, value);
    1146                 if (UNLIKELY(scope.exception()))
    1147                     return false;
     1082                RETURN_IF_EXCEPTION(scope, false);
    11481083            }
    11491084        }
     
    11511086        for (unsigned i = 0; i < sourceLength; ++i) {
    11521087            JSValue value = getProperty(exec, source, i);
    1153             if (UNLIKELY(scope.exception()))
    1154                 return false;
     1088            RETURN_IF_EXCEPTION(scope, false);
    11551089            if (value) {
    11561090                target->putDirectIndex(exec, targetOffset + i, value);
    1157                 if (UNLIKELY(scope.exception()))
    1158                     return false;
     1091                RETURN_IF_EXCEPTION(scope, false);
    11591092            }
    11601093        }
     
    12291162    if (type == NonArray || !firstArray->canFastCopy(vm, secondArray) || firstArraySize + secondArraySize >= MIN_SPARSE_ARRAY_INDEX) {
    12301163        JSArray* result = constructEmptyArray(exec, nullptr, firstArraySize + secondArraySize);
    1231         if (UNLIKELY(scope.exception()))
    1232             return JSValue::encode(JSValue());
     1164        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    12331165
    12341166        if (!moveElements(exec, vm, result, 0, firstArray, firstArraySize)
  • trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp

    r205569 r206386  
    5353    JSValue boolean = jsBoolean(exec->argument(0).toBoolean(exec));
    5454    Structure* booleanStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure());
    55     if (UNLIKELY(scope.exception()))
    56         return JSValue::encode(JSValue());
     55    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    5756    BooleanObject* obj = BooleanObject::create(vm, booleanStructure);
    5857    obj->setInternalValue(vm, boolean);
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h

    r205569 r206386  
    8888
    8989    auto property = propName.toPropertyKey(exec);
    90     if (scope.exception())
    91         return false;
     90    RETURN_IF_EXCEPTION(scope, false);
    9291    return baseObj->hasProperty(exec, property);
    9392}
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r206333 r206386  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003, 2007, 2013 Apple Inc.
     4 *  Copyright (C) 2003, 2007, 2013, 2016 Apple Inc.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    194194    // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
    195195    globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
    196     if (UNLIKELY(scope.exception()))
    197         return rejectPromise(exec, globalObject);
     196    RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject));
    198197
    199198    return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined(), initiator);
     
    234233    // FIXME: Introduce JSSourceCode object to wrap around this source.
    235234    globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
    236     if (UNLIKELY(scope.exception()))
    237         return rejectPromise(exec, globalObject);
     235    RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject));
    238236
    239237    return loadModule(lock, exec, globalObject, key, jsUndefined(), initiator);
  • trunk/Source/JavaScriptCore/runtime/ConsoleObject.cpp

    r205569 r206386  
    204204
    205205    bool condition = exec->argument(0).toBoolean(exec);
    206     if (UNLIKELY(scope.exception()))
    207         return JSValue::encode(jsUndefined());
     206    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    208207
    209208    if (condition)
     
    241240
    242241    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
    243     if (UNLIKELY(scope.exception()))
    244         return JSValue::encode(jsUndefined());
     242    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    245243
    246244    client->profile(exec, title);
     
    263261
    264262    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
    265     if (UNLIKELY(scope.exception()))
    266         return JSValue::encode(jsUndefined());
     263    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    267264
    268265    client->profileEnd(exec, title);
     
    285282
    286283    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
    287     if (UNLIKELY(scope.exception()))
    288         return JSValue::encode(jsUndefined());
     284    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    289285
    290286    client->takeHeapSnapshot(exec, title);
     
    312308    else {
    313309        title = valueOrDefaultLabelString(exec, exec->argument(0));
    314         if (UNLIKELY(scope.exception()))
    315             return JSValue::encode(jsUndefined());
     310        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    316311    }
    317312
     
    333328    else {
    334329        title = valueOrDefaultLabelString(exec, exec->argument(0));
    335         if (UNLIKELY(scope.exception()))
    336             return JSValue::encode(jsUndefined());
     330        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    337331    }
    338332
  • trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp

    r205569 r206386  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011, 2016 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2004-2008, 2011, 2016 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    169169
    170170    Structure* dateStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->dateStructure());
    171     if (UNLIKELY(scope.exception()))
    172         return nullptr;
     171    RETURN_IF_EXCEPTION(scope, nullptr);
    173172
    174173    return DateInstance::create(vm, dateStructure, value);
     
    207206    auto scope = DECLARE_THROW_SCOPE(vm);
    208207    String dateStr = exec->argument(0).toString(exec)->value(exec);
    209     if (UNLIKELY(scope.exception()))
    210         return JSValue::encode(jsUndefined());
     208    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    211209    return JSValue::encode(jsNumber(parseDate(vm, dateStr)));
    212210}
  • trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp

    r205569 r206386  
    616616    JSValue hintValue = exec->uncheckedArgument(0);
    617617    PreferredPrimitiveType type = toPreferredPrimitiveType(exec, hintValue);
    618     if (UNLIKELY(scope.exception()))
    619         return JSValue::encode(JSValue());
     618    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    620619
    621620    if (type == NoPreference)
     
    11291128    JSValue thisValue = exec->thisValue();
    11301129    JSObject* object = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode));
    1131     if (UNLIKELY(scope.exception()))
    1132         return JSValue::encode(jsNull());
     1130    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11331131
    11341132    JSValue timeValue = object->toPrimitive(exec, PreferNumber);
    1135     if (UNLIKELY(scope.exception()))
    1136         return JSValue::encode(jsNull());
     1133    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11371134    if (timeValue.isNumber() && !(timeValue.isInt32() || std::isfinite(timeValue.asDouble())))
    11381135        return JSValue::encode(jsNull());
    11391136
    11401137    JSValue toISOValue = object->get(exec, vm.propertyNames->toISOString);
    1141     if (UNLIKELY(scope.exception()))
    1142         return JSValue::encode(jsNull());
     1138    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11431139
    11441140    CallData callData;
     
    11481144
    11491145    JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList());
    1150     if (UNLIKELY(scope.exception()))
    1151         return JSValue::encode(jsNull());
     1146    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11521147    if (result.isObject())
    11531148        return throwVMTypeError(exec, scope, ASCIILiteral("toISOString did not return a primitive value"));
  • trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp

    r206018 r206386  
    5555    JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
    5656    Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->errorStructure());
    57     if (UNLIKELY(scope.exception()))
    58         return JSValue::encode(JSValue());
     57    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    5958    return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
    6059}
  • trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp

    r205569 r206386  
    186186    else {
    187187        nameString = nameValue.toString(exec)->value(exec);
    188         if (UNLIKELY(scope.exception()))
    189             return String();
     188        RETURN_IF_EXCEPTION(scope, String());
    190189    }
    191190
     
    202201    else {
    203202        messageString = messageValue.toString(exec)->value(exec);
    204         if (UNLIKELY(scope.exception()))
    205             return String();
     203        RETURN_IF_EXCEPTION(scope, String());
    206204    }
    207205
  • trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp

    r205569 r206386  
    8686    // 3. Let name be the result of calling the [[Get]] internal method of O with argument "name".
    8787    JSValue name = thisObj->get(exec, exec->propertyNames().name);
    88     if (UNLIKELY(scope.exception()))
    89         return JSValue::encode(jsUndefined());
     88    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9089
    9190    // 4. If name is undefined, then let name be "Error"; else let name be ToString(name).
     
    9594    else {
    9695        nameString = name.toString(exec)->value(exec);
    97         if (UNLIKELY(scope.exception()))
    98             return JSValue::encode(jsUndefined());
     96        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9997    }
    10098
    10199    // 5. Let msg be the result of calling the [[Get]] internal method of O with argument "message".
    102100    JSValue message = thisObj->get(exec, exec->propertyNames().message);
    103     if (UNLIKELY(scope.exception()))
    104         return JSValue::encode(jsUndefined());
     101    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    105102
    106103    // (sic)
     
    112109    else {
    113110        messageString = message.toString(exec)->value(exec);
    114         if (UNLIKELY(scope.exception()))
    115             return JSValue::encode(jsUndefined());
     111        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    116112    }
    117113
  • trunk/Source/JavaScriptCore/runtime/ExceptionScope.h

    r205569 r206386  
    7171   
    7272#endif // ENABLE(EXCEPTION_SCOPE_VERIFICATION)
    73    
     73
     74#define RETURN_IF_EXCEPTION(scope__, value__) do { \
     75        if (UNLIKELY((scope__).exception())) \
     76            return value__; \
     77    } while (false)
     78
    7479} // namespace JSC
    7580
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp

    r205569 r206386  
    127127
    128128    Structure* subclassStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->functionStructure());
    129     if (UNLIKELY(scope.exception()))
    130         return nullptr;
     129    RETURN_IF_EXCEPTION(scope, nullptr);
    131130
    132131    return JSFunction::create(vm, function, globalObject->globalScope(), subclassStructure);
  • trunk/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h

    r205569 r206386  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    229229        else {
    230230            exec->r(firstElementDest + i) = get(exec, i + offset);
    231             if (UNLIKELY(scope.exception()))
    232                 return;
     231            RETURN_IF_EXCEPTION(scope, void());
    233232        }
    234233    }
  • trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp

    r205569 r206386  
    7878    // FIXME: Some callers may invoke get() without checking for an exception first.
    7979    // We work around that by checking here.
    80     if (UNLIKELY(scope.exception()))
    81         return scope.exception()->value();
     80    RETURN_IF_EXCEPTION(scope, scope.exception()->value());
    8281
    8382    JSObject* getter = jsCast<GetterSetter*>(getterSetter)->getter();
  • trunk/Source/JavaScriptCore/runtime/HashMapImpl.h

    r205989 r206386  
    246246        JSString* string = asString(value);
    247247        const String& wtfString = string->value(exec);
    248         if (UNLIKELY(scope.exception()))
    249             return UINT_MAX;
     248        RETURN_IF_EXCEPTION(scope, UINT_MAX);
    250249        return wtfString.impl()->hash();
    251250    }
     
    338337
    339338        makeAndSetNewBuffer(exec, vm);
    340         if (UNLIKELY(scope.exception()))
    341             return;
     339        RETURN_IF_EXCEPTION(scope, void());
    342340
    343341        m_head.set(vm, this, HashMapBucketType::create(vm));
     
    377375        key = normalizeMapKey(key);
    378376        uint32_t hash = jsMapHash(exec, vm, key);
    379         if (UNLIKELY(scope.exception()))
    380             return nullptr;
     377        RETURN_IF_EXCEPTION(scope, nullptr);
    381378        return findBucket(exec, key, hash);
    382379    }
     
    409406        const uint32_t mask = m_capacity - 1;
    410407        uint32_t index = jsMapHash(exec, vm, key) & mask;
    411         if (UNLIKELY(scope.exception()))
    412             return;
     408        RETURN_IF_EXCEPTION(scope, void());
    413409        HashMapBucketType** buffer = this->buffer();
    414410        HashMapBucketType* bucket = buffer[index];
     
    571567        if (m_capacity != oldCapacity) {
    572568            makeAndSetNewBuffer(exec, vm);
    573             if (UNLIKELY(scope.exception()))
    574                 return;
     569            RETURN_IF_EXCEPTION(scope, void());
    575570        } else {
    576571            m_buffer.get()->reset(m_capacity);
  • trunk/Source/JavaScriptCore/runtime/InspectorInstrumentationObject.cpp

    r205569 r206386  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8888    JSValue target = exec->argument(0);
    8989    String value = target.toString(exec)->value(exec);
    90     if (UNLIKELY(scope.exception()))
    91         return JSValue::encode(jsUndefined());
     90    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9291    dataLog(value, "\n");
    9392    return JSValue::encode(jsUndefined());
  • trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp

    r205569 r206386  
    22 *  Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2004, 2007, 2008, 2016 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2004, 2007-2008, 2016 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    114114            // Note, Reflect.construct might cause the profile to churn but we don't care.
    115115            JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype);
    116             if (UNLIKELY(scope.exception()))
    117                 return nullptr;
     116            RETURN_IF_EXCEPTION(scope, nullptr);
    118117            if (JSObject* prototype = jsDynamicCast<JSObject*>(prototypeValue))
    119118                return targetFunction->rareData(vm)->createInternalFunctionAllocationStructureFromBase(vm, prototype, baseClass);
    120119        } else {
    121120            JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype);
    122             if (UNLIKELY(scope.exception()))
    123                 return nullptr;
     121            RETURN_IF_EXCEPTION(scope, nullptr);
    124122            if (JSObject* prototype = jsDynamicCast<JSObject*>(prototypeValue)) {
    125123                // This only happens if someone Reflect.constructs our builtin constructor with another builtin constructor as the new.target.
  • trunk/Source/JavaScriptCore/runtime/IntlCollator.cpp

    r206295 r206386  
    173173    auto requestedLocales = canonicalizeLocaleList(state, locales);
    174174    // 4. ReturnIfAbrupt(requestedLocales).
    175     if (UNLIKELY(scope.exception()))
    176         return;
     175    RETURN_IF_EXCEPTION(scope, void());
    177176
    178177    // 5. If options is undefined, then
     
    185184        options = optionsValue.toObject(&state);
    186185        // b. ReturnIfAbrupt(options).
    187         if (UNLIKELY(scope.exception()))
    188             return;
     186        RETURN_IF_EXCEPTION(scope, void());
    189187    }
    190188
     
    192190    String usageString = intlStringOption(state, options, vm.propertyNames->usage, { "sort", "search" }, "usage must be either \"sort\" or \"search\"", "sort");
    193191    // 8. ReturnIfAbrupt(u).
    194     if (UNLIKELY(scope.exception()))
    195         return;
     192    RETURN_IF_EXCEPTION(scope, void());
    196193    // 9. Set collator.[[usage]] to u.
    197194    if (usageString == "sort")
     
    218215    String matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit");
    219216    // 14. ReturnIfAbrupt(matcher).
    220     if (UNLIKELY(scope.exception()))
    221         return;
     217    RETURN_IF_EXCEPTION(scope, void());
    222218    // 15. Set opt.[[localeMatcher]] to matcher.
    223219    opt.add(ASCIILiteral("localeMatcher"), matcher);
     
    238234        bool usesFallback;
    239235        bool numeric = intlBooleanOption(state, options, vm.propertyNames->numeric, usesFallback);
    240         if (UNLIKELY(scope.exception()))
    241             return;
     236        RETURN_IF_EXCEPTION(scope, void());
    242237        if (!usesFallback)
    243238            numericString = ASCIILiteral(numeric ? "true" : "false");
     
    246241    {
    247242        String caseFirst = intlStringOption(state, options, vm.propertyNames->caseFirst, { "upper", "lower", "false" }, "caseFirst must be either \"upper\", \"lower\", or \"false\"", nullptr);
    248         if (UNLIKELY(scope.exception()))
    249             return;
     243        RETURN_IF_EXCEPTION(scope, void());
    250244        opt.add(ASCIILiteral("kf"), caseFirst);
    251245    }
     
    287281    String sensitivityString = intlStringOption(state, options, vm.propertyNames->sensitivity, { "base", "accent", "case", "variant" }, "sensitivity must be either \"base\", \"accent\", \"case\", or \"variant\"", nullptr);
    288282    // 25. ReturnIfAbrupt(s).
    289     if (UNLIKELY(scope.exception()))
    290         return;
     283    RETURN_IF_EXCEPTION(scope, void());
    291284    // 26. If s is undefined, then
    292285    // a. If u is "sort", then let s be "variant".
     
    312305        ignorePunctuation = false;
    313306    // 29. ReturnIfAbrupt(ip).
    314     if (UNLIKELY(scope.exception()))
    315         return;
     307    RETURN_IF_EXCEPTION(scope, void());
    316308    // 30. Set collator.[[ignorePunctuation]] to ip.
    317309    m_ignorePunctuation = ignorePunctuation;
  • trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp

    r205569 r206386  
    22 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com)
    33 * Copyright (C) 2015 Sukolsak Sakshuwong (sukolsak@gmail.com)
     4 * Copyright (C) 2016 Apple Inc. All Rights Reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    9192    // 3. ReturnIfAbrupt(collator).
    9293    Structure* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), jsCast<IntlCollatorConstructor*>(state->callee())->collatorStructure());
    93     if (UNLIKELY(scope.exception()))
    94         return JSValue::encode(jsUndefined());
     94    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9595    IntlCollator* collator = IntlCollator::create(vm, structure);
    9696    ASSERT(collator);
     
    145145
    146146    // 2. ReturnIfAbrupt(requestedLocales).
    147     if (UNLIKELY(scope.exception()))
    148         return JSValue::encode(jsUndefined());
     147    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    149148
    150149    // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options).
  • trunk/Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp

    r205569 r206386  
    9191    JSString* x = state->argument(0).toString(state);
    9292    // 6. ReturnIfAbrupt(X).
    93     if (UNLIKELY(scope.exception()))
    94         return JSValue::encode(jsUndefined());
     93    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9594
    9695    // 7. Let Y be ToString(y).
    9796    JSString* y = state->argument(1).toString(state);
    9897    // 8. ReturnIfAbrupt(Y).
    99     if (UNLIKELY(scope.exception()))
    100         return JSValue::encode(jsUndefined());
     98    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10199
    102100    // 9. Return CompareStrings(collator, X, Y).
     
    125123        // c. Let bc be BoundFunctionCreate(F, «this value»).
    126124        boundCompare = JSBoundFunction::create(vm, state, globalObject, targetObject, collator, nullptr, 2, ASCIILiteral("compare"));
    127         if (UNLIKELY(scope.exception()))
    128             return JSValue::encode(JSValue());
     125        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    129126        // d. Set collator.[[boundCompare]] to bc.
    130127        collator->setBoundCompare(vm, boundCompare);
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp

    r206295 r206386  
    226226    else {
    227227        JSObject* originalToObject = originalOptions.toObject(&exec);
    228         if (UNLIKELY(scope.exception()))
    229             return nullptr;
     228        RETURN_IF_EXCEPTION(scope, nullptr);
    230229        options = constructEmptyObject(&exec, originalToObject);
    231230    }
     
    243242    // iv. If value is not undefined, then let needDefaults be false.
    244243    JSValue weekday = options->get(&exec, vm.propertyNames->weekday);
    245     if (UNLIKELY(scope.exception()))
    246         return nullptr;
     244    RETURN_IF_EXCEPTION(scope, nullptr);
    247245    if (!weekday.isUndefined())
    248246        needDefaults = false;
    249247
    250248    JSValue year = options->get(&exec, vm.propertyNames->year);
    251     if (UNLIKELY(scope.exception()))
    252         return nullptr;
     249    RETURN_IF_EXCEPTION(scope, nullptr);
    253250    if (!year.isUndefined())
    254251        needDefaults = false;
    255252
    256253    JSValue month = options->get(&exec, vm.propertyNames->month);
    257     if (UNLIKELY(scope.exception()))
    258         return nullptr;
     254    RETURN_IF_EXCEPTION(scope, nullptr);
    259255    if (!month.isUndefined())
    260256        needDefaults = false;
    261257
    262258    JSValue day = options->get(&exec, vm.propertyNames->day);
    263     if (UNLIKELY(scope.exception()))
    264         return nullptr;
     259    RETURN_IF_EXCEPTION(scope, nullptr);
    265260    if (!day.isUndefined())
    266261        needDefaults = false;
     
    275270    // iv. If value is not undefined, then let needDefaults be false.
    276271    JSValue hour = options->get(&exec, vm.propertyNames->hour);
    277     if (UNLIKELY(scope.exception()))
    278         return nullptr;
     272    RETURN_IF_EXCEPTION(scope, nullptr);
    279273    if (!hour.isUndefined())
    280274        needDefaults = false;
    281275
    282276    JSValue minute = options->get(&exec, vm.propertyNames->minute);
    283     if (UNLIKELY(scope.exception()))
    284         return nullptr;
     277    RETURN_IF_EXCEPTION(scope, nullptr);
    285278    if (!minute.isUndefined())
    286279        needDefaults = false;
    287280
    288281    JSValue second = options->get(&exec, vm.propertyNames->second);
    289     if (UNLIKELY(scope.exception()))
    290         return nullptr;
     282    RETURN_IF_EXCEPTION(scope, nullptr);
    291283    if (!second.isUndefined())
    292284        needDefaults = false;
     
    301293
    302294        options->putDirect(vm, vm.propertyNames->year, numeric);
    303         if (UNLIKELY(scope.exception()))
    304             return nullptr;
     295        RETURN_IF_EXCEPTION(scope, nullptr);
    305296
    306297        options->putDirect(vm, vm.propertyNames->month, numeric);
    307         if (UNLIKELY(scope.exception()))
    308             return nullptr;
     298        RETURN_IF_EXCEPTION(scope, nullptr);
    309299
    310300        options->putDirect(vm, vm.propertyNames->day, numeric);
    311         if (UNLIKELY(scope.exception()))
    312             return nullptr;
     301        RETURN_IF_EXCEPTION(scope, nullptr);
    313302    }
    314303
     
    430419    Vector<String> requestedLocales = canonicalizeLocaleList(exec, locales);
    431420    // 4. ReturnIfAbrupt(requestedLocales),
    432     if (UNLIKELY(scope.exception()))
    433         return;
     421    RETURN_IF_EXCEPTION(scope, void());
    434422
    435423    // 5. Let options be ToDateTimeOptions(options, "any", "date").
    436424    JSObject* options = toDateTimeOptionsAnyDate(exec, originalOptions);
    437425    // 6. ReturnIfAbrupt(options).
    438     if (UNLIKELY(scope.exception()))
    439         return;
     426    RETURN_IF_EXCEPTION(scope, void());
    440427
    441428    // 7. Let opt be a new Record.
     
    445432    String localeMatcher = intlStringOption(exec, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit");
    446433    // 9. ReturnIfAbrupt(matcher).
    447     if (UNLIKELY(scope.exception()))
    448         return;
     434    RETURN_IF_EXCEPTION(scope, void());
    449435    // 10. Set opt.[[localeMatcher]] to matcher.
    450436    localeOpt.add(vm.propertyNames->localeMatcher.string(), localeMatcher);
     
    478464    JSValue tzValue = options->get(&exec, vm.propertyNames->timeZone);
    479465    // 18. ReturnIfAbrupt(tz).
    480     if (UNLIKELY(scope.exception()))
    481         return;
     466    RETURN_IF_EXCEPTION(scope, void());
    482467
    483468    // 19. If tz is not undefined, then
     
    487472        String originalTz = tzValue.toWTFString(&exec);
    488473        // b. ReturnIfAbrupt(tz).
    489         if (UNLIKELY(scope.exception()))
    490             return;
     474        RETURN_IF_EXCEPTION(scope, void());
    491475        // c. If the result of IsValidTimeZoneName(tz) is false, then i. Throw a RangeError exception.
    492476        // d. Let tz be CanonicalizeTimeZoneName(tz).
     
    520504
    521505    String weekday = intlStringOption(exec, options, vm.propertyNames->weekday, narrowShortLong, "weekday must be \"narrow\", \"short\", or \"long\"", nullptr);
    522     if (UNLIKELY(scope.exception()))
    523         return;
     506    RETURN_IF_EXCEPTION(scope, void());
    524507    if (!weekday.isNull()) {
    525508        if (weekday == "narrow")
     
    532515
    533516    String era = intlStringOption(exec, options, vm.propertyNames->era, narrowShortLong, "era must be \"narrow\", \"short\", or \"long\"", nullptr);
    534     if (UNLIKELY(scope.exception()))
    535         return;
     517    RETURN_IF_EXCEPTION(scope, void());
    536518    if (!era.isNull()) {
    537519        if (era == "narrow")
     
    544526
    545527    String year = intlStringOption(exec, options, vm.propertyNames->year, twoDigitNumeric, "year must be \"2-digit\" or \"numeric\"", nullptr);
    546     if (UNLIKELY(scope.exception()))
    547         return;
     528    RETURN_IF_EXCEPTION(scope, void());
    548529    if (!year.isNull()) {
    549530        if (year == "2-digit")
     
    554535
    555536    String month = intlStringOption(exec, options, vm.propertyNames->month, twoDigitNumericNarrowShortLong, "month must be \"2-digit\", \"numeric\", \"narrow\", \"short\", or \"long\"", nullptr);
    556     if (UNLIKELY(scope.exception()))
    557         return;
     537    RETURN_IF_EXCEPTION(scope, void());
    558538    if (!month.isNull()) {
    559539        if (month == "2-digit")
     
    570550
    571551    String day = intlStringOption(exec, options, vm.propertyNames->day, twoDigitNumeric, "day must be \"2-digit\" or \"numeric\"", nullptr);
    572     if (UNLIKELY(scope.exception()))
    573         return;
     552    RETURN_IF_EXCEPTION(scope, void());
    574553    if (!day.isNull()) {
    575554        if (day == "2-digit")
     
    580559
    581560    String hour = intlStringOption(exec, options, vm.propertyNames->hour, twoDigitNumeric, "hour must be \"2-digit\" or \"numeric\"", nullptr);
    582     if (UNLIKELY(scope.exception()))
    583         return;
     561    RETURN_IF_EXCEPTION(scope, void());
    584562
    585563    // We need hour12 to make the hour skeleton pattern decision, so do this early.
     
    588566    bool hr12 = intlBooleanOption(exec, options, vm.propertyNames->hour12, isHour12Undefined);
    589567    // 33. ReturnIfAbrupt(hr12).
    590     if (UNLIKELY(scope.exception()))
    591         return;
     568    RETURN_IF_EXCEPTION(scope, void());
    592569
    593570    if (!hour.isNull()) {
     
    611588
    612589    String minute = intlStringOption(exec, options, vm.propertyNames->minute, twoDigitNumeric, "minute must be \"2-digit\" or \"numeric\"", nullptr);
    613     if (UNLIKELY(scope.exception()))
    614         return;
     590    RETURN_IF_EXCEPTION(scope, void());
    615591    if (!minute.isNull()) {
    616592        if (minute == "2-digit")
     
    621597
    622598    String second = intlStringOption(exec, options, vm.propertyNames->second, twoDigitNumeric, "second must be \"2-digit\" or \"numeric\"", nullptr);
    623     if (UNLIKELY(scope.exception()))
    624         return;
     599    RETURN_IF_EXCEPTION(scope, void());
    625600    if (!second.isNull()) {
    626601        if (second == "2-digit")
     
    631606
    632607    String timeZoneName = intlStringOption(exec, options, vm.propertyNames->timeZoneName, shortLong, "timeZoneName must be \"short\" or \"long\"", nullptr);
    633     if (UNLIKELY(scope.exception()))
    634         return;
     608    RETURN_IF_EXCEPTION(scope, void());
    635609    if (!timeZoneName.isNull()) {
    636610        if (timeZoneName == "short")
     
    645619    intlStringOption(exec, options, vm.propertyNames->formatMatcher, { "basic", "best fit" }, "formatMatcher must be either \"basic\" or \"best fit\"", "best fit");
    646620    // 27. ReturnIfAbrupt(matcher).
    647     if (UNLIKELY(scope.exception()))
    648         return;
     621    RETURN_IF_EXCEPTION(scope, void());
    649622
    650623    // Always use ICU date format generator, rather than our own pattern list and matcher.
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp

    r205569 r206386  
    11/*
    22 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com)
     3 * Copyright (C) 2016 Apple Inc. All Rights Reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    9192    // 3. ReturnIfAbrupt(dateTimeFormat).
    9293    Structure* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), jsCast<IntlDateTimeFormatConstructor*>(state->callee())->dateTimeFormatStructure());
    93     if (UNLIKELY(scope.exception()))
    94         return JSValue::encode(jsUndefined());
     94    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9595    IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create(vm, structure);
    9696    ASSERT(dateTimeFormat);
     
    147147    // 2. Let requestedLocales be CanonicalizeLocaleList(locales).
    148148    Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0));
    149     if (UNLIKELY(scope.exception()))
    150         return JSValue::encode(jsUndefined());
     149    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    151150
    152151    // 3. Return SupportedLocales(availableLocales, requestedLocales, options).
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp

    r205569 r206386  
    102102        value = date.toNumber(state);
    103103        // b. ReturnIfAbrupt(x).
    104         if (UNLIKELY(scope.exception()))
    105             return JSValue::encode(jsUndefined());
     104        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    106105    }
    107106
     
    141140        // c. Let bf be BoundFunctionCreate(F, «this value»).
    142141        boundFormat = JSBoundFunction::create(vm, state, globalObject, targetObject, dtf, boundArgs, 1, ASCIILiteral("format"));
    143         if (UNLIKELY(scope.exception()))
    144             return JSValue::encode(JSValue());
     142        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    145143        // d. Set dtf.[[boundFormat]] to bf.
    146144        dtf->setBoundFormat(vm, boundFormat);
  • trunk/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp

    r206295 r206386  
    165165    auto requestedLocales = canonicalizeLocaleList(state, locales);
    166166    // 4. ReturnIfAbrupt(requestedLocales).
    167     if (UNLIKELY(scope.exception()))
    168         return;
     167    RETURN_IF_EXCEPTION(scope, void());
    169168
    170169    // 5. If options is undefined, then
     
    177176        options = optionsValue.toObject(&state);
    178177        // b. ReturnIfAbrupt(options).
    179         if (UNLIKELY(scope.exception()))
    180             return;
     178        RETURN_IF_EXCEPTION(scope, void());
    181179    }
    182180
     
    187185    String matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit");
    188186    // 9. ReturnIfAbrupt(matcher).
    189     if (UNLIKELY(scope.exception()))
    190         return;
     187    RETURN_IF_EXCEPTION(scope, void());
    191188    // 10. Set opt.[[localeMatcher]] to matcher.
    192189    opt.add(ASCIILiteral("localeMatcher"), matcher);
     
    212209    String styleString = intlStringOption(state, options, Identifier::fromString(&vm, "style"), { "decimal", "percent", "currency" }, "style must be either \"decimal\", \"percent\", or \"currency\"", "decimal");
    213210    // 17. ReturnIfAbrupt(s).
    214     if (UNLIKELY(scope.exception()))
    215         return;
     211    RETURN_IF_EXCEPTION(scope, void());
    216212    // 18. Set numberFormat.[[style]] to s.
    217213    if (styleString == "decimal")
     
    227223    String currency = intlStringOption(state, options, Identifier::fromString(&vm, "currency"), { }, nullptr, nullptr);
    228224    // 20. ReturnIfAbrupt(c).
    229     if (UNLIKELY(scope.exception()))
    230         return;
     225    RETURN_IF_EXCEPTION(scope, void());
    231226    // 21. If c is not undefined, then
    232227    if (!currency.isNull()) {
     
    258253    String currencyDisplayString = intlStringOption(state, options, Identifier::fromString(&vm, "currencyDisplay"), { "code", "symbol", "name" }, "currencyDisplay must be either \"code\", \"symbol\", or \"name\"", "symbol");
    259254    // 25. ReturnIfAbrupt(cd).
    260     if (UNLIKELY(scope.exception()))
    261         return;
     255    RETURN_IF_EXCEPTION(scope, void());
    262256    // 26. If s is "currency", set numberFormat.[[currencyDisplay]] to cd.
    263257    if (m_style == Style::Currency) {
     
    276270    // 29. Set numberFormat.[[minimumIntegerDigits]] to mnid.
    277271    unsigned minimumIntegerDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumIntegerDigits"), 1, 21, 1);
    278     if (UNLIKELY(scope.exception()))
    279         return;
     272    RETURN_IF_EXCEPTION(scope, void());
    280273    m_minimumIntegerDigits = minimumIntegerDigits;
    281274
     
    287280    // 33. Set numberFormat.[[minimumFractionDigits]] to mnfd.
    288281    unsigned minimumFractionDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumFractionDigits"), 0, 20, minimumFractionDigitsDefault);
    289     if (UNLIKELY(scope.exception()))
    290         return;
     282    RETURN_IF_EXCEPTION(scope, void());
    291283    m_minimumFractionDigits = minimumFractionDigits;
    292284
     
    304296    // 37. Set numberFormat.[[maximumFractionDigits]] to mxfd.
    305297    unsigned maximumFractionDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "maximumFractionDigits"), minimumFractionDigits, 20, maximumFractionDigitsDefault);
    306     if (UNLIKELY(scope.exception()))
    307         return;
     298    RETURN_IF_EXCEPTION(scope, void());
    308299    m_maximumFractionDigits = maximumFractionDigits;
    309300
     
    311302    JSValue minimumSignificantDigitsValue = options->get(&state, Identifier::fromString(&vm, "minimumSignificantDigits"));
    312303    // 39. ReturnIfAbrupt(mnsd).
    313     if (UNLIKELY(scope.exception()))
    314         return;
     304    RETURN_IF_EXCEPTION(scope, void());
    315305
    316306    // 40. Let mxsd be Get(options, "maximumSignificantDigits").
    317307    JSValue maximumSignificantDigitsValue = options->get(&state, Identifier::fromString(&vm, "maximumSignificantDigits"));
    318308    // 41. ReturnIfAbrupt(mxsd).
    319     if (UNLIKELY(scope.exception()))
    320         return;
     309    RETURN_IF_EXCEPTION(scope, void());
    321310
    322311    // 42. If mnsd is not undefined or mxsd is not undefined, then
     
    325314        unsigned minimumSignificantDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumSignificantDigits"), 1, 21, 1);
    326315        // b. ReturnIfAbrupt(mnsd).
    327         if (UNLIKELY(scope.exception()))
    328             return;
     316        RETURN_IF_EXCEPTION(scope, void());
    329317        // c. Let mxsd be GetNumberOption(options, "maximumSignificantDigits", mnsd, 21, 21).
    330318        unsigned maximumSignificantDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "maximumSignificantDigits"), minimumSignificantDigits, 21, 21);
    331319        // d. ReturnIfAbrupt(mxsd).
    332         if (UNLIKELY(scope.exception()))
    333             return;
     320        RETURN_IF_EXCEPTION(scope, void());
    334321        // e. Set numberFormat.[[minimumSignificantDigits]] to mnsd.
    335322        m_minimumSignificantDigits = minimumSignificantDigits;
     
    344331        useGrouping = true;
    345332    // 44. ReturnIfAbrupt(g).
    346     if (UNLIKELY(scope.exception()))
    347         return;
     333    RETURN_IF_EXCEPTION(scope, void());
    348334    // 45. Set numberFormat.[[useGrouping]] to g.
    349335    m_useGrouping = useGrouping;
  • trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp

    r205569 r206386  
    11/*
    22 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com)
     3 * Copyright (C) 2016 Apple Inc. All Rights Reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    9192    // 3. ReturnIfAbrupt(numberFormat).
    9293    Structure* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), jsCast<IntlNumberFormatConstructor*>(state->callee())->numberFormatStructure());
    93     if (UNLIKELY(scope.exception()))
    94         return JSValue::encode(jsUndefined());
     94    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9595    IntlNumberFormat* numberFormat = IntlNumberFormat::create(vm, structure);
    9696    ASSERT(numberFormat);
     
    147147    // 2. Let requestedLocales be CanonicalizeLocaleList(locales).
    148148    Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0));
    149     if (UNLIKELY(scope.exception()))
    150         return JSValue::encode(jsUndefined());
     149    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    151150
    152151    // 3. Return SupportedLocales(availableLocales, requestedLocales, options).
  • trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp

    r205569 r206386  
    9292    double number = state->argument(0).toNumber(state);
    9393    // 5. ReturnIfAbrupt(x).
    94     if (UNLIKELY(scope.exception()))
    95         return JSValue::encode(jsUndefined());
     94    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9695
    9796    // 6. Return FormatNumber(nf, x).
     
    129128        // c. Let bf be BoundFunctionCreate(F, «this value»).
    130129        boundFormat = JSBoundFunction::create(vm, state, globalObject, targetObject, nf, boundArgs, 1, ASCIILiteral("format"));
    131         if (UNLIKELY(scope.exception()))
    132             return JSValue::encode(JSValue());
     130        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    133131        // d. Set nf.[[boundFormat]] to bf.
    134132        nf->setBoundFormat(vm, boundFormat);
  • trunk/Source/JavaScriptCore/runtime/IntlObject.cpp

    r205569 r206386  
    135135
    136136    // 2. ReturnIfAbrupt(opts).
    137     if (UNLIKELY(scope.exception()))
    138         return false;
     137    RETURN_IF_EXCEPTION(scope, false);
    139138
    140139    // 3. Let value be Get(opts, property).
     
    142141
    143142    // 4. ReturnIfAbrupt(value).
    144     if (UNLIKELY(scope.exception()))
    145         return false;
     143    RETURN_IF_EXCEPTION(scope, false);
    146144
    147145    // 5. If value is not undefined, then
     
    177175
    178176    // 2. ReturnIfAbrupt(opts).
    179     if (UNLIKELY(scope.exception()))
    180         return { };
     177    RETURN_IF_EXCEPTION(scope, String());
    181178
    182179    // 3. Let value be Get(opts, property).
     
    184181
    185182    // 4. ReturnIfAbrupt(value).
    186     if (UNLIKELY(scope.exception()))
    187         return { };
     183    RETURN_IF_EXCEPTION(scope, String());
    188184
    189185    // 5. If value is not undefined, then
     
    197193
    198194        // ii. ReturnIfAbrupt(value).
    199         if (UNLIKELY(scope.exception()))
    200             return { };
     195        RETURN_IF_EXCEPTION(scope, String());
    201196
    202197        // d. If values is not undefined, then
     
    225220
    226221    // 2. ReturnIfAbrupt(opts).
    227     if (UNLIKELY(scope.exception()))
    228         return 0;
     222    RETURN_IF_EXCEPTION(scope, 0);
    229223
    230224    // 3. Let value be Get(opts, property).
     
    232226
    233227    // 4. ReturnIfAbrupt(value).
    234     if (UNLIKELY(scope.exception()))
    235         return 0;
     228    RETURN_IF_EXCEPTION(scope, 0);
    236229
    237230    // 5. If value is not undefined, then
     
    240233        double doubleValue = value.toNumber(&state);
    241234        // b. ReturnIfAbrupt(value).
    242         if (UNLIKELY(scope.exception()))
    243             return 0;
     235        RETURN_IF_EXCEPTION(scope, 0);
    244236        // 1. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception.
    245237        if (!(doubleValue >= minimum && doubleValue <= maximum)) {
     
    561553
    562554    // 5. ReturnIfAbrupt(O).
    563     if (UNLIKELY(scope.exception()))
    564         return Vector<String>();
     555    RETURN_IF_EXCEPTION(scope, Vector<String>());
    565556
    566557    // 6. Let len be ToLength(Get(O, "length")).
    567558    JSValue lengthProperty = localesObject->get(&state, vm.propertyNames->length);
    568     if (UNLIKELY(scope.exception()))
    569         return Vector<String>();
     559    RETURN_IF_EXCEPTION(scope, Vector<String>());
    570560
    571561    double length = lengthProperty.toLength(&state);
    572     if (UNLIKELY(scope.exception()))
    573         return Vector<String>();
     562    RETURN_IF_EXCEPTION(scope, Vector<String>());
    574563
    575564    // Keep track of locales that have been added to the list.
     
    586575
    587576        // c. ReturnIfAbrupt(kPresent).
    588         if (UNLIKELY(scope.exception()))
    589             return Vector<String>();
     577        RETURN_IF_EXCEPTION(scope, Vector<String>());
    590578
    591579        // d. If kPresent is true, then
     
    595583
    596584            // ii. ReturnIfAbrupt(kValue).
    597             if (UNLIKELY(scope.exception()))
    598                 return Vector<String>();
     585            RETURN_IF_EXCEPTION(scope, Vector<String>());
    599586
    600587            // iii. If Type(kValue) is not String or Object, throw a TypeError exception.
     
    608595
    609596            // v. ReturnIfAbrupt(tag).
    610             if (UNLIKELY(scope.exception()))
    611                 return Vector<String>();
     597            RETURN_IF_EXCEPTION(scope, Vector<String>());
    612598
    613599            // vi. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
     
    946932        matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit");
    947933        // b. ReturnIfAbrupt(matcher).
    948         if (UNLIKELY(scope.exception()))
    949             return jsUndefined();
     934        RETURN_IF_EXCEPTION(scope, JSValue());
    950935    } else {
    951936        // 2. Else, let matcher be "best fit".
     
    966951    }
    967952
    968     if (UNLIKELY(scope.exception()))
    969         return jsUndefined();
     953    RETURN_IF_EXCEPTION(scope, JSValue());
    970954
    971955    // 6. Let subset be CreateArrayFromList(supportedLocales).
     
    975959    PropertyNameArray keys(&state, PropertyNameMode::Strings);
    976960    supportedLocales->getOwnPropertyNames(supportedLocales, &state, keys, EnumerationMode());
    977     if (UNLIKELY(scope.exception()))
    978         return jsUndefined();
     961    RETURN_IF_EXCEPTION(scope, JSValue());
    979962
    980963    PropertyDescriptor desc;
     
    992975
    993976        // c. Assert: status is not abrupt completion.
    994         if (UNLIKELY(scope.exception()))
    995             return jsUndefined();
     977        RETURN_IF_EXCEPTION(scope, JSValue());
    996978    }
    997979
  • trunk/Source/JavaScriptCore/runtime/IntlObjectInlines.h

    r205569 r206386  
    4747        if (JSObject::defaultHasInstance(&state, thisValue, prototype)) {
    4848            JSObject* thisObject = thisValue.toObject(&state);
    49             if (UNLIKELY(scope.exception()))
    50                 return jsUndefined();
     49            RETURN_IF_EXCEPTION(scope, JSValue());
    5150
    5251            IntlInstance* instance = factory(vm);
    53             if (UNLIKELY(scope.exception()))
    54                 return jsUndefined();
     52            RETURN_IF_EXCEPTION(scope, JSValue());
    5553
    5654            thisObject->putDirect(vm, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName(), instance);
  • trunk/Source/JavaScriptCore/runtime/IteratorOperations.cpp

    r205569 r206386  
    4242
    4343    JSValue nextFunction = iterator.get(exec, vm.propertyNames->next);
    44     if (UNLIKELY(scope.exception()))
    45         return jsUndefined();
     44    RETURN_IF_EXCEPTION(scope, JSValue());
    4645
    4746    CallData nextFunctionCallData;
     
    5453        nextFunctionArguments.append(value);
    5554    JSValue result = call(exec, nextFunction, nextFunctionCallType, nextFunctionCallData, iterator, nextFunctionArguments);
    56     if (UNLIKELY(scope.exception()))
    57         return jsUndefined();
     55    RETURN_IF_EXCEPTION(scope, JSValue());
    5856
    5957    if (!result.isObject())
     
    8583
    8684    JSValue result = iteratorNext(exec, iterator);
    87     if (UNLIKELY(scope.exception()))
    88         return jsUndefined();
     85    RETURN_IF_EXCEPTION(scope, JSValue());
    8986    bool done = iteratorComplete(exec, result);
    90     if (UNLIKELY(scope.exception()))
    91         return jsUndefined();
     87    RETURN_IF_EXCEPTION(scope, JSValue());
    9288    if (done)
    9389        return jsBoolean(false);
     
    107103    }
    108104    JSValue returnFunction = iterator.get(exec, vm.propertyNames->returnKeyword);
    109     if (UNLIKELY(throwScope.exception()))
    110         return;
     105    RETURN_IF_EXCEPTION(throwScope, void());
    111106
    112107    if (returnFunction.isUndefined()) {
     
    134129    }
    135130
    136     if (UNLIKELY(throwScope.exception()))
    137         return;
     131    RETURN_IF_EXCEPTION(throwScope, void());
    138132
    139133    if (!innerResult.isObject()) {
     
    172166   
    173167    JSValue iteratorFunction = iterable.get(state, state->propertyNames().iteratorSymbol);
    174     if (UNLIKELY(scope.exception()))
    175         return JSValue();
     168    RETURN_IF_EXCEPTION(scope, JSValue());
    176169   
    177170    CallData iteratorFunctionCallData;
     
    184177    ArgList iteratorFunctionArguments;
    185178    JSValue iterator = call(state, iteratorFunction, iteratorFunctionCallType, iteratorFunctionCallData, iterable, iteratorFunctionArguments);
    186     if (UNLIKELY(scope.exception()))
    187         return JSValue();
     179    RETURN_IF_EXCEPTION(scope, JSValue());
    188180
    189181    if (!iterator.isObject()) {
  • trunk/Source/JavaScriptCore/runtime/IteratorOperations.h

    r205569 r206386  
    11/*
    22 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
     3 * Copyright (C) 2016 Apple Inc. All Rights Reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    5253
    5354    JSValue iterator = iteratorForIterable(state, iterable);
    54     if (UNLIKELY(scope.exception()))
    55         return;
     55    RETURN_IF_EXCEPTION(scope, void());
    5656    while (true) {
    5757        JSValue next = iteratorStep(state, iterator);
     
    6060
    6161        JSValue nextValue = iteratorValue(state, next);
    62         if (UNLIKELY(scope.exception()))
    63             return;
     62        RETURN_IF_EXCEPTION(scope, void());
    6463
    6564        callback(vm, state, nextValue);
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r205666 r206386  
    654654    // Let element be the result of calling the [[Get]] internal method of O with argument indx.
    655655    JSValue element = get(exec, index);
    656     if (UNLIKELY(scope.exception()))
    657         return jsUndefined();
     656    RETURN_IF_EXCEPTION(scope, JSValue());
    658657    // Call the [[Delete]] internal method of O with arguments indx and true.
    659658    if (!deletePropertyByIndex(this, exec, index)) {
     
    13241323    for (; i < length; ++i) {
    13251324        exec->r(firstElementDest + i - offset) = get(exec, i);
    1326         if (UNLIKELY(scope.exception()))
    1327             return;
     1325        RETURN_IF_EXCEPTION(scope, void());
    13281326    }
    13291327}
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp

    r205569 r206386  
    8989    if (exec->argumentCount()) {
    9090        length = exec->uncheckedArgument(0).toUInt32(exec);
    91         if (UNLIKELY(scope.exception()))
    92             return JSValue::encode(jsUndefined());
     91        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9392    } else {
    9493        // Although the documentation doesn't say so, it is in fact correct to say
     
    103102
    104103    Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure());
    105     if (UNLIKELY(scope.exception()))
    106         return JSValue::encode(JSValue());
     104    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    107105    JSArrayBuffer* result = JSArrayBuffer::create(vm, arrayBufferStructure, WTFMove(buffer));
    108106   
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp

    r205569 r206386  
    5151   
    5252    int32_t begin = exec->argument(0).toInt32(exec);
    53     if (UNLIKELY(scope.exception()))
    54         return JSValue::encode(jsUndefined());
     53    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    5554   
    5655    int32_t end;
    5756    if (exec->argumentCount() >= 2) {
    5857        end = exec->uncheckedArgument(1).toInt32(exec);
    59         if (UNLIKELY(scope.exception()))
    60             return JSValue::encode(jsUndefined());
     58        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6159    } else
    6260        end = thisObject->impl()->byteLength();
  • trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h

    r205569 r206386  
    7777
    7878    JSValue lengthValue = obj->get(exec, vm.propertyNames->length);
    79     if (UNLIKELY(scope.exception()))
    80         return UINT_MAX;
     79    RETURN_IF_EXCEPTION(scope, UINT_MAX);
    8180    return lengthValue.toUInt32(exec);
    8281}
     
    9089
    9190    JSValue lengthValue = obj->get(exec, vm.propertyNames->length);
    92     if (UNLIKELY(scope.exception()))
    93         return PNaN;
     91    RETURN_IF_EXCEPTION(scope, PNaN);
    9492    return lengthValue.toLength(exec);
    9593}
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp

    r205569 r206386  
    129129    auto scope = DECLARE_THROW_SCOPE(vm);
    130130    JSValue prototype = targetFunction->getPrototype(vm, exec);
    131     if (UNLIKELY(scope.exception()))
    132         return nullptr;
     131    RETURN_IF_EXCEPTION(scope, nullptr);
    133132    JSFunction* targetJSFunction = jsDynamicCast<JSFunction*>(targetFunction);
    134133
     
    173172        name);
    174173    Structure* structure = getBoundFunctionStructure(vm, exec, globalObject, targetFunction);
    175     if (UNLIKELY(scope.exception()))
    176         return nullptr;
     174    RETURN_IF_EXCEPTION(scope, nullptr);
    177175    JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(vm, globalObject, structure, targetFunction, boundThis, boundArgs);
    178176
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r205569 r206386  
    193193
    194194        prototype = obj->getPrototype(vm, exec);
    195         if (UNLIKELY(scope.exception()))
    196             return false;
     195        RETURN_IF_EXCEPTION(scope, false);
    197196        if (prototype.isNull())
    198197            break;
     
    382381    ASSERT(isCell());
    383382    JSValue value = asCell()->toPrimitive(exec, PreferString);
    384     if (UNLIKELY(scope.exception()))
    385         return errorValue();
     383    RETURN_IF_EXCEPTION(scope, errorValue());
    386384    ASSERT(!value.isObject());
    387385    JSString* result = value.toString(exec);
    388     if (UNLIKELY(scope.exception()))
    389         return errorValue();
     386    RETURN_IF_EXCEPTION(scope, errorValue());
    390387    return result;
    391388}
  • trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h

    r205569 r206386  
    643643
    644644    StringImpl* hintString = jsCast<JSString*>(value)->value(exec).impl();
    645     if (UNLIKELY(scope.exception()))
    646         return NoPreference;
     645    RETURN_IF_EXCEPTION(scope, NoPreference);
    647646
    648647    if (WTF::equal(hintString, "default"))
     
    787786    auto scope = DECLARE_THROW_SCOPE(exec->vm());
    788787    bool found = getPropertySlot(exec, propertyName, slot);
    789     if (UNLIKELY(scope.exception()))
    790         return { };
     788    RETURN_IF_EXCEPTION(scope, { });
    791789    return callback(found, slot);
    792790}
     
    927925                return v1 == v2;
    928926            JSValue p1 = v1.toPrimitive(exec);
    929             if (UNLIKELY(scope.exception()))
    930                 return false;
     927            RETURN_IF_EXCEPTION(scope, false);
    931928            v1 = p1;
    932929            if (v1.isInt32() && v2.isInt32())
     
    937934        if (v2.isObject()) {
    938935            JSValue p2 = v2.toPrimitive(exec);
    939             if (UNLIKELY(scope.exception()))
    940                 return false;
     936            RETURN_IF_EXCEPTION(scope, false);
    941937            v2 = p2;
    942938            if (v1.isInt32() && v2.isInt32())
  • trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp

    r205569 r206386  
    134134   
    135135    unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec);
    136     if (UNLIKELY(scope.exception()))
    137         return JSValue::encode(jsUndefined());
     136    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    138137   
    139138    bool littleEndian = false;
     
    141140    if (elementSize > 1 && exec->argumentCount() >= 2) {
    142141        littleEndian = exec->uncheckedArgument(1).toBoolean(exec);
    143         if (UNLIKELY(scope.exception()))
    144             return JSValue::encode(jsUndefined());
     142        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    145143    }
    146144   
     
    182180   
    183181    unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec);
    184     if (UNLIKELY(scope.exception()))
    185         return JSValue::encode(jsUndefined());
     182    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    186183
    187184    const unsigned dataSize = sizeof(typename Adaptor::Type);
     
    192189
    193190    u.value = toNativeFromValue<Adaptor>(exec, exec->uncheckedArgument(1));
    194     if (UNLIKELY(scope.exception()))
    195         return JSValue::encode(jsUndefined());
     191    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    196192   
    197193    bool littleEndian = false;
     
    199195    if (elementSize > 1 && exec->argumentCount() >= 3) {
    200196        littleEndian = exec->uncheckedArgument(2).toBoolean(exec);
    201         if (UNLIKELY(scope.exception()))
    202             return JSValue::encode(jsUndefined());
     197        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    203198    }
    204199   
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r206268 r206386  
    613613    } else {
    614614        JSString* jsStr = value.toString(exec);
    615         if (UNLIKELY(scope.exception()))
    616             return;
     615        RETURN_IF_EXCEPTION(scope, void());
    617616        name = jsStr->value(exec);
    618         if (UNLIKELY(scope.exception()))
    619             return;
     617        RETURN_IF_EXCEPTION(scope, void());
    620618    }
    621619    reifyName(vm, exec, name);
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h

    r205989 r206386  
    175175
    176176        typename Adaptor::Type value = toNativeFromValue<Adaptor>(exec, jsValue);
    177         if (UNLIKELY(scope.exception()))
    178             return false;
     177        RETURN_IF_EXCEPTION(scope, false);
    179178
    180179        if (isNeutered()) {
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h

    r205932 r206386  
    9090    while (true) {
    9191        JSValue next = iteratorStep(exec, iterator);
    92         if (UNLIKELY(scope.exception()))
    93             return nullptr;
     92        RETURN_IF_EXCEPTION(scope, nullptr);
    9493
    9594        if (next.isFalse())
     
    9796
    9897        JSValue nextItem = iteratorValue(exec, next);
    99         if (UNLIKELY(scope.exception()))
    100             return nullptr;
     98        RETURN_IF_EXCEPTION(scope, nullptr);
    10199
    102100        storage.append(nextItem);
     
    104102
    105103    ViewClass* result = ViewClass::createUninitialized(exec, structure, storage.size());
    106     if (!result) {
    107         ASSERT(scope.exception());
    108         return nullptr;
    109     }
     104    if (!result)
     105        RETURN_IF_EXCEPTION(scope, nullptr);
    110106
    111107    for (unsigned i = 0; i < storage.size(); ++i) {
     
    163159
    164160            JSValue iteratorFunc = object->get(exec, vm.propertyNames->iteratorSymbol);
    165             if (UNLIKELY(scope.exception()))
    166                 return nullptr;
     161            RETURN_IF_EXCEPTION(scope, nullptr);
    167162
    168163            // We would like not use the iterator as it is painfully slow. Fortunately, unless
     
    184179                    ArgList arguments;
    185180                    JSValue iterator = call(exec, iteratorFunc, callType, callData, object, arguments);
    186                     if (UNLIKELY(scope.exception()))
    187                         return nullptr;
     181                    RETURN_IF_EXCEPTION(scope, nullptr);
    188182
    189183                    return constructGenericTypedArrayViewFromIterator<ViewClass>(exec, structure, iterator);
     
    191185
    192186            length = lengthSlot.isUnset() ? 0 : lengthSlot.getValue(exec, vm.propertyNames->length).toUInt32(exec);
    193             if (UNLIKELY(scope.exception()))
    194                 return nullptr;
     187            RETURN_IF_EXCEPTION(scope, nullptr);
    195188        }
    196189
     
    236229    Structure* parentStructure = function->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType);
    237230    Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), parentStructure);
    238     if (UNLIKELY(scope.exception()))
    239         return JSValue::encode(JSValue());
     231    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    240232
    241233    size_t argCount = exec->argumentCount();
     
    253245    if (jsDynamicCast<JSArrayBuffer*>(firstValue) && argCount > 1) {
    254246        offset = exec->uncheckedArgument(1).toUInt32(exec);
    255         if (UNLIKELY(scope.exception()))
    256             return JSValue::encode(jsUndefined());
     247        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    257248
    258249        if (argCount > 2) {
    259250            length = exec->uncheckedArgument(2).toUInt32(exec);
    260             if (UNLIKELY(scope.exception()))
    261                 return JSValue::encode(jsUndefined());
     251            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    262252        }
    263253
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h

    r205569 r206386  
    5252
    5353    JSValue constructor = exemplar->get(exec, exec->propertyNames().constructor);
    54     if (UNLIKELY(scope.exception()))
    55         return nullptr;
     54    RETURN_IF_EXCEPTION(scope, nullptr);
    5655
    5756    if (constructor.isUndefined())
     
    6362
    6463    JSValue species = constructor.get(exec, exec->propertyNames().speciesSymbol);
    65     if (UNLIKELY(scope.exception()))
    66         return nullptr;
     64    RETURN_IF_EXCEPTION(scope, nullptr);
    6765
    6866    if (species.isUndefinedOrNull())
     
    7068
    7169    JSValue result = construct(exec, species, args, "species is not a constructor");
    72     if (UNLIKELY(scope.exception()))
    73         return nullptr;
     70    RETURN_IF_EXCEPTION(scope, nullptr);
    7471
    7572    if (JSArrayBufferView* view = jsDynamicCast<JSArrayBufferView*>(result)) {
     
    113110    if (exec->argumentCount() >= 2) {
    114111        double offsetNumber = exec->uncheckedArgument(1).toInteger(exec);
    115         if (UNLIKELY(scope.exception()))
    116             return JSValue::encode(jsUndefined());
     112        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    117113        if (UNLIKELY(offsetNumber < 0))
    118114            return throwVMRangeError(exec, scope, "Offset should not be negative");
     
    138134        length = sourceArray->get(exec, vm.propertyNames->length).toUInt32(exec);
    139135
    140     if (UNLIKELY(scope.exception()))
    141         return JSValue::encode(jsUndefined());
     136    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    142137
    143138    thisObject->set(exec, offset, sourceArray, 0, length, CopyType::Unobservable);
     
    157152    long length = thisObject->length();
    158153    long to = argumentClampedIndexFromStartOrEnd(exec, 0, length);
    159     if (UNLIKELY(scope.exception()))
    160         return encodedJSValue();
     154    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    161155    long from = argumentClampedIndexFromStartOrEnd(exec, 1, length);
    162     if (UNLIKELY(scope.exception()))
    163         return encodedJSValue();
     156    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    164157    long final = argumentClampedIndexFromStartOrEnd(exec, 2, length, length);
    165     if (UNLIKELY(scope.exception()))
    166         return encodedJSValue();
     158    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    167159
    168160    if (final < from)
     
    197189
    198190    unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length);
    199     if (UNLIKELY(scope.exception()))
    200         return JSValue::encode(jsUndefined());
     191    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    201192
    202193    if (thisObject->isNeutered())
     
    243234    JSValue valueToFind = exec->argument(0);
    244235    unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length);
    245     if (UNLIKELY(scope.exception()))
    246         return encodedJSValue();
     236    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    247237
    248238    if (thisObject->isNeutered())
     
    279269
    280270        JSStringJoiner joiner(*exec, separator, length);
    281         if (UNLIKELY(scope.exception()))
    282             return JSValue::encode(jsUndefined());
     271        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    283272        for (unsigned i = 0; i < length; i++) {
    284273            joiner.append(*exec, thisObject->getIndexQuickly(i));
    285             if (UNLIKELY(scope.exception()))
    286                 return JSValue::encode(jsUndefined());
     274            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    287275        }
    288276        return JSValue::encode(joiner.join(*exec));
     
    296284
    297285    JSString* separatorString = separatorValue.toString(exec);
    298     if (UNLIKELY(scope.exception()))
    299         return JSValue::encode(jsUndefined());
     286    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    300287
    301288    if (thisObject->isNeutered())
     
    334321    }
    335322
    336     if (UNLIKELY(scope.exception()))
    337         return JSValue::encode(JSValue());
     323    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    338324
    339325    if (thisObject->isNeutered())
     
    440426
    441427    unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength);
    442     if (UNLIKELY(scope.exception()))
    443         return encodedJSValue();
     428    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    444429    unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, thisLength, thisLength);
    445     if (UNLIKELY(scope.exception()))
    446         return encodedJSValue();
     430    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    447431
    448432    if (thisObject->isNeutered())
     
    462446        return ViewClass::createUninitialized(exec, structure, length);
    463447    });
    464     if (UNLIKELY(scope.exception()))
    465         return JSValue::encode(JSValue());
     448    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    466449
    467450    ASSERT(!result->isNeutered());
     
    566549
    567550    JSObject* result = construct(exec, species, args, "species is not a constructor");
    568     if (UNLIKELY(scope.exception()))
    569         return JSValue::encode(JSValue());
     551    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    570552
    571553    if (jsDynamicCast<JSArrayBufferView*>(result))
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r206267 r206386  
    817817    else
    818818        structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget);
    819     if (UNLIKELY(scope.exception()))
    820         return nullptr;
     819    RETURN_IF_EXCEPTION(scope, nullptr);
    821820
    822821    return ArrayAllocationProfile::updateLastAllocationFor(profile, JSArray::create(exec->vm(), structure, initialLength));
     
    833832    auto scope = DECLARE_THROW_SCOPE(vm);
    834833    Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget);
    835     if (UNLIKELY(scope.exception()))
    836         return nullptr;
     834    RETURN_IF_EXCEPTION(scope, nullptr);
    837835    return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, structure, values));
    838836}
     
    848846    auto scope = DECLARE_THROW_SCOPE(vm);
    849847    Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget);
    850     if (UNLIKELY(scope.exception()))
    851         return nullptr;
     848    RETURN_IF_EXCEPTION(scope, nullptr);
    852849    return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, structure, values, length));
    853850}
     
    863860    auto scope = DECLARE_THROW_SCOPE(vm);
    864861    Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget);
    865     if (UNLIKELY(scope.exception()))
    866         return nullptr;
     862    RETURN_IF_EXCEPTION(scope, nullptr);
    867863    return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArrayNegativeIndexed(exec, structure, values, length));
    868864}
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r205670 r206386  
    661661
    662662    String s = x.toString(exec)->value(exec);
    663     if (UNLIKELY(scope.exception()))
    664         return JSValue::encode(jsUndefined());
     663    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    665664
    666665    if (s.is8Bit()) {
  • trunk/Source/JavaScriptCore/runtime/JSModuleRecord.cpp

    r205569 r206386  
    779779        if (importEntry.isNamespace(vm)) {
    780780            JSModuleNamespaceObject* namespaceObject = importedModule->getModuleNamespace(exec);
    781             if (UNLIKELY(scope.exception()))
    782                 return;
     781            RETURN_IF_EXCEPTION(scope, void());
    783782            bool putResult = false;
    784783            symbolTablePutTouchWatchpointSet(moduleEnvironment, exec, importEntry.localName, namespaceObject, /* shouldThrowReadOnlyError */ false, /* ignoreReadOnlyErrors */ true, putResult);
  • trunk/Source/JavaScriptCore/runtime/JSONObject.cpp

    r205569 r206386  
    254254    auto scope = DECLARE_THROW_SCOPE(vm);
    255255    JSObject* object = constructEmptyObject(m_exec);
    256     if (UNLIKELY(scope.exception()))
    257         return Local<Unknown>(vm, jsNull());
     256    RETURN_IF_EXCEPTION(scope, Local<Unknown>(vm, jsNull()));
    258257
    259258    PropertyNameForFunctionCall emptyPropertyName(vm.propertyNames->emptyIdentifier);
     
    263262    if (appendStringifiedValue(result, value.get(), object, emptyPropertyName) != StringifySucceeded)
    264263        return Local<Unknown>(vm, jsUndefined());
    265     if (UNLIKELY(scope.exception()))
    266         return Local<Unknown>(vm, jsNull());
     264    RETURN_IF_EXCEPTION(scope, Local<Unknown>(vm, jsNull()));
    267265
    268266    return Local<Unknown>(vm, jsString(m_exec, result.toString()));
     
    283281
    284282    JSValue toJSONFunction = slot.getValue(m_exec, vm.propertyNames->toJSON);
    285     if (UNLIKELY(scope.exception()))
    286         return jsNull();
     283    RETURN_IF_EXCEPTION(scope, JSValue());
    287284    return toJSONImpl(value, toJSONFunction, propertyName);
    288285}
     
    307304    // Call the toJSON function.
    308305    value = toJSON(value, propertyName);
    309     if (UNLIKELY(scope.exception()))
    310         return StringifyFailed;
     306    RETURN_IF_EXCEPTION(scope, StringifyFailed);
    311307
    312308    // Call the replacer function.
     
    316312        args.append(value);
    317313        value = call(m_exec, m_replacer.get(), m_replacerCallType, m_replacerCallData, holder, args);
    318         if (UNLIKELY(scope.exception()))
    319             return StringifyFailed;
     314        RETURN_IF_EXCEPTION(scope, StringifyFailed);
    320315    }
    321316
     
    330325    value = unwrapBoxedPrimitive(m_exec, value);
    331326
    332     if (UNLIKELY(scope.exception()))
    333         return StringifyFailed;
     327    RETURN_IF_EXCEPTION(scope, StringifyFailed);
    334328
    335329    if (value.isBoolean()) {
     
    383377    bool holderStackWasEmpty = m_holderStack.isEmpty();
    384378    m_holderStack.append(Holder(vm, m_exec, object));
    385     if (UNLIKELY(scope.exception()))
    386         return StringifyFailed;
     379    RETURN_IF_EXCEPTION(scope, StringifyFailed);
    387380    if (!holderStackWasEmpty)
    388381        return StringifySucceeded;
    389382
    390383    do {
    391         while (m_holderStack.last().appendNextProperty(*this, builder)) {
    392             if (UNLIKELY(scope.exception()))
    393                 return StringifyFailed;
    394         }
     384        while (m_holderStack.last().appendNextProperty(*this, builder))
     385            RETURN_IF_EXCEPTION(scope, StringifyFailed);
    395386        m_holderStack.removeLast();
    396387    } while (!m_holderStack.isEmpty());
     
    460451                PropertyNameArray objectPropertyNames(exec, PropertyNameMode::Strings);
    461452                m_object->methodTable()->getOwnPropertyNames(m_object.get(), exec, objectPropertyNames, EnumerationMode());
    462                 if (UNLIKELY(scope.exception()))
    463                     return false;
     453                RETURN_IF_EXCEPTION(scope, false);
    464454                m_propertyNames = objectPropertyNames.releaseData();
    465455            }
     
    494484            else
    495485                value = jsUndefined();
    496             if (UNLIKELY(scope.exception()))
    497                 return false;
     486            RETURN_IF_EXCEPTION(scope, false);
    498487        }
    499488
     
    512501            return true;
    513502        JSValue value = slot.getValue(exec, propertyName);
    514         if (UNLIKELY(scope.exception()))
    515             return false;
     503        RETURN_IF_EXCEPTION(scope, false);
    516504
    517505        rollBackPoint = builder.length();
     
    648636                    else
    649637                        inValue = jsUndefined();
    650                     if (UNLIKELY(scope.exception()))
    651                         return jsNull();
     638                    RETURN_IF_EXCEPTION(scope, JSValue());
    652639                }
    653640                   
     
    666653                else
    667654                    array->putDirectIndex(m_exec, indexStack.last(), filteredValue);
    668                 if (UNLIKELY(scope.exception()))
    669                     return jsNull();
     655                RETURN_IF_EXCEPTION(scope, JSValue());
    670656                indexStack.last()++;
    671657                goto arrayStartVisitMember;
     
    683669                propertyStack.append(PropertyNameArray(m_exec, PropertyNameMode::Strings));
    684670                object->methodTable()->getOwnPropertyNames(object, m_exec, propertyStack.last(), EnumerationMode());
    685                 if (UNLIKELY(scope.exception()))
    686                     return jsNull();
     671                RETURN_IF_EXCEPTION(scope, JSValue());
    687672            }
    688673            objectStartVisitMember:
     
    706691
    707692                // The holder may be modified by the reviver function so any lookup may throw
    708                 if (UNLIKELY(scope.exception()))
    709                     return jsNull();
     693                RETURN_IF_EXCEPTION(scope, JSValue());
    710694
    711695                if (inValue.isObject()) {
     
    725709                else
    726710                    object->methodTable()->put(object, m_exec, prop, filteredValue, slot);
    727                 if (UNLIKELY(scope.exception()))
    728                     return jsNull();
     711                RETURN_IF_EXCEPTION(scope, JSValue());
    729712                indexStack.last()++;
    730713                goto objectStartVisitMember;
     
    762745        return throwVMError(exec, scope, createError(exec, ASCIILiteral("JSON.parse requires at least one parameter")));
    763746    JSString::SafeView source = exec->uncheckedArgument(0).toString(exec)->view(exec);
    764     if (UNLIKELY(scope.exception()))
    765         return JSValue::encode(jsNull());
     747    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    766748
    767749    JSValue unfiltered;
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r206221 r206386  
    361361        // 9.1.9.1-2 Let ownDesc be ? O.[[GetOwnProperty]](P).
    362362        bool ownDescriptorFound = current->getOwnPropertyDescriptor(exec, propertyName, ownDescriptor);
    363         if (UNLIKELY(scope.exception()))
    364             return false;
     363        RETURN_IF_EXCEPTION(scope, false);
    365364
    366365        if (!ownDescriptorFound) {
    367366            // 9.1.9.1-3-a Let parent be ? O.[[GetPrototypeOf]]().
    368367            JSValue prototype = current->getPrototype(vm, exec);
    369             if (UNLIKELY(scope.exception()))
    370                 return false;
     368            RETURN_IF_EXCEPTION(scope, false);
    371369
    372370            // 9.1.9.1-3-b If parent is not null, then
     
    399397        PropertyDescriptor existingDescriptor;
    400398        bool existingDescriptorFound = receiverObject->getOwnPropertyDescriptor(exec, propertyName, existingDescriptor);
    401         if (UNLIKELY(scope.exception()))
    402             return false;
     399        RETURN_IF_EXCEPTION(scope, false);
    403400
    404401        // 9.1.9.1-4-d If existingDescriptor is not undefined, then
     
    12911288
    12921289    bool isExtensible = this->isExtensible(exec);
    1293     if (UNLIKELY(scope.exception()))
    1294         return false;
     1290    RETURN_IF_EXCEPTION(scope, false);
    12951291
    12961292    if (!isExtensible) {
     
    15341530
    15351531    JSValue function = object->get(exec, propertyName);
    1536     if (UNLIKELY(scope.exception()))
    1537         return scope.exception();
     1532    RETURN_IF_EXCEPTION(scope, scope.exception());
    15381533    if (function.isUndefined() && mode == TypeHintMode::TakesHint)
    15391534        return JSValue();
     
    15611556
    15621557    JSValue result = call(exec, function, callType, callData, const_cast<JSObject*>(object), callArgs);
     1558    RETURN_IF_EXCEPTION(scope, scope.exception());
    15631559    ASSERT(!result.isGetterSetter());
    1564     if (UNLIKELY(scope.exception()))
    1565         return scope.exception();
    15661560    if (result.isObject())
    15671561        return mode == TypeHintMode::DoesNotTakeHint ? JSValue() : throwTypeError(exec, scope, ASCIILiteral("Symbol.toPrimitive returned an object"));
     
    17001694    while (true) {
    17011695        JSValue objectValue = object->getPrototype(vm, exec);
    1702         if (UNLIKELY(scope.exception()))
    1703             return false;
     1696        RETURN_IF_EXCEPTION(scope, false);
    17041697        if (!objectValue.isObject())
    17051698            return false;
     
    17241717    auto scope = DECLARE_THROW_SCOPE(vm);
    17251718    object->methodTable(vm)->getOwnPropertyNames(object, exec, propertyNames, mode);
    1726     if (UNLIKELY(scope.exception()))
    1727         return;
     1719    RETURN_IF_EXCEPTION(scope, void());
    17281720
    17291721    JSValue nextProto = object->getPrototype(vm, exec);
    1730     if (UNLIKELY(scope.exception()))
    1731         return;
     1722    RETURN_IF_EXCEPTION(scope, void());
    17321723    if (nextProto.isNull())
    17331724        return;
     
    17401731        }
    17411732        prototype->methodTable(vm)->getOwnPropertyNames(prototype, exec, propertyNames, mode);
    1742         if (UNLIKELY(scope.exception()))
    1743             return;
     1733        RETURN_IF_EXCEPTION(scope, void());
    17441734        nextProto = prototype->getPrototype(vm, exec);
    1745         if (UNLIKELY(scope.exception()))
    1746             return;
     1735        RETURN_IF_EXCEPTION(scope, void());
    17471736        if (nextProto.isNull())
    17481737            break;
     
    18441833    auto scope = DECLARE_THROW_SCOPE(vm);
    18451834    JSValue primitive = toPrimitive(exec, PreferNumber);
    1846     if (UNLIKELY(scope.exception())) // should be picked up soon in Nodes.cpp
    1847         return 0.0;
     1835    RETURN_IF_EXCEPTION(scope, 0.0); // should be picked up soon in Nodes.cpp
    18481836    return primitive.toNumber(exec);
    18491837}
     
    18541842    auto scope = DECLARE_THROW_SCOPE(vm);
    18551843    JSValue primitive = toPrimitive(exec, PreferString);
    1856     if (UNLIKELY(scope.exception()))
    1857         return jsEmptyString(exec);
     1844    RETURN_IF_EXCEPTION(scope, jsEmptyString(exec));
    18581845    return primitive.toString(exec);
    18591846}
     
    30793066    bool isCurrentDefined = getOwnPropertyDescriptor(exec, propertyName, current);
    30803067    bool isExtensible = this->isExtensible(exec);
    3081     if (UNLIKELY(throwScope.exception()))
    3082         return false;
     3068    RETURN_IF_EXCEPTION(throwScope, false);
    30833069    return validateAndApplyPropertyDescriptor(exec, this, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException);
    30843070}
     
    31813167    auto scope = DECLARE_THROW_SCOPE(vm);
    31823168    object->methodTable(vm)->getOwnPropertyNames(object, exec, propertyNames, EnumerationMode(mode, JSObjectPropertiesMode::Exclude));
    3183     if (UNLIKELY(scope.exception()))
    3184         return;
     3169    RETURN_IF_EXCEPTION(scope, void());
    31853170
    31863171    JSValue nextProto = object->getPrototype(vm, exec);
    3187     if (UNLIKELY(scope.exception()))
    3188         return;
     3172    RETURN_IF_EXCEPTION(scope, void());
    31893173    if (nextProto.isNull())
    31903174        return;
     
    31973181        }
    31983182        prototype->methodTable(vm)->getOwnPropertyNames(prototype, exec, propertyNames, mode);
    3199         if (UNLIKELY(scope.exception()))
    3200             return;
     3183        RETURN_IF_EXCEPTION(scope, void());
    32013184        nextProto = prototype->getPrototype(vm, exec);
    3202         if (UNLIKELY(scope.exception()))
    3203             return;
     3185        RETURN_IF_EXCEPTION(scope, void());
    32043186        if (nextProto.isNull())
    32053187            break;
     
    32163198
    32173199    JSValue method = get(exec, ident);
    3218     if (UNLIKELY(scope.exception()))
    3219         return jsUndefined();
     3200    RETURN_IF_EXCEPTION(scope, JSValue());
    32203201
    32213202    if (!method.isCell()) {
  • trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h

    r206136 r206386  
    4141    Vector<JSValue> result;
    4242    JSValue lengthProperty = arrayLikeValue.get(exec, vm.propertyNames->length);
    43     if (UNLIKELY(scope.exception()))
    44         return;
     43    RETURN_IF_EXCEPTION(scope, void());
    4544    double lengthAsDouble = lengthProperty.toLength(exec);
    46     if (UNLIKELY(scope.exception()))
    47         return;
     45    RETURN_IF_EXCEPTION(scope, void());
    4846    RELEASE_ASSERT(lengthAsDouble >= 0.0 && lengthAsDouble == std::trunc(lengthAsDouble));
    4947    uint64_t length = static_cast<uint64_t>(lengthAsDouble);
    5048    for (uint64_t index = 0; index < length; index++) {
    5149        JSValue next = arrayLikeValue.get(exec, index);
    52         if (UNLIKELY(scope.exception()))
    53             return;
     50        RETURN_IF_EXCEPTION(scope, void());
    5451       
    5552        RuntimeType type = runtimeTypeForValue(next);
     
    10097    auto scope = DECLARE_THROW_SCOPE(vm);
    10198    bool found = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
    102     if (UNLIKELY(scope.exception()))
    103         return { };
     99    RETURN_IF_EXCEPTION(scope, { });
    104100    return callback(found, slot);
    105101}
     
    116112        if (structure.classInfo()->methodTable.getOwnPropertySlotByIndex(object, exec, propertyName, slot))
    117113            return true;
    118         if (UNLIKELY(scope.exception()))
    119             return false;
     114        RETURN_IF_EXCEPTION(scope, false);
    120115        JSValue prototype;
    121116        if (LIKELY(structure.classInfo()->methodTable.getPrototype == defaultGetPrototype || slot.internalMethodType() == PropertySlot::InternalMethodType::VMInquiry))
     
    123118        else {
    124119            prototype = object->getPrototype(vm, exec);
    125             if (UNLIKELY(scope.exception()))
    126                 return false;
     120            RETURN_IF_EXCEPTION(scope, false);
    127121        }
    128122        if (!prototype.isObject())
     
    150144            if (structure.classInfo()->methodTable.getOwnPropertySlot(object, exec, propertyName, slot))
    151145                return true;
    152             if (UNLIKELY(scope.exception()))
    153                 return false;
     146            RETURN_IF_EXCEPTION(scope, false);
    154147        }
    155148        JSValue prototype;
     
    158151        else {
    159152            prototype = object->getPrototype(vm, exec);
    160             if (UNLIKELY(scope.exception()))
    161                 return false;
     153            RETURN_IF_EXCEPTION(scope, false);
    162154        }
    163155        if (!prototype.isObject())
  • trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp

    r206018 r206386  
    104104
    105105    Structure* promiseStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->promiseStructure());
    106     if (UNLIKELY(scope.exception()))
    107         return JSValue::encode(JSValue());
     106    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    108107    JSPromise* promise = JSPromise::create(vm, promiseStructure);
    109108    promise->initialize(exec, globalObject, exec->argument(0));
  • trunk/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp

    r205729 r206386  
    5858
    5959    JSValue deferred = newPromiseCapability(exec, globalObject, globalObject->promiseConstructor());
    60     if (UNLIKELY(scope.exception()))
    61         return nullptr;
     60    RETURN_IF_EXCEPTION(scope, nullptr);
    6261
    6362    JSValue promise = deferred.get(exec, vm.propertyNames->builtinNames().promisePrivateName());
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.h

    r206267 r206386  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    130130        indexedLength = 0;
    131131        base->methodTable(vm)->getPropertyNames(base, exec, propertyNames, EnumerationMode());
    132         if (UNLIKELY(scope.exception()))
    133             return nullptr;
     132        RETURN_IF_EXCEPTION(scope, nullptr);
    134133    }
    135134
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp

    r205569 r206386  
    5959    auto scope = DECLARE_THROW_SCOPE(vm);
    6060    JSPropertyNameEnumerator* enumerator = propertyNameEnumerator(exec, iteratedObject);
    61     if (UNLIKELY(scope.exception()))
    62         return nullptr;
     61    RETURN_IF_EXCEPTION(scope, nullptr);
    6362    return JSPropertyNameIterator::create(exec, structure, iteratedObject, enumerator);
    6463}
  • trunk/Source/JavaScriptCore/runtime/JSScope.cpp

    r205569 r206386  
    11/*
    2  * Copyright (C) 2012-2015 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2012-2016 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    207207
    208208    JSValue unscopables = object->get(exec, exec->propertyNames().unscopablesSymbol);
    209     if (UNLIKELY(throwScope.exception()))
    210         return false;
     209    RETURN_IF_EXCEPTION(throwScope, false);
    211210    if (!unscopables.isObject())
    212211        return false;
    213212    JSValue blocked = jsCast<JSObject*>(unscopables)->get(exec, ident);
    214     if (UNLIKELY(throwScope.exception()))
    215         return false;
     213    RETURN_IF_EXCEPTION(throwScope, false);
    216214
    217215    return blocked.toBoolean(exec);
  • trunk/Source/JavaScriptCore/runtime/JSString.cpp

    r205569 r206386  
    7979    String str1 = value(exec);
    8080    String str2 = other->value(exec);
    81     if (UNLIKELY(scope.exception()))
    82         return false;
     81    RETURN_IF_EXCEPTION(scope, false);
    8382    return WTF::equal(*str1.impl(), *str2.impl());
    8483}
  • trunk/Source/JavaScriptCore/runtime/JSStringJoiner.cpp

    r205569 r206386  
    109109
    110110    unsigned length = joinedLength(state);
    111     if (UNLIKELY(scope.exception()))
    112         return jsUndefined();
     111    RETURN_IF_EXCEPTION(scope, JSValue());
    113112
    114113    if (!length)
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp

    r205666 r206386  
    11/*
    2  * Copyright (C) 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009, 2016 Apple Inc. All rights reserved.
    33 * Copyright (C) 2012 Mathias Bynens (mathias@qiwi.be)
    44 *
     
    585585            case StartParseArray: {
    586586                JSArray* array = constructEmptyArray(m_exec, 0);
    587                 if (UNLIKELY(scope.exception()))
    588                     return JSValue();
     587                RETURN_IF_EXCEPTION(scope, JSValue());
    589588                objectStack.append(array);
    590589            }
  • trunk/Source/JavaScriptCore/runtime/MapBase.h

    r205520 r206386  
    7676        auto scope = DECLARE_THROW_SCOPE(vm);
    7777        HashMapImplType* impl = HashMapImplType::create(exec, vm);
    78         if (UNLIKELY(scope.exception()))
    79             return;
     78        RETURN_IF_EXCEPTION(scope, void());
    8079        m_map.set(vm, this, impl);
    8180    }
  • trunk/Source/JavaScriptCore/runtime/MapConstructor.cpp

    r206018 r206386  
    6262    JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
    6363    Structure* mapStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->mapStructure());
    64     if (UNLIKELY(scope.exception()))
    65         return JSValue::encode(JSValue());
     64    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6665    JSMap* map = JSMap::create(exec, vm, mapStructure);
    67     if (UNLIKELY(scope.exception()))
    68         return JSValue::encode(JSValue());
     66    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6967    JSValue iterable = exec->argument(0);
    7068    if (iterable.isUndefinedOrNull())
     
    7270
    7371    JSValue adderFunction = map->JSObject::get(exec, exec->propertyNames().set);
    74     if (UNLIKELY(scope.exception()))
    75         return JSValue::encode(jsUndefined());
     72    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7673
    7774    CallData adderFunctionCallData;
     
    8885
    8986        JSValue key = nextItem.get(exec, static_cast<unsigned>(0));
    90         if (UNLIKELY(scope.exception()))
    91             return;
     87        RETURN_IF_EXCEPTION(scope, void());
    9288
    9389        JSValue value = nextItem.get(exec, static_cast<unsigned>(1));
    94         if (UNLIKELY(scope.exception()))
    95             return;
     90        RETURN_IF_EXCEPTION(scope, void());
    9691
    9792        MarkedArgumentBuffer arguments;
  • trunk/Source/JavaScriptCore/runtime/MathObject.cpp

    r205828 r206386  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2007, 2008, 2013, 2015 Apple Inc. All Rights Reserved.
     3 *  Copyright (C) 2007-2008, 2013, 2015-2016 Apple Inc. All Rights Reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    166166    auto scope = DECLARE_THROW_SCOPE(vm);
    167167    uint32_t value = exec->argument(0).toUInt32(exec);
    168     if (UNLIKELY(scope.exception()))
    169         return JSValue::encode(jsNull());
     168    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    170169    return JSValue::encode(JSValue(clz32(value)));
    171170}
     
    196195    for (unsigned i = 0; i < argsCount; ++i) {
    197196        args.uncheckedAppend(exec->uncheckedArgument(i).toNumber(exec));
    198         if (UNLIKELY(scope.exception()))
    199             return JSValue::encode(jsNull());
     197        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    200198        if (std::isinf(args[i]))
    201199            return JSValue::encode(jsDoubleNumber(+std::numeric_limits<double>::infinity()));
     
    300298    auto scope = DECLARE_THROW_SCOPE(vm);
    301299    int32_t left = exec->argument(0).toInt32(exec);
    302     if (UNLIKELY(scope.exception()))
    303         return JSValue::encode(jsNull());
     300    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    304301    int32_t right = exec->argument(1).toInt32(exec);
    305302    return JSValue::encode(jsNumber(left * right));
  • trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp

    r206333 r206386  
    113113
    114114    const Identifier moduleKey = exec->argument(0).toPropertyKey(exec);
    115     if (UNLIKELY(scope.exception()))
    116         return JSValue::encode(jsUndefined());
     115    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    117116
    118117    String source = exec->argument(1).toString(exec)->value(exec);
    119     if (UNLIKELY(scope.exception()))
    120         return JSValue::encode(jsUndefined());
     118    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    121119
    122120    SourceCode sourceCode = makeSource(source, moduleKey.impl());
     
    150148
    151149    JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size());
    152     if (UNLIKELY(scope.exception()))
    153         JSValue::encode(jsUndefined());
     150    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    154151    size_t i = 0;
    155152    for (auto& key : moduleRecord->requestedModules())
     
    171168
    172169    moduleRecord->link(exec);
    173     if (UNLIKELY(scope.exception()))
    174         return JSValue::encode(jsUndefined());
     170    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    175171
    176172    return JSValue::encode(jsUndefined());
  • trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp

    r206018 r206386  
    6868    JSValue message = exec->argument(0);
    6969    Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), jsCast<NativeErrorConstructor*>(exec->callee())->errorStructure());
    70     if (UNLIKELY(scope.exception()))
    71         return JSValue::encode(JSValue());
     70    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7271    ASSERT(errorStructure);
    7372    return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
  • trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp

    r205569 r206386  
    9090    double n = exec->argumentCount() ? exec->uncheckedArgument(0).toNumber(exec) : 0;
    9191    Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), exec->lexicalGlobalObject()->numberObjectStructure());
    92     if (UNLIKELY(scope.exception()))
    93         return JSValue::encode(JSValue());
     92    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9493
    9594    NumberObject* object = NumberObject::create(exec->vm(), structure);
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r205670 r206386  
    131131        // a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%").
    132132        Structure* objectStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->objectStructureForObjectConstructor());
    133         if (UNLIKELY(scope.exception()))
    134             return nullptr;
     133        RETURN_IF_EXCEPTION(scope, nullptr);
    135134        return constructEmptyObject(exec, objectStructure);
    136135    }
     
    173172    auto scope = DECLARE_THROW_SCOPE(vm);
    174173    JSObject* object = exec->argument(0).toObject(exec);
    175     if (UNLIKELY(scope.exception()))
    176         return JSValue::encode(jsUndefined());
     174    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    177175    return JSValue::encode(object->getPrototype(exec->vm(), exec));
    178176}
     
    192190
    193191    JSObject* object = objectValue.toObject(exec);
    194     if (UNLIKELY(scope.exception()))
    195         return JSValue::encode(objectValue);
     192    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    196193
    197194    bool shouldThrowIfCantSet = true;
     
    208205    if (!object->getOwnPropertyDescriptor(exec, propertyName, descriptor))
    209206        return jsUndefined();
    210     if (UNLIKELY(scope.exception()))
    211         return jsUndefined();
     207    RETURN_IF_EXCEPTION(scope, JSValue());
    212208
    213209    JSObject* result = constructObjectFromPropertyDescriptor(exec, descriptor);
     
    223219    PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols);
    224220    object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));
    225     if (UNLIKELY(scope.exception()))
    226         return jsUndefined();
     221    RETURN_IF_EXCEPTION(scope, JSValue());
    227222
    228223    JSObject* descriptors = constructEmptyObject(exec);
    229     if (UNLIKELY(scope.exception()))
    230         return jsUndefined();
     224    RETURN_IF_EXCEPTION(scope, JSValue());
    231225
    232226    for (auto& propertyName : properties) {
    233227        PropertyDescriptor descriptor;
    234228        bool didGetDescriptor = object->getOwnPropertyDescriptor(exec, propertyName, descriptor);
    235         if (UNLIKELY(scope.exception()))
    236             return jsUndefined();
     229        RETURN_IF_EXCEPTION(scope, JSValue());
    237230
    238231        if (!didGetDescriptor)
     
    256249    auto scope = DECLARE_THROW_SCOPE(vm);
    257250    JSObject* object = exec->argument(0).toObject(exec);
    258     if (UNLIKELY(scope.exception()))
    259         return JSValue::encode(jsUndefined());
     251    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    260252    auto propertyName = exec->argument(1).toPropertyKey(exec);
    261     if (UNLIKELY(scope.exception()))
    262         return JSValue::encode(jsUndefined());
     253    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    263254    return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName));
    264255}
     
    269260    auto scope = DECLARE_THROW_SCOPE(vm);
    270261    JSObject* object = exec->argument(0).toObject(exec);
    271     if (UNLIKELY(scope.exception()))
    272         return JSValue::encode(jsUndefined());
     262    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    273263    return JSValue::encode(objectConstructorGetOwnPropertyDescriptors(exec, object));
    274264}
     
    280270    auto scope = DECLARE_THROW_SCOPE(vm);
    281271    JSObject* object = exec->argument(0).toObject(exec);
    282     if (UNLIKELY(scope.exception()))
    283         return JSValue::encode(jsNull());
     272    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    284273    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include));
    285274}
     
    291280    auto scope = DECLARE_THROW_SCOPE(vm);
    292281    JSObject* object = exec->argument(0).toObject(exec);
    293     if (UNLIKELY(scope.exception()))
    294         return JSValue::encode(jsNull());
     282    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    295283    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include));
    296284}
     
    302290    auto scope = DECLARE_THROW_SCOPE(vm);
    303291    JSObject* object = exec->argument(0).toObject(exec);
    304     if (UNLIKELY(scope.exception()))
    305         return JSValue::encode(jsNull());
     292    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    306293    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude));
    307294}
     
    312299    auto scope = DECLARE_THROW_SCOPE(vm);
    313300    JSObject* object = exec->argument(0).toObject(exec);
    314     if (UNLIKELY(scope.exception()))
    315         return JSValue::encode(jsNull());
     301    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    316302    return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Exclude));
    317303}
     
    332318    if (description->hasProperty(exec, exec->propertyNames().enumerable)) {
    333319        JSValue value = description->get(exec, exec->propertyNames().enumerable);
    334         if (UNLIKELY(scope.exception()))
    335             return false;
     320        RETURN_IF_EXCEPTION(scope, false);
    336321        desc.setEnumerable(value.toBoolean(exec));
    337     } else if (UNLIKELY(scope.exception()))
    338         return false;
     322    } else
     323        RETURN_IF_EXCEPTION(scope, false);
    339324
    340325    if (description->hasProperty(exec, exec->propertyNames().configurable)) {
    341326        JSValue value = description->get(exec, exec->propertyNames().configurable);
    342         if (UNLIKELY(scope.exception()))
    343             return false;
     327        RETURN_IF_EXCEPTION(scope, false);
    344328        desc.setConfigurable(value.toBoolean(exec));
    345     } else if (UNLIKELY(scope.exception()))
    346         return false;
     329    } else
     330        RETURN_IF_EXCEPTION(scope, false);
    347331
    348332    JSValue value;
    349333    if (description->hasProperty(exec, exec->propertyNames().value)) {
    350334        JSValue value = description->get(exec, exec->propertyNames().value);
    351         if (UNLIKELY(scope.exception()))
    352             return false;
     335        RETURN_IF_EXCEPTION(scope, false);
    353336        desc.setValue(value);
    354     } else if (UNLIKELY(scope.exception()))
    355         return false;
     337    } else
     338        RETURN_IF_EXCEPTION(scope, false);
    356339
    357340    if (description->hasProperty(exec, exec->propertyNames().writable)) {
    358341        JSValue value = description->get(exec, exec->propertyNames().writable);
    359         if (UNLIKELY(scope.exception()))
    360             return false;
     342        RETURN_IF_EXCEPTION(scope, false);
    361343        desc.setWritable(value.toBoolean(exec));
    362     } else if (UNLIKELY(scope.exception()))
    363         return false;
     344    } else
     345        RETURN_IF_EXCEPTION(scope, false);
    364346
    365347    if (description->hasProperty(exec, exec->propertyNames().get)) {
    366348        JSValue get = description->get(exec, exec->propertyNames().get);
    367         if (UNLIKELY(scope.exception()))
    368             return false;
     349        RETURN_IF_EXCEPTION(scope, false);
    369350        if (!get.isUndefined()) {
    370351            CallData callData;
     
    375356        }
    376357        desc.setGetter(get);
    377     } else if (UNLIKELY(scope.exception()))
    378         return false;
     358    } else
     359        RETURN_IF_EXCEPTION(scope, false);
    379360
    380361    if (description->hasProperty(exec, exec->propertyNames().set)) {
    381362        JSValue set = description->get(exec, exec->propertyNames().set);
    382         if (UNLIKELY(scope.exception()))
    383             return false;
     363        RETURN_IF_EXCEPTION(scope, false);
    384364        if (!set.isUndefined()) {
    385365            CallData callData;
     
    390370        }
    391371        desc.setSetter(set);
    392     } else if (UNLIKELY(scope.exception()))
    393         return false;
     372    } else
     373        RETURN_IF_EXCEPTION(scope, false);
    394374
    395375    if (!desc.isAccessorDescriptor())
     
    417397    JSObject* obj = asObject(exec->argument(0));
    418398    auto propertyName = exec->argument(1).toPropertyKey(exec);
    419     if (UNLIKELY(scope.exception()))
    420         return JSValue::encode(jsNull());
     399    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    421400    PropertyDescriptor descriptor;
    422401    auto success = toPropertyDescriptor(exec, exec->argument(2), descriptor);
     
    438417    PropertyNameArray propertyNames(exec, PropertyNameMode::StringsAndSymbols);
    439418    asObject(properties)->methodTable(vm)->getOwnPropertyNames(asObject(properties), exec, propertyNames, EnumerationMode(DontEnumPropertiesMode::Exclude));
    440     if (UNLIKELY(scope.exception()))
    441         return jsNull();
     419    RETURN_IF_EXCEPTION(scope, JSValue());
    442420    size_t numProperties = propertyNames.size();
    443421    Vector<PropertyDescriptor> descriptors;
     
    445423    for (size_t i = 0; i < numProperties; i++) {
    446424        JSValue prop = properties->get(exec, propertyNames[i]);
    447         if (UNLIKELY(scope.exception()))
    448             return jsNull();
     425        RETURN_IF_EXCEPTION(scope, JSValue());
    449426        PropertyDescriptor descriptor;
    450427        if (!toPropertyDescriptor(exec, prop, descriptor))
     
    466443            continue;
    467444        object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, descriptors[i], true);
    468         if (UNLIKELY(scope.exception()))
    469             return jsNull();
     445        RETURN_IF_EXCEPTION(scope, JSValue());
    470446    }
    471447    return object;
     
    523499    PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols);
    524500    object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));
    525     if (UNLIKELY(scope.exception()))
    526         return JSValue::encode(obj);
     501    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    527502    PropertyNameArray::const_iterator end = properties.end();
    528503    for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) {
     
    538513        // c. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments.
    539514        object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, desc, true);
    540         if (UNLIKELY(scope.exception()))
    541             return JSValue::encode(obj);
     515        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    542516    }
    543517
    544518    // 3. Set the [[Extensible]] internal property of O to false.
    545519    object->methodTable(vm)->preventExtensions(object, exec);
    546     if (UNLIKELY(scope.exception()))
    547         return JSValue::encode(JSValue());
     520    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    548521
    549522    // 4. Return O.
     
    564537    PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols);
    565538    object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));
    566     if (UNLIKELY(scope.exception()))
    567         return object;
     539    RETURN_IF_EXCEPTION(scope, nullptr);
    568540    PropertyNameArray::const_iterator end = properties.end();
    569541    for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) {
     
    583555        // d. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments.
    584556        object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, desc, true);
    585         if (UNLIKELY(scope.exception()))
    586             return object;
     557        RETURN_IF_EXCEPTION(scope, nullptr);
    587558    }
    588559
    589560    // 3. Set the [[Extensible]] internal property of O to false.
    590561    object->methodTable(vm)->preventExtensions(object, exec);
    591     if (UNLIKELY(scope.exception()))
    592         return nullptr;
     562    RETURN_IF_EXCEPTION(scope, nullptr);
    593563
    594564    // 4. Return O.
     
    605575        return JSValue::encode(obj);
    606576    JSObject* result = objectConstructorFreeze(exec, asObject(obj));
    607     if (UNLIKELY(scope.exception()))
    608         return JSValue::encode(JSValue());
     577    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    609578    return JSValue::encode(result);
    610579}
     
    637606    PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols);
    638607    object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));
    639     if (UNLIKELY(scope.exception()))
    640         return JSValue::encode(JSValue());
     608    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    641609    PropertyNameArray::const_iterator end = properties.end();
    642610    for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) {
     
    656624    // 4. Otherwise, return false.
    657625    bool isExtensible = object->isExtensible(exec);
    658     if (UNLIKELY(scope.exception()))
    659         return JSValue::encode(JSValue());
     626    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    660627    return JSValue::encode(jsBoolean(!isExtensible));
    661628}
     
    678645    PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols);
    679646    object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));
    680     if (UNLIKELY(scope.exception()))
    681         return JSValue::encode(JSValue());
     647    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    682648    PropertyNameArray::const_iterator end = properties.end();
    683649    for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) {
     
    698664    // 4. Otherwise, return false.
    699665    bool isExtensible = object->isExtensible(exec);
    700     if (UNLIKELY(scope.exception()))
    701         return JSValue::encode(JSValue());
     666    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    702667    return JSValue::encode(jsBoolean(!isExtensible));
    703668}
     
    712677    JSObject* object = asObject(obj);
    713678    bool isExtensible = object->isExtensible(exec);
    714     if (UNLIKELY(scope.exception()))
    715         return JSValue::encode(JSValue());
     679    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    716680    return JSValue::encode(jsBoolean(isExtensible));
    717681}
     
    729693    PropertyNameArray properties(exec, propertyNameMode);
    730694    object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(dontEnumPropertiesMode));
    731     if (UNLIKELY(scope.exception()))
    732         return nullptr;
     695    RETURN_IF_EXCEPTION(scope, nullptr);
    733696
    734697    JSArray* keys = constructEmptyArray(exec, 0);
    735     if (UNLIKELY(scope.exception()))
    736         return nullptr;
     698    RETURN_IF_EXCEPTION(scope, nullptr);
    737699
    738700    switch (propertyNameMode) {
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h

    r205670 r206386  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008, 2016 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    104104    auto scope = DECLARE_THROW_SCOPE(vm);
    105105    JSObject* description = constructEmptyObject(exec);
    106     if (UNLIKELY(scope.exception()))
    107         return nullptr;
     106    RETURN_IF_EXCEPTION(scope, nullptr);
    108107
    109108    if (!descriptor.isAccessorDescriptor()) {
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp

    r206136 r206386  
    9696    JSValue thisValue = exec->thisValue().toThis(exec, StrictMode);
    9797    auto propertyName = exec->argument(0).toPropertyKey(exec);
    98     if (UNLIKELY(scope.exception()))
    99         return JSValue::encode(jsUndefined());
     98    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10099    JSObject* thisObject = thisValue.toObject(exec);
    101100    if (UNLIKELY(!thisObject))
     
    112111    PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
    113112    bool result = thisObject->hasOwnProperty(exec, propertyName, slot);
    114     if (UNLIKELY(scope.exception()))
    115         return JSValue::encode(jsUndefined());
     113    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    116114
    117115    hasOwnPropertyCache->tryAdd(vm, slot, thisObject, propertyName, result);
     
    133131
    134132    JSValue v = asObject(exec->argument(0))->getPrototype(vm, exec);
    135     if (UNLIKELY(scope.exception()))
    136         return JSValue::encode(JSValue());
     133    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    137134
    138135    while (true) {
     
    142139            return JSValue::encode(jsBoolean(true));
    143140        v = asObject(v)->getPrototype(vm, exec);
    144         if (UNLIKELY(scope.exception()))
    145             return JSValue::encode(JSValue());
     141        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    146142    }
    147143}
     
    153149
    154150    JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    155     if (UNLIKELY(scope.exception()))
    156         return JSValue::encode(jsUndefined());
     151    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    157152
    158153    JSValue get = exec->argument(1);
     
    162157
    163158    auto propertyName = exec->argument(0).toPropertyKey(exec);
    164     if (UNLIKELY(scope.exception()))
    165         return JSValue::encode(jsUndefined());
     159    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    166160
    167161    PropertyDescriptor descriptor;
     
    182176
    183177    JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    184     if (UNLIKELY(scope.exception()))
    185         return JSValue::encode(jsUndefined());
     178    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    186179
    187180    JSValue set = exec->argument(1);
     
    191184
    192185    auto propertyName = exec->argument(0).toPropertyKey(exec);
    193     if (UNLIKELY(scope.exception()))
    194         return JSValue::encode(jsUndefined());
     186    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    195187
    196188    PropertyDescriptor descriptor;
     
    211203
    212204    JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    213     if (UNLIKELY(scope.exception()))
    214         return JSValue::encode(jsUndefined());
    215 
    216     auto propertyName = exec->argument(0).toPropertyKey(exec);
    217     if (UNLIKELY(scope.exception()))
    218         return JSValue::encode(jsUndefined());
     205    RETURN_IF_EXCEPTION(scope, encodedJSValue());
     206
     207    auto propertyName = exec->argument(0).toPropertyKey(exec);
     208    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    219209
    220210    PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
     
    241231
    242232    JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    243     if (UNLIKELY(scope.exception()))
    244         return JSValue::encode(jsUndefined());
    245 
    246     auto propertyName = exec->argument(0).toPropertyKey(exec);
    247     if (UNLIKELY(scope.exception()))
    248         return JSValue::encode(jsUndefined());
     233    RETURN_IF_EXCEPTION(scope, encodedJSValue());
     234
     235    auto propertyName = exec->argument(0).toPropertyKey(exec);
     236    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    249237
    250238    PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
     
    271259
    272260    auto propertyName = exec->argument(0).toPropertyKey(exec);
    273     if (UNLIKELY(scope.exception()))
    274         return JSValue::encode(jsUndefined());
    275 
    276     JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    277     if (UNLIKELY(scope.exception()))
    278         return JSValue::encode(jsUndefined());
     261    RETURN_IF_EXCEPTION(scope, encodedJSValue());
     262
     263    JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
     264    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    279265    PropertyDescriptor descriptor;
    280266    bool enumerable = thisObject->getOwnPropertyDescriptor(exec, propertyName, descriptor) && descriptor.enumerable();
     
    290276    // 1. Let O be the result of calling ToObject passing the this value as the argument.
    291277    JSObject* object = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    292     if (UNLIKELY(scope.exception()))
    293         return JSValue::encode(jsUndefined());
     278    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    294279
    295280    // 2. Let toString be the result of calling the [[Get]] internal method of O passing "toString" as the argument.
     
    326311        if (found) {
    327312            JSValue stringTag = toStringTagSlot.getValue(exec, toStringTagSymbol);
    328             if (UNLIKELY(scope.exception()))
    329                 return jsUndefined();
     313            RETURN_IF_EXCEPTION(scope, JSValue());
    330314            if (stringTag.isString()) {
    331315                JSRopeString::RopeBuilder ropeBuilder(vm);
     
    341325
    342326        String tag = thisObject->methodTable(exec->vm())->toStringName(thisObject, exec);
    343         if (UNLIKELY(scope.exception()))
    344             return JSValue();
     327        RETURN_IF_EXCEPTION(scope, JSValue());
    345328        String newString = WTF::tryMakeString("[object ", WTFMove(tag), "]");
    346329        if (!newString)
  • trunk/Source/JavaScriptCore/runtime/Operations.cpp

    r205569 r206386  
    4747    auto scope = DECLARE_THROW_SCOPE(vm);
    4848    JSValue p1 = v1.toPrimitive(callFrame);
    49     if (UNLIKELY(scope.exception()))
    50         return JSValue();
     49    RETURN_IF_EXCEPTION(scope, JSValue());
    5150    JSValue p2 = v2.toPrimitive(callFrame);
    52     if (UNLIKELY(scope.exception()))
    53         return JSValue();
     51    RETURN_IF_EXCEPTION(scope, JSValue());
    5452
    5553    if (p1.isString())
  • trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp

    r205569 r206386  
    8080    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    8181    GetterSetter* getterSetter = GetterSetter::create(vm, globalObject);
    82     if (UNLIKELY(scope.exception()))
    83         return nullptr;
     82    RETURN_IF_EXCEPTION(scope, nullptr);
    8483    if (m_getter && !m_getter.isUndefined())
    8584        getterSetter->setGetter(vm, globalObject, jsCast<JSObject*>(m_getter));
  • trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp

    r206018 r206386  
    6565    JSValue handler = args.at(1);
    6666    ProxyObject* proxy = ProxyObject::create(exec, exec->lexicalGlobalObject(), target, handler);
    67     if (UNLIKELY(scope.exception()))
    68         return JSValue::encode(JSValue());
     67    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6968    ProxyRevoke* revoke = ProxyRevoke::create(vm, exec->lexicalGlobalObject()->proxyRevokeStructure(), proxy);
    70     if (UNLIKELY(scope.exception()))
    71         return JSValue::encode(JSValue());
     69    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7270
    7371    JSObject* result = constructEmptyObject(exec);
    74     if (UNLIKELY(scope.exception()))
    75         return JSValue::encode(JSValue());
     72    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7673    result->putDirect(vm, makeIdentifier(vm, "proxy"), proxy, None);
    7774    result->putDirect(vm, makeIdentifier(vm, "revoke"), revoke, None);
  • trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp

    r205569 r206386  
    142142    CallType callType;
    143143    JSValue getHandler = handler->getMethod(exec, callData, callType, vm.propertyNames->get, ASCIILiteral("'get' property of a Proxy's handler object should be callable"));
    144     if (UNLIKELY(scope.exception()))
    145         return jsUndefined();
     144    RETURN_IF_EXCEPTION(scope, JSValue());
    146145
    147146    if (getHandler.isUndefined())
     
    153152    arguments.append(receiver);
    154153    JSValue trapResult = call(exec, getHandler, callType, callData, handler, arguments);
    155     if (UNLIKELY(scope.exception()))
    156         return jsUndefined();
     154    RETURN_IF_EXCEPTION(scope, JSValue());
    157155
    158156    PropertyDescriptor descriptor;
     
    167165    }
    168166
    169     if (UNLIKELY(scope.exception()))
    170         return jsUndefined();
     167    RETURN_IF_EXCEPTION(scope, JSValue());
    171168
    172169    return trapResult;
     
    178175    auto scope = DECLARE_THROW_SCOPE(vm);
    179176    JSValue result = performProxyGet(exec, this, slot.thisValue(), propertyName);
    180     if (UNLIKELY(scope.exception()))
    181         return false;
     177    RETURN_IF_EXCEPTION(scope, false);
    182178    unsigned ignoredAttributes = 0;
    183179    slot.setValue(this, ignoredAttributes, result);
     
    212208    CallType callType;
    213209    JSValue getOwnPropertyDescriptorMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "getOwnPropertyDescriptor"), ASCIILiteral("'getOwnPropertyDescriptor' property of a Proxy's handler should be callable"));
    214     if (UNLIKELY(scope.exception()))
    215         return false;
     210    RETURN_IF_EXCEPTION(scope, false);
    216211    if (getOwnPropertyDescriptorMethod.isUndefined())
    217212        return performDefaultGetOwnProperty();
     
    221216    arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid())));
    222217    JSValue trapResult = call(exec, getOwnPropertyDescriptorMethod, callType, callData, handler, arguments);
    223     if (UNLIKELY(scope.exception()))
    224         return false;
     218    RETURN_IF_EXCEPTION(scope, false);
    225219
    226220    if (!trapResult.isUndefined() && !trapResult.isObject()) {
     
    231225    PropertyDescriptor targetPropertyDescriptor;
    232226    bool isTargetPropertyDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, targetPropertyDescriptor);
    233     if (UNLIKELY(scope.exception()))
    234         return false;
     227    RETURN_IF_EXCEPTION(scope, false);
    235228
    236229    if (trapResult.isUndefined()) {
     
    244237        // https://bugs.webkit.org/show_bug.cgi?id=154375
    245238        bool isExtensible = target->isExtensible(exec);
    246         if (UNLIKELY(scope.exception()))
    247             return false;
     239        RETURN_IF_EXCEPTION(scope, false);
    248240        if (!isExtensible) {
    249241            // FIXME: Come up with a test for this error. I'm not sure how to because
     
    258250
    259251    bool isExtensible = target->isExtensible(exec);
    260     if (UNLIKELY(scope.exception()))
    261         return false;
     252    RETURN_IF_EXCEPTION(scope, false);
    262253    PropertyDescriptor trapResultAsDescriptor;
    263254    toPropertyDescriptor(exec, trapResult, trapResultAsDescriptor);
    264     if (UNLIKELY(scope.exception()))
    265         return false;
     255    RETURN_IF_EXCEPTION(scope, false);
    266256    bool throwException = false;
    267257    bool valid = validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible,
     
    281271    if (trapResultAsDescriptor.isAccessorDescriptor()) {
    282272        GetterSetter* getterSetter = trapResultAsDescriptor.slowGetterSetter(exec);
    283         if (UNLIKELY(scope.exception()))
    284             return false;
     273        RETURN_IF_EXCEPTION(scope, false);
    285274        slot.setGetterSlot(this, trapResultAsDescriptor.attributes(), getterSetter);
    286275    } else if (trapResultAsDescriptor.isDataDescriptor() && !trapResultAsDescriptor.value().isEmpty())
     
    320309    CallType callType;
    321310    JSValue hasMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->has, ASCIILiteral("'has' property of a Proxy's handler should be callable"));
    322     if (UNLIKELY(scope.exception()))
    323         return false;
     311    RETURN_IF_EXCEPTION(scope, false);
    324312    if (hasMethod.isUndefined())
    325313        return performDefaultHasProperty();
     
    329317    arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid())));
    330318    JSValue trapResult = call(exec, hasMethod, callType, callData, handler, arguments);
    331     if (UNLIKELY(scope.exception()))
    332         return false;
     319    RETURN_IF_EXCEPTION(scope, false);
    333320
    334321    bool trapResultAsBool = trapResult.toBoolean(exec);
    335     if (UNLIKELY(scope.exception()))
    336         return false;
     322    RETURN_IF_EXCEPTION(scope, false);
    337323
    338324    if (!trapResultAsBool) {
    339325        PropertyDescriptor descriptor;
    340326        bool isPropertyDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, descriptor);
    341         if (UNLIKELY(scope.exception()))
    342             return false;
     327        RETURN_IF_EXCEPTION(scope, false);
    343328        if (isPropertyDescriptorDefined) {
    344329            if (!descriptor.configurable()) {
     
    347332            }
    348333            bool isExtensible = target->isExtensible(exec);
    349             if (UNLIKELY(scope.exception()))
    350                 return false;
     334            RETURN_IF_EXCEPTION(scope, false);
    351335            if (!isExtensible) {
    352336                throwVMTypeError(exec, scope, ASCIILiteral("Proxy 'has' must return 'true' for a non-extensible 'target' object with a configurable property"));
     
    420404    CallType callType;
    421405    JSValue setMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->set, ASCIILiteral("'set' property of a Proxy's handler should be callable"));
    422     if (UNLIKELY(scope.exception()))
    423         return false;
     406    RETURN_IF_EXCEPTION(scope, false);
    424407    JSObject* target = this->target();
    425408    if (setMethod.isUndefined())
     
    432415    arguments.append(thisValue);
    433416    JSValue trapResult = call(exec, setMethod, callType, callData, handler, arguments);
    434     if (UNLIKELY(scope.exception()))
    435         return false;
     417    RETURN_IF_EXCEPTION(scope, false);
    436418    bool trapResultAsBool = trapResult.toBoolean(exec);
    437     if (UNLIKELY(scope.exception()))
    438         return false;
     419    RETURN_IF_EXCEPTION(scope, false);
    439420    if (!trapResultAsBool)
    440421        return false;
     
    473454    auto scope = DECLARE_THROW_SCOPE(vm);
    474455    Identifier ident = Identifier::from(exec, propertyName);
    475     if (UNLIKELY(scope.exception()))
    476         return false;
     456    RETURN_IF_EXCEPTION(scope, false);
    477457    auto performDefaultPut = [&] () {
    478458        JSObject* target = this->target();
     
    507487    CallType callType;
    508488    JSValue applyMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "apply"), ASCIILiteral("'apply' property of a Proxy's handler should be callable"));
    509     if (UNLIKELY(scope.exception()))
    510         return JSValue::encode(jsUndefined());
     489    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    511490    JSObject* target = proxy->target();
    512491    if (applyMethod.isUndefined()) {
     
    518497
    519498    JSArray* argArray = constructArray(exec, static_cast<ArrayAllocationProfile*>(nullptr), ArgList(exec));
    520     if (UNLIKELY(scope.exception()))
    521         return JSValue::encode(jsUndefined());
     499    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    522500    MarkedArgumentBuffer arguments;
    523501    arguments.append(target);
     
    557535    CallType callType;
    558536    JSValue constructMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "construct"), ASCIILiteral("'construct' property of a Proxy's handler should be constructible"));
    559     if (UNLIKELY(scope.exception()))
    560         return JSValue::encode(jsUndefined());
     537    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    561538    JSObject* target = proxy->target();
    562539    if (constructMethod.isUndefined()) {
     
    568545
    569546    JSArray* argArray = constructArray(exec, static_cast<ArrayAllocationProfile*>(nullptr), ArgList(exec));
    570     if (UNLIKELY(scope.exception()))
    571         return JSValue::encode(jsUndefined());
     547    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    572548    MarkedArgumentBuffer arguments;
    573549    arguments.append(target);
     
    575551    arguments.append(exec->newTarget());
    576552    JSValue result = call(exec, constructMethod, callType, callData, handler, arguments);
    577     if (UNLIKELY(scope.exception()))
    578         return JSValue::encode(jsUndefined());
     553    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    579554    if (!result.isObject())
    580555        return throwVMTypeError(exec, scope, ASCIILiteral("Result from Proxy handler's 'construct' method should be an object"));
     
    618593    CallType callType;
    619594    JSValue deletePropertyMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "deleteProperty"), ASCIILiteral("'deleteProperty' property of a Proxy's handler should be callable"));
    620     if (UNLIKELY(scope.exception()))
    621         return false;
     595    RETURN_IF_EXCEPTION(scope, false);
    622596    JSObject* target = this->target();
    623597    if (deletePropertyMethod.isUndefined())
     
    628602    arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid())));
    629603    JSValue trapResult = call(exec, deletePropertyMethod, callType, callData, handler, arguments);
    630     if (UNLIKELY(scope.exception()))
    631         return false;
     604    RETURN_IF_EXCEPTION(scope, false);
    632605
    633606    bool trapResultAsBool = trapResult.toBoolean(exec);
    634     if (UNLIKELY(scope.exception()))
    635         return false;
     607    RETURN_IF_EXCEPTION(scope, false);
    636608
    637609    if (!trapResultAsBool)
     
    646618    }
    647619
    648     if (UNLIKELY(scope.exception()))
    649         return false;
     620    RETURN_IF_EXCEPTION(scope, false);
    650621
    651622    return true;
     
    692663    CallType callType;
    693664    JSValue preventExtensionsMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "preventExtensions"), ASCIILiteral("'preventExtensions' property of a Proxy's handler should be callable"));
    694     if (UNLIKELY(scope.exception()))
    695         return false;
     665    RETURN_IF_EXCEPTION(scope, false);
    696666    JSObject* target = this->target();
    697667    if (preventExtensionsMethod.isUndefined())
     
    701671    arguments.append(target);
    702672    JSValue trapResult = call(exec, preventExtensionsMethod, callType, callData, handler, arguments);
    703     if (UNLIKELY(scope.exception()))
    704         return false;
     673    RETURN_IF_EXCEPTION(scope, false);
    705674
    706675    bool trapResultAsBool = trapResult.toBoolean(exec);
    707     if (UNLIKELY(scope.exception()))
    708         return false;
     676    RETURN_IF_EXCEPTION(scope, false);
    709677
    710678    if (trapResultAsBool) {
    711679        bool targetIsExtensible = target->isExtensible(exec);
    712         if (UNLIKELY(scope.exception()))
    713             return false;
     680        RETURN_IF_EXCEPTION(scope, false);
    714681        if (targetIsExtensible) {
    715682            throwVMTypeError(exec, scope, ASCIILiteral("Proxy's 'preventExtensions' trap returned true even though its target is extensible. It should have returned false"));
     
    745712    CallType callType;
    746713    JSValue isExtensibleMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "isExtensible"), ASCIILiteral("'isExtensible' property of a Proxy's handler should be callable"));
    747     if (UNLIKELY(scope.exception()))
    748         return false;
     714    RETURN_IF_EXCEPTION(scope, false);
    749715
    750716    JSObject* target = this->target();
     
    755721    arguments.append(target);
    756722    JSValue trapResult = call(exec, isExtensibleMethod, callType, callData, handler, arguments);
    757     if (UNLIKELY(scope.exception()))
    758         return false;
     723    RETURN_IF_EXCEPTION(scope, false);
    759724
    760725    bool trapResultAsBool = trapResult.toBoolean(exec);
    761     if (UNLIKELY(scope.exception()))
    762         return false;
     726    RETURN_IF_EXCEPTION(scope, false);
    763727
    764728    bool isTargetExtensible = target->isExtensible(exec);
    765     if (UNLIKELY(scope.exception()))
    766         return false;
     729    RETURN_IF_EXCEPTION(scope, false);
    767730
    768731    if (trapResultAsBool != isTargetExtensible) {
     
    812775    CallType callType;
    813776    JSValue definePropertyMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->defineProperty, ASCIILiteral("'defineProperty' property of a Proxy's handler should be callable"));
    814     if (UNLIKELY(scope.exception()))
    815         return false;
     777    RETURN_IF_EXCEPTION(scope, false);
    816778
    817779    if (definePropertyMethod.isUndefined())
     
    819781
    820782    JSObject* descriptorObject = constructObjectFromPropertyDescriptor(exec, descriptor);
    821     if (UNLIKELY(scope.exception()))
    822         return false;
     783    RETURN_IF_EXCEPTION(scope, false);
    823784
    824785    MarkedArgumentBuffer arguments;
     
    827788    arguments.append(descriptorObject);
    828789    JSValue trapResult = call(exec, definePropertyMethod, callType, callData, handler, arguments);
    829     if (UNLIKELY(scope.exception()))
    830         return false;
     790    RETURN_IF_EXCEPTION(scope, false);
    831791
    832792    bool trapResultAsBool = trapResult.toBoolean(exec);
    833     if (UNLIKELY(scope.exception()))
    834         return false;
     793    RETURN_IF_EXCEPTION(scope, false);
    835794
    836795    if (!trapResultAsBool)
     
    839798    PropertyDescriptor targetDescriptor;
    840799    bool isTargetDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, targetDescriptor);
    841     if (UNLIKELY(scope.exception()))
    842         return false;
     800    RETURN_IF_EXCEPTION(scope, false);
    843801
    844802    bool targetIsExtensible = target->isExtensible(exec);
    845     if (UNLIKELY(scope.exception()))
    846         return false;
     803    RETURN_IF_EXCEPTION(scope, false);
    847804    bool settingConfigurableToFalse = descriptor.configurablePresent() && !descriptor.configurable();
    848805
     
    901858    CallType callType;
    902859    JSValue ownKeysMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "ownKeys"), ASCIILiteral("'ownKeys' property of a Proxy's handler should be callable"));
    903     if (UNLIKELY(scope.exception()))
    904         return;
     860    RETURN_IF_EXCEPTION(scope, void());
    905861    JSObject* target = this->target();
    906862    if (ownKeysMethod.isUndefined()) {
     
    912868    arguments.append(target);
    913869    JSValue arrayLikeObject = call(exec, ownKeysMethod, callType, callData, handler, arguments);
    914     if (UNLIKELY(scope.exception()))
    915         return;
     870    RETURN_IF_EXCEPTION(scope, void());
    916871
    917872    PropertyNameMode propertyNameMode = trapResult.mode();
     
    940895
    941896        Identifier ident = value.toPropertyKey(exec);
    942         if (UNLIKELY(scope.exception()))
    943             return doExitEarly;
     897        RETURN_IF_EXCEPTION(scope, doExitEarly);
    944898
    945899        uncheckedResultKeys.add(ident.impl());
     
    949903
    950904    createListFromArrayLike(exec, arrayLikeObject, dontThrowAnExceptionTypeFilter, ASCIILiteral("Proxy handler's 'ownKeys' method must return an array-like object containing only Strings and Symbols"), addPropName);
    951     if (UNLIKELY(scope.exception()))
    952         return;
     905    RETURN_IF_EXCEPTION(scope, void());
    953906
    954907    bool targetIsExensible = target->isExtensible(exec);
     
    956909    PropertyNameArray targetKeys(&vm, propertyNameMode);
    957910    target->methodTable(vm)->getOwnPropertyNames(target, exec, targetKeys, enumerationMode);
    958     if (UNLIKELY(scope.exception()))
    959         return;
     911    RETURN_IF_EXCEPTION(scope, void());
    960912    Vector<UniquedStringImpl*> targetConfigurableKeys;
    961913    Vector<UniquedStringImpl*> targetNonConfigurableKeys;
     
    963915        PropertyDescriptor descriptor;
    964916        bool isPropertyDefined = target->getOwnPropertyDescriptor(exec, ident.impl(), descriptor);
    965         if (UNLIKELY(scope.exception()))
    966             return;
     917        RETURN_IF_EXCEPTION(scope, void());
    967918        if (isPropertyDefined && !descriptor.configurable())
    968919            targetNonConfigurableKeys.append(ident.impl());
     
    10521003    CallType callType;
    10531004    JSValue setPrototypeOfMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "setPrototypeOf"), ASCIILiteral("'setPrototypeOf' property of a Proxy's handler should be callable"));
    1054     if (UNLIKELY(scope.exception()))
    1055         return false;
     1005    RETURN_IF_EXCEPTION(scope, false);
    10561006
    10571007    JSObject* target = this->target();
     
    10631013    arguments.append(prototype);
    10641014    JSValue trapResult = call(exec, setPrototypeOfMethod, callType, callData, handler, arguments);
    1065     if (UNLIKELY(scope.exception()))
    1066         return false;
     1015    RETURN_IF_EXCEPTION(scope, false);
    10671016
    10681017    bool trapResultAsBool = trapResult.toBoolean(exec);
    1069     if (UNLIKELY(scope.exception()))
    1070         return false;
     1018    RETURN_IF_EXCEPTION(scope, false);
    10711019   
    10721020    if (!trapResultAsBool) {
     
    10771025
    10781026    bool targetIsExtensible = target->isExtensible(exec);
    1079     if (UNLIKELY(scope.exception()))
    1080         return false;
     1027    RETURN_IF_EXCEPTION(scope, false);
    10811028    if (targetIsExtensible)
    10821029        return true;
    10831030
    10841031    JSValue targetPrototype = target->getPrototype(vm, exec);
    1085     if (UNLIKELY(scope.exception()))
    1086         return false;
     1032    RETURN_IF_EXCEPTION(scope, false);
    10871033    if (!sameValue(exec, prototype, targetPrototype)) {
    10881034        throwVMTypeError(exec, scope, ASCIILiteral("Proxy 'setPrototypeOf' trap returned true when its target is non-extensible and the new prototype value is not the same as the current prototype value. It should have returned false"));
     
    11171063    CallType callType;
    11181064    JSValue getPrototypeOfMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "getPrototypeOf"), ASCIILiteral("'getPrototypeOf' property of a Proxy's handler should be callable"));
    1119     if (UNLIKELY(scope.exception()))
    1120         return JSValue();
     1065    RETURN_IF_EXCEPTION(scope, JSValue());
    11211066
    11221067    JSObject* target = this->target();
     
    11271072    arguments.append(target);
    11281073    JSValue trapResult = call(exec, getPrototypeOfMethod, callType, callData, handler, arguments);
    1129     if (UNLIKELY(scope.exception()))
    1130         return JSValue();
     1074    RETURN_IF_EXCEPTION(scope, JSValue());
    11311075
    11321076    if (!trapResult.isObject() && !trapResult.isNull()) {
     
    11361080
    11371081    bool targetIsExtensible = target->isExtensible(exec);
    1138     if (UNLIKELY(scope.exception()))
    1139         return JSValue();
     1082    RETURN_IF_EXCEPTION(scope, JSValue());
    11401083    if (targetIsExtensible)
    11411084        return trapResult;
    11421085
    11431086    JSValue targetPrototype = target->getPrototype(vm, exec);
    1144     if (UNLIKELY(scope.exception()))
    1145         return JSValue();
     1087    RETURN_IF_EXCEPTION(scope, JSValue());
    11461088    if (!sameValue(exec, targetPrototype, trapResult)) {
    11471089        throwVMTypeError(exec, scope, ASCIILiteral("Proxy's 'getPrototypeOf' trap for a non-extensible target should return the same value as the target's prototype"));
  • trunk/Source/JavaScriptCore/runtime/ReflectObject.cpp

    r205670 r206386  
    124124        return false;
    125125    });
    126     if (UNLIKELY(scope.exception()))
    127         return JSValue::encode(jsUndefined());
     126    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    128127
    129128    return JSValue::encode(construct(exec, target, constructType, constructData, arguments, newTarget));
     
    140139        return JSValue::encode(throwTypeError(exec, scope, ASCIILiteral("Reflect.defineProperty requires the first argument be an object")));
    141140    auto propertyName = exec->argument(1).toPropertyKey(exec);
    142     if (UNLIKELY(scope.exception()))
    143         return JSValue::encode(jsUndefined());
     141    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    144142
    145143    PropertyDescriptor descriptor;
     
    179177
    180178    const Identifier propertyName = exec->argument(1).toPropertyKey(exec);
    181     if (UNLIKELY(scope.exception()))
    182         return JSValue::encode(jsNull());
     179    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    183180
    184181    JSValue receiver = target;
     
    201198
    202199    auto key = exec->argument(1).toPropertyKey(exec);
    203     if (UNLIKELY(scope.exception()))
    204         return JSValue::encode(jsUndefined());
     200    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    205201
    206202    return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, asObject(target), key));
     
    230226
    231227    bool isExtensible = asObject(target)->isExtensible(exec);
    232     if (UNLIKELY(scope.exception()))
    233         return JSValue::encode(JSValue());
     228    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    234229    return JSValue::encode(jsBoolean(isExtensible));
    235230}
     
    258253    JSObject* object = asObject(target);
    259254    bool result = object->methodTable(vm)->preventExtensions(object, exec);
    260     if (UNLIKELY(scope.exception()))
    261         return JSValue::encode(JSValue());
     255    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    262256    return JSValue::encode(jsBoolean(result));
    263257}
     
    275269
    276270    auto propertyName = exec->argument(1).toPropertyKey(exec);
    277     if (UNLIKELY(scope.exception()))
    278         return JSValue::encode(jsUndefined());
     271    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    279272
    280273    JSValue receiver = target;
     
    305298    bool shouldThrowIfCantSet = false;
    306299    bool didSetPrototype = object->setPrototype(vm, exec, proto, shouldThrowIfCantSet);
    307     if (UNLIKELY(scope.exception()))
    308         return JSValue::encode(JSValue());
     300    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    309301    return JSValue::encode(jsBoolean(didSetPrototype));
    310302}
  • trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp

    r206267 r206386  
    222222
    223223    RegExpFlags result = regExpFlags(flagsString->value(exec));
    224     if (UNLIKELY(scope.exception()))
    225         return InvalidFlags;
     224    RETURN_IF_EXCEPTION(scope, InvalidFlags);
    226225    if (result == InvalidFlags)
    227226        throwSyntaxError(exec, scope, ASCIILiteral("Invalid flags supplied to RegExp constructor."));
     
    235234
    236235    String pattern = patternArg.isUndefined() ? emptyString() : patternArg.toString(exec)->value(exec);
    237     if (UNLIKELY(scope.exception()))
    238         return nullptr;
     236    RETURN_IF_EXCEPTION(scope, nullptr);
    239237
    240238    RegExpFlags flags = toFlags(exec, flagsArg);
     
    247245
    248246    Structure* structure = getRegExpStructure(exec, globalObject, newTarget);
    249     if (UNLIKELY(scope.exception()))
    250         return nullptr;
     247    RETURN_IF_EXCEPTION(scope, nullptr);
    251248    return RegExpObject::create(vm, structure, regExp);
    252249}
     
    264261    if (newTarget.isUndefined() && constructAsRegexp && flagsArg.isUndefined()) {
    265262        JSValue constructor = patternArg.get(exec, vm.propertyNames->constructor);
    266         if (UNLIKELY(scope.exception()))
    267             return nullptr;
     263        RETURN_IF_EXCEPTION(scope, nullptr);
    268264        if (callee == constructor) {
    269265            // We know that patternArg is a object otherwise constructAsRegexp would be false.
     
    275271        RegExp* regExp = jsCast<RegExpObject*>(patternArg)->regExp();
    276272        Structure* structure = getRegExpStructure(exec, globalObject, newTarget);
    277         if (UNLIKELY(scope.exception()))
    278             return nullptr;
     273        RETURN_IF_EXCEPTION(scope, nullptr);
    279274
    280275        if (!flagsArg.isUndefined()) {
  • trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h

    r205569 r206386  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
     3 *  Copyright (C) 2003, 2007-2008, 2016 Apple Inc. All Rights Reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    140140    JSObject* object = asObject(value);
    141141    JSValue matchValue = object->get(exec, vm.propertyNames->matchSymbol);
    142     if (UNLIKELY(scope.exception()))
    143         return false;
     142    RETURN_IF_EXCEPTION(scope, false);
    144143    if (!matchValue.isUndefined())
    145144        return matchValue.toBoolean(exec);
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp

    r206267 r206386  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2003, 2007, 2008, 2012, 2016 Apple Inc. All Rights Reserved.
     3 *  Copyright (C) 2003, 2007-2008, 2012, 2016 Apple Inc. All Rights Reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    177177   
    178178    JSArray* array = constructEmptyArray(exec, nullptr);
    179     if (UNLIKELY(scope.exception()))
    180         return jsUndefined();
     179    RETURN_IF_EXCEPTION(scope, JSValue());
    181180
    182181    auto iterate = [&] () {
     
    237236
    238237    setLastIndex(exec, 0);
    239     if (UNLIKELY(scope.exception()))
    240         return jsUndefined();
     238    RETURN_IF_EXCEPTION(scope, JSValue());
    241239
    242240    String s = string->value(exec);
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r206267 r206386  
    160160    } else {
    161161        String pattern = !exec->argumentCount() ? emptyString() : arg0.toString(exec)->value(exec);
    162         if (UNLIKELY(scope.exception()))
    163             return JSValue::encode(jsUndefined());
     162        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    164163
    165164        RegExpFlags flags = NoFlags;
    166165        if (!arg1.isUndefined()) {
    167166            flags = regExpFlags(arg1.toString(exec)->value(exec));
    168             if (UNLIKELY(scope.exception()))
    169                 return JSValue::encode(jsUndefined());
     167            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    170168            if (flags == InvalidFlags)
    171169                return throwVMError(exec, scope, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor.")));
     
    193191
    194192    JSValue globalValue = regexp->get(exec, exec->propertyNames().global);
    195     if (UNLIKELY(scope.exception()))
    196         return string;
     193    RETURN_IF_EXCEPTION(scope, string);
    197194    JSValue ignoreCaseValue = regexp->get(exec, exec->propertyNames().ignoreCase);
    198     if (UNLIKELY(scope.exception()))
    199         return string;
     195    RETURN_IF_EXCEPTION(scope, string);
    200196    JSValue multilineValue = regexp->get(exec, exec->propertyNames().multiline);
    201     if (UNLIKELY(scope.exception()))
    202         return string;
     197    RETURN_IF_EXCEPTION(scope, string);
    203198    JSValue unicodeValue = regexp->get(exec, exec->propertyNames().unicode);
    204     if (UNLIKELY(scope.exception()))
    205         return string;
     199    RETURN_IF_EXCEPTION(scope, string);
    206200    JSValue stickyValue = regexp->get(exec, exec->propertyNames().sticky);
    207     if (UNLIKELY(scope.exception()))
    208         return string;
     201    RETURN_IF_EXCEPTION(scope, string);
    209202
    210203    unsigned index = 0;
     
    240233
    241234    JSValue sourceValue = thisObject->get(exec, vm.propertyNames->source);
    242     if (UNLIKELY(scope.exception()))
    243         return JSValue::encode(jsUndefined());
     235    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    244236    String source = sourceValue.toString(exec)->value(exec);
    245     if (UNLIKELY(scope.exception()))
    246         return JSValue::encode(jsUndefined());
     237    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    247238
    248239    JSValue flagsValue = thisObject->get(exec, vm.propertyNames->flags);
    249     if (UNLIKELY(scope.exception()))
    250         return JSValue::encode(jsUndefined());
     240    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    251241    String flags = flagsValue.toString(exec)->value(exec);
    252     if (UNLIKELY(scope.exception()))
    253         return JSValue::encode(jsUndefined());
     242    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    254243
    255244    return JSValue::encode(jsMakeNontrivialString(exec, '/', source, '/', flags));
     
    341330
    342331    auto flags = flagsString(exec, asObject(thisValue));
    343     if (UNLIKELY(scope.exception()))
    344         return JSValue::encode(jsUndefined());
     332    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    345333
    346334    return JSValue::encode(jsString(exec, flags.data()));
     
    480468    JSString* string = exec->uncheckedArgument(0).toString(exec);
    481469    String s = string->value(exec);
    482     if (UNLIKELY(scope.exception()))
    483         return JSValue::encode(jsUndefined());
     470    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    484471
    485472    RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
     
    589576    JSString* inputString = exec->argument(0).toString(exec);
    590577    String input = inputString->value(exec);
    591     if (UNLIKELY(scope.exception()))
    592         return JSValue::encode(jsUndefined());
     578    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    593579    ASSERT(!input.isNull());
    594580
     
    604590    // 12. Let lengthA be 0.
    605591    JSArray* result = constructEmptyArray(exec, 0);
    606     if (UNLIKELY(scope.exception()))
    607         return JSValue::encode(jsUndefined());
     592    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    608593    unsigned resultLength = 0;
    609594
  • trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp

    r206018 r206386  
    6262    JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
    6363    Structure* setStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->setStructure());
    64     if (UNLIKELY(scope.exception()))
    65         return JSValue::encode(JSValue());
     64    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6665    JSSet* set = JSSet::create(exec, vm, setStructure);
    67     if (UNLIKELY(scope.exception()))
    68         return JSValue::encode(JSValue());
     66    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6967    JSValue iterable = exec->argument(0);
    7068    if (iterable.isUndefinedOrNull())
     
    7270
    7371    JSValue adderFunction = set->get(exec, exec->propertyNames().add);
    74     if (UNLIKELY(scope.exception()))
    75         return JSValue::encode(jsUndefined());
     72    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7673
    7774    CallData adderFunctionCallData;
  • trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp

    r205569 r206386  
    101101    for (unsigned i = 0; i < length; ++i) {
    102102        double codePointAsDouble = exec->uncheckedArgument(i).toNumber(exec);
    103         if (UNLIKELY(scope.exception()))
    104             return JSValue::encode(jsUndefined());
     103        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    105104
    106105        uint32_t codePoint = static_cast<uint32_t>(codePointAsDouble);
     
    127126
    128127    Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->stringObjectStructure());
    129     if (UNLIKELY(scope.exception()))
    130         return JSValue::encode(JSValue());
     128    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    131129
    132130    if (!exec->argumentCount())
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r206267 r206386  
    122122        ASSERT(isCurrentDefined);
    123123        bool isExtensible = thisObject->isExtensible(exec);
    124         if (UNLIKELY(scope.exception()))
    125             return false;
     124        RETURN_IF_EXCEPTION(scope, false);
    126125        return validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException);
    127126    }
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r206267 r206386  
    481481    const String& source = string->value(exec);
    482482    unsigned sourceLen = source.length();
    483     if (UNLIKELY(scope.exception()))
    484         return JSValue::encode(jsUndefined());
     483    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    485484    RegExpObject* regExpObject = asRegExpObject(searchValue);
    486485    RegExp* regExp = regExpObject->regExp();
     
    490489        // ES5.1 15.5.4.10 step 8.a.
    491490        regExpObject->setLastIndex(exec, 0);
    492         if (UNLIKELY(scope.exception()))
    493             return JSValue::encode(jsUndefined());
     491        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    494492
    495493        if (callType == CallType::None && !replacementString.length())
     
    513511        JSFunction* func = jsCast<JSFunction*>(replaceValue);
    514512        CachedCall cachedCall(exec, func, argCount);
    515         if (UNLIKELY(scope.exception()))
    516             return JSValue::encode(jsUndefined());
     513        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    517514        if (source.is8Bit()) {
    518515            while (true) {
     
    541538                JSValue jsResult = cachedCall.call();
    542539                replacements.append(jsResult.toString(exec)->value(exec));
    543                 if (UNLIKELY(scope.exception()))
    544                     return JSValue::encode(jsUndefined());
     540                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    545541
    546542                lastIndex = result.end;
     
    580576                JSValue jsResult = cachedCall.call();
    581577                replacements.append(jsResult.toString(exec)->value(exec));
    582                 if (UNLIKELY(scope.exception()))
    583                     return JSValue::encode(jsUndefined());
     578                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    584579
    585580                lastIndex = result.end;
     
    619614                args.append(string);
    620615
    621                 replacements.append(call(exec, replaceValue, callType, callData, jsUndefined(), args).toString(exec)->value(exec));
    622                 if (UNLIKELY(scope.exception()))
    623                     return JSValue::encode(jsUndefined());
     616                JSValue value = call(exec, replaceValue, callType, callData, jsUndefined(), args);
     617                RETURN_IF_EXCEPTION(scope, encodedJSValue());
     618                replacements.append(value.toString(exec)->value(exec));
     619                RETURN_IF_EXCEPTION(scope, encodedJSValue());
    624620            } else {
    625621                int replLen = replacementString.length();
     
    666662        // ES5.1 15.5.4.10 step 8.a.
    667663        searchValue->setLastIndex(exec, 0);
    668         if (UNLIKELY(scope.exception()))
    669             return JSValue::encode(jsUndefined());
     664        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    670665        return removeUsingRegExpSearch(vm, exec, thisValue, thisValue->value(exec), regExp);
    671666    }
     
    698693    if (callType == CallType::None) {
    699694        replacementString = replaceValue.toString(exec)->value(exec);
    700         if (UNLIKELY(scope.exception()))
    701             return JSValue::encode(jsUndefined());
     695        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    702696    }
    703697
     
    712706    const String& string = jsString->value(exec);
    713707    String searchString = searchValue.toString(exec)->value(exec);
    714     if (UNLIKELY(scope.exception()))
    715         return JSValue::encode(jsUndefined());
     708    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    716709
    717710    size_t matchStart = string.find(searchString);
     
    728721        args.append(jsString);
    729722        replaceValue = call(exec, replaceValue, callType, callData, jsUndefined(), args);
    730         if (UNLIKELY(scope.exception()))
    731             return JSValue::encode(jsUndefined());
     723        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    732724    }
    733725
    734726    String replaceString = replaceValue.toString(exec)->value(exec);
    735     if (UNLIKELY(scope.exception()))
    736         return JSValue::encode(jsUndefined());
     727    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    737728
    738729    StringImpl* stringImpl = string.impl();
     
    818809        return throwVMTypeError(exec, scope);
    819810    JSString* string = thisValue.toString(exec);
    820     if (UNLIKELY(scope.exception()))
    821         return JSValue::encode(jsUndefined());
     811    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    822812    return replace(vm, exec, string, searchValue, replaceValue);
    823813}
     
    829819
    830820    JSString* string = exec->thisValue().toString(exec);
    831     if (UNLIKELY(scope.exception()))
    832         return JSValue::encode(jsUndefined());
     821    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    833822
    834823    JSValue searchValue = exec->argument(0);
     
    845834
    846835    JSString* string = exec->thisValue().toString(exec);
    847     if (UNLIKELY(scope.exception()))
    848         return JSValue::encode(jsUndefined());
     836    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    849837
    850838    return replaceUsingStringSearch(exec->vm(), exec, string, exec->argument(0), exec->argument(1));
     
    954942    }
    955943
    956     if (UNLIKELY(scope.exception()))
    957         return JSValue::encode(jsUndefined());
     944    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    958945
    959946    double doublePosition = argument0.toInteger(exec);
     
    10661053        return throwVMTypeError(exec, scope);
    10671054    String s = thisValue.toString(exec)->value(exec);
    1068     if (UNLIKELY(scope.exception()))
    1069         return JSValue::encode(jsUndefined());
     1055    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10701056
    10711057    int len = s.length();
     
    11311117    // 7. Let s be the number of characters in S.
    11321118    String input = thisValue.toString(exec)->value(exec);
    1133     if (UNLIKELY(scope.exception()))
    1134         return JSValue::encode(jsUndefined());
     1119    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11351120    ASSERT(!input.isNull());
    11361121
     
    11381123    //    where Array is the standard built-in constructor with that name.
    11391124    JSArray* result = constructEmptyArray(exec, 0);
    1140     if (UNLIKELY(scope.exception()))
    1141         return JSValue::encode(jsUndefined());
     1125    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11421126
    11431127    // 5. Let lengthA be 0.
     
    11551139    JSValue separatorValue = exec->uncheckedArgument(0);
    11561140    String separator = separatorValue.toString(exec)->value(exec);
    1157     if (UNLIKELY(scope.exception()))
    1158         return JSValue::encode(jsUndefined());
     1141    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    11591142
    11601143    // 10. If lim == 0, return A.
     
    12641247    } else {
    12651248        uString = thisValue.toString(exec)->value(exec);
    1266         if (UNLIKELY(scope.exception()))
    1267             return JSValue::encode(jsUndefined());
     1249        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    12681250        len = uString.length();
    12691251    }
     
    13171299
    13181300    JSString* jsString = thisValue.toString(exec);
    1319     if (UNLIKELY(scope.exception()))
    1320         return JSValue::encode(jsUndefined());
     1301    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    13211302
    13221303    JSValue a0 = exec->argument(0);
     
    13911372        return throwVMTypeError(exec, scope);
    13921373    String s = thisValue.toString(exec)->value(exec);
    1393     if (UNLIKELY(scope.exception()))
    1394         return JSValue::encode(jsUndefined());
     1374    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    13951375
    13961376    JSValue a0 = exec->argument(0);
    13971377    String str = a0.toString(exec)->value(exec);
    1398     if (UNLIKELY(scope.exception()))
    1399         return JSValue::encode(jsUndefined());
     1378    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    14001379    return JSValue::encode(jsNumber(Collator().collate(s, str)));
    14011380}
     
    14171396
    14181397    // 3. ReturnIfAbrupt(S).
    1419     if (UNLIKELY(scope.exception()))
    1420         return JSValue::encode(jsUndefined());
     1398    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    14211399
    14221400    // Optimization for empty strings.
     
    14281406
    14291407    // 5. ReturnIfAbrupt(requestedLocales).
    1430     if (UNLIKELY(scope.exception()))
    1431         return JSValue::encode(jsUndefined());
     1408    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    14321409
    14331410    // 6. Let len be the number of elements in requestedLocales.
     
    15121489        return throwVMTypeError(exec, scope);
    15131490    String s = thisValue.toString(exec)->value(exec);
    1514     if (UNLIKELY(scope.exception()))
    1515         return JSValue::encode(jsUndefined());
     1491    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15161492    return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>"));
    15171493}
     
    15261502        return throwVMTypeError(exec, scope);
    15271503    String s = thisValue.toString(exec)->value(exec);
    1528     if (UNLIKELY(scope.exception()))
    1529         return JSValue::encode(jsUndefined());
     1504    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15301505    return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>"));
    15311506}
     
    15401515        return throwVMTypeError(exec, scope);
    15411516    String s = thisValue.toString(exec)->value(exec);
    1542     if (UNLIKELY(scope.exception()))
    1543         return JSValue::encode(jsUndefined());
     1517    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15441518    return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>"));
    15451519}
     
    15541528        return throwVMTypeError(exec, scope);
    15551529    String s = thisValue.toString(exec)->value(exec);
    1556     if (UNLIKELY(scope.exception()))
    1557         return JSValue::encode(jsUndefined());
     1530    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15581531    return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>"));
    15591532}
     
    15681541        return throwVMTypeError(exec, scope);
    15691542    String s = thisValue.toString(exec)->value(exec);
    1570     if (UNLIKELY(scope.exception()))
    1571         return JSValue::encode(jsUndefined());
     1543    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15721544    return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>"));
    15731545}
     
    15821554        return throwVMTypeError(exec, scope);
    15831555    String s = thisValue.toString(exec)->value(exec);
    1584     if (UNLIKELY(scope.exception()))
    1585         return JSValue::encode(jsUndefined());
     1556    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    15861557    return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>"));
    15871558}
     
    15961567        return throwVMTypeError(exec, scope);
    15971568    String s = thisValue.toString(exec)->value(exec);
    1598     if (UNLIKELY(scope.exception()))
    1599         return JSValue::encode(jsUndefined());
     1569    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16001570    return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>"));
    16011571}
     
    16101580        return throwVMTypeError(exec, scope);
    16111581    String s = thisValue.toString(exec)->value(exec);
    1612     if (UNLIKELY(scope.exception()))
    1613         return JSValue::encode(jsUndefined());
     1582    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16141583    return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>"));
    16151584}
     
    16241593        return throwVMTypeError(exec, scope);
    16251594    String s = thisValue.toString(exec)->value(exec);
    1626     if (UNLIKELY(scope.exception()))
    1627         return JSValue::encode(jsUndefined());
     1595    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16281596    return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>"));
    16291597}
     
    16381606        return throwVMTypeError(exec, scope);
    16391607    String s = thisValue.toString(exec)->value(exec);
    1640     if (UNLIKELY(scope.exception()))
    1641         return JSValue::encode(jsUndefined());
     1608    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16421609
    16431610    JSValue a0 = exec->argument(0);
     
    16571624        return throwVMTypeError(exec, scope);
    16581625    String s = thisValue.toString(exec)->value(exec);
    1659     if (UNLIKELY(scope.exception()))
    1660         return JSValue::encode(jsUndefined());
     1626    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    16611627
    16621628    JSValue a0 = exec->argument(0);
     
    17121678        return throwVMTypeError(exec, scope);
    17131679    String s = thisValue.toString(exec)->value(exec);
    1714     if (UNLIKELY(scope.exception()))
    1715         return JSValue::encode(jsUndefined());
     1680    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    17161681
    17171682    JSValue a0 = exec->argument(0);
     
    17311696        return throwVMTypeError(exec, scope);
    17321697    String s = thisValue.toString(exec)->value(exec);
    1733     if (UNLIKELY(scope.exception()))
    1734         return JSValue::encode(jsUndefined());
     1698    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    17351699
    17361700    JSValue a0 = exec->argument(0);
     
    17791743        return throwTypeError(exec, scope);
    17801744    String str = thisValue.toString(exec)->value(exec);
    1781     if (UNLIKELY(scope.exception()))
    1782         return jsUndefined();
     1745    RETURN_IF_EXCEPTION(scope, JSValue());
    17831746
    17841747    unsigned left = 0;
     
    18371800
    18381801    String stringToSearchIn = thisValue.toString(exec)->value(exec);
    1839     if (UNLIKELY(scope.exception()))
    1840         return JSValue::encode(jsUndefined());
     1802    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18411803
    18421804    JSValue a0 = exec->argument(0);
    18431805    bool isRegularExpression = isRegExp(vm, exec, a0);
    1844     if (UNLIKELY(scope.exception()))
    1845         return JSValue::encode(JSValue());
     1806    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18461807    if (isRegularExpression)
    18471808        return throwVMTypeError(exec, scope, "Argument to String.prototype.startsWith cannot be a RegExp");
    18481809
    18491810    String searchString = a0.toString(exec)->value(exec);
    1850     if (UNLIKELY(scope.exception()))
    1851         return JSValue::encode(jsUndefined());
     1811    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18521812
    18531813    JSValue positionArg = exec->argument(1);
     
    18581818        unsigned length = stringToSearchIn.length();
    18591819        start = clampAndTruncateToUnsigned(positionArg.toInteger(exec), 0, length);
    1860         if (UNLIKELY(scope.exception()))
    1861             return JSValue::encode(jsUndefined());
     1820        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18621821    }
    18631822
     
    18751834
    18761835    String stringToSearchIn = thisValue.toString(exec)->value(exec);
    1877     if (UNLIKELY(scope.exception()))
    1878         return JSValue::encode(jsUndefined());
     1836    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18791837
    18801838    JSValue a0 = exec->argument(0);
    18811839    bool isRegularExpression = isRegExp(vm, exec, a0);
    1882     if (UNLIKELY(scope.exception()))
    1883         return JSValue::encode(JSValue());
     1840    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18841841    if (isRegularExpression)
    18851842        return throwVMTypeError(exec, scope, "Argument to String.prototype.endsWith cannot be a RegExp");
    18861843
    18871844    String searchString = a0.toString(exec)->value(exec);
    1888     if (UNLIKELY(scope.exception()))
    1889         return JSValue::encode(jsUndefined());
     1845    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    18901846
    18911847    unsigned length = stringToSearchIn.length();
     
    18971853    else if (!endPositionArg.isUndefined()) {
    18981854        end = clampAndTruncateToUnsigned(endPositionArg.toInteger(exec), 0, length);
    1899         if (UNLIKELY(scope.exception()))
    1900             return JSValue::encode(jsUndefined());
     1855        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19011856    }
    19021857
     
    19131868        unsigned length = stringToSearchIn.length();
    19141869        start = clampAndTruncateToUnsigned(positionArg.toInteger(exec), 0, length);
    1915         if (UNLIKELY(scope.exception()))
    1916             return JSValue::encode(jsUndefined());
     1870        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19171871    }
    19181872
     
    19301884
    19311885    String stringToSearchIn = thisValue.toString(exec)->value(exec);
    1932     if (UNLIKELY(scope.exception()))
    1933         return JSValue::encode(jsUndefined());
     1886    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19341887
    19351888    JSValue a0 = exec->argument(0);
    19361889    bool isRegularExpression = isRegExp(vm, exec, a0);
    1937     if (UNLIKELY(scope.exception()))
    1938         return JSValue::encode(JSValue());
     1890    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19391891    if (isRegularExpression)
    19401892        return throwVMTypeError(exec, scope, "Argument to String.prototype.includes cannot be a RegExp");
    19411893
    19421894    String searchString = a0.toString(exec)->value(exec);
    1943     if (UNLIKELY(scope.exception()))
    1944         return JSValue::encode(jsUndefined());
     1895    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19451896
    19461897    JSValue positionArg = exec->argument(1);
     
    19581909
    19591910    String stringToSearchIn = thisValue.toString(exec)->value(exec);
    1960     if (UNLIKELY(scope.exception()))
    1961         return JSValue::encode(jsUndefined());
     1911    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19621912
    19631913    JSValue a0 = exec->uncheckedArgument(0);
    19641914    String searchString = a0.toString(exec)->value(exec);
    1965     if (UNLIKELY(scope.exception()))
    1966         return JSValue::encode(jsUndefined());
     1915    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    19671916
    19681917    JSValue positionArg = exec->argument(1);
     
    20191968        return throwVMTypeError(exec, scope);
    20201969    JSString::SafeView source = thisValue.toString(exec)->view(exec);
    2021     if (UNLIKELY(scope.exception()))
    2022         return JSValue::encode(jsUndefined());
     1970    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    20231971
    20241972    UNormalizationMode form = UNORM_NFC;
     
    20261974    if (!exec->argument(0).isUndefined()) {
    20271975        String formString = exec->uncheckedArgument(0).toString(exec)->value(exec);
    2028         if (UNLIKELY(scope.exception()))
    2029             return JSValue::encode(jsUndefined());
     1976        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    20301977
    20311978        if (formString == "NFC")
  • trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp

    r205569 r206386  
    101101
    102102    JSString* stringKey = exec->argument(0).toString(exec);
    103     if (UNLIKELY(scope.exception()))
    104         return JSValue::encode(jsUndefined());
     103    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    105104    String string = stringKey->value(exec);
    106     if (UNLIKELY(scope.exception()))
    107         return JSValue::encode(jsUndefined());
     105    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    108106
    109107    return JSValue::encode(Symbol::create(exec->vm(), exec->vm().symbolRegistry().symbolForKey(string)));
  • trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp

    r205569 r206386  
    11/*
    22 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
     3 * Copyright (C) 2016 Apple Inc. All Rights Reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    4950    unsigned count = templateKey.cookedStrings().size();
    5051    JSArray* templateObject = constructEmptyArray(exec, nullptr, count);
    51     if (UNLIKELY(scope.exception()))
    52         return nullptr;
     52    RETURN_IF_EXCEPTION(scope, nullptr);
    5353    JSArray* rawObject = constructEmptyArray(exec, nullptr, count);
    54     if (UNLIKELY(scope.exception()))
    55         return nullptr;
     54    RETURN_IF_EXCEPTION(scope, nullptr);
    5655
    5756    for (unsigned index = 0; index < count; ++index) {
  • trunk/Source/JavaScriptCore/runtime/WeakMapConstructor.cpp

    r206018 r206386  
    6060    JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
    6161    Structure* weakMapStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->weakMapStructure());
    62     if (UNLIKELY(scope.exception()))
    63         return JSValue::encode(JSValue());
     62    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6463    JSWeakMap* weakMap = JSWeakMap::create(exec, weakMapStructure);
    6564    JSValue iterable = exec->argument(0);
     
    6867
    6968    JSValue adderFunction = weakMap->JSObject::get(exec, exec->propertyNames().set);
    70     if (UNLIKELY(scope.exception()))
    71         return JSValue::encode(jsUndefined());
     69    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7270
    7371    CallData adderFunctionCallData;
     
    8482
    8583        JSValue key = nextItem.get(exec, static_cast<unsigned>(0));
    86         if (UNLIKELY(scope.exception()))
    87             return;
     84        RETURN_IF_EXCEPTION(scope, void());
    8885
    8986        JSValue value = nextItem.get(exec, static_cast<unsigned>(1));
    90         if (UNLIKELY(scope.exception()))
    91             return;
     87        RETURN_IF_EXCEPTION(scope, void());
    9288
    9389        MarkedArgumentBuffer arguments;
  • trunk/Source/JavaScriptCore/runtime/WeakSetConstructor.cpp

    r206018 r206386  
    6060    JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
    6161    Structure* weakSetStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->weakSetStructure());
    62     if (UNLIKELY(scope.exception()))
    63         return JSValue::encode(JSValue());
     62    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6463    JSWeakSet* weakSet = JSWeakSet::create(exec, weakSetStructure);
    6564    JSValue iterable = exec->argument(0);
     
    6867
    6968    JSValue adderFunction = weakSet->JSObject::get(exec, exec->propertyNames().add);
    70     if (UNLIKELY(scope.exception()))
    71         return JSValue::encode(jsUndefined());
     69    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7270
    7371    CallData adderFunctionCallData;
  • trunk/Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp

    r206154 r206386  
    313313    for (unsigned i = 0; i < exec->argumentCount(); ++i) {
    314314        String argStr = exec->uncheckedArgument(i).toString(exec)->value(exec);
    315         if (UNLIKELY(scope.exception()))
    316             return JSValue::encode(jsUndefined());
     315        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    317316        dataLog(argStr);
    318317    }
  • trunk/Source/WebCore/ChangeLog

    r206385 r206386  
     12016-09-26  Mark Lam  <mark.lam@apple.com>
     2
     3        Added RETURN_IF_EXCEPTION() macro and use it for exception checks.
     4        https://bugs.webkit.org/show_bug.cgi?id=162521
     5
     6        Reviewed by Saam Barati.
     7
     8        No new tests because this patch is mostly refactoring.  The only change in
     9        behavior is that functions that have a JSValue return type will now return the
     10        empty JSValue when an exception is thrown.  I tested this behavior by running
     11        the existing JSC and layout tests.
     12
     13        * bindings/js/ArrayValue.cpp:
     14        (WebCore::ArrayValue::get):
     15        * bindings/js/IDBBindingUtilities.cpp:
     16        (WebCore::toJS):
     17        * bindings/js/JSApplePaySessionCustom.cpp:
     18        (WebCore::JSApplePaySession::completeShippingMethodSelection):
     19        (WebCore::JSApplePaySession::completeShippingContactSelection):
     20        (WebCore::JSApplePaySession::completePaymentMethodSelection):
     21        * bindings/js/JSAudioTrackCustom.cpp:
     22        (WebCore::JSAudioTrack::setKind):
     23        (WebCore::JSAudioTrack::setLanguage):
     24        * bindings/js/JSBlobCustom.cpp:
     25        (WebCore::constructJSBlob):
     26        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
     27        (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
     28        * bindings/js/JSCommandLineAPIHostCustom.cpp:
     29        (WebCore::getJSListenerFunctions):
     30        * bindings/js/JSCryptoAlgorithmDictionary.cpp:
     31        (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
     32        (WebCore::getHashAlgorithm):
     33        (WebCore::createAesCbcParams):
     34        (WebCore::createAesKeyGenParams):
     35        (WebCore::createHmacKeyParams):
     36        (WebCore::createRsaKeyGenParams):
     37        (WebCore::createRsaOaepParams):
     38        * bindings/js/JSCryptoKeySerializationJWK.cpp:
     39        (WebCore::getStringFromJSON):
     40        (WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
     41        (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents):
     42        (WebCore::buildJSONForRSAComponents):
     43        (WebCore::addUsagesToJSON):
     44        (WebCore::JSCryptoKeySerializationJWK::serialize):
     45        * bindings/js/JSCustomElementInterface.cpp:
     46        (WebCore::constructCustomElementSynchronously):
     47        (WebCore::JSCustomElementInterface::upgradeElement):
     48        * bindings/js/JSCustomElementRegistryCustom.cpp:
     49        (WebCore::getCustomElementCallback):
     50        (WebCore::JSCustomElementRegistry::define):
     51        (WebCore::whenDefinedPromise):
     52        * bindings/js/JSDOMBinding.cpp:
     53        (WebCore::valueToUSVString):
     54        (WebCore::hasIteratorMethod):
     55        (WebCore::toSmallerInt):
     56        (WebCore::toSmallerUInt):
     57        (WebCore::toInt32EnforceRange):
     58        (WebCore::toUInt32EnforceRange):
     59        (WebCore::toInt64EnforceRange):
     60        (WebCore::toUInt64EnforceRange):
     61        * bindings/js/JSDOMBinding.h:
     62        (WebCore::toJSSequence):
     63        (WebCore::toJS):
     64        (WebCore::jsFrozenArray):
     65        * bindings/js/JSDOMPromise.cpp:
     66        (WebCore::rejectPromiseWithExceptionIfAny):
     67        * bindings/js/JSDOMStringMapCustom.cpp:
     68        (WebCore::JSDOMStringMap::putDelegate):
     69        * bindings/js/JSDOMWindowCustom.cpp:
     70        (WebCore::JSDOMWindow::setLocation):
     71        (WebCore::JSDOMWindow::open):
     72        (WebCore::JSDOMWindow::showModalDialog):
     73        (WebCore::handlePostMessage):
     74        (WebCore::JSDOMWindow::setTimeout):
     75        (WebCore::JSDOMWindow::setInterval):
     76        * bindings/js/JSDataCueCustom.cpp:
     77        (WebCore::constructJSDataCue):
     78        * bindings/js/JSDeviceMotionEventCustom.cpp:
     79        (WebCore::readAccelerationArgument):
     80        (WebCore::readRotationRateArgument):
     81        (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
     82        * bindings/js/JSDictionary.cpp:
     83        (WebCore::JSDictionary::tryGetProperty):
     84        (WebCore::JSDictionary::convertValue):
     85        * bindings/js/JSDictionary.h:
     86        (WebCore::JSDictionary::tryGetPropertyAndResult):
     87        * bindings/js/JSDocumentCustom.cpp:
     88        (WebCore::JSDocument::getCSSCanvasContext):
     89        * bindings/js/JSFileCustom.cpp:
     90        (WebCore::constructJSFile):
     91        * bindings/js/JSGeolocationCustom.cpp:
     92        (WebCore::JSGeolocation::getCurrentPosition):
     93        (WebCore::JSGeolocation::watchPosition):
     94        * bindings/js/JSHTMLAllCollectionCustom.cpp:
     95        (WebCore::callHTMLAllCollection):
     96        * bindings/js/JSHTMLCanvasElementCustom.cpp:
     97        (WebCore::JSHTMLCanvasElement::getContext):
     98        * bindings/js/JSHTMLElementCustom.cpp:
     99        (WebCore::constructJSHTMLElement):
     100        * bindings/js/JSHistoryCustom.cpp:
     101        (WebCore::JSHistory::pushState):
     102        (WebCore::JSHistory::replaceState):
     103        * bindings/js/JSIDBDatabaseCustom.cpp:
     104        (WebCore::JSIDBDatabase::createObjectStore):
     105        * bindings/js/JSMessageEventCustom.cpp:
     106        (WebCore::handleInitMessageEvent):
     107        * bindings/js/JSMessagePortCustom.cpp:
     108        (WebCore::fillMessagePortArray):
     109        * bindings/js/JSMessagePortCustom.h:
     110        (WebCore::handlePostMessage):
     111        * bindings/js/JSMockContentFilterSettingsCustom.cpp:
     112        (WebCore::JSMockContentFilterSettings::setDecisionPoint):
     113        (WebCore::toDecision):
     114        (WebCore::JSMockContentFilterSettings::setDecision):
     115        (WebCore::JSMockContentFilterSettings::setUnblockRequestDecision):
     116        * bindings/js/JSNodeFilterCustom.cpp:
     117        (WebCore::JSNodeFilter::acceptNode):
     118        * bindings/js/JSNodeOrString.cpp:
     119        (WebCore::toNodeOrStringVector):
     120        * bindings/js/JSSQLTransactionCustom.cpp:
     121        (WebCore::JSSQLTransaction::executeSql):
     122        * bindings/js/JSSVGLengthCustom.cpp:
     123        (WebCore::JSSVGLength::convertToSpecifiedUnits):
     124        * bindings/js/JSStorageCustom.cpp:
     125        (WebCore::JSStorage::getOwnPropertyNames):
     126        * bindings/js/JSTextTrackCustom.cpp:
     127        (WebCore::JSTextTrack::setLanguage):
     128        * bindings/js/JSVideoTrackCustom.cpp:
     129        (WebCore::JSVideoTrack::setKind):
     130        (WebCore::JSVideoTrack::setLanguage):
     131        * bindings/js/JSWebGL2RenderingContextCustom.cpp:
     132        (WebCore::JSWebGL2RenderingContext::getIndexedParameter):
     133        * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
     134        (WebCore::getObjectParameter):
     135        (WebCore::JSWebGLRenderingContextBase::getExtension):
     136        (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
     137        (WebCore::JSWebGLRenderingContextBase::getParameter):
     138        (WebCore::JSWebGLRenderingContextBase::getProgramParameter):
     139        (WebCore::JSWebGLRenderingContextBase::getShaderParameter):
     140        (WebCore::toVector):
     141        (WebCore::dataFunctionf):
     142        (WebCore::dataFunctionMatrix):
     143        * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
     144        (WebCore::cryptoKeyFormatFromJSValue):
     145        (WebCore::cryptoKeyUsagesFromJSValue):
     146        (WebCore::JSWebKitSubtleCrypto::generateKey):
     147        (WebCore::importKey):
     148        (WebCore::JSWebKitSubtleCrypto::importKey):
     149        (WebCore::exportKey):
     150        (WebCore::JSWebKitSubtleCrypto::exportKey):
     151        (WebCore::JSWebKitSubtleCrypto::unwrapKey):
     152        * bindings/js/JSWorkerCustom.cpp:
     153        (WebCore::constructJSWorker):
     154        * bindings/js/JSWorkerGlobalScopeCustom.cpp:
     155        (WebCore::JSWorkerGlobalScope::importScripts):
     156        (WebCore::JSWorkerGlobalScope::setTimeout):
     157        (WebCore::JSWorkerGlobalScope::setInterval):
     158        * bindings/js/ReadableStreamDefaultController.cpp:
     159        (WebCore::ReadableStreamDefaultController::invoke):
     160        * bindings/js/ScheduledAction.cpp:
     161        (WebCore::ScheduledAction::create):
     162        * bindings/scripts/CodeGeneratorJS.pm:
     163        (GenerateDictionaryImplementationContent):
     164        (GenerateImplementation):
     165        (GenerateParametersCheck):
     166        (GenerateImplementationFunctionCall):
     167        (GenerateConstructorDefinition):
     168        * html/HTMLMediaElement.cpp:
     169        (WebCore::controllerJSValue):
     170        (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
     171        (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
     172
    11732016-09-26  Michael Catanzaro  <mcatanzaro@igalia.com>
    2174
  • trunk/Source/WebCore/bindings/js/ArrayValue.cpp

    r205569 r206386  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All Rights Reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    9495
    9596    value = indexedValue.toWTFString(m_exec);
    96     if (UNLIKELY(scope.exception()))
    97         return false;
     97    RETURN_IF_EXCEPTION(scope, false);
    9898
    9999    return true;
  • trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp

    r205744 r206386  
    9898        unsigned size = inArray.size();
    9999        auto outArray = constructEmptyArray(&state, 0, &globalObject, size);
    100         if (UNLIKELY(scope.exception()))
    101             return jsUndefined();
     100        RETURN_IF_EXCEPTION(scope, JSValue());
    102101        for (size_t i = 0; i < size; ++i)
    103102            outArray->putDirectIndex(&state, i, toJS(state, globalObject, inArray.at(i).get()));
  • trunk/Source/WebCore/bindings/js/JSApplePaySessionCustom.cpp

    r205569 r206386  
    5656    ExceptionCode ec = 0;
    5757    uint16_t status = convert<uint16_t>(state, state.argument(0), NormalConversion);
    58     if (UNLIKELY(scope.exception()))
    59         return jsUndefined();
     58    RETURN_IF_EXCEPTION(scope, JSValue());
    6059
    6160    Dictionary newTotal = { &state, state.argument(1) };
    62     if (UNLIKELY(scope.exception()))
    63         return jsUndefined();
     61    RETURN_IF_EXCEPTION(scope, JSValue());
    6462
    6563    ArrayValue newLineItems { &state, state.argument(2) };
    66     if (UNLIKELY(scope.exception()))
    67         return jsUndefined();
     64    RETURN_IF_EXCEPTION(scope, JSValue());
    6865    impl.completeShippingMethodSelection(status, newTotal, newLineItems, ec);
    6966    setDOMException(&state, ec);
     
    8986    ExceptionCode ec = 0;
    9087    uint16_t status = convert<uint16_t>(state, state.argument(0), NormalConversion);
    91     if (UNLIKELY(scope.exception()))
    92         return jsUndefined();
     88    RETURN_IF_EXCEPTION(scope, JSValue());
    9389
    9490    ArrayValue newShippingMethods { &state, state.argument(1) };
    95     if (UNLIKELY(scope.exception()))
    96         return jsUndefined();
     91    RETURN_IF_EXCEPTION(scope, JSValue());
    9792
    9893    Dictionary newTotal = { &state, state.argument(2) };
    99     if (UNLIKELY(scope.exception()))
    100         return jsUndefined();
     94    RETURN_IF_EXCEPTION(scope, JSValue());
    10195
    10296    ArrayValue newLineItems { &state, state.argument(3) };
    103     if (UNLIKELY(scope.exception()))
    104         return jsUndefined();
     97    RETURN_IF_EXCEPTION(scope, JSValue());
    10598    impl.completeShippingContactSelection(status, newShippingMethods, newTotal, newLineItems, ec);
    10699    setDOMException(&state, ec);
     
    126119    ExceptionCode ec = 0;
    127120    Dictionary newTotal = { &state, state.argument(0) };
    128     if (UNLIKELY(scope.exception()))
    129         return jsUndefined();
     121    RETURN_IF_EXCEPTION(scope, JSValue());
    130122
    131123    ArrayValue newLineItems { &state, state.argument(1) };
    132     if (UNLIKELY(scope.exception()))
    133         return jsUndefined();
     124    RETURN_IF_EXCEPTION(scope, JSValue());
    134125    impl.completePaymentMethodSelection(newTotal, newLineItems, ec);
    135126    setDOMException(&state, ec);
  • trunk/Source/WebCore/bindings/js/JSAudioTrackCustom.cpp

    r205569 r206386  
    4848
    4949    auto& string = value.toString(&state)->value(&state);
    50     if (UNLIKELY(scope.exception()))
    51         return;
     50    RETURN_IF_EXCEPTION(scope, void());
    5251    wrapped().setKind(string);
    5352#else
     
    6463
    6564    auto& string = value.toString(&state)->value(&state);
    66     if (UNLIKELY(scope.exception()))
    67         return;
     65    RETURN_IF_EXCEPTION(scope, void());
    6866    wrapped().setLanguage(string);
    6967#else
  • trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp

    r205569 r206386  
    8181    unsigned blobPartsLength = 0;
    8282    JSObject* blobParts = toJSSequence(exec, exec.uncheckedArgument(0), blobPartsLength);
    83     if (UNLIKELY(scope.exception()))
    84         return JSValue::encode(jsUndefined());
     83    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    8584    ASSERT(blobParts);
    8685
     
    102101        // Attempt to get the endings property and validate it.
    103102        bool containsEndings = dictionary.get("endings", endings);
    104         if (UNLIKELY(scope.exception()))
    105             return JSValue::encode(jsUndefined());
     103        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    106104
    107105        if (containsEndings) {
     
    112110        // Attempt to get the type property.
    113111        dictionary.get("type", type);
    114         if (UNLIKELY(scope.exception()))
    115             return JSValue::encode(jsUndefined());
     112        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    116113    }
    117114
     
    122119    for (unsigned i = 0; i < blobPartsLength; ++i) {
    123120        JSValue item = blobParts->get(&exec, i);
    124         if (UNLIKELY(scope.exception()))
    125             return JSValue::encode(jsUndefined());
     121        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    126122
    127123        if (ArrayBuffer* arrayBuffer = toArrayBuffer(item))
     
    133129        else {
    134130            String string = item.toWTFString(&exec);
    135             if (UNLIKELY(scope.exception()))
    136                 return JSValue::encode(jsUndefined());
     131            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    137132            blobBuilder.append(string, endings);
    138133        }
  • trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp

    r205569 r206386  
    356356
    357357    String propertyName = state.uncheckedArgument(0).toWTFString(&state);
    358     if (UNLIKELY(scope.exception()))
    359         return jsUndefined();
     358    RETURN_IF_EXCEPTION(scope, JSValue());
    360359
    361360    RefPtr<CSSValue> cssValue = wrapped().getPropertyCSSValue(propertyName);
  • trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp

    r205569 r206386  
    11/*
    2  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007-2008, 2016 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
    44 * Copyright (C) 2010-2011 Google Inc. All rights reserved.
     
    7171    auto scope = DECLARE_THROW_SCOPE(vm);
    7272    JSArray* result = constructEmptyArray(&state, nullptr);
    73     if (UNLIKELY(scope.exception()))
    74         return nullptr;
     73    RETURN_IF_EXCEPTION(scope, nullptr);
    7574    size_t handlersCount = listenerInfo.eventListenerVector.size();
    7675    for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) {
  • trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp

    r205569 r206386  
    8181    }
    8282
    83     if (UNLIKELY(scope.exception()))
    84         return false;
     83    RETURN_IF_EXCEPTION(scope, false);
    8584
    8685    if (!algorithmName.containsOnlyASCII()) {
     
    114113
    115114    JSValue hash = getProperty(exec, object, "hash");
    116     if (UNLIKELY(scope.exception()))
    117         return false;
     115    RETURN_IF_EXCEPTION(scope, false);
    118116
    119117    if (hash.isUndefinedOrNull()) {
     
    137135
    138136    JSValue iv = getProperty(exec, value.getObject(), "iv");
    139     if (UNLIKELY(scope.exception()))
    140         return nullptr;
     137    RETURN_IF_EXCEPTION(scope, nullptr);
    141138
    142139    auto result = adoptRef(*new CryptoAlgorithmAesCbcParams);
     
    171168
    172169    JSValue lengthValue = getProperty(&state, value.getObject(), "length");
    173     if (UNLIKELY(scope.exception()))
    174         return nullptr;
     170    RETURN_IF_EXCEPTION(scope, nullptr);
    175171
    176172    result->length = convert<uint16_t>(state, lengthValue, EnforceRange);
     
    219215
    220216    result->hasLength = jsDictionary.get("length", result->length);
    221     if (UNLIKELY(scope.exception()))
    222         return nullptr;
     217    RETURN_IF_EXCEPTION(scope, nullptr);
    223218
    224219    return WTFMove(result);
     
    239234
    240235    JSValue modulusLengthValue = getProperty(&state, value.getObject(), "modulusLength");
    241     if (UNLIKELY(scope.exception()))
    242         return nullptr;
     236    RETURN_IF_EXCEPTION(scope, nullptr);
    243237
    244238    // FIXME: Why no EnforceRange? Filed as <https://www.w3.org/Bugs/Public/show_bug.cgi?id=23779>.
    245239    result->modulusLength = convert<uint32_t>(state, modulusLengthValue, NormalConversion);
    246     if (UNLIKELY(scope.exception()))
    247         return nullptr;
     240    RETURN_IF_EXCEPTION(scope, nullptr);
    248241
    249242    JSValue publicExponentValue = getProperty(&state, value.getObject(), "publicExponent");
    250     if (UNLIKELY(scope.exception()))
    251         return nullptr;
     243    RETURN_IF_EXCEPTION(scope, nullptr);
    252244
    253245    RefPtr<Uint8Array> publicExponentArray = toUint8Array(publicExponentValue);
     
    288280
    289281    JSValue labelValue = getProperty(exec, value.getObject(), "label");
    290     if (UNLIKELY(scope.exception()))
    291         return nullptr;
     282    RETURN_IF_EXCEPTION(scope, nullptr);
    292283
    293284    result->hasLabel = !labelValue.isUndefinedOrNull();
  • trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp

    r205569 r206386  
    8989    if (!jsValue.getString(exec, result)) {
    9090        // Can get an out of memory exception.
    91         if (UNLIKELY(scope.exception()))
    92             return false;
     91        RETURN_IF_EXCEPTION(scope, false);
    9392        throwTypeError(exec, scope, String::format("Expected a string value for \"%s\" JSON key",  key));
    9493        return false;
     
    321320        }
    322321    } else {
    323         if (UNLIKELY(scope.exception()))
    324             return;
     322        RETURN_IF_EXCEPTION(scope, void());
    325323
    326324        String jwkUseString;
     
    438436
    439437    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "d", modulus)) {
    440         if (scope.exception())
    441             return nullptr;
     438        RETURN_IF_EXCEPTION(scope, nullptr);
    442439        return CryptoKeyDataRSAComponents::createPublic(modulus, exponent);
    443440    }
     
    447444    Vector<CryptoKeyDataRSAComponents::PrimeInfo> otherPrimeInfos;
    448445    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "p", firstPrimeInfo.primeFactor)) {
    449         if (scope.exception())
    450             return nullptr;
     446        RETURN_IF_EXCEPTION(scope, nullptr);
    451447        return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent);
    452448    }
    453449
    454450    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "dp", firstPrimeInfo.factorCRTExponent)) {
    455         if (scope.exception())
    456             return nullptr;
     451        RETURN_IF_EXCEPTION(scope, nullptr);
    457452        return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent);
    458453    }
    459454
    460455    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "q", secondPrimeInfo.primeFactor)) {
    461         if (scope.exception())
    462             return nullptr;
     456        RETURN_IF_EXCEPTION(scope, nullptr);
    463457        return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent);
    464458    }
    465459
    466460    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "dq", secondPrimeInfo.factorCRTExponent)) {
    467         if (scope.exception())
    468             return nullptr;
     461        RETURN_IF_EXCEPTION(scope, nullptr);
    469462        return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent);
    470463    }
    471464
    472465    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "qi", secondPrimeInfo.factorCRTCoefficient)) {
    473         if (scope.exception())
    474             return nullptr;
     466        RETURN_IF_EXCEPTION(scope, nullptr);
    475467        return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent);
    476468    }
     
    478470    JSArray* otherPrimeInfoJSArray;
    479471    if (!getJSArrayFromJSON(m_exec, m_json.get(), "oth", otherPrimeInfoJSArray)) {
    480         if (scope.exception())
    481             return nullptr;
     472        RETURN_IF_EXCEPTION(scope, nullptr);
    482473        return CryptoKeyDataRSAComponents::createPrivateWithAdditionalData(modulus, exponent, privateExponent, firstPrimeInfo, secondPrimeInfo, otherPrimeInfos);
    483474    }
     
    486477        CryptoKeyDataRSAComponents::PrimeInfo info;
    487478        JSValue element = otherPrimeInfoJSArray->getIndex(m_exec, i);
    488         if (UNLIKELY(scope.exception()))
    489             return nullptr;
     479        RETURN_IF_EXCEPTION(scope, nullptr);
    490480        if (!element.isObject()) {
    491481            throwTypeError(m_exec, scope, ASCIILiteral("JWK \"oth\" array member is not an object"));
     
    575565
    576566    JSArray* oth = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), data.otherPrimeInfos().size());
    577     if (UNLIKELY(scope.exception()))
    578         return;
     567    RETURN_IF_EXCEPTION(scope, void());
    579568    for (size_t i = 0, size = data.otherPrimeInfos().size(); i < size; ++i) {
    580569        JSObject* jsPrimeInfo = constructEmptyObject(exec);
     
    703692    auto scope = DECLARE_THROW_SCOPE(vm);
    704693    JSArray* keyOps = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), 0);
    705     if (UNLIKELY(scope.exception()))
    706         return;
     694    RETURN_IF_EXCEPTION(scope, void());
    707695
    708696    unsigned index = 0;
     
    742730
    743731    addJWKAlgorithmToJSON(exec, result, key);
    744     if (UNLIKELY(scope.exception()))
    745         return String();
     732    RETURN_IF_EXCEPTION(scope, String());
    746733
    747734    addBoolToJSON(exec, result, "ext", key.extractable());
    748735
    749736    addUsagesToJSON(exec, result, key.usagesBitmap());
    750     if (UNLIKELY(scope.exception()))
    751         return String();
     737    RETURN_IF_EXCEPTION(scope, String());
    752738
    753739    if (is<CryptoKeyDataOctetSequence>(*keyData))
     
    759745        return String();
    760746    }
    761     if (UNLIKELY(scope.exception()))
    762         return String();
     747    RETURN_IF_EXCEPTION(scope, String());
    763748
    764749    return JSONStringify(exec, result, 0);
  • trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp

    r205569 r206386  
    112112    JSValue newElement = construct(&state, constructor, constructType, constructData, args);
    113113    InspectorInstrumentation::didCallFunction(cookie, &document);
    114     if (UNLIKELY(scope.exception()))
    115         return nullptr;
     114    RETURN_IF_EXCEPTION(scope, nullptr);
    116115
    117116    ASSERT(!newElement.isEmpty());
     
    168167    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, *m_isolatedWorld);
    169168    ExecState* state = globalObject->globalExec();
    170     if (UNLIKELY(scope.exception()))
    171         return;
     169    RETURN_IF_EXCEPTION(scope, void());
    172170
    173171    ConstructData constructData;
  • trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp

    r206252 r206386  
    4747
    4848    JSValue callback = prototype.get(&state, id);
    49     if (UNLIKELY(scope.exception()))
    50         return nullptr;
     49    RETURN_IF_EXCEPTION(scope, nullptr);
    5150    if (callback.isUndefined())
    5251        return nullptr;
     
    8988
    9089    AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state));
    91     if (UNLIKELY(scope.exception()))
    92         return jsUndefined();
     90    RETURN_IF_EXCEPTION(scope, JSValue());
    9391
    9492    JSValue constructorValue = state.uncheckedArgument(1);
     
    119117
    120118    JSValue prototypeValue = constructor->get(&state, vm.propertyNames->prototype);
    121     if (UNLIKELY(scope.exception()))
    122         return jsUndefined();
     119    RETURN_IF_EXCEPTION(scope, JSValue());
    123120    if (!prototypeValue.isObject())
    124121        return throwTypeError(&state, scope, ASCIILiteral("Custom element constructor's prototype must be an object"));
     
    130127    if (auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback")))
    131128        elementInterface->setConnectedCallback(connectedCallback);
    132     if (UNLIKELY(scope.exception()))
    133         return jsUndefined();
     129    RETURN_IF_EXCEPTION(scope, JSValue());
    134130
    135131    if (auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback")))
    136132        elementInterface->setDisconnectedCallback(disconnectedCallback);
    137     if (UNLIKELY(scope.exception()))
    138         return jsUndefined();
     133    RETURN_IF_EXCEPTION(scope, JSValue());
    139134
    140135    if (auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback")))
    141136        elementInterface->setAdoptedCallback(adoptedCallback);
    142     if (UNLIKELY(scope.exception()))
    143         return jsUndefined();
     137    RETURN_IF_EXCEPTION(scope, JSValue());
    144138
    145139    auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback"));
    146     if (UNLIKELY(scope.exception()))
    147         return jsUndefined();
     140    RETURN_IF_EXCEPTION(scope, JSValue());
    148141    if (attributeChangedCallback) {
    149142        auto value = convertOptional<Vector<String>>(state, constructor->get(&state, Identifier::fromString(&state, "observedAttributes")));
    150         if (UNLIKELY(scope.exception()))
    151             return jsUndefined();
     143        RETURN_IF_EXCEPTION(scope, JSValue());
    152144        if (value)
    153145            elementInterface->setAttributeChangedCallback(attributeChangedCallback, *value);
     
    171163
    172164    AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state));
    173     if (UNLIKELY(scope.exception()))
    174         return jsUndefined();
     165    RETURN_IF_EXCEPTION(scope, JSValue());
    175166
    176167    if (!validateCustomElementNameAndThrowIfNeeded(state, localName)) {
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp

    r206354 r206386  
    124124
    125125    String string = value.toWTFString(exec);
    126     if (UNLIKELY(scope.exception()))
    127         return { };
     126    RETURN_IF_EXCEPTION(scope, { });
    128127    StringView view { string };
    129128
     
    403402    CallType callType;
    404403    JSValue applyMethod = object->getMethod(&state, callData, callType, vm.propertyNames->iteratorSymbol, ASCIILiteral("Symbol.iterator property should be callable"));
    405     if (UNLIKELY(scope.exception()))
    406         return false;
     404    RETURN_IF_EXCEPTION(scope, false);
    407405
    408406    return !applyMethod.isUndefined();
     
    542540
    543541    double x = value.toNumber(&state);
    544     if (UNLIKELY(scope.exception()))
    545         return 0;
     542    RETURN_IF_EXCEPTION(scope, 0);
    546543
    547544    switch (configuration) {
     
    589586
    590587    double x = value.toNumber(&state);
    591     if (UNLIKELY(scope.exception()))
    592         return 0;
     588    RETURN_IF_EXCEPTION(scope, 0);
    593589
    594590    switch (configuration) {
     
    682678
    683679    double x = value.toNumber(&state);
    684     if (UNLIKELY(scope.exception()))
    685         return 0;
     680    RETURN_IF_EXCEPTION(scope, 0);
    686681    return enforceRange(state, x, kMinInt32, kMaxInt32);
    687682}
     
    715710
    716711    double x = value.toNumber(&state);
    717     if (UNLIKELY(scope.exception()))
    718         return 0;
     712    RETURN_IF_EXCEPTION(scope, 0);
    719713    return enforceRange(state, x, 0, kMaxUInt32);
    720714}
     
    726720
    727721    double x = value.toNumber(&state);
    728     if (UNLIKELY(scope.exception()))
    729         return 0;
     722    RETURN_IF_EXCEPTION(scope, 0);
    730723    return enforceRange(state, x, -kJSMaxInteger, kJSMaxInteger);
    731724}
     
    737730
    738731    double x = value.toNumber(&state);
    739     if (UNLIKELY(scope.exception()))
    740         return 0;
     732    RETURN_IF_EXCEPTION(scope, 0);
    741733    return enforceRange(state, x, 0, kJSMaxInteger);
    742734}
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.h

    r206354 r206386  
    580580
    581581    JSC::JSValue lengthValue = object->get(&exec, exec.propertyNames().length);
    582     if (UNLIKELY(scope.exception()))
    583         return nullptr;
     582    RETURN_IF_EXCEPTION(scope, nullptr);
    584583
    585584    if (lengthValue.isUndefinedOrNull()) {
     
    589588
    590589    length = lengthValue.toUInt32(&exec);
    591     if (UNLIKELY(scope.exception()))
    592         return nullptr;
     590    RETURN_IF_EXCEPTION(scope, nullptr);
    593591
    594592    return object;
     
    636634
    637635    JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size());
    638     if (UNLIKELY(scope.exception()))
    639         return JSC::jsUndefined();
     636    RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    640637    for (size_t i = 0; i < vector.size(); ++i)
    641638        array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i]));
     
    649646
    650647    JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size());
    651     if (UNLIKELY(scope.exception()))
    652         return JSC::jsUndefined();
     648    RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    653649    for (size_t i = 0; i < vector.size(); ++i)
    654650        array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i].get()));
     
    739735    for (auto& element : vector) {
    740736        list.append(JSValueTraits<T>::arrayJSValue(exec, globalObject, element));
    741         if (UNLIKELY(scope.exception()))
    742             return JSC::jsUndefined();
     737        RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    743738    }
    744739    auto* array = JSC::constructArray(exec, nullptr, globalObject, list);
    745     if (UNLIKELY(scope.exception()))
    746         return JSC::jsUndefined();
     740    RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    747741    return JSC::objectConstructorFreeze(exec, array);
    748742}
  • trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp

    r206252 r206386  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    107107    auto scope = DECLARE_CATCH_SCOPE(vm);
    108108
    109     if (!scope.exception())
     109    if (LIKELY(!scope.exception()))
    110110        return;
    111111
  • trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp

    r205569 r206386  
    8383
    8484    String stringValue = value.toString(exec)->value(exec);
    85     if (UNLIKELY(scope.exception()))
    86         return false;
     85    RETURN_IF_EXCEPTION(scope, false);
    8786
    8887    ExceptionCode ec = 0;
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r206359 r206386  
    398398
    399399    String locationString = value.toString(&state)->value(&state);
    400     if (UNLIKELY(scope.exception()))
    401         return;
     400    RETURN_IF_EXCEPTION(scope, void());
    402401
    403402    if (Location* location = wrapped().location())
     
    426425
    427426    String urlString = valueToUSVStringWithUndefinedOrNullCheck(&state, state.argument(0));
    428     if (UNLIKELY(scope.exception()))
    429         return jsUndefined();
     427    RETURN_IF_EXCEPTION(scope, JSValue());
    430428    JSValue targetValue = state.argument(1);
    431429    AtomicString target = targetValue.isUndefinedOrNull() ? AtomicString("_blank", AtomicString::ConstructFromLiteral) : targetValue.toString(&state)->toAtomicString(&state);
    432     if (UNLIKELY(scope.exception()))
    433         return jsUndefined();
     430    RETURN_IF_EXCEPTION(scope, JSValue());
    434431    String windowFeaturesString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(2));
    435     if (UNLIKELY(scope.exception()))
    436         return jsUndefined();
     432    RETURN_IF_EXCEPTION(scope, JSValue());
    437433
    438434    RefPtr<DOMWindow> openedWindow = wrapped().open(urlString, target, windowFeaturesString, activeDOMWindow(&state), firstDOMWindow(&state));
     
    489485
    490486    String urlString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(0));
    491     if (UNLIKELY(scope.exception()))
    492         return jsUndefined();
     487    RETURN_IF_EXCEPTION(scope, JSValue());
    493488    String dialogFeaturesString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(2));
    494     if (UNLIKELY(scope.exception()))
    495         return jsUndefined();
     489    RETURN_IF_EXCEPTION(scope, JSValue());
    496490
    497491    DialogHandler handler(state);
     
    530524        fillMessagePortArray(state, state.argument(transferablesArgIndex), messagePorts, arrayBuffers);
    531525    }
    532     if (UNLIKELY(scope.exception()))
    533         return jsUndefined();
     526    RETURN_IF_EXCEPTION(scope, JSValue());
    534527
    535528    auto message = SerializedScriptValue::create(&state, state.uncheckedArgument(0), &messagePorts, &arrayBuffers);
    536529
    537     if (UNLIKELY(scope.exception()))
    538         return jsUndefined();
     530    RETURN_IF_EXCEPTION(scope, JSValue());
    539531
    540532    String targetOrigin = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(targetOriginArgIndex));
    541     if (UNLIKELY(scope.exception()))
    542         return jsUndefined();
     533    RETURN_IF_EXCEPTION(scope, JSValue());
    543534
    544535    ExceptionCode ec = 0;
     
    564555    ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr;
    565556    std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), contentSecurityPolicy);
    566     if (UNLIKELY(scope.exception()))
    567         return jsUndefined();
     557    RETURN_IF_EXCEPTION(scope, JSValue());
    568558
    569559    if (!action)
     
    589579    ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr;
    590580    std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), contentSecurityPolicy);
    591     if (UNLIKELY(scope.exception()))
    592         return jsUndefined();
     581    RETURN_IF_EXCEPTION(scope, JSValue());
    593582    int delay = state.argument(1).toInt32(&state);
    594583
  • trunk/Source/WebCore/bindings/js/JSDataCueCustom.cpp

    r205569 r206386  
    5959
    6060    double startTime(exec.uncheckedArgument(0).toNumber(&exec));
    61     if (UNLIKELY(scope.exception()))
    62         return JSValue::encode(jsUndefined());
     61    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6362
    6463    double endTime(exec.uncheckedArgument(1).toNumber(&exec));
    65     if (UNLIKELY(scope.exception()))
    66         return JSValue::encode(jsUndefined());
     64    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6765
    6866    ScriptExecutionContext* context = castedThis->scriptExecutionContext();
     
    8886
    8987        ArrayBuffer* data = toArrayBuffer(valueArgument);
    90         if (UNLIKELY(scope.exception()))
    91             return JSValue::encode(jsUndefined());
     88        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9289
    9390        if (UNLIKELY(!data)) {
  • trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp

    r205569 r206386  
    5656
    5757    JSValue xValue = object->get(&state, Identifier::fromString(&state, "x"));
    58     if (UNLIKELY(scope.exception()))
    59         return nullptr;
     58    RETURN_IF_EXCEPTION(scope, nullptr);
    6059    bool canProvideX = !xValue.isUndefinedOrNull();
    6160    double x = xValue.toNumber(&state);
    62     if (UNLIKELY(scope.exception()))
    63         return nullptr;
     61    RETURN_IF_EXCEPTION(scope, nullptr);
    6462
    6563    JSValue yValue = object->get(&state, Identifier::fromString(&state, "y"));
    66     if (UNLIKELY(scope.exception()))
    67         return nullptr;
     64    RETURN_IF_EXCEPTION(scope, nullptr);
    6865    bool canProvideY = !yValue.isUndefinedOrNull();
    6966    double y = yValue.toNumber(&state);
    70     if (UNLIKELY(scope.exception()))
    71         return nullptr;
     67    RETURN_IF_EXCEPTION(scope, nullptr);
    7268
    7369    JSValue zValue = object->get(&state, Identifier::fromString(&state, "z"));
    74     if (UNLIKELY(scope.exception()))
    75         return nullptr;
     70    RETURN_IF_EXCEPTION(scope, nullptr);
    7671    bool canProvideZ = !zValue.isUndefinedOrNull();
    7772    double z = zValue.toNumber(&state);
    78     if (UNLIKELY(scope.exception()))
    79         return nullptr;
     73    RETURN_IF_EXCEPTION(scope, nullptr);
    8074
    8175    if (!canProvideX && !canProvideY && !canProvideZ)
     
    9892
    9993    JSValue alphaValue = object->get(&state, Identifier::fromString(&state, "alpha"));
    100     if (UNLIKELY(scope.exception()))
    101         return nullptr;
     94    RETURN_IF_EXCEPTION(scope, nullptr);
    10295    bool canProvideAlpha = !alphaValue.isUndefinedOrNull();
    10396    double alpha = alphaValue.toNumber(&state);
    104     if (UNLIKELY(scope.exception()))
    105         return nullptr;
     97    RETURN_IF_EXCEPTION(scope, nullptr);
    10698
    10799    JSValue betaValue = object->get(&state, Identifier::fromString(&state, "beta"));
    108     if (UNLIKELY(scope.exception()))
    109         return nullptr;
     100    RETURN_IF_EXCEPTION(scope, nullptr);
    110101    bool canProvideBeta = !betaValue.isUndefinedOrNull();
    111102    double beta = betaValue.toNumber(&state);
    112     if (UNLIKELY(scope.exception()))
    113         return nullptr;
     103    RETURN_IF_EXCEPTION(scope, nullptr);
    114104
    115105    JSValue gammaValue = object->get(&state, Identifier::fromString(&state, "gamma"));
    116     if (UNLIKELY(scope.exception()))
    117         return nullptr;
     106    RETURN_IF_EXCEPTION(scope, nullptr);
    118107    bool canProvideGamma = !gammaValue.isUndefinedOrNull();
    119108    double gamma = gammaValue.toNumber(&state);
    120     if (UNLIKELY(scope.exception()))
    121         return nullptr;
     109    RETURN_IF_EXCEPTION(scope, nullptr);
    122110
    123111    if (!canProvideAlpha && !canProvideBeta && !canProvideGamma)
     
    189177    // Otherwise, use the standard JavaScript conversion.
    190178    RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(state.argument(3), state);
    191     if (UNLIKELY(scope.exception()))
    192         return jsUndefined();
     179    RETURN_IF_EXCEPTION(scope, JSValue());
    193180
    194181    RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(state.argument(4), state);
    195     if (UNLIKELY(scope.exception()))
    196         return jsUndefined();
     182    RETURN_IF_EXCEPTION(scope, JSValue());
    197183
    198184    RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(state.argument(5), state);
    199     if (UNLIKELY(scope.exception()))
    200         return jsUndefined();
     185    RETURN_IF_EXCEPTION(scope, JSValue());
    201186
    202187    bool intervalProvided = !state.argument(6).isUndefinedOrNull();
  • trunk/Source/WebCore/bindings/js/JSDictionary.cpp

    r205569 r206386  
    8989        return true;
    9090    });
    91     if (UNLIKELY(scope.exception()))
    92         return ExceptionThrown;
     91    RETURN_IF_EXCEPTION(scope, ExceptionThrown);
    9392    return propertyFound ? PropertyFound : NoPropertyFound;
    9493}
     
    162161    unsigned length = 0;
    163162    JSObject* object = toJSSequence(*exec, value, length);
    164     if (UNLIKELY(scope.exception()))
    165         return;
     163    RETURN_IF_EXCEPTION(scope, void());
    166164
    167165    for (unsigned i = 0 ; i < length; ++i) {
    168166        JSValue itemValue = object->get(exec, i);
    169         if (UNLIKELY(scope.exception()))
    170             return;
     167        RETURN_IF_EXCEPTION(scope, void());
    171168        result.append(itemValue.toString(exec)->value(exec));
    172169    }
     
    237234    unsigned length = 0;
    238235    JSObject* object = toJSSequence(*exec, value, length);
    239     if (UNLIKELY(scope.exception()))
    240         return;
     236    RETURN_IF_EXCEPTION(scope, void());
    241237
    242238    for (unsigned i = 0 ; i < length; ++i) {
    243239        JSValue itemValue = object->get(exec, i);
    244         if (UNLIKELY(scope.exception()))
    245             return;
     240        RETURN_IF_EXCEPTION(scope, void());
    246241        result.add(itemValue.toString(exec)->value(exec));
    247242    }
     
    314309    unsigned length = 0;
    315310    JSObject* object = toJSSequence(*exec, value, length);
    316     if (UNLIKELY(scope.exception()))
    317         return;
     311    RETURN_IF_EXCEPTION(scope, void());
    318312
    319313    for (unsigned i = 0 ; i < length; ++i) {
    320314        JSValue itemValue = object->get(exec, i);
    321         if (UNLIKELY(scope.exception()))
    322             return;
     315        RETURN_IF_EXCEPTION(scope, void());
    323316
    324317        auto stream = JSMediaStream::toWrapped(itemValue);
  • trunk/Source/WebCore/bindings/js/JSDictionary.h

    r205569 r206386  
    216216        convertValue(m_exec, value, result);
    217217
    218         if (UNLIKELY(scope.exception()))
    219             return ExceptionThrown;
     218        RETURN_IF_EXCEPTION(scope, ExceptionThrown);
    220219
    221220        setter(context, result);
  • trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp

    r205569 r206386  
    154154        return throwException(&state, scope, createNotEnoughArgumentsError(&state));
    155155    auto contextId = state.uncheckedArgument(0).toWTFString(&state);
    156     if (UNLIKELY(scope.exception()))
    157         return jsUndefined();
     156    RETURN_IF_EXCEPTION(scope, JSValue());
    158157    auto name = state.uncheckedArgument(1).toWTFString(&state);
    159     if (UNLIKELY(scope.exception()))
    160         return jsUndefined();
     158    RETURN_IF_EXCEPTION(scope, JSValue());
    161159    auto width = convert<int32_t>(state, state.uncheckedArgument(2), NormalConversion);
    162     if (UNLIKELY(scope.exception()))
    163         return jsUndefined();
     160    RETURN_IF_EXCEPTION(scope, JSValue());
    164161    auto height = convert<int32_t>(state, state.uncheckedArgument(3), NormalConversion);
    165     if (UNLIKELY(scope.exception()))
    166         return jsUndefined();
     162    RETURN_IF_EXCEPTION(scope, JSValue());
    167163
    168164    auto* context = wrapped().getCSSCanvasContext(WTFMove(contextId), WTFMove(name), WTFMove(width), WTFMove(height));
  • trunk/Source/WebCore/bindings/js/JSFileCustom.cpp

    r205569 r206386  
    6161    unsigned blobPartsLength = 0;
    6262    JSObject* blobParts = toJSSequence(exec, arg, blobPartsLength);
    63     if (UNLIKELY(scope.exception()))
    64         return JSValue::encode(jsUndefined());
     63    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6564    ASSERT(blobParts);
    6665
     
    7069
    7170    String filename = arg.toWTFString(&exec).replace('/', ':');
    72     if (UNLIKELY(scope.exception()))
    73         return JSValue::encode(jsUndefined());
     71    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7472
    7573    String normalizedType;
     
    8886        String type;
    8987        dictionary.get("type", type);
    90         if (UNLIKELY(scope.exception()))
    91             return JSValue::encode(jsUndefined());
     88        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9289
    9390        normalizedType = Blob::normalizedContentType(type);
     
    9693        if (type.isEmpty() ||  !normalizedType.isEmpty()) {
    9794            dictionary.get("lastModified", lastModified);
    98             if (UNLIKELY(scope.exception()))
    99                 return JSValue::encode(jsUndefined());
     95            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    10096        }
    10197    }
     
    108104    for (unsigned i = 0; i < blobPartsLength; ++i) {
    109105        JSValue item = blobParts->get(&exec, i);
    110         if (UNLIKELY(scope.exception()))
    111             return JSValue::encode(jsUndefined());
     106        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    112107
    113108        if (ArrayBuffer* arrayBuffer = toArrayBuffer(item))
     
    119114        else {
    120115            String string = item.toWTFString(&exec);
    121             if (UNLIKELY(scope.exception()))
    122                 return JSValue::encode(jsUndefined());
     116            RETURN_IF_EXCEPTION(scope, encodedJSValue());
    123117            blobBuilder.append(string, ASCIILiteral("transparent"));
    124118        }
  • trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp

    r205569 r206386  
    109109
    110110    auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0));
    111     if (UNLIKELY(scope.exception()))
    112         return jsUndefined();
     111    RETURN_IF_EXCEPTION(scope, JSValue());
    113112    ASSERT(positionCallback);
    114113
    115114    auto positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(&state, globalObject(), state.argument(1), CallbackAllowUndefined | CallbackAllowNull);
    116     if (UNLIKELY(scope.exception()))
    117         return jsUndefined();
     115    RETURN_IF_EXCEPTION(scope, JSValue());
    118116
    119117    auto positionOptions = createPositionOptions(&state, state.argument(2));
    120     if (UNLIKELY(scope.exception()))
    121         return jsUndefined();
     118    RETURN_IF_EXCEPTION(scope, JSValue());
    122119    ASSERT(positionOptions);
    123120
     
    134131
    135132    auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0));
    136     if (UNLIKELY(scope.exception()))
    137         return jsUndefined();
     133    RETURN_IF_EXCEPTION(scope, JSValue());
    138134    ASSERT(positionCallback);
    139135
    140136    auto positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(&state, globalObject(), state.argument(1), CallbackAllowUndefined | CallbackAllowNull);
    141     if (UNLIKELY(scope.exception()))
    142         return jsUndefined();
     137    RETURN_IF_EXCEPTION(scope, JSValue());
    143138
    144139    auto positionOptions = createPositionOptions(&state, state.argument(2));
    145     if (UNLIKELY(scope.exception()))
    146         return jsUndefined();
     140    RETURN_IF_EXCEPTION(scope, JSValue());
    147141    ASSERT(positionOptions);
    148142
  • trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp

    r205569 r206386  
    6969        // Support for document.all(<index>) etc.
    7070        String string = exec->argument(0).toString(exec)->value(exec);
    71         if (UNLIKELY(scope.exception()))
    72             return JSValue::encode(jsUndefined());
     71        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7372        if (Optional<uint32_t> index = parseIndex(*string.impl()))
    7473            return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection.item(index.value())));
     
    8079    // The second arg, if set, is the index of the item we want
    8180    String string = exec->argument(0).toString(exec)->value(exec);
    82     if (UNLIKELY(scope.exception()))
    83         return JSValue::encode(jsUndefined());
     81    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    8482    if (Optional<uint32_t> index = parseIndex(*exec->argument(1).toWTFString(exec).impl())) {
    8583        if (auto* item = collection.namedItemWithIndex(string, index.value()))
  • trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp

    r205569 r206386  
    8787    if (HTMLCanvasElement::is3dType(contextId)) {
    8888        get3DContextAttributes(state, attrs);
    89         if (UNLIKELY(scope.exception()))
    90             return jsUndefined();
     89        RETURN_IF_EXCEPTION(scope, JSValue());
    9190    }
    9291#endif
  • trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp

    r205569 r206386  
    7979        Structure* baseStructure = getDOMStructure<JSHTMLElement>(vm, *globalObject);
    8080        auto* newElementStructure = InternalFunction::createSubclassStructure(&exec, newTargetValue, baseStructure);
    81         if (UNLIKELY(scope.exception()))
    82             return JSValue::encode(jsUndefined());
     81        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    8382
    8483        Ref<HTMLElement> element = HTMLElement::create(elementInterface->name(), document);
     
    9998
    10099    JSValue newPrototype = newTarget->get(&exec, vm.propertyNames->prototype);
    101     if (UNLIKELY(scope.exception()))
    102         return JSValue::encode(jsUndefined());
     100    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    103101
    104102    JSObject* elementWrapperObject = asObject(elementWrapperValue);
    105103    JSObject::setPrototype(elementWrapperObject, &exec, newPrototype, true /* shouldThrowIfCantSet */);
    106     if (UNLIKELY(scope.exception()))
    107         return JSValue::encode(jsUndefined());
     104    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    108105
    109106    elementInterface->didUpgradeLastElementInConstructionStack();
  • trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp

    r205569 r206386  
    6464
    6565    auto historyState = SerializedScriptValue::create(&state, state.uncheckedArgument(0), 0, 0);
    66     if (UNLIKELY(scope.exception()))
    67         return jsUndefined();
     66    RETURN_IF_EXCEPTION(scope, JSValue());
    6867
    6968    // FIXME: title should not be nullable.
    7069    String title = valueToStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(1));
    71     if (UNLIKELY(scope.exception()))
    72         return jsUndefined();
     70    RETURN_IF_EXCEPTION(scope, JSValue());
    7371
    7472    String url;
    7573    if (argCount > 2) {
    7674        url = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(2));
    77         if (UNLIKELY(scope.exception()))
    78             return jsUndefined();
     75        RETURN_IF_EXCEPTION(scope, JSValue());
    7976    }
    8077
     
    9895
    9996    auto historyState = SerializedScriptValue::create(&state, state.uncheckedArgument(0), 0, 0);
    100     if (UNLIKELY(scope.exception()))
    101         return jsUndefined();
     97    RETURN_IF_EXCEPTION(scope, JSValue());
    10298
    10399    // FIXME: title should not be nullable.
    104100    String title = valueToStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(1));
    105     if (UNLIKELY(scope.exception()))
    106         return jsUndefined();
     101    RETURN_IF_EXCEPTION(scope, JSValue());
    107102
    108103    String url;
    109104    if (argCount > 2) {
    110105        url = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(2));
    111         if (UNLIKELY(scope.exception()))
    112             return jsUndefined();
     106        RETURN_IF_EXCEPTION(scope, JSValue());
    113107    }
    114108
  • trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp

    r205569 r206386  
    5656
    5757    String name = state.argument(0).toString(&state)->value(&state);
    58     if (UNLIKELY(scope.exception()))
    59         return jsUndefined();
     58    RETURN_IF_EXCEPTION(scope, JSValue());
    6059
    6160    JSValue optionsValue = state.argument(1);
     
    6766    if (!optionsValue.isUndefinedOrNull()) {
    6867        JSValue keyPathValue = optionsValue.get(&state, Identifier::fromString(&state, "keyPath"));
    69         if (UNLIKELY(scope.exception()))
    70             return jsUndefined();
     68        RETURN_IF_EXCEPTION(scope, JSValue());
    7169
    7270        if (!keyPathValue.isUndefinedOrNull()) {
    7371            keyPath = idbKeyPathFromValue(state, keyPathValue);
    74             if (UNLIKELY(scope.exception()))
    75                 return jsUndefined();
     72            RETURN_IF_EXCEPTION(scope, JSValue());
    7673        }
    7774
    7875        autoIncrement = optionsValue.get(&state, Identifier::fromString(&state, "autoIncrement")).toBoolean(&state);
    79         if (UNLIKELY(scope.exception()))
    80             return jsUndefined();
     76        RETURN_IF_EXCEPTION(scope, JSValue());
    8177    }
    8278
  • trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp

    r205569 r206386  
    120120        arrayBuffers = std::make_unique<ArrayBufferArray>();
    121121        fillMessagePortArray(state, state.argument(7), *messagePorts, *arrayBuffers);
    122         if (UNLIKELY(scope.exception()))
    123             return jsUndefined();
     122        RETURN_IF_EXCEPTION(scope, JSValue());
    124123    }
    125124    Deprecated::ScriptValue dataArg(vm, state.argument(3));
    126     if (UNLIKELY(scope.exception()))
    127         return jsUndefined();
     125    RETURN_IF_EXCEPTION(scope, JSValue());
    128126
    129127    MessageEvent& event = jsEvent->wrapped();
  • trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp

    r205569 r206386  
    7474    unsigned length = 0;
    7575    JSObject* object = toJSSequence(state, value, length);
    76     if (UNLIKELY(scope.exception()))
    77         return;
     76    RETURN_IF_EXCEPTION(scope, void());
    7877
    7978    for (unsigned i = 0 ; i < length; ++i) {
    8079        JSValue value = object->get(&state, i);
    81         if (UNLIKELY(scope.exception()))
    82             return;
     80        RETURN_IF_EXCEPTION(scope, void());
    8381        // Validation of non-null objects, per HTML5 spec 10.3.3.
    8482        if (value.isUndefinedOrNull()) {
  • trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h

    r205569 r206386  
    6262        fillMessagePortArray(state, state.argument(1), portArray, arrayBufferArray);
    6363        auto message = SerializedScriptValue::create(&state, state.uncheckedArgument(0), &portArray, &arrayBufferArray);
    64         if (UNLIKELY(scope.exception()))
    65             return JSC::jsUndefined();
     64        RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    6665
    6766        ExceptionCode ec = 0;
  • trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp

    r205569 r206386  
    6363
    6464    uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) };
    65     if (UNLIKELY(scope.exception()))
    66         return;
     65    RETURN_IF_EXCEPTION(scope, void());
    6766
    6867    DecisionPoint decisionPoint { static_cast<DecisionPoint>(nativeValue) };
     
    9998
    10099    uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) };
    101     if (UNLIKELY(scope.exception()))
    102         return Decision::Allow;
     100    RETURN_IF_EXCEPTION(scope, Decision::Allow);
    103101
    104102    Decision decision { static_cast<Decision>(nativeValue) };
     
    124122
    125123    Decision decision { toDecision(state, value) };
    126     if (UNLIKELY(scope.exception()))
    127         return;
     124    RETURN_IF_EXCEPTION(scope, void());
    128125
    129126    wrapped().setDecision(decision);
     
    141138
    142139    Decision unblockRequestDecision { toDecision(state, value) };
    143     if (UNLIKELY(scope.exception()))
    144         return;
     140    RETURN_IF_EXCEPTION(scope, void());
    145141
    146142    wrapped().setUnblockRequestDecision(unblockRequestDecision);
  • trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp

    r205569 r206386  
    5050    MarkedArgumentBuffer args;
    5151    args.append(toJS(state, m_data->globalObject(), node));
    52     if (UNLIKELY(scope.exception()))
    53         return NodeFilter::FILTER_REJECT;
     52    RETURN_IF_EXCEPTION(scope, NodeFilter::FILTER_REJECT);
    5453
    5554    NakedPtr<Exception> returnedException;
     
    6463
    6564    uint16_t result = convert<uint16_t>(*state, value, NormalConversion);
    66     if (UNLIKELY(scope.exception()))
    67         return NodeFilter::FILTER_REJECT;
     65    RETURN_IF_EXCEPTION(scope, NodeFilter::FILTER_REJECT);
    6866
    6967    return result;
  • trunk/Source/WebCore/bindings/js/JSNodeOrString.cpp

    r205569 r206386  
    5151        else {
    5252            String string = value.toWTFString(&state);
    53             if (UNLIKELY(scope.exception()))
    54                 return { };
     53            RETURN_IF_EXCEPTION(scope, { });
    5554            result.uncheckedAppend(string);
    5655        }
  • trunk/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp

    r205569 r206386  
    5454
    5555    String sqlStatement = state.argument(0).toString(&state)->value(&state);
    56     if (UNLIKELY(scope.exception()))
    57         return jsUndefined();
     56    RETURN_IF_EXCEPTION(scope, JSValue());
    5857
    5958    // Now assemble the list of SQL arguments
     
    6766
    6867        JSValue lengthValue = object->get(&state, state.propertyNames().length);
    69         if (UNLIKELY(scope.exception()))
    70             return jsUndefined();
     68        RETURN_IF_EXCEPTION(scope, JSValue());
    7169        unsigned length = lengthValue.toUInt32(&state);
    72         if (UNLIKELY(scope.exception()))
    73             return jsUndefined();
     70        RETURN_IF_EXCEPTION(scope, JSValue());
    7471
    7572        for (unsigned i = 0 ; i < length; ++i) {
    7673            JSValue value = object->get(&state, i);
    77             if (UNLIKELY(scope.exception()))
    78                 return jsUndefined();
     74            RETURN_IF_EXCEPTION(scope, JSValue());
    7975
    8076            if (value.isUndefinedOrNull())
     
    8581                // Convert the argument to a string and append it
    8682                sqlValues.append(value.toString(&state)->value(&state));
    87                 if (UNLIKELY(scope.exception()))
    88                     return jsUndefined();
     83                RETURN_IF_EXCEPTION(scope, JSValue());
    8984            }
    9085        }
  • trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp

    r205569 r206386  
    9191
    9292    unsigned short unitType = state.uncheckedArgument(0).toUInt32(&state);
    93     if (UNLIKELY(scope.exception()))
    94         return jsUndefined();
     93    RETURN_IF_EXCEPTION(scope, JSValue());
    9594
    9695    ExceptionCode ec = 0;
  • trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp

    r205569 r206386  
    8787    unsigned length = thisObject->wrapped().length(ec);
    8888    setDOMException(exec, ec);
    89     if (UNLIKELY(scope.exception()))
    90         return;
     89    RETURN_IF_EXCEPTION(scope, void());
    9190    for (unsigned i = 0; i < length; ++i) {
    9291        propertyNames.add(Identifier::fromString(exec, thisObject->wrapped().key(i, ec)));
    9392        setDOMException(exec, ec);
    94         if (UNLIKELY(scope.exception()))
    95             return;
     93        RETURN_IF_EXCEPTION(scope, void());
    9694    }
    9795       
  • trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp

    r205569 r206386  
    4949
    5050    auto& string = value.toString(&state)->value(&state);
    51     if (UNLIKELY(scope.exception()))
    52         return;
     51    RETURN_IF_EXCEPTION(scope, void());
    5352    wrapped().setLanguage(string);
    5453#else
  • trunk/Source/WebCore/bindings/js/JSVideoTrackCustom.cpp

    r205569 r206386  
    4848
    4949    auto& string = value.toString(&state)->value(&state);
    50     if (UNLIKELY(scope.exception()))
    51         return;
     50    RETURN_IF_EXCEPTION(scope, void());
    5251    wrapped().setKind(string);
    5352#else
     
    6463
    6564    auto& string = value.toString(&state)->value(&state);
    66     if (UNLIKELY(scope.exception()))
    67         return;
     65    RETURN_IF_EXCEPTION(scope, void());
    6866    wrapped().setLanguage(string);
    6967#else
  • trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp

    r205569 r206386  
    107107    WebGL2RenderingContext& context = wrapped();
    108108    unsigned pname = exec.uncheckedArgument(0).toInt32(&exec);
    109     if (UNLIKELY(scope.exception()))
    110         return jsUndefined();
     109    RETURN_IF_EXCEPTION(scope, JSValue());
    111110    unsigned index = exec.uncheckedArgument(1).toInt32(&exec);
    112     if (UNLIKELY(scope.exception()))
    113         return jsUndefined();
     111    RETURN_IF_EXCEPTION(scope, JSValue());
    114112    WebGLGetInfo info = context.getIndexedParameter(pname, index);
    115113    return toJS(&exec, globalObject(), info);
  • trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp

    r205569 r206386  
    200200    WebGLRenderingContextBase& context = obj->wrapped();
    201201    unsigned target = state.uncheckedArgument(0).toInt32(&state);
    202     if (UNLIKELY(scope.exception()))
    203         return jsUndefined();
     202    RETURN_IF_EXCEPTION(scope, JSValue());
    204203    unsigned pname = state.uncheckedArgument(1).toInt32(&state);
    205     if (UNLIKELY(scope.exception()))
    206         return jsUndefined();
     204    RETURN_IF_EXCEPTION(scope, JSValue());
    207205    WebGLGetInfo info;
    208206    switch (objectType) {
     
    336334    WebGLRenderingContextBase& context = wrapped();
    337335    const String name = state.uncheckedArgument(0).toString(&state)->value(&state);
    338     if (UNLIKELY(scope.exception()))
    339         return jsUndefined();
     336    RETURN_IF_EXCEPTION(scope, JSValue());
    340337    WebGLExtension* extension = context.getExtension(name);
    341338    return toJS(&state, globalObject(), extension);
     
    358355    WebGLRenderingContextBase& context = wrapped();
    359356    unsigned target = state.uncheckedArgument(0).toInt32(&state);
    360     if (UNLIKELY(scope.exception()))
    361         return jsUndefined();
     357    RETURN_IF_EXCEPTION(scope, JSValue());
    362358    unsigned attachment = state.uncheckedArgument(1).toInt32(&state);
    363     if (UNLIKELY(scope.exception()))
    364         return jsUndefined();
     359    RETURN_IF_EXCEPTION(scope, JSValue());
    365360    unsigned pname = state.uncheckedArgument(2).toInt32(&state);
    366     if (UNLIKELY(scope.exception()))
    367         return jsUndefined();
     361    RETURN_IF_EXCEPTION(scope, JSValue());
    368362    WebGLGetInfo info = context.getFramebufferAttachmentParameter(target, attachment, pname, ec);
    369363    if (ec) {
     
    385379    WebGLRenderingContextBase& context = wrapped();
    386380    unsigned pname = state.uncheckedArgument(0).toInt32(&state);
    387     if (UNLIKELY(scope.exception()))
    388         return jsUndefined();
     381    RETURN_IF_EXCEPTION(scope, JSValue());
    389382    WebGLGetInfo info = context.getParameter(pname, ec);
    390383    if (ec) {
     
    409402        return throwTypeError(&state, scope);
    410403    unsigned pname = state.uncheckedArgument(1).toInt32(&state);
    411     if (UNLIKELY(scope.exception()))
    412         return jsUndefined();
     404    RETURN_IF_EXCEPTION(scope, JSValue());
    413405    WebGLGetInfo info = context.getProgramParameter(program, pname, ec);
    414406    if (ec) {
     
    438430    WebGLShader* shader = JSWebGLShader::toWrapped(state.uncheckedArgument(0));
    439431    unsigned pname = state.uncheckedArgument(1).toInt32(&state);
    440     if (UNLIKELY(scope.exception()))
    441         return jsUndefined();
     432    RETURN_IF_EXCEPTION(scope, JSValue());
    442433    WebGLGetInfo info = context.getShaderParameter(shader, pname, ec);
    443434    if (ec) {
     
    512503    for (int32_t i = 0; i < length; ++i) {
    513504        JSC::JSValue v = object->get(&state, i);
    514         if (UNLIKELY(scope.exception()))
    515             return false;
     505        RETURN_IF_EXCEPTION(scope, false);
    516506        vector[i] = static_cast<T>(v.toNumber(&state));
    517507    }
     
    560550        index = state.uncheckedArgument(0).toInt32(&state);
    561551   
    562     if (UNLIKELY(scope.exception()))
    563         return jsUndefined();
     552    RETURN_IF_EXCEPTION(scope, JSValue());
    564553   
    565554    RefPtr<Float32Array> webGLArray = toFloat32Array(state.uncheckedArgument(1));
    566     if (UNLIKELY(scope.exception()))
    567         return jsUndefined();
     555    RETURN_IF_EXCEPTION(scope, JSValue());
    568556   
    569557    ExceptionCode ec = 0;
     
    711699   
    712700    bool transpose = state.uncheckedArgument(1).toBoolean(&state);
    713     if (UNLIKELY(scope.exception()))
    714         return jsUndefined();
     701    RETURN_IF_EXCEPTION(scope, JSValue());
    715702   
    716703    RefPtr<Float32Array> webGLArray = toFloat32Array(state.uncheckedArgument(2));
  • trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp

    r206252 r206386  
    8585
    8686    String keyFormatString = value.toString(&state)->value(&state);
    87     if (UNLIKELY(scope.exception()))
    88         return false;
     87    RETURN_IF_EXCEPTION(scope, false);
    8988    if (keyFormatString == "raw")
    9089        result = CryptoKeyFormat::Raw;
     
    118117        JSValue element = array->getIndex(&state, i);
    119118        String usageString = element.toString(&state)->value(&state);
    120         if (UNLIKELY(scope.exception()))
    121             return false;
     119        RETURN_IF_EXCEPTION(scope, false);
    122120        if (usageString == "encrypt")
    123121            result |= CryptoKeyUsageEncrypt;
     
    422420    if (state.argumentCount() >= 2) {
    423421        extractable = state.uncheckedArgument(1).toBoolean(&state);
    424         if (UNLIKELY(scope.exception()))
    425             return jsUndefined();
     422        RETURN_IF_EXCEPTION(scope, JSValue());
    426423    }
    427424
     
    475472        }
    476473        keySerialization = std::make_unique<JSCryptoKeySerializationJWK>(&state, jwkString);
    477         if (UNLIKELY(scope.exception()))
    478             return;
     474        RETURN_IF_EXCEPTION(scope, void());
    479475        break;
    480476    }
     
    492488        return;
    493489    }
    494     if (UNLIKELY(scope.exception()))
    495         return;
     490    RETURN_IF_EXCEPTION(scope, void());
    496491
    497492    algorithm = reconciledResult->algorithm;
     
    504499
    505500    keySerialization->reconcileExtractable(extractable);
    506     if (UNLIKELY(scope.exception()))
    507         return;
     501    RETURN_IF_EXCEPTION(scope, void());
    508502
    509503    keySerialization->reconcileUsages(keyUsages);
    510     if (UNLIKELY(scope.exception()))
    511         return;
     504    RETURN_IF_EXCEPTION(scope, void());
    512505
    513506    auto keyData = keySerialization->keyData();
    514     if (UNLIKELY(scope.exception()))
    515         return;
     507    RETURN_IF_EXCEPTION(scope, void());
    516508
    517509    ExceptionCode ec = 0;
     
    558550    if (state.argumentCount() >= 4) {
    559551        extractable = state.uncheckedArgument(3).toBoolean(&state);
    560         if (UNLIKELY(scope.exception()))
    561             return jsUndefined();
     552        RETURN_IF_EXCEPTION(scope, JSValue());
    562553    }
    563554
     
    580571
    581572    WebCore::importKey(state, keyFormat, data, WTFMove(algorithm), WTFMove(parameters), extractable, keyUsages, WTFMove(successCallback), WTFMove(failureCallback));
    582     if (UNLIKELY(scope.exception()))
    583         return jsUndefined();
     573    RETURN_IF_EXCEPTION(scope, JSValue());
    584574
    585575    return promise;
     
    607597    case CryptoKeyFormat::JWK: {
    608598        String result = JSCryptoKeySerializationJWK::serialize(&state, key);
    609         if (UNLIKELY(scope.exception()))
    610             return;
     599        RETURN_IF_EXCEPTION(scope, void());
    611600        CString utf8String = result.utf8(StrictConversion);
    612601        Vector<uint8_t> resultBuffer;
     
    649638
    650639    WebCore::exportKey(state, keyFormat, *key, WTFMove(successCallback), WTFMove(failureCallback));
    651     if (UNLIKELY(scope.exception()))
    652         return jsUndefined();
     640    RETURN_IF_EXCEPTION(scope, JSValue());
    653641
    654642    return promise;
     
    781769    if (state.argumentCount() >= 6) {
    782770        extractable = state.uncheckedArgument(5).toBoolean(&state);
    783         if (UNLIKELY(scope.exception()))
    784             return jsUndefined();
     771        RETURN_IF_EXCEPTION(scope, JSValue());
    785772    }
    786773
  • trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp

    r205569 r206386  
    5757
    5858    String scriptURL = exec.uncheckedArgument(0).toWTFString(&exec);
    59     if (UNLIKELY(scope.exception()))
    60         return JSValue::encode(JSValue());
     59    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    6160
    6261    // See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject.
  • trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp

    r205569 r206386  
    7171    for (unsigned i = 0; i < state.argumentCount(); ++i) {
    7272        urls.append(valueToUSVString(&state, state.uncheckedArgument(i)));
    73         if (UNLIKELY(scope.exception()))
    74             return jsUndefined();
     73        RETURN_IF_EXCEPTION(scope, JSValue());
    7574    }
    7675    ExceptionCode ec = 0;
     
    9089
    9190    std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), wrapped().contentSecurityPolicy());
    92     if (UNLIKELY(scope.exception()))
    93         return jsUndefined();
     91    RETURN_IF_EXCEPTION(scope, JSValue());
    9492    if (!action)
    9593        return jsNumber(0);
     
    107105
    108106    std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), wrapped().contentSecurityPolicy());
    109     if (UNLIKELY(scope.exception()))
    110         return jsUndefined();
     107    RETURN_IF_EXCEPTION(scope, JSValue());
    111108    if (!action)
    112109        return jsNumber(0);
  • trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp

    r205569 r206386  
    5454
    5555    auto function = object.get(&state, JSC::Identifier::fromString(&state, propertyName));
    56     if (UNLIKELY(scope.exception()))
    57         return JSC::jsUndefined();
     56    RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    5857
    5958    if (!function.isFunction()) {
  • trunk/Source/WebCore/bindings/js/ScheduledAction.cpp

    r205569 r206386  
    5858            return nullptr;
    5959        String string = v.toString(exec)->value(exec);
    60         if (UNLIKELY(scope.exception()))
    61             return nullptr;
     60        RETURN_IF_EXCEPTION(scope, nullptr);
    6261        return std::unique_ptr<ScheduledAction>(new ScheduledAction(string, isolatedWorld));
    6362    }
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r206354 r206386  
    10271027        foreach my $member (@{$dictionary->members}) {
    10281028            if ($needExceptionCheck) {
    1029                 $result .= "    if (UNLIKELY(throwScope.exception()))\n";
    1030                 $result .= "        return Nullopt;\n";
     1029                $result .= "    RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
    10311030            }
    10321031            # FIXME: Eventually we will want this to share a lot more code with JSValueToNative.
     
    32493248                    push(@implContent, "        nativeValue = $nativeValue;\n");
    32503249                    if ($mayThrowException) {
    3251                         push(@implContent, "        if (UNLIKELY(throwScope.exception()))\n");
    3252                         push(@implContent, "            return false;\n");
     3250                        push(@implContent, "        RETURN_IF_EXCEPTION(throwScope, false);\n");
    32533251                    }
    32543252                    push(@implContent, "        if (UNLIKELY(!nativeValue)) {\n");
     
    32603258                    push(@implContent, "    auto nativeValue = $nativeValue;\n");
    32613259                    if ($mayThrowException) {
    3262                         push(@implContent, "    if (UNLIKELY(throwScope.exception()))\n");
    3263                         push(@implContent, "        return false;\n");
     3260                        push(@implContent, "    RETURN_IF_EXCEPTION(throwScope, false);\n");
    32643261                    }
    32653262                }
     
    40094006
    40104007            if (IsNativeType($type)) {
    4011                 push(@$outputArray, "    if (UNLIKELY(throwScope.exception()))\n");
    4012                 push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
     4008                push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
    40134009            }
    40144010            else {
     
    40524048
    40534049            push(@$outputArray, "$indent    $defineOptionalValue = parse<$className>(*state, ${name}Value);\n");
    4054             push(@$outputArray, "$indent    if (UNLIKELY(throwScope.exception()))\n");
    4055             push(@$outputArray, "$indent        return JSValue::encode(jsUndefined());\n");
     4050            push(@$outputArray, "$indent    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
    40564051            push(@$outputArray, "$indent    if (UNLIKELY(!$optionalValue))\n");
    40574052            push(@$outputArray, "$indent        return throwArgumentMustBeEnumError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, expectedEnumerationValues<$className>());\n");
     
    40784073                push(@$outputArray, "        $name = $nativeValue;\n");
    40794074                if ($mayThrowException) {
    4080                     push(@$outputArray, "        if (UNLIKELY(throwScope.exception()))\n");
    4081                     push(@$outputArray, "            return JSValue::encode(jsUndefined());\n");
     4075                    push(@$outputArray, "        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
    40824076                }
    40834077                push(@$outputArray, "        if (UNLIKELY(!$name))\n");
     
    41214115                $value = "WTFMove($name)";
    41224116                if ($mayThrowException) {
    4123                     push(@$outputArray, "    if (UNLIKELY(throwScope.exception()))\n");
    4124                     push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
     4117                    push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
    41254118                }
    41264119            }
     
    44984491
    44994492        if ($codeGenerator->ExtendedAttributeContains($function->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
    4500             push(@implContent, $indent . "if (UNLIKELY(throwScope.exception()))\n");
    4501             push(@implContent, $indent . "    return JSValue::encode(jsUndefined());\n");
     4493            push(@implContent, $indent . "RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
    45024494        }
    45034495
     
    53205312
    53215313    AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state);
    5322     if (UNLIKELY(throwScope.exception()))
    5323         return JSValue::encode(jsUndefined());
     5314    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    53245315
    53255316    ${interfaceName}Init eventInit;
     
    54725463
    54735464            if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"ConstructorCallWith"}, "ScriptState")) {
    5474                  push(@$outputArray, "    if (UNLIKELY(throwScope.exception()))\n");
    5475                  push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
     5465                 push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
    54765466            }
    54775467
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r206350 r206386  
    40494049    JSC::Identifier controlsHost = JSC::Identifier::fromString(&vm, "controlsHost");
    40504050    JSC::JSValue controlsHostJSWrapper = mediaJSWrapperObject->get(&exec, controlsHost);
    4051     if (UNLIKELY(scope.exception()))
    4052         return JSC::jsNull();
     4051    RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    40534052
    40544053    JSC::JSObject* controlsHostJSWrapperObject = JSC::jsDynamicCast<JSC::JSObject*>(controlsHostJSWrapper);
     
    40584057    JSC::Identifier controllerID = JSC::Identifier::fromString(&vm, "controller");
    40594058    JSC::JSValue controllerJSWrapper = controlsHostJSWrapperObject->get(&exec, controllerID);
    4060     if (UNLIKELY(scope.exception()))
    4061         return JSC::jsNull();
     4059    RETURN_IF_EXCEPTION(scope, JSC::JSValue());
    40624060
    40634061    return controllerJSWrapper;
     
    68366834    JSC::JSObject* controllerObject = controllerValue.toObject(exec);
    68376835
    6838     if (UNLIKELY(scope.exception()))
    6839         return;
     6836    RETURN_IF_EXCEPTION(scope, void());
    68406837
    68416838    JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "handlePresentationModeChange"));
     
    68796876    JSC::JSObject* controllerObject = controllerValue.toObject(exec);
    68806877
    6881     if (UNLIKELY(scope.exception()))
    6882         return emptyString();
     6878    RETURN_IF_EXCEPTION(scope, emptyString());
    68836879
    68846880    JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "getCurrentControlsStatus"));
     
    68966892    JSC::JSValue outputValue = JSC::call(exec, function, callType, callData, controllerObject, argList);
    68976893
    6898     if (UNLIKELY(scope.exception()))
    6899         return emptyString();
     6894    RETURN_IF_EXCEPTION(scope, emptyString());
    69006895
    69016896    return outputValue.getString(exec);
Note: See TracChangeset for help on using the changeset viewer.