Changeset 206386 in webkit
- Timestamp:
- Sep 26, 2016, 12:11:17 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 146 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r206379 r206386 1 2016-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 1 406 2016-09-26 Don Olmstead <don.olmstead@am.sony.com> 2 407 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r206281 r206386 124 124 // Don't put to an object if toString throws an exception. 125 125 auto propertyName = property.toPropertyKey(exec); 126 if (UNLIKELY(scope.exception())) 127 return; 126 RETURN_IF_EXCEPTION(scope, void()); 128 127 129 128 PutPropertySlot slot(baseValue, strict); … … 193 192 194 193 JSValue proto = constructor->get(exec, exec->propertyNames().prototype); 195 if (UNLIKELY(scope.exception())) 196 return nullptr; 194 RETURN_IF_EXCEPTION(scope, nullptr); 197 195 if (proto.isObject()) 198 196 return constructEmptyObject(exec, asObject(proto)); … … 223 221 224 222 int32_t a = op1.toInt32(exec); 225 if (UNLIKELY(scope.exception())) 226 return JSValue::encode(JSValue()); 223 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 227 224 int32_t b = op2.toInt32(exec); 228 225 return JSValue::encode(jsNumber(a & b)); … … 239 236 240 237 int32_t a = op1.toInt32(exec); 241 if (UNLIKELY(scope.exception())) 242 return JSValue::encode(JSValue()); 238 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 243 239 int32_t b = op2.toInt32(exec); 244 240 return JSValue::encode(jsNumber(a | b)); … … 255 251 256 252 int32_t a = op1.toInt32(exec); 257 if (UNLIKELY(scope.exception())) 258 return JSValue::encode(JSValue()); 253 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 259 254 int32_t b = op2.toInt32(exec); 260 255 return JSValue::encode(jsNumber(a ^ b)); … … 271 266 272 267 int32_t a = op1.toInt32(exec); 273 if (UNLIKELY(scope.exception())) 274 return JSValue::encode(JSValue()); 268 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 275 269 uint32_t b = op2.toUInt32(exec); 276 270 return JSValue::encode(jsNumber(a << (b & 0x1f))); … … 287 281 288 282 int32_t a = op1.toInt32(exec); 289 if (UNLIKELY(scope.exception())) 290 return JSValue::encode(JSValue()); 283 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 291 284 uint32_t b = op2.toUInt32(exec); 292 285 return JSValue::encode(jsNumber(a >> (b & 0x1f))); … … 303 296 304 297 uint32_t a = op1.toUInt32(exec); 305 if (UNLIKELY(scope.exception())) 306 return JSValue::encode(JSValue()); 298 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 307 299 uint32_t b = op2.toUInt32(exec); 308 300 return JSValue::encode(jsNumber(static_cast<int32_t>(a >> (b & 0x1f)))); … … 335 327 336 328 double a = op1.toNumber(exec); 337 if (UNLIKELY(scope.exception())) 338 return JSValue::encode(JSValue()); 329 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 339 330 double b = op2.toNumber(exec); 340 331 return JSValue::encode(jsNumber(a / b)); … … 349 340 JSValue op1 = JSValue::decode(encodedOp1); 350 341 double a = op1.toNumber(exec); 351 if (UNLIKELY(scope.exception())) 352 return PNaN; 342 RETURN_IF_EXCEPTION(scope, PNaN); 353 343 return fabs(a); 354 344 } … … 362 352 JSValue op1 = JSValue::decode(encodedOp1); 363 353 uint32_t value = op1.toUInt32(exec); 364 if (UNLIKELY(scope.exception())) 365 return 0; 354 RETURN_IF_EXCEPTION(scope, 0); 366 355 return clz32(value); 367 356 } … … 375 364 JSValue op1 = JSValue::decode(encodedOp1); 376 365 double a = op1.toNumber(exec); 377 if (UNLIKELY(scope.exception())) 378 return JSValue::encode(JSValue()); 366 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 379 367 return cos(a); 380 368 } … … 388 376 JSValue op1 = JSValue::decode(encodedOp1); 389 377 double a = op1.toNumber(exec); 390 if (UNLIKELY(scope.exception())) 391 return PNaN; 378 RETURN_IF_EXCEPTION(scope, PNaN); 392 379 return static_cast<float>(a); 393 380 } … … 401 388 JSValue op1 = JSValue::decode(encodedOp1); 402 389 double a = op1.toNumber(exec); 403 if (UNLIKELY(scope.exception())) 404 return PNaN; 390 RETURN_IF_EXCEPTION(scope, PNaN); 405 391 return log(a); 406 392 } … … 414 400 JSValue op1 = JSValue::decode(encodedOp1); 415 401 double a = op1.toNumber(exec); 416 if (UNLIKELY(scope.exception())) 417 return PNaN; 402 RETURN_IF_EXCEPTION(scope, PNaN); 418 403 return sin(a); 419 404 } … … 427 412 JSValue op1 = JSValue::decode(encodedOp1); 428 413 double a = op1.toNumber(exec); 429 if (UNLIKELY(scope.exception())) 430 return PNaN; 414 RETURN_IF_EXCEPTION(scope, PNaN); 431 415 return sqrt(a); 432 416 } … … 440 424 JSValue op1 = JSValue::decode(encodedOp1); 441 425 double a = op1.toNumber(exec); 442 if (UNLIKELY(scope.exception())) 443 return JSValue::encode(JSValue()); 426 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 444 427 return tan(a); 445 428 } … … 453 436 JSValue argument = JSValue::decode(encodedArgument); 454 437 double valueOfArgument = argument.toNumber(exec); 455 if (UNLIKELY(scope.exception())) 456 return JSValue::encode(JSValue()); 438 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 457 439 return JSValue::encode(jsNumber(jsRound(valueOfArgument))); 458 440 } … … 466 448 JSValue argument = JSValue::decode(encodedArgument); 467 449 double valueOfArgument = argument.toNumber(exec); 468 if (UNLIKELY(scope.exception())) 469 return JSValue::encode(JSValue()); 450 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 470 451 return JSValue::encode(jsNumber(floor(valueOfArgument))); 471 452 } … … 479 460 JSValue argument = JSValue::decode(encodedArgument); 480 461 double valueOfArgument = argument.toNumber(exec); 481 if (UNLIKELY(scope.exception())) 482 return JSValue::encode(JSValue()); 462 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 483 463 return JSValue::encode(jsNumber(ceil(valueOfArgument))); 484 464 } … … 492 472 JSValue argument = JSValue::decode(encodedArgument); 493 473 double truncatedValueOfArgument = argument.toIntegerPreserveNaN(exec); 494 if (UNLIKELY(scope.exception())) 495 return JSValue::encode(JSValue()); 474 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 496 475 return JSValue::encode(jsNumber(truncatedValueOfArgument)); 497 476 } … … 545 524 546 525 baseValue.requireObjectCoercible(exec); 547 if (UNLIKELY(scope.exception())) 548 return JSValue::encode(jsUndefined()); 526 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 549 527 auto propertyName = property.toPropertyKey(exec); 550 if (UNLIKELY(scope.exception())) 551 return JSValue::encode(jsUndefined()); 528 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 552 529 return JSValue::encode(baseValue.get(exec, propertyName)); 553 530 } … … 579 556 580 557 auto propertyName = property.toPropertyKey(exec); 581 if (UNLIKELY(scope.exception())) 582 return JSValue::encode(jsUndefined()); 558 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 583 559 return JSValue::encode(JSValue(base).get(exec, propertyName)); 584 560 } … … 974 950 975 951 baseValue.requireObjectCoercible(exec); 976 if (UNLIKELY(scope.exception())) 977 return JSValue::encode(JSValue()); 952 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 978 953 979 954 auto property = subscript.toPropertyKey(exec); 980 if (UNLIKELY(scope.exception())) 981 return JSValue::encode(JSValue()); 955 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 982 956 return JSValue::encode(baseValue.get(exec, property, slot)); 983 957 } … … 1006 980 1007 981 Identifier property = JSValue::decode(encodedSubscript).toPropertyKey(exec); 1008 if (UNLIKELY(scope.exception())) 1009 return; 982 RETURN_IF_EXCEPTION(scope, void()); 1010 983 putWithThis<true>(exec, encodedBase, encodedThis, encodedValue, property); 1011 984 } … … 1018 991 1019 992 Identifier property = JSValue::decode(encodedSubscript).toPropertyKey(exec); 1020 if (UNLIKELY(scope.exception())) 1021 return; 993 RETURN_IF_EXCEPTION(scope, void()); 1022 994 putWithThis<false>(exec, encodedBase, encodedThis, encodedValue, property); 1023 995 } … … 1664 1636 JSValue key = JSValue::decode(encodedKey); 1665 1637 Identifier propertyName = key.toPropertyKey(exec); 1666 if (UNLIKELY(scope.exception())) 1667 return false; 1638 RETURN_IF_EXCEPTION(scope, false); 1668 1639 1669 1640 PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty); 1670 1641 bool result = thisObject->hasOwnProperty(exec, propertyName.impl(), slot); 1671 if (UNLIKELY(scope.exception())) 1672 return false; 1642 RETURN_IF_EXCEPTION(scope, false); 1673 1643 1674 1644 HasOwnPropertyCache* hasOwnPropertyCache = vm.hasOwnPropertyCache(); -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
r205569 r206386 104 104 105 105 String program = scriptValue.toString(exec)->value(exec); 106 if (UNLIKELY(scope.exception())) 107 return jsUndefined(); 106 RETURN_IF_EXCEPTION(scope, JSValue()); 108 107 109 108 NakedPtr<Exception> exception; … … 266 265 unsigned index = 0; 267 266 JSArray* array = constructEmptyArray(exec, nullptr); 268 if (UNLIKELY(scope.exception())) 269 return jsUndefined(); 267 RETURN_IF_EXCEPTION(scope, JSValue()); 270 268 switch (promise->status(exec->vm())) { 271 269 case JSPromise::Status::Pending: … … 288 286 unsigned index = 0; 289 287 JSArray* array = constructEmptyArray(exec, nullptr); 290 if (UNLIKELY(scope.exception())) 291 return jsUndefined(); 288 RETURN_IF_EXCEPTION(scope, JSValue()); 292 289 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction())); 293 290 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis())); … … 300 297 unsigned index = 0; 301 298 JSArray* array = constructEmptyArray(exec, nullptr, 2); 302 if (UNLIKELY(scope.exception())) 303 return jsUndefined(); 299 RETURN_IF_EXCEPTION(scope, JSValue()); 304 300 array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target())); 305 301 array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler())); … … 314 310 unsigned index = 0; 315 311 JSArray* array = constructEmptyArray(exec, nullptr, 2); 316 if (UNLIKELY(scope.exception())) 317 return jsUndefined(); 312 RETURN_IF_EXCEPTION(scope, JSValue()); 318 313 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue)); 319 314 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", kind)); … … 337 332 unsigned index = 0; 338 333 JSArray* array = constructEmptyArray(exec, nullptr, 2); 339 if (UNLIKELY(scope.exception())) 340 return jsUndefined(); 334 RETURN_IF_EXCEPTION(scope, JSValue()); 341 335 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue())); 342 336 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind))); … … 359 353 unsigned index = 0; 360 354 JSArray* array = constructEmptyArray(exec, nullptr, 2); 361 if (UNLIKELY(scope.exception())) 362 return jsUndefined(); 355 RETURN_IF_EXCEPTION(scope, JSValue()); 363 356 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue())); 364 357 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind))); … … 369 362 unsigned index = 0; 370 363 JSArray* array = constructEmptyArray(exec, nullptr, 1); 371 if (UNLIKELY(scope.exception())) 372 return jsUndefined(); 364 RETURN_IF_EXCEPTION(scope, JSValue()); 373 365 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec))); 374 366 return array; … … 378 370 unsigned index = 0; 379 371 JSArray* array = constructEmptyArray(exec, nullptr, 1); 380 if (UNLIKELY(scope.exception())) 381 return jsUndefined(); 372 RETURN_IF_EXCEPTION(scope, JSValue()); 382 373 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue())); 383 374 return array; … … 421 412 422 413 JSArray* array = constructEmptyArray(exec, nullptr); 423 if (UNLIKELY(scope.exception())) 424 return jsUndefined(); 414 RETURN_IF_EXCEPTION(scope, JSValue()); 425 415 for (auto it = weakMap->weakMapData()->begin(); it != weakMap->weakMapData()->end(); ++it) { 426 416 JSObject* entry = constructEmptyObject(exec); … … 469 459 470 460 JSArray* array = constructEmptyArray(exec, nullptr); 471 if (UNLIKELY(scope.exception())) 472 return jsUndefined(); 461 RETURN_IF_EXCEPTION(scope, JSValue()); 473 462 for (auto it = weakSet->weakMapData()->begin(); it != weakSet->weakMapData()->end(); ++it) { 474 463 JSObject* entry = constructEmptyObject(exec); … … 510 499 else if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value)) { 511 500 iterator = propertyNameIterator->clone(exec); 512 if (UNLIKELY(scope.exception())) 513 return JSValue(); 501 RETURN_IF_EXCEPTION(scope, JSValue()); 514 502 } else { 515 503 if (JSObject* iteratorObject = jsDynamicCast<JSObject*>(value)) { … … 530 518 531 519 JSArray* array = constructEmptyArray(exec, nullptr); 532 if (UNLIKELY(scope.exception())) 533 return jsUndefined(); 520 RETURN_IF_EXCEPTION(scope, JSValue()); 534 521 535 522 for (unsigned i = 0; i < numberToFetch; ++i) { -
trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp
r205569 r206386 84 84 85 85 String script = scriptValue.toString(exec)->value(exec); 86 if (UNLIKELY(scope.exception())) 87 return jsUndefined(); 86 RETURN_IF_EXCEPTION(scope, JSValue()); 88 87 89 88 NakedPtr<Exception> exception; -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r206267 r206386 104 104 } 105 105 String programSource = asString(program)->value(callFrame); 106 if (UNLIKELY(scope.exception())) 107 return JSValue(); 106 RETURN_IF_EXCEPTION(scope, JSValue()); 108 107 109 108 CallFrame* callerFrame = callFrame->callerFrame(); … … 187 186 RELEASE_ASSERT(arguments.isObject()); 188 187 length = getLength(callFrame, jsCast<JSObject*>(cell)); 189 if (UNLIKELY(scope.exception())) 190 return 0; 188 RETURN_IF_EXCEPTION(scope, 0); 191 189 break; 192 190 } … … 805 803 PropertySlot slot(globalObject, PropertySlot::InternalMethodType::Get); 806 804 if (!globalObject->getPropertySlot(callFrame, JSONPPath[i].m_pathEntryName, slot)) { 807 if (throwScope.exception()) 808 return jsUndefined(); 805 RETURN_IF_EXCEPTION(throwScope, JSValue()); 809 806 if (entry) 810 807 return throwException(callFrame, throwScope, createUndefinedVariableError(callFrame, JSONPPath[i].m_pathEntryName)); … … 814 811 } else 815 812 baseObject = baseObject.get(callFrame, JSONPPath[i].m_pathEntryName); 816 if (throwScope.exception()) 817 return jsUndefined(); 813 RETURN_IF_EXCEPTION(throwScope, JSValue()); 818 814 continue; 819 815 } 820 816 case JSONPPathEntryTypeLookup: { 821 817 baseObject = baseObject.get(callFrame, static_cast<unsigned>(JSONPPath[i].m_pathIndex)); 822 if (throwScope.exception()) 823 return jsUndefined(); 818 RETURN_IF_EXCEPTION(throwScope, JSValue()); 824 819 continue; 825 820 } … … 833 828 case JSONPPathEntryTypeCall: { 834 829 JSValue function = baseObject.get(callFrame, JSONPPath.last().m_pathEntryName); 835 if (throwScope.exception()) 836 return jsUndefined(); 830 RETURN_IF_EXCEPTION(throwScope, JSValue()); 837 831 CallData callData; 838 832 CallType callType = getCallData(function, callData); … … 843 837 JSValue thisValue = JSONPPath.size() == 1 ? jsUndefined(): baseObject; 844 838 JSONPValue = JSC::call(callFrame, function, callType, callData, thisValue, jsonArg); 845 if (throwScope.exception()) 846 return jsUndefined(); 839 RETURN_IF_EXCEPTION(throwScope, JSValue()); 847 840 break; 848 841 } 849 842 case JSONPPathEntryTypeDot: { 850 843 baseObject.put(callFrame, JSONPPath.last().m_pathEntryName, JSONPValue, slot); 851 if (throwScope.exception()) 852 return jsUndefined(); 844 RETURN_IF_EXCEPTION(throwScope, JSValue()); 853 845 break; 854 846 } 855 847 case JSONPPathEntryTypeLookup: { 856 848 baseObject.putByIndex(callFrame, JSONPPath.last().m_pathIndex, JSONPValue, slot.isStrictMode()); 857 if (throwScope.exception()) 858 return jsUndefined(); 849 RETURN_IF_EXCEPTION(throwScope, JSValue()); 859 850 break; 860 851 } … … 959 950 } else { 960 951 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()); 963 953 } 964 954 } … … 1028 1018 } 1029 1019 1030 if (UNLIKELY(throwScope.exception())) 1031 return 0; 1020 RETURN_IF_EXCEPTION(throwScope, 0); 1032 1021 ASSERT(result.isObject()); 1033 1022 return checkedReturn(asObject(result)); -
trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp
r205569 r206386 439 439 auto scope = DECLARE_THROW_SCOPE(vm); 440 440 JSArray* result = constructEmptyArray(exec, 0); 441 if (UNLIKELY(scope.exception())) 442 return nullptr; 441 RETURN_IF_EXCEPTION(scope, nullptr); 443 442 444 443 iterate( -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r206289 r206386 277 277 PropertySlot slot(base, PropertySlot::InternalMethodType::HasProperty); 278 278 bool result = asObject(base)->getPropertySlot(exec, ident, slot); 279 if (UNLIKELY(scope.exception())) 280 return JSValue::encode(jsUndefined()); 279 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 281 280 282 281 RELEASE_ASSERT(accessType == stubInfo->accessType); … … 513 512 auto property = subscript.toPropertyKey(callFrame); 514 513 // Don't put to an object if toString threw an exception. 515 if (UNLIKELY(scope.exception())) 516 return; 514 RETURN_IF_EXCEPTION(scope, void()); 517 515 518 516 if (byValInfo->stubInfo && (!isStringOrSymbol(subscript) || byValInfo->cachedId != property)) … … 558 556 // Don't put to an object if toString threw an exception. 559 557 auto property = subscript.toPropertyKey(callFrame); 560 if (UNLIKELY(scope.exception())) 561 return; 558 RETURN_IF_EXCEPTION(scope, void()); 562 559 563 560 if (Optional<uint32_t> index = parseIndex(property)) { … … 788 785 789 786 JSValue result = eval(execCallee); 790 if (UNLIKELY(scope.exception())) 791 return EncodedJSValue(); 787 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 792 788 793 789 return JSValue::encode(result); … … 1462 1458 auto scope = DECLARE_THROW_SCOPE(vm); 1463 1459 auto propertyKey = subscript.toPropertyKey(exec); 1464 if (UNLIKELY(scope.exception())) 1465 return; 1460 RETURN_IF_EXCEPTION(scope, void()); 1466 1461 1467 1462 if (accessorType == AccessorType::Getter) … … 1652 1647 1653 1648 baseValue.requireObjectCoercible(exec); 1654 if (UNLIKELY(scope.exception())) 1655 return jsUndefined(); 1649 RETURN_IF_EXCEPTION(scope, JSValue()); 1656 1650 auto property = subscript.toPropertyKey(exec); 1657 if (UNLIKELY(scope.exception())) 1658 return jsUndefined(); 1651 RETURN_IF_EXCEPTION(scope, JSValue()); 1659 1652 1660 1653 ASSERT(exec->bytecodeOffset()); … … 1864 1857 } else { 1865 1858 baseValue.requireObjectCoercible(exec); 1866 if (UNLIKELY(scope.exception())) 1867 return JSValue::encode(jsUndefined()); 1859 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1868 1860 auto property = subscript.toPropertyKey(exec); 1869 if (UNLIKELY(scope.exception())) 1870 return JSValue::encode(jsUndefined()); 1861 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1871 1862 result = baseValue.get(exec, property); 1872 1863 } … … 1916 1907 couldDelete = baseObj->methodTable(vm)->deletePropertyByIndex(baseObj, exec, index); 1917 1908 else { 1918 if (UNLIKELY(scope.exception())) 1919 return false; 1909 RETURN_IF_EXCEPTION(scope, false); 1920 1910 Identifier property = key.toPropertyKey(exec); 1921 if (UNLIKELY(scope.exception())) 1922 return false; 1911 RETURN_IF_EXCEPTION(scope, false); 1923 1912 couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, property); 1924 1913 } … … 2124 2113 scope->methodTable()->put(scope, exec, ident, value, slot); 2125 2114 2126 if (UNLIKELY(throwScope.exception())) 2127 return; 2115 RETURN_IF_EXCEPTION(throwScope, void()); 2128 2116 2129 2117 CommonSlowPaths::tryCachePutToScopeGlobal(exec, codeBlock, pc, scope, getPutInfo, slot, ident); … … 2378 2366 2379 2367 double a = op1.toNumber(exec); 2380 if (UNLIKELY(scope.exception())) 2381 return JSValue::encode(JSValue()); 2368 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2382 2369 double b = op2.toNumber(exec); 2383 2370 return JSValue::encode(jsNumber(a * b)); … … 2394 2381 2395 2382 double a = op1.toNumber(exec); 2396 if (UNLIKELY(scope.exception())) 2397 return JSValue::encode(JSValue()); 2383 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2398 2384 double b = op2.toNumber(exec); 2399 if (UNLIKELY(scope.exception())) 2400 return JSValue::encode(JSValue()); 2385 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2401 2386 2402 2387 JSValue result = jsNumber(a * b); … … 2561 2546 2562 2547 double a = op1.toNumber(exec); 2563 if (UNLIKELY(scope.exception())) 2564 return JSValue::encode(JSValue()); 2548 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2565 2549 double b = op2.toNumber(exec); 2566 2550 return JSValue::encode(jsNumber(a - b)); … … 2577 2561 2578 2562 double a = op1.toNumber(exec); 2579 if (UNLIKELY(scope.exception())) 2580 return JSValue::encode(JSValue()); 2563 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2581 2564 double b = op2.toNumber(exec); 2582 if (UNLIKELY(scope.exception())) 2583 return JSValue::encode(JSValue()); 2565 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2584 2566 2585 2567 JSValue result = jsNumber(a - b); -
trunk/Source/JavaScriptCore/jsc.cpp
r206134 r206386 312 312 if (thisObject->m_delegate->getPropertySlot(exec, name, slot)) 313 313 return true; 314 if (UNLIKELY(scope.exception())) 315 return false; 314 RETURN_IF_EXCEPTION(scope, false); 316 315 } 317 316 … … 1461 1460 1462 1461 String fileName = exec->argument(0).toWTFString(exec); 1463 if (UNLIKELY(scope.exception())) 1464 return JSValue::encode(jsUndefined()); 1462 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1465 1463 Vector<char> script; 1466 1464 if (!fetchScriptFromLocalFileSystem(fileName, script)) … … 1495 1493 1496 1494 String source = exec->argument(0).toWTFString(exec); 1497 if (UNLIKELY(scope.exception())) 1498 return JSValue::encode(jsUndefined()); 1495 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1499 1496 1500 1497 GlobalObject* globalObject = GlobalObject::create(vm, GlobalObject::createStructure(vm, jsNull()), Vector<String>()); … … 1523 1520 1524 1521 String fileName = exec->argument(0).toWTFString(exec); 1525 if (UNLIKELY(scope.exception())) 1526 return JSValue::encode(jsUndefined()); 1522 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1527 1523 Vector<char> script; 1528 1524 if (!fetchScriptFromLocalFileSystem(fileName, script)) … … 1544 1540 1545 1541 String sourceCode = exec->argument(0).toWTFString(exec); 1546 if (UNLIKELY(scope.exception())) 1547 return JSValue::encode(jsUndefined()); 1542 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1548 1543 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 1549 1544 … … 1561 1556 1562 1557 String fileName = exec->argument(0).toWTFString(exec); 1563 if (UNLIKELY(scope.exception())) 1564 return JSValue::encode(jsUndefined()); 1558 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1565 1559 1566 1560 bool isBinary = false; 1567 1561 if (exec->argumentCount() > 1) { 1568 1562 String type = exec->argument(1).toWTFString(exec); 1569 if (UNLIKELY(scope.exception())) 1570 return EncodedJSValue(); 1563 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1571 1564 if (type != "binary") 1572 1565 return throwVMError(exec, scope, "Expected 'binary' as second argument."); … … 1584 1577 auto length = content.size(); 1585 1578 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()); 1588 1580 1589 1581 return JSValue::encode(result); … … 1596 1588 1597 1589 String fileName = exec->argument(0).toWTFString(exec); 1598 if (UNLIKELY(scope.exception())) 1599 return JSValue::encode(jsUndefined()); 1590 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1600 1591 Vector<char> script; 1601 1592 if (!fetchScriptFromLocalFileSystem(fileName, script)) … … 1660 1651 1661 1652 unsigned seed = exec->argument(0).toUInt32(exec); 1662 if (UNLIKELY(scope.exception())) 1663 return JSValue::encode(jsUndefined()); 1653 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1664 1654 exec->lexicalGlobalObject()->weakRandom().setSeed(seed); 1665 1655 return JSValue::encode(jsUndefined()); … … 1932 1922 1933 1923 String fileName = exec->argument(0).toWTFString(exec); 1934 if (UNLIKELY(scope.exception())) 1935 return JSValue::encode(jsUndefined()); 1924 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1936 1925 Vector<char> script; 1937 1926 if (!fetchScriptFromLocalFileSystem(fileName, script)) … … 1939 1928 1940 1929 JSInternalPromise* promise = loadAndEvaluateModule(exec, fileName); 1941 if (UNLIKELY(scope.exception())) 1942 return JSValue::encode(jsUndefined()); 1930 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1943 1931 1944 1932 JSValue error; … … 1964 1952 1965 1953 String functionText = exec->argument(0).toWTFString(exec); 1966 if (UNLIKELY(scope.exception())) 1967 return JSValue::encode(JSValue()); 1954 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1968 1955 1969 1956 const SourceCode& source = makeSource(functionText); … … 1985 1972 1986 1973 String source = exec->argument(0).toWTFString(exec); 1987 if (UNLIKELY(scope.exception())) 1988 return JSValue::encode(jsUndefined()); 1974 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1989 1975 1990 1976 StopWatch stopWatch; -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r206267 r206386 812 812 813 813 baseValue.requireObjectCoercible(exec); 814 if (scope.exception()) 815 return jsUndefined(); 814 RETURN_IF_EXCEPTION(scope, JSValue()); 816 815 auto property = subscript.toPropertyKey(exec); 817 if (scope.exception()) 818 return jsUndefined(); 816 RETURN_IF_EXCEPTION(scope, JSValue()); 819 817 return baseValue.get(exec, property); 820 818 } … … 884 882 // Don't put to an object if toString threw an exception. 885 883 auto property = subscript.toPropertyKey(exec); 886 if ( throwScope.exception())884 if (UNLIKELY(throwScope.exception())) 887 885 LLINT_END(); 888 886 -
trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp
r205569 r206386 1 1 /* 2 * Copyright (C) 2012 , 2013, 2014Apple Inc. All rights reserved.2 * Copyright (C) 2012-2014, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 82 82 auto scope = DECLARE_THROW_SCOPE(vm); 83 83 JSArray* header = constructEmptyArray(exec, 0); 84 if (UNLIKELY(scope.exception())) 85 return; 84 RETURN_IF_EXCEPTION(scope, void()); 86 85 for (unsigned i = 0; i < m_header.size(); ++i) 87 86 header->putDirectIndex(exec, i, jsString(exec, String::fromUTF8(m_header[i]))); … … 89 88 90 89 JSArray* sequence = constructEmptyArray(exec, 0); 91 if (UNLIKELY(scope.exception())) 92 return; 90 RETURN_IF_EXCEPTION(scope, void()); 93 91 for (unsigned i = 0; i < m_sequence.size(); ++i) 94 92 sequence->putDirectIndex(exec, i, m_sequence[i].toJS(exec)); -
trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp
r205569 r206386 118 118 auto scope = DECLARE_THROW_SCOPE(vm); 119 119 JSObject* result = constructEmptyObject(exec); 120 if (UNLIKELY(scope.exception())) 121 return jsUndefined(); 120 RETURN_IF_EXCEPTION(scope, JSValue()); 122 121 result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id())); 123 122 result->putDirect(vm, exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind)))); 124 123 125 124 JSArray* profiledBytecodes = constructEmptyArray(exec, 0); 126 if (UNLIKELY(scope.exception())) 127 return jsUndefined(); 125 RETURN_IF_EXCEPTION(scope, JSValue()); 128 126 for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i) 129 127 profiledBytecodes->putDirectIndex(exec, i, m_profiledBytecodes[i].toJS(exec)); … … 131 129 132 130 JSArray* descriptions = constructEmptyArray(exec, 0); 133 if (UNLIKELY(scope.exception())) 134 return jsUndefined(); 131 RETURN_IF_EXCEPTION(scope, JSValue()); 135 132 for (unsigned i = 0; i < m_descriptions.size(); ++i) 136 133 descriptions->putDirectIndex(exec, i, m_descriptions[i].toJS(exec)); … … 138 135 139 136 JSArray* counters = constructEmptyArray(exec, 0); 140 if (UNLIKELY(scope.exception())) 141 return jsUndefined(); 137 RETURN_IF_EXCEPTION(scope, JSValue()); 142 138 for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) { 143 139 JSObject* counterEntry = constructEmptyObject(exec); … … 149 145 150 146 JSArray* exitSites = constructEmptyArray(exec, 0); 151 if (UNLIKELY(scope.exception())) 152 return jsUndefined(); 147 RETURN_IF_EXCEPTION(scope, JSValue()); 153 148 for (unsigned i = 0; i < m_osrExitSites.size(); ++i) 154 149 exitSites->putDirectIndex(exec, i, m_osrExitSites[i].toJS(exec)); … … 156 151 157 152 JSArray* exits = constructEmptyArray(exec, 0); 158 if (UNLIKELY(scope.exception())) 159 return jsUndefined(); 153 RETURN_IF_EXCEPTION(scope, JSValue()); 160 154 for (unsigned i = 0; i < m_osrExits.size(); ++i) 161 155 exits->putDirectIndex(exec, i, m_osrExits[i].toJS(exec)); -
trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
r205569 r206386 105 105 106 106 JSArray* bytecodes = constructEmptyArray(exec, 0); 107 if (UNLIKELY(scope.exception())) 108 return jsUndefined(); 107 RETURN_IF_EXCEPTION(scope, JSValue()); 109 108 for (unsigned i = 0; i < m_bytecodes.size(); ++i) 110 109 bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec)); … … 112 111 113 112 JSArray* compilations = constructEmptyArray(exec, 0); 114 if (UNLIKELY(scope.exception())) 115 return jsUndefined(); 113 RETURN_IF_EXCEPTION(scope, JSValue()); 116 114 for (unsigned i = 0; i < m_compilations.size(); ++i) 117 115 compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec)); … … 119 117 120 118 JSArray* events = constructEmptyArray(exec, 0); 121 if (UNLIKELY(scope.exception())) 122 return jsUndefined(); 119 RETURN_IF_EXCEPTION(scope, JSValue()); 123 120 for (unsigned i = 0; i < m_events.size(); ++i) 124 121 events->putDirectIndex(exec, i, m_events[i].toJS(exec)); -
trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp
r205569 r206386 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 40 40 auto scope = DECLARE_THROW_SCOPE(vm); 41 41 JSArray* result = constructEmptyArray(exec, 0); 42 if (UNLIKELY(scope.exception())) 43 return jsUndefined(); 42 RETURN_IF_EXCEPTION(scope, JSValue()); 44 43 for (unsigned i = 0; i < m_codeAddresses.size(); ++i) 45 44 result->putDirectIndex(exec, i, jsString(exec, toString(RawPointer(m_codeAddresses[i])))); -
trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp
r205569 r206386 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 104 104 auto scope = DECLARE_THROW_SCOPE(vm); 105 105 JSArray* result = constructEmptyArray(exec, 0); 106 if (UNLIKELY(scope.exception())) 107 return jsUndefined(); 106 RETURN_IF_EXCEPTION(scope, JSValue()); 108 107 109 108 for (unsigned i = 0; i < m_stack.size(); ++i) -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r206281 r206386 200 200 auto scope = DECLARE_THROW_SCOPE(vm); 201 201 202 auto exceptionResult = [] () { 203 return std::make_pair(SpeciesConstructResult::Exception, nullptr); 204 }; 205 202 206 // ECMA 9.4.2.3: https://tc39.github.io/ecma262/#sec-arrayspeciescreate 203 207 JSValue constructor = jsUndefined(); … … 209 213 210 214 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()); 213 216 if (constructor.isConstructor()) { 214 217 JSObject* constructorObject = jsCast<JSObject*>(constructor); … … 218 221 if (constructor.isObject()) { 219 222 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()); 222 224 if (constructor.isNull()) 223 225 return std::make_pair(SpeciesConstructResult::FastPath, nullptr);; 224 226 } 225 } else if (UNLIKELY(scope.exception()))226 return std::make_pair(SpeciesConstructResult::Exception, nullptr);227 } else 228 RETURN_IF_EXCEPTION(scope, exceptionResult()); 227 229 228 230 if (constructor.isUndefined()) … … 232 234 args.append(jsNumber(length)); 233 235 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()); 236 237 return std::make_pair(SpeciesConstructResult::CreatedObject, newObject); 237 238 } … … 288 289 unsigned to = k + resultCount; 289 290 if (JSValue value = getProperty(exec, thisObj, from)) { 290 if (UNLIKELY(scope.exception())) 291 return; 291 RETURN_IF_EXCEPTION(scope, void()); 292 292 thisObj->putByIndexInline(exec, to, value, true); 293 if (UNLIKELY(scope.exception())) 294 return; 293 RETURN_IF_EXCEPTION(scope, void()); 295 294 } else if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, to)) { 296 295 throwTypeError(exec, scope, ASCIILiteral("Unable to delete property.")); … … 334 333 unsigned to = k + resultCount - 1; 335 334 if (JSValue value = getProperty(exec, thisObj, from)) { 336 if (UNLIKELY(scope.exception())) 337 return; 335 RETURN_IF_EXCEPTION(scope, void()); 338 336 thisObj->putByIndexInline(exec, to, value, true); 339 337 } else if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, to)) { … … 341 339 return; 342 340 } 343 if (UNLIKELY(scope.exception())) 344 return; 341 RETURN_IF_EXCEPTION(scope, void()); 345 342 } 346 343 } … … 354 351 // 1. Let array be the result of calling ToObject on the this value. 355 352 JSObject* thisObject = thisValue.toObject(exec); 356 if (UNLIKELY(scope.exception())) 357 return JSValue::encode(jsUndefined()); 353 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 358 354 359 355 // 2. Let func be the result of calling the [[Get]] internal method of array with argument "join". 360 356 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()); 363 358 364 359 // 3. If IsCallable(func) is false, then let func be the standard built-in method Object.prototype.toString (15.2.4.2). … … 388 383 389 384 JSStringJoiner joiner(*exec, ',', length); 390 if (UNLIKELY(scope.exception())) 391 return JSValue::encode(jsUndefined()); 385 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 392 386 393 387 for (unsigned i = 0; i < length; ++i) { … … 395 389 if (!element) { 396 390 element = thisArray->get(exec, i); 397 if (UNLIKELY(scope.exception())) 398 return JSValue::encode(jsUndefined()); 391 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 399 392 } 400 393 joiner.append(*exec, element); 401 if (UNLIKELY(scope.exception())) 402 return JSValue::encode(jsUndefined()); 394 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 403 395 } 404 396 … … 413 405 414 406 JSObject* thisObject = thisValue.toObject(exec); 415 if (UNLIKELY(scope.exception())) 416 return JSValue::encode(jsUndefined()); 407 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 417 408 418 409 unsigned length = getLength(exec, thisObject); 419 if (UNLIKELY(scope.exception())) 420 return JSValue::encode(jsUndefined()); 410 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 421 411 422 412 StringRecursionChecker checker(exec, thisObject); … … 425 415 426 416 JSStringJoiner stringJoiner(*exec, ',', length); 427 if (UNLIKELY(scope.exception())) 428 return JSValue::encode(jsUndefined()); 417 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 429 418 430 419 #if ENABLE(INTL) … … 432 421 for (unsigned i = 0; i < length; ++i) { 433 422 JSValue element = thisObject->getIndex(exec, i); 434 if (UNLIKELY(scope.exception())) 435 return JSValue::encode(jsUndefined()); 423 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 436 424 if (element.isUndefinedOrNull()) 437 425 element = jsEmptyString(exec); 438 426 else { 439 427 JSValue conversionFunction = element.get(exec, exec->propertyNames().toLocaleString); 440 if (UNLIKELY(scope.exception())) 441 return JSValue::encode(jsUndefined()); 428 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 442 429 CallData callData; 443 430 CallType callType = getCallData(conversionFunction, callData); 444 431 if (callType != CallType::None) { 445 432 element = call(exec, conversionFunction, callType, callData, element, arguments); 446 if (UNLIKELY(scope.exception())) 447 return JSValue::encode(jsUndefined()); 433 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 448 434 } 449 435 } 450 436 stringJoiner.append(*exec, element); 451 if (UNLIKELY(scope.exception())) 452 return JSValue::encode(jsUndefined()); 437 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 453 438 } 454 439 #else // !ENABLE(INTL) 455 440 for (unsigned i = 0; i < length; ++i) { 456 441 JSValue element = thisObject->getIndex(exec, i); 457 if (UNLIKELY(scope.exception())) 458 return JSValue::encode(jsUndefined()); 442 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 459 443 if (element.isUndefinedOrNull()) 460 444 continue; 461 445 JSValue conversionFunction = element.get(exec, exec->propertyNames().toLocaleString); 462 if (UNLIKELY(scope.exception())) 463 return JSValue::encode(jsUndefined()); 446 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 464 447 CallData callData; 465 448 CallType callType = getCallData(conversionFunction, callData); 466 449 if (callType != CallType::None) { 467 450 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()); 470 452 } 471 453 stringJoiner.append(*exec, element); 472 if (UNLIKELY(scope.exception())) 473 return JSValue::encode(jsUndefined()); 454 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 474 455 } 475 456 #endif // !ENABLE(INTL) … … 514 495 // 6. Let element0 be Get(O, "0"). 515 496 JSValue element0 = thisObject->getIndex(&exec, 0); 516 if (UNLIKELY(scope.exception())) 517 return JSValue(); 497 RETURN_IF_EXCEPTION(scope, JSValue()); 518 498 519 499 // 7. If element0 is undefined or null, let R be the empty String; otherwise, let R be ? ToString(element0). … … 523 503 else 524 504 r = element0.toString(&exec); 525 if (UNLIKELY(scope.exception())) 526 return JSValue(); 505 RETURN_IF_EXCEPTION(scope, JSValue()); 527 506 528 507 // 8. Let k be 1. … … 532 511 // b. Let element be ? Get(O, ! ToString(k)). 533 512 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()); 536 514 537 515 // c. If element is undefined or null, let next be the empty String; otherwise, let next be ? ToString(element). … … 543 521 } else 544 522 next = element.toString(&exec); 545 if (UNLIKELY(scope.exception())) 546 return JSValue(); 523 RETURN_IF_EXCEPTION(scope, JSValue()); 547 524 548 525 // a. Let S be the String value produced by concatenating R and sep. 549 526 // d. Let R be a String value produced by concatenating S and next. 550 527 r = jsString(&exec, r, separator, next); 551 if (UNLIKELY(scope.exception())) 552 return JSValue(); 528 RETURN_IF_EXCEPTION(scope, JSValue()); 553 529 } 554 530 // 10. Return R. … … 581 557 break; 582 558 JSStringJoiner joiner(state, separator, length); 583 if (UNLIKELY(scope.exception())) 584 return jsUndefined(); 559 RETURN_IF_EXCEPTION(scope, JSValue()); 585 560 auto data = butterfly.contiguous().data(); 586 561 bool holesKnownToBeOK = false; … … 605 580 break; 606 581 JSStringJoiner joiner(state, separator, length); 607 if (UNLIKELY(scope.exception())) 608 return jsUndefined(); 582 RETURN_IF_EXCEPTION(scope, JSValue()); 609 583 auto data = butterfly.contiguousDouble().data(); 610 584 bool holesKnownToBeOK = false; … … 628 602 generalCase: 629 603 JSStringJoiner joiner(state, separator, length); 630 if (UNLIKELY(scope.exception())) 631 return jsUndefined(); 604 RETURN_IF_EXCEPTION(scope, JSValue()); 632 605 for (unsigned i = 0; i < length; ++i) { 633 606 JSValue element = thisObject->getIndex(&state, i); 634 if (UNLIKELY(scope.exception())) 635 return jsUndefined(); 607 RETURN_IF_EXCEPTION(scope, JSValue()); 636 608 joiner.append(state, element); 637 if (UNLIKELY(scope.exception())) 638 return jsUndefined(); 609 RETURN_IF_EXCEPTION(scope, JSValue()); 639 610 } 640 611 return joiner.join(state); … … 657 628 // 2. Let len be ? ToLength(? Get(O, "length")). 658 629 double length = toLength(exec, thisObject); 659 if (UNLIKELY(scope.exception())) 660 return JSValue::encode(JSValue()); 630 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 661 631 662 632 // 3. If separator is undefined, let separator be the single-element String ",". … … 669 639 ASSERT(static_cast<double>(length64) == length); 670 640 JSString* jsSeparator = jsSingleCharacterString(exec, comma); 671 if (UNLIKELY(scope.exception())) 672 return JSValue::encode(JSValue()); 641 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 673 642 674 643 return JSValue::encode(slowJoin(*exec, thisObject, jsSeparator, length64)); … … 682 651 // 4. Let sep be ? ToString(separator). 683 652 JSString* jsSeparator = separatorValue.toString(exec); 684 if (UNLIKELY(scope.exception())) 685 return JSValue::encode(jsUndefined()); 653 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 686 654 687 655 if (UNLIKELY(length > std::numeric_limits<unsigned>::max() || !canUseFastJoin(thisObject))) { … … 708 676 return JSValue::encode(JSValue()); 709 677 unsigned length = getLength(exec, thisObj); 710 if (UNLIKELY(scope.exception())) 711 return JSValue::encode(jsUndefined()); 678 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 712 679 713 680 JSValue result; … … 717 684 } else { 718 685 result = thisObj->get(exec, length - 1); 719 if (UNLIKELY(scope.exception())) 720 return JSValue::encode(jsUndefined()); 686 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 721 687 if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, length - 1)) { 722 688 throwTypeError(exec, scope, ASCIILiteral("Unable to delete property.")); … … 744 710 return JSValue::encode(JSValue()); 745 711 unsigned length = getLength(exec, thisObj); 746 if (UNLIKELY(scope.exception())) 747 return JSValue::encode(jsUndefined()); 712 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 748 713 749 714 for (unsigned n = 0; n < exec->argumentCount(); n++) { … … 756 721 thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot); 757 722 } 758 if (UNLIKELY(scope.exception())) 759 return JSValue::encode(jsUndefined()); 723 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 760 724 } 761 725 … … 775 739 776 740 unsigned length = getLength(exec, thisObject); 777 if (UNLIKELY(scope.exception())) 778 return JSValue::encode(jsUndefined()); 741 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 779 742 780 743 switch (thisObject->indexingType()) { … … 816 779 unsigned upper = length - lower - 1; 817 780 bool lowerExists = thisObject->hasProperty(exec, lower); 818 if (UNLIKELY(scope.exception())) 819 return JSValue::encode(jsUndefined()); 781 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 820 782 JSValue lowerValue; 821 783 if (lowerExists) { 822 784 lowerValue = thisObject->get(exec, lower); 823 if (UNLIKELY(scope.exception())) 824 return JSValue::encode(jsUndefined()); 785 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 825 786 } 826 787 827 788 bool upperExists = thisObject->hasProperty(exec, upper); 828 if (UNLIKELY(scope.exception())) 829 return JSValue::encode(jsUndefined()); 789 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 830 790 JSValue upperValue; 831 791 if (upperExists) { 832 792 upperValue = thisObject->get(exec, upper); 833 if (UNLIKELY(scope.exception())) 834 return JSValue::encode(jsUndefined()); 793 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 835 794 } 836 795 837 796 if (upperExists) { 838 797 thisObject->putByIndexInline(exec, lower, upperValue, true); 839 if (UNLIKELY(scope.exception())) 840 return JSValue::encode(JSValue()); 798 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 841 799 } else if (!thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, lower)) { 842 800 if (!scope.exception()) … … 847 805 if (lowerExists) { 848 806 thisObject->putByIndexInline(exec, upper, lowerValue, true); 849 if (UNLIKELY(scope.exception())) 850 return JSValue::encode(JSValue()); 807 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 851 808 } else if (!thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, upper)) { 852 809 if (!scope.exception()) … … 866 823 return JSValue::encode(JSValue()); 867 824 unsigned length = getLength(exec, thisObj); 868 if (UNLIKELY(scope.exception())) 869 return JSValue::encode(jsUndefined()); 825 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 870 826 871 827 JSValue result; … … 876 832 result = thisObj->getIndex(exec, 0); 877 833 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()); 880 835 putLength(exec, thisObj, jsNumber(length - 1)); 881 836 } … … 892 847 return JSValue::encode(JSValue()); 893 848 unsigned length = getLength(exec, thisObj); 894 if (UNLIKELY(scope.exception())) 895 return JSValue::encode(jsUndefined()); 849 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 896 850 897 851 unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, length); … … 913 867 else { 914 868 result = constructEmptyArray(exec, nullptr, end - begin); 915 if (UNLIKELY(scope.exception())) 916 return JSValue::encode(jsUndefined()); 869 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 917 870 } 918 871 … … 920 873 for (unsigned k = begin; k < end; k++, n++) { 921 874 JSValue v = getProperty(exec, thisObj, k); 922 if (UNLIKELY(scope.exception())) 923 return JSValue::encode(jsUndefined()); 875 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 924 876 if (v) 925 877 result->putDirectIndex(exec, n, v); … … 940 892 return JSValue::encode(JSValue()); 941 893 unsigned length = getLength(exec, thisObj); 942 if (UNLIKELY(scope.exception())) 943 return JSValue::encode(jsUndefined()); 894 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 944 895 945 896 if (!exec->argumentCount()) { … … 953 904 else { 954 905 result = constructEmptyArray(exec, nullptr); 955 if (UNLIKELY(scope.exception())) 956 return JSValue::encode(jsUndefined()); 906 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 957 907 } 958 908 … … 989 939 for (unsigned k = 0; k < deleteCount; ++k) { 990 940 JSValue v = getProperty(exec, thisObj, k + begin); 991 if (UNLIKELY(scope.exception())) 992 return JSValue::encode(jsUndefined()); 941 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 993 942 if (UNLIKELY(!v)) 994 943 continue; 995 944 result->putByIndexInline(exec, k, v, true); 996 if (UNLIKELY(scope.exception())) 997 return JSValue::encode(jsUndefined()); 945 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 998 946 } 999 947 } else { … … 1004 952 for (unsigned k = 0; k < deleteCount; ++k) { 1005 953 JSValue v = getProperty(exec, thisObj, k + begin); 1006 if (UNLIKELY(scope.exception())) 1007 return JSValue::encode(jsUndefined()); 954 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1008 955 if (UNLIKELY(!v)) 1009 956 continue; … … 1016 963 if (additionalArgs < deleteCount) { 1017 964 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()); 1020 966 } else if (additionalArgs > deleteCount) { 1021 967 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()); 1024 969 } 1025 970 for (unsigned k = 0; k < additionalArgs; ++k) { 1026 971 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()); 1029 973 } 1030 974 … … 1043 987 return JSValue::encode(JSValue()); 1044 988 unsigned length = getLength(exec, thisObj); 1045 if (UNLIKELY(scope.exception())) 1046 return JSValue::encode(jsUndefined()); 989 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1047 990 1048 991 unsigned nrArgs = exec->argumentCount(); 1049 992 if (nrArgs) { 1050 993 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()); 1053 995 } 1054 996 for (unsigned k = 0; k < nrArgs; ++k) { 1055 997 thisObj->putByIndexInline(exec, k, exec->uncheckedArgument(k), true); 1056 if (UNLIKELY(scope.exception())) 1057 return JSValue::encode(jsUndefined()); 998 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1058 999 } 1059 1000 JSValue result = jsNumber(length + nrArgs); … … 1072 1013 return JSValue::encode(JSValue()); 1073 1014 unsigned length = getLength(exec, thisObj); 1074 if (UNLIKELY(scope.exception())) 1075 return JSValue::encode(jsUndefined()); 1015 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1076 1016 1077 1017 unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length); … … 1079 1019 for (; index < length; ++index) { 1080 1020 JSValue e = getProperty(exec, thisObj, index); 1081 if (UNLIKELY(scope.exception())) 1082 return JSValue::encode(jsUndefined()); 1021 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1083 1022 if (!e) 1084 1023 continue; 1085 1024 if (JSValue::strictEqual(exec, searchElement, e)) 1086 1025 return JSValue::encode(jsNumber(index)); 1087 if (UNLIKELY(scope.exception())) 1088 return JSValue::encode(jsUndefined()); 1026 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1089 1027 } 1090 1028 … … 1122 1060 RELEASE_ASSERT(index < length); 1123 1061 JSValue e = getProperty(exec, thisObj, index); 1124 if (UNLIKELY(scope.exception())) 1125 return JSValue::encode(jsUndefined()); 1062 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1126 1063 if (!e) 1127 1064 continue; 1128 1065 if (JSValue::strictEqual(exec, searchElement, e)) 1129 1066 return JSValue::encode(jsNumber(index)); 1130 if (UNLIKELY(scope.exception())) 1131 return JSValue::encode(jsUndefined()); 1067 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1132 1068 } while (index--); 1133 1069 … … 1144 1080 if (value) { 1145 1081 target->putDirectIndex(exec, targetOffset + i, value); 1146 if (UNLIKELY(scope.exception())) 1147 return false; 1082 RETURN_IF_EXCEPTION(scope, false); 1148 1083 } 1149 1084 } … … 1151 1086 for (unsigned i = 0; i < sourceLength; ++i) { 1152 1087 JSValue value = getProperty(exec, source, i); 1153 if (UNLIKELY(scope.exception())) 1154 return false; 1088 RETURN_IF_EXCEPTION(scope, false); 1155 1089 if (value) { 1156 1090 target->putDirectIndex(exec, targetOffset + i, value); 1157 if (UNLIKELY(scope.exception())) 1158 return false; 1091 RETURN_IF_EXCEPTION(scope, false); 1159 1092 } 1160 1093 } … … 1229 1162 if (type == NonArray || !firstArray->canFastCopy(vm, secondArray) || firstArraySize + secondArraySize >= MIN_SPARSE_ARRAY_INDEX) { 1230 1163 JSArray* result = constructEmptyArray(exec, nullptr, firstArraySize + secondArraySize); 1231 if (UNLIKELY(scope.exception())) 1232 return JSValue::encode(JSValue()); 1164 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1233 1165 1234 1166 if (!moveElements(exec, vm, result, 0, firstArray, firstArraySize) -
trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
r205569 r206386 53 53 JSValue boolean = jsBoolean(exec->argument(0).toBoolean(exec)); 54 54 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()); 57 56 BooleanObject* obj = BooleanObject::create(vm, booleanStructure); 58 57 obj->setInternalValue(vm, boolean); -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h
r205569 r206386 88 88 89 89 auto property = propName.toPropertyKey(exec); 90 if (scope.exception()) 91 return false; 90 RETURN_IF_EXCEPTION(scope, false); 92 91 return baseObj->hasProperty(exec, property); 93 92 } -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r206333 r206386 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 3 * 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. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 194 194 // Insert the given source code to the ModuleLoader registry as the fetched registry entry. 195 195 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)); 198 197 199 198 return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined(), initiator); … … 234 233 // FIXME: Introduce JSSourceCode object to wrap around this source. 235 234 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)); 238 236 239 237 return loadModule(lock, exec, globalObject, key, jsUndefined(), initiator); -
trunk/Source/JavaScriptCore/runtime/ConsoleObject.cpp
r205569 r206386 204 204 205 205 bool condition = exec->argument(0).toBoolean(exec); 206 if (UNLIKELY(scope.exception())) 207 return JSValue::encode(jsUndefined()); 206 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 208 207 209 208 if (condition) … … 241 240 242 241 const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); 243 if (UNLIKELY(scope.exception())) 244 return JSValue::encode(jsUndefined()); 242 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 245 243 246 244 client->profile(exec, title); … … 263 261 264 262 const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); 265 if (UNLIKELY(scope.exception())) 266 return JSValue::encode(jsUndefined()); 263 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 267 264 268 265 client->profileEnd(exec, title); … … 285 282 286 283 const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); 287 if (UNLIKELY(scope.exception())) 288 return JSValue::encode(jsUndefined()); 284 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 289 285 290 286 client->takeHeapSnapshot(exec, title); … … 312 308 else { 313 309 title = valueOrDefaultLabelString(exec, exec->argument(0)); 314 if (UNLIKELY(scope.exception())) 315 return JSValue::encode(jsUndefined()); 310 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 316 311 } 317 312 … … 333 328 else { 334 329 title = valueOrDefaultLabelString(exec, exec->argument(0)); 335 if (UNLIKELY(scope.exception())) 336 return JSValue::encode(jsUndefined()); 330 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 337 331 } 338 332 -
trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp
r205569 r206386 1 1 /* 2 2 * 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. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 169 169 170 170 Structure* dateStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->dateStructure()); 171 if (UNLIKELY(scope.exception())) 172 return nullptr; 171 RETURN_IF_EXCEPTION(scope, nullptr); 173 172 174 173 return DateInstance::create(vm, dateStructure, value); … … 207 206 auto scope = DECLARE_THROW_SCOPE(vm); 208 207 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()); 211 209 return JSValue::encode(jsNumber(parseDate(vm, dateStr))); 212 210 } -
trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp
r205569 r206386 616 616 JSValue hintValue = exec->uncheckedArgument(0); 617 617 PreferredPrimitiveType type = toPreferredPrimitiveType(exec, hintValue); 618 if (UNLIKELY(scope.exception())) 619 return JSValue::encode(JSValue()); 618 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 620 619 621 620 if (type == NoPreference) … … 1129 1128 JSValue thisValue = exec->thisValue(); 1130 1129 JSObject* object = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode)); 1131 if (UNLIKELY(scope.exception())) 1132 return JSValue::encode(jsNull()); 1130 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1133 1131 1134 1132 JSValue timeValue = object->toPrimitive(exec, PreferNumber); 1135 if (UNLIKELY(scope.exception())) 1136 return JSValue::encode(jsNull()); 1133 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1137 1134 if (timeValue.isNumber() && !(timeValue.isInt32() || std::isfinite(timeValue.asDouble()))) 1138 1135 return JSValue::encode(jsNull()); 1139 1136 1140 1137 JSValue toISOValue = object->get(exec, vm.propertyNames->toISOString); 1141 if (UNLIKELY(scope.exception())) 1142 return JSValue::encode(jsNull()); 1138 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1143 1139 1144 1140 CallData callData; … … 1148 1144 1149 1145 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()); 1152 1147 if (result.isObject()) 1153 1148 return throwVMTypeError(exec, scope, ASCIILiteral("toISOString did not return a primitive value")); -
trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
r206018 r206386 55 55 JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); 56 56 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()); 59 58 return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)); 60 59 } -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp
r205569 r206386 186 186 else { 187 187 nameString = nameValue.toString(exec)->value(exec); 188 if (UNLIKELY(scope.exception())) 189 return String(); 188 RETURN_IF_EXCEPTION(scope, String()); 190 189 } 191 190 … … 202 201 else { 203 202 messageString = messageValue.toString(exec)->value(exec); 204 if (UNLIKELY(scope.exception())) 205 return String(); 203 RETURN_IF_EXCEPTION(scope, String()); 206 204 } 207 205 -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r205569 r206386 86 86 // 3. Let name be the result of calling the [[Get]] internal method of O with argument "name". 87 87 JSValue name = thisObj->get(exec, exec->propertyNames().name); 88 if (UNLIKELY(scope.exception())) 89 return JSValue::encode(jsUndefined()); 88 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 90 89 91 90 // 4. If name is undefined, then let name be "Error"; else let name be ToString(name). … … 95 94 else { 96 95 nameString = name.toString(exec)->value(exec); 97 if (UNLIKELY(scope.exception())) 98 return JSValue::encode(jsUndefined()); 96 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 99 97 } 100 98 101 99 // 5. Let msg be the result of calling the [[Get]] internal method of O with argument "message". 102 100 JSValue message = thisObj->get(exec, exec->propertyNames().message); 103 if (UNLIKELY(scope.exception())) 104 return JSValue::encode(jsUndefined()); 101 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 105 102 106 103 // (sic) … … 112 109 else { 113 110 messageString = message.toString(exec)->value(exec); 114 if (UNLIKELY(scope.exception())) 115 return JSValue::encode(jsUndefined()); 111 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 116 112 } 117 113 -
trunk/Source/JavaScriptCore/runtime/ExceptionScope.h
r205569 r206386 71 71 72 72 #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 74 79 } // namespace JSC 75 80 -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r205569 r206386 127 127 128 128 Structure* subclassStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->functionStructure()); 129 if (UNLIKELY(scope.exception())) 130 return nullptr; 129 RETURN_IF_EXCEPTION(scope, nullptr); 131 130 132 131 return JSFunction::create(vm, function, globalObject->globalScope(), subclassStructure); -
trunk/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
r205569 r206386 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 229 229 else { 230 230 exec->r(firstElementDest + i) = get(exec, i + offset); 231 if (UNLIKELY(scope.exception())) 232 return; 231 RETURN_IF_EXCEPTION(scope, void()); 233 232 } 234 233 } -
trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp
r205569 r206386 78 78 // FIXME: Some callers may invoke get() without checking for an exception first. 79 79 // 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()); 82 81 83 82 JSObject* getter = jsCast<GetterSetter*>(getterSetter)->getter(); -
trunk/Source/JavaScriptCore/runtime/HashMapImpl.h
r205989 r206386 246 246 JSString* string = asString(value); 247 247 const String& wtfString = string->value(exec); 248 if (UNLIKELY(scope.exception())) 249 return UINT_MAX; 248 RETURN_IF_EXCEPTION(scope, UINT_MAX); 250 249 return wtfString.impl()->hash(); 251 250 } … … 338 337 339 338 makeAndSetNewBuffer(exec, vm); 340 if (UNLIKELY(scope.exception())) 341 return; 339 RETURN_IF_EXCEPTION(scope, void()); 342 340 343 341 m_head.set(vm, this, HashMapBucketType::create(vm)); … … 377 375 key = normalizeMapKey(key); 378 376 uint32_t hash = jsMapHash(exec, vm, key); 379 if (UNLIKELY(scope.exception())) 380 return nullptr; 377 RETURN_IF_EXCEPTION(scope, nullptr); 381 378 return findBucket(exec, key, hash); 382 379 } … … 409 406 const uint32_t mask = m_capacity - 1; 410 407 uint32_t index = jsMapHash(exec, vm, key) & mask; 411 if (UNLIKELY(scope.exception())) 412 return; 408 RETURN_IF_EXCEPTION(scope, void()); 413 409 HashMapBucketType** buffer = this->buffer(); 414 410 HashMapBucketType* bucket = buffer[index]; … … 571 567 if (m_capacity != oldCapacity) { 572 568 makeAndSetNewBuffer(exec, vm); 573 if (UNLIKELY(scope.exception())) 574 return; 569 RETURN_IF_EXCEPTION(scope, void()); 575 570 } else { 576 571 m_buffer.get()->reset(m_capacity); -
trunk/Source/JavaScriptCore/runtime/InspectorInstrumentationObject.cpp
r205569 r206386 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 88 88 JSValue target = exec->argument(0); 89 89 String value = target.toString(exec)->value(exec); 90 if (UNLIKELY(scope.exception())) 91 return JSValue::encode(jsUndefined()); 90 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 92 91 dataLog(value, "\n"); 93 92 return JSValue::encode(jsUndefined()); -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r205569 r206386 2 2 * Copyright (C) 1999-2002 Harri Porten (porten@kde.org) 3 3 * 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. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 114 114 // Note, Reflect.construct might cause the profile to churn but we don't care. 115 115 JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype); 116 if (UNLIKELY(scope.exception())) 117 return nullptr; 116 RETURN_IF_EXCEPTION(scope, nullptr); 118 117 if (JSObject* prototype = jsDynamicCast<JSObject*>(prototypeValue)) 119 118 return targetFunction->rareData(vm)->createInternalFunctionAllocationStructureFromBase(vm, prototype, baseClass); 120 119 } else { 121 120 JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype); 122 if (UNLIKELY(scope.exception())) 123 return nullptr; 121 RETURN_IF_EXCEPTION(scope, nullptr); 124 122 if (JSObject* prototype = jsDynamicCast<JSObject*>(prototypeValue)) { 125 123 // 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 173 173 auto requestedLocales = canonicalizeLocaleList(state, locales); 174 174 // 4. ReturnIfAbrupt(requestedLocales). 175 if (UNLIKELY(scope.exception())) 176 return; 175 RETURN_IF_EXCEPTION(scope, void()); 177 176 178 177 // 5. If options is undefined, then … … 185 184 options = optionsValue.toObject(&state); 186 185 // b. ReturnIfAbrupt(options). 187 if (UNLIKELY(scope.exception())) 188 return; 186 RETURN_IF_EXCEPTION(scope, void()); 189 187 } 190 188 … … 192 190 String usageString = intlStringOption(state, options, vm.propertyNames->usage, { "sort", "search" }, "usage must be either \"sort\" or \"search\"", "sort"); 193 191 // 8. ReturnIfAbrupt(u). 194 if (UNLIKELY(scope.exception())) 195 return; 192 RETURN_IF_EXCEPTION(scope, void()); 196 193 // 9. Set collator.[[usage]] to u. 197 194 if (usageString == "sort") … … 218 215 String matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 219 216 // 14. ReturnIfAbrupt(matcher). 220 if (UNLIKELY(scope.exception())) 221 return; 217 RETURN_IF_EXCEPTION(scope, void()); 222 218 // 15. Set opt.[[localeMatcher]] to matcher. 223 219 opt.add(ASCIILiteral("localeMatcher"), matcher); … … 238 234 bool usesFallback; 239 235 bool numeric = intlBooleanOption(state, options, vm.propertyNames->numeric, usesFallback); 240 if (UNLIKELY(scope.exception())) 241 return; 236 RETURN_IF_EXCEPTION(scope, void()); 242 237 if (!usesFallback) 243 238 numericString = ASCIILiteral(numeric ? "true" : "false"); … … 246 241 { 247 242 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()); 250 244 opt.add(ASCIILiteral("kf"), caseFirst); 251 245 } … … 287 281 String sensitivityString = intlStringOption(state, options, vm.propertyNames->sensitivity, { "base", "accent", "case", "variant" }, "sensitivity must be either \"base\", \"accent\", \"case\", or \"variant\"", nullptr); 288 282 // 25. ReturnIfAbrupt(s). 289 if (UNLIKELY(scope.exception())) 290 return; 283 RETURN_IF_EXCEPTION(scope, void()); 291 284 // 26. If s is undefined, then 292 285 // a. If u is "sort", then let s be "variant". … … 312 305 ignorePunctuation = false; 313 306 // 29. ReturnIfAbrupt(ip). 314 if (UNLIKELY(scope.exception())) 315 return; 307 RETURN_IF_EXCEPTION(scope, void()); 316 308 // 30. Set collator.[[ignorePunctuation]] to ip. 317 309 m_ignorePunctuation = ignorePunctuation; -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp
r205569 r206386 2 2 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com) 3 3 * Copyright (C) 2015 Sukolsak Sakshuwong (sukolsak@gmail.com) 4 * Copyright (C) 2016 Apple Inc. All Rights Reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 91 92 // 3. ReturnIfAbrupt(collator). 92 93 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()); 95 95 IntlCollator* collator = IntlCollator::create(vm, structure); 96 96 ASSERT(collator); … … 145 145 146 146 // 2. ReturnIfAbrupt(requestedLocales). 147 if (UNLIKELY(scope.exception())) 148 return JSValue::encode(jsUndefined()); 147 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 149 148 150 149 // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options). -
trunk/Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp
r205569 r206386 91 91 JSString* x = state->argument(0).toString(state); 92 92 // 6. ReturnIfAbrupt(X). 93 if (UNLIKELY(scope.exception())) 94 return JSValue::encode(jsUndefined()); 93 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 95 94 96 95 // 7. Let Y be ToString(y). 97 96 JSString* y = state->argument(1).toString(state); 98 97 // 8. ReturnIfAbrupt(Y). 99 if (UNLIKELY(scope.exception())) 100 return JSValue::encode(jsUndefined()); 98 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 101 99 102 100 // 9. Return CompareStrings(collator, X, Y). … … 125 123 // c. Let bc be BoundFunctionCreate(F, «this value»). 126 124 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()); 129 126 // d. Set collator.[[boundCompare]] to bc. 130 127 collator->setBoundCompare(vm, boundCompare); -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
r206295 r206386 226 226 else { 227 227 JSObject* originalToObject = originalOptions.toObject(&exec); 228 if (UNLIKELY(scope.exception())) 229 return nullptr; 228 RETURN_IF_EXCEPTION(scope, nullptr); 230 229 options = constructEmptyObject(&exec, originalToObject); 231 230 } … … 243 242 // iv. If value is not undefined, then let needDefaults be false. 244 243 JSValue weekday = options->get(&exec, vm.propertyNames->weekday); 245 if (UNLIKELY(scope.exception())) 246 return nullptr; 244 RETURN_IF_EXCEPTION(scope, nullptr); 247 245 if (!weekday.isUndefined()) 248 246 needDefaults = false; 249 247 250 248 JSValue year = options->get(&exec, vm.propertyNames->year); 251 if (UNLIKELY(scope.exception())) 252 return nullptr; 249 RETURN_IF_EXCEPTION(scope, nullptr); 253 250 if (!year.isUndefined()) 254 251 needDefaults = false; 255 252 256 253 JSValue month = options->get(&exec, vm.propertyNames->month); 257 if (UNLIKELY(scope.exception())) 258 return nullptr; 254 RETURN_IF_EXCEPTION(scope, nullptr); 259 255 if (!month.isUndefined()) 260 256 needDefaults = false; 261 257 262 258 JSValue day = options->get(&exec, vm.propertyNames->day); 263 if (UNLIKELY(scope.exception())) 264 return nullptr; 259 RETURN_IF_EXCEPTION(scope, nullptr); 265 260 if (!day.isUndefined()) 266 261 needDefaults = false; … … 275 270 // iv. If value is not undefined, then let needDefaults be false. 276 271 JSValue hour = options->get(&exec, vm.propertyNames->hour); 277 if (UNLIKELY(scope.exception())) 278 return nullptr; 272 RETURN_IF_EXCEPTION(scope, nullptr); 279 273 if (!hour.isUndefined()) 280 274 needDefaults = false; 281 275 282 276 JSValue minute = options->get(&exec, vm.propertyNames->minute); 283 if (UNLIKELY(scope.exception())) 284 return nullptr; 277 RETURN_IF_EXCEPTION(scope, nullptr); 285 278 if (!minute.isUndefined()) 286 279 needDefaults = false; 287 280 288 281 JSValue second = options->get(&exec, vm.propertyNames->second); 289 if (UNLIKELY(scope.exception())) 290 return nullptr; 282 RETURN_IF_EXCEPTION(scope, nullptr); 291 283 if (!second.isUndefined()) 292 284 needDefaults = false; … … 301 293 302 294 options->putDirect(vm, vm.propertyNames->year, numeric); 303 if (UNLIKELY(scope.exception())) 304 return nullptr; 295 RETURN_IF_EXCEPTION(scope, nullptr); 305 296 306 297 options->putDirect(vm, vm.propertyNames->month, numeric); 307 if (UNLIKELY(scope.exception())) 308 return nullptr; 298 RETURN_IF_EXCEPTION(scope, nullptr); 309 299 310 300 options->putDirect(vm, vm.propertyNames->day, numeric); 311 if (UNLIKELY(scope.exception())) 312 return nullptr; 301 RETURN_IF_EXCEPTION(scope, nullptr); 313 302 } 314 303 … … 430 419 Vector<String> requestedLocales = canonicalizeLocaleList(exec, locales); 431 420 // 4. ReturnIfAbrupt(requestedLocales), 432 if (UNLIKELY(scope.exception())) 433 return; 421 RETURN_IF_EXCEPTION(scope, void()); 434 422 435 423 // 5. Let options be ToDateTimeOptions(options, "any", "date"). 436 424 JSObject* options = toDateTimeOptionsAnyDate(exec, originalOptions); 437 425 // 6. ReturnIfAbrupt(options). 438 if (UNLIKELY(scope.exception())) 439 return; 426 RETURN_IF_EXCEPTION(scope, void()); 440 427 441 428 // 7. Let opt be a new Record. … … 445 432 String localeMatcher = intlStringOption(exec, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 446 433 // 9. ReturnIfAbrupt(matcher). 447 if (UNLIKELY(scope.exception())) 448 return; 434 RETURN_IF_EXCEPTION(scope, void()); 449 435 // 10. Set opt.[[localeMatcher]] to matcher. 450 436 localeOpt.add(vm.propertyNames->localeMatcher.string(), localeMatcher); … … 478 464 JSValue tzValue = options->get(&exec, vm.propertyNames->timeZone); 479 465 // 18. ReturnIfAbrupt(tz). 480 if (UNLIKELY(scope.exception())) 481 return; 466 RETURN_IF_EXCEPTION(scope, void()); 482 467 483 468 // 19. If tz is not undefined, then … … 487 472 String originalTz = tzValue.toWTFString(&exec); 488 473 // b. ReturnIfAbrupt(tz). 489 if (UNLIKELY(scope.exception())) 490 return; 474 RETURN_IF_EXCEPTION(scope, void()); 491 475 // c. If the result of IsValidTimeZoneName(tz) is false, then i. Throw a RangeError exception. 492 476 // d. Let tz be CanonicalizeTimeZoneName(tz). … … 520 504 521 505 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()); 524 507 if (!weekday.isNull()) { 525 508 if (weekday == "narrow") … … 532 515 533 516 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()); 536 518 if (!era.isNull()) { 537 519 if (era == "narrow") … … 544 526 545 527 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()); 548 529 if (!year.isNull()) { 549 530 if (year == "2-digit") … … 554 535 555 536 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()); 558 538 if (!month.isNull()) { 559 539 if (month == "2-digit") … … 570 550 571 551 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()); 574 553 if (!day.isNull()) { 575 554 if (day == "2-digit") … … 580 559 581 560 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()); 584 562 585 563 // We need hour12 to make the hour skeleton pattern decision, so do this early. … … 588 566 bool hr12 = intlBooleanOption(exec, options, vm.propertyNames->hour12, isHour12Undefined); 589 567 // 33. ReturnIfAbrupt(hr12). 590 if (UNLIKELY(scope.exception())) 591 return; 568 RETURN_IF_EXCEPTION(scope, void()); 592 569 593 570 if (!hour.isNull()) { … … 611 588 612 589 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()); 615 591 if (!minute.isNull()) { 616 592 if (minute == "2-digit") … … 621 597 622 598 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()); 625 600 if (!second.isNull()) { 626 601 if (second == "2-digit") … … 631 606 632 607 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()); 635 609 if (!timeZoneName.isNull()) { 636 610 if (timeZoneName == "short") … … 645 619 intlStringOption(exec, options, vm.propertyNames->formatMatcher, { "basic", "best fit" }, "formatMatcher must be either \"basic\" or \"best fit\"", "best fit"); 646 620 // 27. ReturnIfAbrupt(matcher). 647 if (UNLIKELY(scope.exception())) 648 return; 621 RETURN_IF_EXCEPTION(scope, void()); 649 622 650 623 // Always use ICU date format generator, rather than our own pattern list and matcher. -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp
r205569 r206386 1 1 /* 2 2 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com) 3 * Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 91 92 // 3. ReturnIfAbrupt(dateTimeFormat). 92 93 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()); 95 95 IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create(vm, structure); 96 96 ASSERT(dateTimeFormat); … … 147 147 // 2. Let requestedLocales be CanonicalizeLocaleList(locales). 148 148 Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0)); 149 if (UNLIKELY(scope.exception())) 150 return JSValue::encode(jsUndefined()); 149 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 151 150 152 151 // 3. Return SupportedLocales(availableLocales, requestedLocales, options). -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp
r205569 r206386 102 102 value = date.toNumber(state); 103 103 // b. ReturnIfAbrupt(x). 104 if (UNLIKELY(scope.exception())) 105 return JSValue::encode(jsUndefined()); 104 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 106 105 } 107 106 … … 141 140 // c. Let bf be BoundFunctionCreate(F, «this value»). 142 141 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()); 145 143 // d. Set dtf.[[boundFormat]] to bf. 146 144 dtf->setBoundFormat(vm, boundFormat); -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp
r206295 r206386 165 165 auto requestedLocales = canonicalizeLocaleList(state, locales); 166 166 // 4. ReturnIfAbrupt(requestedLocales). 167 if (UNLIKELY(scope.exception())) 168 return; 167 RETURN_IF_EXCEPTION(scope, void()); 169 168 170 169 // 5. If options is undefined, then … … 177 176 options = optionsValue.toObject(&state); 178 177 // b. ReturnIfAbrupt(options). 179 if (UNLIKELY(scope.exception())) 180 return; 178 RETURN_IF_EXCEPTION(scope, void()); 181 179 } 182 180 … … 187 185 String matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 188 186 // 9. ReturnIfAbrupt(matcher). 189 if (UNLIKELY(scope.exception())) 190 return; 187 RETURN_IF_EXCEPTION(scope, void()); 191 188 // 10. Set opt.[[localeMatcher]] to matcher. 192 189 opt.add(ASCIILiteral("localeMatcher"), matcher); … … 212 209 String styleString = intlStringOption(state, options, Identifier::fromString(&vm, "style"), { "decimal", "percent", "currency" }, "style must be either \"decimal\", \"percent\", or \"currency\"", "decimal"); 213 210 // 17. ReturnIfAbrupt(s). 214 if (UNLIKELY(scope.exception())) 215 return; 211 RETURN_IF_EXCEPTION(scope, void()); 216 212 // 18. Set numberFormat.[[style]] to s. 217 213 if (styleString == "decimal") … … 227 223 String currency = intlStringOption(state, options, Identifier::fromString(&vm, "currency"), { }, nullptr, nullptr); 228 224 // 20. ReturnIfAbrupt(c). 229 if (UNLIKELY(scope.exception())) 230 return; 225 RETURN_IF_EXCEPTION(scope, void()); 231 226 // 21. If c is not undefined, then 232 227 if (!currency.isNull()) { … … 258 253 String currencyDisplayString = intlStringOption(state, options, Identifier::fromString(&vm, "currencyDisplay"), { "code", "symbol", "name" }, "currencyDisplay must be either \"code\", \"symbol\", or \"name\"", "symbol"); 259 254 // 25. ReturnIfAbrupt(cd). 260 if (UNLIKELY(scope.exception())) 261 return; 255 RETURN_IF_EXCEPTION(scope, void()); 262 256 // 26. If s is "currency", set numberFormat.[[currencyDisplay]] to cd. 263 257 if (m_style == Style::Currency) { … … 276 270 // 29. Set numberFormat.[[minimumIntegerDigits]] to mnid. 277 271 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()); 280 273 m_minimumIntegerDigits = minimumIntegerDigits; 281 274 … … 287 280 // 33. Set numberFormat.[[minimumFractionDigits]] to mnfd. 288 281 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()); 291 283 m_minimumFractionDigits = minimumFractionDigits; 292 284 … … 304 296 // 37. Set numberFormat.[[maximumFractionDigits]] to mxfd. 305 297 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()); 308 299 m_maximumFractionDigits = maximumFractionDigits; 309 300 … … 311 302 JSValue minimumSignificantDigitsValue = options->get(&state, Identifier::fromString(&vm, "minimumSignificantDigits")); 312 303 // 39. ReturnIfAbrupt(mnsd). 313 if (UNLIKELY(scope.exception())) 314 return; 304 RETURN_IF_EXCEPTION(scope, void()); 315 305 316 306 // 40. Let mxsd be Get(options, "maximumSignificantDigits"). 317 307 JSValue maximumSignificantDigitsValue = options->get(&state, Identifier::fromString(&vm, "maximumSignificantDigits")); 318 308 // 41. ReturnIfAbrupt(mxsd). 319 if (UNLIKELY(scope.exception())) 320 return; 309 RETURN_IF_EXCEPTION(scope, void()); 321 310 322 311 // 42. If mnsd is not undefined or mxsd is not undefined, then … … 325 314 unsigned minimumSignificantDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumSignificantDigits"), 1, 21, 1); 326 315 // b. ReturnIfAbrupt(mnsd). 327 if (UNLIKELY(scope.exception())) 328 return; 316 RETURN_IF_EXCEPTION(scope, void()); 329 317 // c. Let mxsd be GetNumberOption(options, "maximumSignificantDigits", mnsd, 21, 21). 330 318 unsigned maximumSignificantDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "maximumSignificantDigits"), minimumSignificantDigits, 21, 21); 331 319 // d. ReturnIfAbrupt(mxsd). 332 if (UNLIKELY(scope.exception())) 333 return; 320 RETURN_IF_EXCEPTION(scope, void()); 334 321 // e. Set numberFormat.[[minimumSignificantDigits]] to mnsd. 335 322 m_minimumSignificantDigits = minimumSignificantDigits; … … 344 331 useGrouping = true; 345 332 // 44. ReturnIfAbrupt(g). 346 if (UNLIKELY(scope.exception())) 347 return; 333 RETURN_IF_EXCEPTION(scope, void()); 348 334 // 45. Set numberFormat.[[useGrouping]] to g. 349 335 m_useGrouping = useGrouping; -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp
r205569 r206386 1 1 /* 2 2 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com) 3 * Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 91 92 // 3. ReturnIfAbrupt(numberFormat). 92 93 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()); 95 95 IntlNumberFormat* numberFormat = IntlNumberFormat::create(vm, structure); 96 96 ASSERT(numberFormat); … … 147 147 // 2. Let requestedLocales be CanonicalizeLocaleList(locales). 148 148 Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0)); 149 if (UNLIKELY(scope.exception())) 150 return JSValue::encode(jsUndefined()); 149 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 151 150 152 151 // 3. Return SupportedLocales(availableLocales, requestedLocales, options). -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp
r205569 r206386 92 92 double number = state->argument(0).toNumber(state); 93 93 // 5. ReturnIfAbrupt(x). 94 if (UNLIKELY(scope.exception())) 95 return JSValue::encode(jsUndefined()); 94 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 96 95 97 96 // 6. Return FormatNumber(nf, x). … … 129 128 // c. Let bf be BoundFunctionCreate(F, «this value»). 130 129 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()); 133 131 // d. Set nf.[[boundFormat]] to bf. 134 132 nf->setBoundFormat(vm, boundFormat); -
trunk/Source/JavaScriptCore/runtime/IntlObject.cpp
r205569 r206386 135 135 136 136 // 2. ReturnIfAbrupt(opts). 137 if (UNLIKELY(scope.exception())) 138 return false; 137 RETURN_IF_EXCEPTION(scope, false); 139 138 140 139 // 3. Let value be Get(opts, property). … … 142 141 143 142 // 4. ReturnIfAbrupt(value). 144 if (UNLIKELY(scope.exception())) 145 return false; 143 RETURN_IF_EXCEPTION(scope, false); 146 144 147 145 // 5. If value is not undefined, then … … 177 175 178 176 // 2. ReturnIfAbrupt(opts). 179 if (UNLIKELY(scope.exception())) 180 return { }; 177 RETURN_IF_EXCEPTION(scope, String()); 181 178 182 179 // 3. Let value be Get(opts, property). … … 184 181 185 182 // 4. ReturnIfAbrupt(value). 186 if (UNLIKELY(scope.exception())) 187 return { }; 183 RETURN_IF_EXCEPTION(scope, String()); 188 184 189 185 // 5. If value is not undefined, then … … 197 193 198 194 // ii. ReturnIfAbrupt(value). 199 if (UNLIKELY(scope.exception())) 200 return { }; 195 RETURN_IF_EXCEPTION(scope, String()); 201 196 202 197 // d. If values is not undefined, then … … 225 220 226 221 // 2. ReturnIfAbrupt(opts). 227 if (UNLIKELY(scope.exception())) 228 return 0; 222 RETURN_IF_EXCEPTION(scope, 0); 229 223 230 224 // 3. Let value be Get(opts, property). … … 232 226 233 227 // 4. ReturnIfAbrupt(value). 234 if (UNLIKELY(scope.exception())) 235 return 0; 228 RETURN_IF_EXCEPTION(scope, 0); 236 229 237 230 // 5. If value is not undefined, then … … 240 233 double doubleValue = value.toNumber(&state); 241 234 // b. ReturnIfAbrupt(value). 242 if (UNLIKELY(scope.exception())) 243 return 0; 235 RETURN_IF_EXCEPTION(scope, 0); 244 236 // 1. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception. 245 237 if (!(doubleValue >= minimum && doubleValue <= maximum)) { … … 561 553 562 554 // 5. ReturnIfAbrupt(O). 563 if (UNLIKELY(scope.exception())) 564 return Vector<String>(); 555 RETURN_IF_EXCEPTION(scope, Vector<String>()); 565 556 566 557 // 6. Let len be ToLength(Get(O, "length")). 567 558 JSValue lengthProperty = localesObject->get(&state, vm.propertyNames->length); 568 if (UNLIKELY(scope.exception())) 569 return Vector<String>(); 559 RETURN_IF_EXCEPTION(scope, Vector<String>()); 570 560 571 561 double length = lengthProperty.toLength(&state); 572 if (UNLIKELY(scope.exception())) 573 return Vector<String>(); 562 RETURN_IF_EXCEPTION(scope, Vector<String>()); 574 563 575 564 // Keep track of locales that have been added to the list. … … 586 575 587 576 // c. ReturnIfAbrupt(kPresent). 588 if (UNLIKELY(scope.exception())) 589 return Vector<String>(); 577 RETURN_IF_EXCEPTION(scope, Vector<String>()); 590 578 591 579 // d. If kPresent is true, then … … 595 583 596 584 // ii. ReturnIfAbrupt(kValue). 597 if (UNLIKELY(scope.exception())) 598 return Vector<String>(); 585 RETURN_IF_EXCEPTION(scope, Vector<String>()); 599 586 600 587 // iii. If Type(kValue) is not String or Object, throw a TypeError exception. … … 608 595 609 596 // v. ReturnIfAbrupt(tag). 610 if (UNLIKELY(scope.exception())) 611 return Vector<String>(); 597 RETURN_IF_EXCEPTION(scope, Vector<String>()); 612 598 613 599 // vi. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception. … … 946 932 matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 947 933 // b. ReturnIfAbrupt(matcher). 948 if (UNLIKELY(scope.exception())) 949 return jsUndefined(); 934 RETURN_IF_EXCEPTION(scope, JSValue()); 950 935 } else { 951 936 // 2. Else, let matcher be "best fit". … … 966 951 } 967 952 968 if (UNLIKELY(scope.exception())) 969 return jsUndefined(); 953 RETURN_IF_EXCEPTION(scope, JSValue()); 970 954 971 955 // 6. Let subset be CreateArrayFromList(supportedLocales). … … 975 959 PropertyNameArray keys(&state, PropertyNameMode::Strings); 976 960 supportedLocales->getOwnPropertyNames(supportedLocales, &state, keys, EnumerationMode()); 977 if (UNLIKELY(scope.exception())) 978 return jsUndefined(); 961 RETURN_IF_EXCEPTION(scope, JSValue()); 979 962 980 963 PropertyDescriptor desc; … … 992 975 993 976 // c. Assert: status is not abrupt completion. 994 if (UNLIKELY(scope.exception())) 995 return jsUndefined(); 977 RETURN_IF_EXCEPTION(scope, JSValue()); 996 978 } 997 979 -
trunk/Source/JavaScriptCore/runtime/IntlObjectInlines.h
r205569 r206386 47 47 if (JSObject::defaultHasInstance(&state, thisValue, prototype)) { 48 48 JSObject* thisObject = thisValue.toObject(&state); 49 if (UNLIKELY(scope.exception())) 50 return jsUndefined(); 49 RETURN_IF_EXCEPTION(scope, JSValue()); 51 50 52 51 IntlInstance* instance = factory(vm); 53 if (UNLIKELY(scope.exception())) 54 return jsUndefined(); 52 RETURN_IF_EXCEPTION(scope, JSValue()); 55 53 56 54 thisObject->putDirect(vm, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName(), instance); -
trunk/Source/JavaScriptCore/runtime/IteratorOperations.cpp
r205569 r206386 42 42 43 43 JSValue nextFunction = iterator.get(exec, vm.propertyNames->next); 44 if (UNLIKELY(scope.exception())) 45 return jsUndefined(); 44 RETURN_IF_EXCEPTION(scope, JSValue()); 46 45 47 46 CallData nextFunctionCallData; … … 54 53 nextFunctionArguments.append(value); 55 54 JSValue result = call(exec, nextFunction, nextFunctionCallType, nextFunctionCallData, iterator, nextFunctionArguments); 56 if (UNLIKELY(scope.exception())) 57 return jsUndefined(); 55 RETURN_IF_EXCEPTION(scope, JSValue()); 58 56 59 57 if (!result.isObject()) … … 85 83 86 84 JSValue result = iteratorNext(exec, iterator); 87 if (UNLIKELY(scope.exception())) 88 return jsUndefined(); 85 RETURN_IF_EXCEPTION(scope, JSValue()); 89 86 bool done = iteratorComplete(exec, result); 90 if (UNLIKELY(scope.exception())) 91 return jsUndefined(); 87 RETURN_IF_EXCEPTION(scope, JSValue()); 92 88 if (done) 93 89 return jsBoolean(false); … … 107 103 } 108 104 JSValue returnFunction = iterator.get(exec, vm.propertyNames->returnKeyword); 109 if (UNLIKELY(throwScope.exception())) 110 return; 105 RETURN_IF_EXCEPTION(throwScope, void()); 111 106 112 107 if (returnFunction.isUndefined()) { … … 134 129 } 135 130 136 if (UNLIKELY(throwScope.exception())) 137 return; 131 RETURN_IF_EXCEPTION(throwScope, void()); 138 132 139 133 if (!innerResult.isObject()) { … … 172 166 173 167 JSValue iteratorFunction = iterable.get(state, state->propertyNames().iteratorSymbol); 174 if (UNLIKELY(scope.exception())) 175 return JSValue(); 168 RETURN_IF_EXCEPTION(scope, JSValue()); 176 169 177 170 CallData iteratorFunctionCallData; … … 184 177 ArgList iteratorFunctionArguments; 185 178 JSValue iterator = call(state, iteratorFunction, iteratorFunctionCallType, iteratorFunctionCallData, iterable, iteratorFunctionArguments); 186 if (UNLIKELY(scope.exception())) 187 return JSValue(); 179 RETURN_IF_EXCEPTION(scope, JSValue()); 188 180 189 181 if (!iterator.isObject()) { -
trunk/Source/JavaScriptCore/runtime/IteratorOperations.h
r205569 r206386 1 1 /* 2 2 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. 3 * Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 52 53 53 54 JSValue iterator = iteratorForIterable(state, iterable); 54 if (UNLIKELY(scope.exception())) 55 return; 55 RETURN_IF_EXCEPTION(scope, void()); 56 56 while (true) { 57 57 JSValue next = iteratorStep(state, iterator); … … 60 60 61 61 JSValue nextValue = iteratorValue(state, next); 62 if (UNLIKELY(scope.exception())) 63 return; 62 RETURN_IF_EXCEPTION(scope, void()); 64 63 65 64 callback(vm, state, nextValue); -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r205666 r206386 654 654 // Let element be the result of calling the [[Get]] internal method of O with argument indx. 655 655 JSValue element = get(exec, index); 656 if (UNLIKELY(scope.exception())) 657 return jsUndefined(); 656 RETURN_IF_EXCEPTION(scope, JSValue()); 658 657 // Call the [[Delete]] internal method of O with arguments indx and true. 659 658 if (!deletePropertyByIndex(this, exec, index)) { … … 1324 1323 for (; i < length; ++i) { 1325 1324 exec->r(firstElementDest + i - offset) = get(exec, i); 1326 if (UNLIKELY(scope.exception())) 1327 return; 1325 RETURN_IF_EXCEPTION(scope, void()); 1328 1326 } 1329 1327 } -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
r205569 r206386 89 89 if (exec->argumentCount()) { 90 90 length = exec->uncheckedArgument(0).toUInt32(exec); 91 if (UNLIKELY(scope.exception())) 92 return JSValue::encode(jsUndefined()); 91 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 93 92 } else { 94 93 // Although the documentation doesn't say so, it is in fact correct to say … … 103 102 104 103 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()); 107 105 JSArrayBuffer* result = JSArrayBuffer::create(vm, arrayBufferStructure, WTFMove(buffer)); 108 106 -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp
r205569 r206386 51 51 52 52 int32_t begin = exec->argument(0).toInt32(exec); 53 if (UNLIKELY(scope.exception())) 54 return JSValue::encode(jsUndefined()); 53 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 55 54 56 55 int32_t end; 57 56 if (exec->argumentCount() >= 2) { 58 57 end = exec->uncheckedArgument(1).toInt32(exec); 59 if (UNLIKELY(scope.exception())) 60 return JSValue::encode(jsUndefined()); 58 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 61 59 } else 62 60 end = thisObject->impl()->byteLength(); -
trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h
r205569 r206386 77 77 78 78 JSValue lengthValue = obj->get(exec, vm.propertyNames->length); 79 if (UNLIKELY(scope.exception())) 80 return UINT_MAX; 79 RETURN_IF_EXCEPTION(scope, UINT_MAX); 81 80 return lengthValue.toUInt32(exec); 82 81 } … … 90 89 91 90 JSValue lengthValue = obj->get(exec, vm.propertyNames->length); 92 if (UNLIKELY(scope.exception())) 93 return PNaN; 91 RETURN_IF_EXCEPTION(scope, PNaN); 94 92 return lengthValue.toLength(exec); 95 93 } -
trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
r205569 r206386 129 129 auto scope = DECLARE_THROW_SCOPE(vm); 130 130 JSValue prototype = targetFunction->getPrototype(vm, exec); 131 if (UNLIKELY(scope.exception())) 132 return nullptr; 131 RETURN_IF_EXCEPTION(scope, nullptr); 133 132 JSFunction* targetJSFunction = jsDynamicCast<JSFunction*>(targetFunction); 134 133 … … 173 172 name); 174 173 Structure* structure = getBoundFunctionStructure(vm, exec, globalObject, targetFunction); 175 if (UNLIKELY(scope.exception())) 176 return nullptr; 174 RETURN_IF_EXCEPTION(scope, nullptr); 177 175 JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(vm, globalObject, structure, targetFunction, boundThis, boundArgs); 178 176 -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r205569 r206386 193 193 194 194 prototype = obj->getPrototype(vm, exec); 195 if (UNLIKELY(scope.exception())) 196 return false; 195 RETURN_IF_EXCEPTION(scope, false); 197 196 if (prototype.isNull()) 198 197 break; … … 382 381 ASSERT(isCell()); 383 382 JSValue value = asCell()->toPrimitive(exec, PreferString); 384 if (UNLIKELY(scope.exception())) 385 return errorValue(); 383 RETURN_IF_EXCEPTION(scope, errorValue()); 386 384 ASSERT(!value.isObject()); 387 385 JSString* result = value.toString(exec); 388 if (UNLIKELY(scope.exception())) 389 return errorValue(); 386 RETURN_IF_EXCEPTION(scope, errorValue()); 390 387 return result; 391 388 } -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r205569 r206386 643 643 644 644 StringImpl* hintString = jsCast<JSString*>(value)->value(exec).impl(); 645 if (UNLIKELY(scope.exception())) 646 return NoPreference; 645 RETURN_IF_EXCEPTION(scope, NoPreference); 647 646 648 647 if (WTF::equal(hintString, "default")) … … 787 786 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 788 787 bool found = getPropertySlot(exec, propertyName, slot); 789 if (UNLIKELY(scope.exception())) 790 return { }; 788 RETURN_IF_EXCEPTION(scope, { }); 791 789 return callback(found, slot); 792 790 } … … 927 925 return v1 == v2; 928 926 JSValue p1 = v1.toPrimitive(exec); 929 if (UNLIKELY(scope.exception())) 930 return false; 927 RETURN_IF_EXCEPTION(scope, false); 931 928 v1 = p1; 932 929 if (v1.isInt32() && v2.isInt32()) … … 937 934 if (v2.isObject()) { 938 935 JSValue p2 = v2.toPrimitive(exec); 939 if (UNLIKELY(scope.exception())) 940 return false; 936 RETURN_IF_EXCEPTION(scope, false); 941 937 v2 = p2; 942 938 if (v1.isInt32() && v2.isInt32()) -
trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp
r205569 r206386 134 134 135 135 unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec); 136 if (UNLIKELY(scope.exception())) 137 return JSValue::encode(jsUndefined()); 136 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 138 137 139 138 bool littleEndian = false; … … 141 140 if (elementSize > 1 && exec->argumentCount() >= 2) { 142 141 littleEndian = exec->uncheckedArgument(1).toBoolean(exec); 143 if (UNLIKELY(scope.exception())) 144 return JSValue::encode(jsUndefined()); 142 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 145 143 } 146 144 … … 182 180 183 181 unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec); 184 if (UNLIKELY(scope.exception())) 185 return JSValue::encode(jsUndefined()); 182 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 186 183 187 184 const unsigned dataSize = sizeof(typename Adaptor::Type); … … 192 189 193 190 u.value = toNativeFromValue<Adaptor>(exec, exec->uncheckedArgument(1)); 194 if (UNLIKELY(scope.exception())) 195 return JSValue::encode(jsUndefined()); 191 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 196 192 197 193 bool littleEndian = false; … … 199 195 if (elementSize > 1 && exec->argumentCount() >= 3) { 200 196 littleEndian = exec->uncheckedArgument(2).toBoolean(exec); 201 if (UNLIKELY(scope.exception())) 202 return JSValue::encode(jsUndefined()); 197 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 203 198 } 204 199 -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r206268 r206386 613 613 } else { 614 614 JSString* jsStr = value.toString(exec); 615 if (UNLIKELY(scope.exception())) 616 return; 615 RETURN_IF_EXCEPTION(scope, void()); 617 616 name = jsStr->value(exec); 618 if (UNLIKELY(scope.exception())) 619 return; 617 RETURN_IF_EXCEPTION(scope, void()); 620 618 } 621 619 reifyName(vm, exec, name); -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
r205989 r206386 175 175 176 176 typename Adaptor::Type value = toNativeFromValue<Adaptor>(exec, jsValue); 177 if (UNLIKELY(scope.exception())) 178 return false; 177 RETURN_IF_EXCEPTION(scope, false); 179 178 180 179 if (isNeutered()) { -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
r205932 r206386 90 90 while (true) { 91 91 JSValue next = iteratorStep(exec, iterator); 92 if (UNLIKELY(scope.exception())) 93 return nullptr; 92 RETURN_IF_EXCEPTION(scope, nullptr); 94 93 95 94 if (next.isFalse()) … … 97 96 98 97 JSValue nextItem = iteratorValue(exec, next); 99 if (UNLIKELY(scope.exception())) 100 return nullptr; 98 RETURN_IF_EXCEPTION(scope, nullptr); 101 99 102 100 storage.append(nextItem); … … 104 102 105 103 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); 110 106 111 107 for (unsigned i = 0; i < storage.size(); ++i) { … … 163 159 164 160 JSValue iteratorFunc = object->get(exec, vm.propertyNames->iteratorSymbol); 165 if (UNLIKELY(scope.exception())) 166 return nullptr; 161 RETURN_IF_EXCEPTION(scope, nullptr); 167 162 168 163 // We would like not use the iterator as it is painfully slow. Fortunately, unless … … 184 179 ArgList arguments; 185 180 JSValue iterator = call(exec, iteratorFunc, callType, callData, object, arguments); 186 if (UNLIKELY(scope.exception())) 187 return nullptr; 181 RETURN_IF_EXCEPTION(scope, nullptr); 188 182 189 183 return constructGenericTypedArrayViewFromIterator<ViewClass>(exec, structure, iterator); … … 191 185 192 186 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); 195 188 } 196 189 … … 236 229 Structure* parentStructure = function->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType); 237 230 Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), parentStructure); 238 if (UNLIKELY(scope.exception())) 239 return JSValue::encode(JSValue()); 231 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 240 232 241 233 size_t argCount = exec->argumentCount(); … … 253 245 if (jsDynamicCast<JSArrayBuffer*>(firstValue) && argCount > 1) { 254 246 offset = exec->uncheckedArgument(1).toUInt32(exec); 255 if (UNLIKELY(scope.exception())) 256 return JSValue::encode(jsUndefined()); 247 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 257 248 258 249 if (argCount > 2) { 259 250 length = exec->uncheckedArgument(2).toUInt32(exec); 260 if (UNLIKELY(scope.exception())) 261 return JSValue::encode(jsUndefined()); 251 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 262 252 } 263 253 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
r205569 r206386 52 52 53 53 JSValue constructor = exemplar->get(exec, exec->propertyNames().constructor); 54 if (UNLIKELY(scope.exception())) 55 return nullptr; 54 RETURN_IF_EXCEPTION(scope, nullptr); 56 55 57 56 if (constructor.isUndefined()) … … 63 62 64 63 JSValue species = constructor.get(exec, exec->propertyNames().speciesSymbol); 65 if (UNLIKELY(scope.exception())) 66 return nullptr; 64 RETURN_IF_EXCEPTION(scope, nullptr); 67 65 68 66 if (species.isUndefinedOrNull()) … … 70 68 71 69 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); 74 71 75 72 if (JSArrayBufferView* view = jsDynamicCast<JSArrayBufferView*>(result)) { … … 113 110 if (exec->argumentCount() >= 2) { 114 111 double offsetNumber = exec->uncheckedArgument(1).toInteger(exec); 115 if (UNLIKELY(scope.exception())) 116 return JSValue::encode(jsUndefined()); 112 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 117 113 if (UNLIKELY(offsetNumber < 0)) 118 114 return throwVMRangeError(exec, scope, "Offset should not be negative"); … … 138 134 length = sourceArray->get(exec, vm.propertyNames->length).toUInt32(exec); 139 135 140 if (UNLIKELY(scope.exception())) 141 return JSValue::encode(jsUndefined()); 136 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 142 137 143 138 thisObject->set(exec, offset, sourceArray, 0, length, CopyType::Unobservable); … … 157 152 long length = thisObject->length(); 158 153 long to = argumentClampedIndexFromStartOrEnd(exec, 0, length); 159 if (UNLIKELY(scope.exception())) 160 return encodedJSValue(); 154 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 161 155 long from = argumentClampedIndexFromStartOrEnd(exec, 1, length); 162 if (UNLIKELY(scope.exception())) 163 return encodedJSValue(); 156 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 164 157 long final = argumentClampedIndexFromStartOrEnd(exec, 2, length, length); 165 if (UNLIKELY(scope.exception())) 166 return encodedJSValue(); 158 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 167 159 168 160 if (final < from) … … 197 189 198 190 unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length); 199 if (UNLIKELY(scope.exception())) 200 return JSValue::encode(jsUndefined()); 191 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 201 192 202 193 if (thisObject->isNeutered()) … … 243 234 JSValue valueToFind = exec->argument(0); 244 235 unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length); 245 if (UNLIKELY(scope.exception())) 246 return encodedJSValue(); 236 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 247 237 248 238 if (thisObject->isNeutered()) … … 279 269 280 270 JSStringJoiner joiner(*exec, separator, length); 281 if (UNLIKELY(scope.exception())) 282 return JSValue::encode(jsUndefined()); 271 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 283 272 for (unsigned i = 0; i < length; i++) { 284 273 joiner.append(*exec, thisObject->getIndexQuickly(i)); 285 if (UNLIKELY(scope.exception())) 286 return JSValue::encode(jsUndefined()); 274 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 287 275 } 288 276 return JSValue::encode(joiner.join(*exec)); … … 296 284 297 285 JSString* separatorString = separatorValue.toString(exec); 298 if (UNLIKELY(scope.exception())) 299 return JSValue::encode(jsUndefined()); 286 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 300 287 301 288 if (thisObject->isNeutered()) … … 334 321 } 335 322 336 if (UNLIKELY(scope.exception())) 337 return JSValue::encode(JSValue()); 323 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 338 324 339 325 if (thisObject->isNeutered()) … … 440 426 441 427 unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength); 442 if (UNLIKELY(scope.exception())) 443 return encodedJSValue(); 428 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 444 429 unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, thisLength, thisLength); 445 if (UNLIKELY(scope.exception())) 446 return encodedJSValue(); 430 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 447 431 448 432 if (thisObject->isNeutered()) … … 462 446 return ViewClass::createUninitialized(exec, structure, length); 463 447 }); 464 if (UNLIKELY(scope.exception())) 465 return JSValue::encode(JSValue()); 448 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 466 449 467 450 ASSERT(!result->isNeutered()); … … 566 549 567 550 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()); 570 552 571 553 if (jsDynamicCast<JSArrayBufferView*>(result)) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r206267 r206386 817 817 else 818 818 structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 819 if (UNLIKELY(scope.exception())) 820 return nullptr; 819 RETURN_IF_EXCEPTION(scope, nullptr); 821 820 822 821 return ArrayAllocationProfile::updateLastAllocationFor(profile, JSArray::create(exec->vm(), structure, initialLength)); … … 833 832 auto scope = DECLARE_THROW_SCOPE(vm); 834 833 Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 835 if (UNLIKELY(scope.exception())) 836 return nullptr; 834 RETURN_IF_EXCEPTION(scope, nullptr); 837 835 return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, structure, values)); 838 836 } … … 848 846 auto scope = DECLARE_THROW_SCOPE(vm); 849 847 Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 850 if (UNLIKELY(scope.exception())) 851 return nullptr; 848 RETURN_IF_EXCEPTION(scope, nullptr); 852 849 return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, structure, values, length)); 853 850 } … … 863 860 auto scope = DECLARE_THROW_SCOPE(vm); 864 861 Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 865 if (UNLIKELY(scope.exception())) 866 return nullptr; 862 RETURN_IF_EXCEPTION(scope, nullptr); 867 863 return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArrayNegativeIndexed(exec, structure, values, length)); 868 864 } -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r205670 r206386 661 661 662 662 String s = x.toString(exec)->value(exec); 663 if (UNLIKELY(scope.exception())) 664 return JSValue::encode(jsUndefined()); 663 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 665 664 666 665 if (s.is8Bit()) { -
trunk/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
r205569 r206386 779 779 if (importEntry.isNamespace(vm)) { 780 780 JSModuleNamespaceObject* namespaceObject = importedModule->getModuleNamespace(exec); 781 if (UNLIKELY(scope.exception())) 782 return; 781 RETURN_IF_EXCEPTION(scope, void()); 783 782 bool putResult = false; 784 783 symbolTablePutTouchWatchpointSet(moduleEnvironment, exec, importEntry.localName, namespaceObject, /* shouldThrowReadOnlyError */ false, /* ignoreReadOnlyErrors */ true, putResult); -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r205569 r206386 254 254 auto scope = DECLARE_THROW_SCOPE(vm); 255 255 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())); 258 257 259 258 PropertyNameForFunctionCall emptyPropertyName(vm.propertyNames->emptyIdentifier); … … 263 262 if (appendStringifiedValue(result, value.get(), object, emptyPropertyName) != StringifySucceeded) 264 263 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())); 267 265 268 266 return Local<Unknown>(vm, jsString(m_exec, result.toString())); … … 283 281 284 282 JSValue toJSONFunction = slot.getValue(m_exec, vm.propertyNames->toJSON); 285 if (UNLIKELY(scope.exception())) 286 return jsNull(); 283 RETURN_IF_EXCEPTION(scope, JSValue()); 287 284 return toJSONImpl(value, toJSONFunction, propertyName); 288 285 } … … 307 304 // Call the toJSON function. 308 305 value = toJSON(value, propertyName); 309 if (UNLIKELY(scope.exception())) 310 return StringifyFailed; 306 RETURN_IF_EXCEPTION(scope, StringifyFailed); 311 307 312 308 // Call the replacer function. … … 316 312 args.append(value); 317 313 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); 320 315 } 321 316 … … 330 325 value = unwrapBoxedPrimitive(m_exec, value); 331 326 332 if (UNLIKELY(scope.exception())) 333 return StringifyFailed; 327 RETURN_IF_EXCEPTION(scope, StringifyFailed); 334 328 335 329 if (value.isBoolean()) { … … 383 377 bool holderStackWasEmpty = m_holderStack.isEmpty(); 384 378 m_holderStack.append(Holder(vm, m_exec, object)); 385 if (UNLIKELY(scope.exception())) 386 return StringifyFailed; 379 RETURN_IF_EXCEPTION(scope, StringifyFailed); 387 380 if (!holderStackWasEmpty) 388 381 return StringifySucceeded; 389 382 390 383 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); 395 386 m_holderStack.removeLast(); 396 387 } while (!m_holderStack.isEmpty()); … … 460 451 PropertyNameArray objectPropertyNames(exec, PropertyNameMode::Strings); 461 452 m_object->methodTable()->getOwnPropertyNames(m_object.get(), exec, objectPropertyNames, EnumerationMode()); 462 if (UNLIKELY(scope.exception())) 463 return false; 453 RETURN_IF_EXCEPTION(scope, false); 464 454 m_propertyNames = objectPropertyNames.releaseData(); 465 455 } … … 494 484 else 495 485 value = jsUndefined(); 496 if (UNLIKELY(scope.exception())) 497 return false; 486 RETURN_IF_EXCEPTION(scope, false); 498 487 } 499 488 … … 512 501 return true; 513 502 JSValue value = slot.getValue(exec, propertyName); 514 if (UNLIKELY(scope.exception())) 515 return false; 503 RETURN_IF_EXCEPTION(scope, false); 516 504 517 505 rollBackPoint = builder.length(); … … 648 636 else 649 637 inValue = jsUndefined(); 650 if (UNLIKELY(scope.exception())) 651 return jsNull(); 638 RETURN_IF_EXCEPTION(scope, JSValue()); 652 639 } 653 640 … … 666 653 else 667 654 array->putDirectIndex(m_exec, indexStack.last(), filteredValue); 668 if (UNLIKELY(scope.exception())) 669 return jsNull(); 655 RETURN_IF_EXCEPTION(scope, JSValue()); 670 656 indexStack.last()++; 671 657 goto arrayStartVisitMember; … … 683 669 propertyStack.append(PropertyNameArray(m_exec, PropertyNameMode::Strings)); 684 670 object->methodTable()->getOwnPropertyNames(object, m_exec, propertyStack.last(), EnumerationMode()); 685 if (UNLIKELY(scope.exception())) 686 return jsNull(); 671 RETURN_IF_EXCEPTION(scope, JSValue()); 687 672 } 688 673 objectStartVisitMember: … … 706 691 707 692 // 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()); 710 694 711 695 if (inValue.isObject()) { … … 725 709 else 726 710 object->methodTable()->put(object, m_exec, prop, filteredValue, slot); 727 if (UNLIKELY(scope.exception())) 728 return jsNull(); 711 RETURN_IF_EXCEPTION(scope, JSValue()); 729 712 indexStack.last()++; 730 713 goto objectStartVisitMember; … … 762 745 return throwVMError(exec, scope, createError(exec, ASCIILiteral("JSON.parse requires at least one parameter"))); 763 746 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()); 766 748 767 749 JSValue unfiltered; -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r206221 r206386 361 361 // 9.1.9.1-2 Let ownDesc be ? O.[[GetOwnProperty]](P). 362 362 bool ownDescriptorFound = current->getOwnPropertyDescriptor(exec, propertyName, ownDescriptor); 363 if (UNLIKELY(scope.exception())) 364 return false; 363 RETURN_IF_EXCEPTION(scope, false); 365 364 366 365 if (!ownDescriptorFound) { 367 366 // 9.1.9.1-3-a Let parent be ? O.[[GetPrototypeOf]](). 368 367 JSValue prototype = current->getPrototype(vm, exec); 369 if (UNLIKELY(scope.exception())) 370 return false; 368 RETURN_IF_EXCEPTION(scope, false); 371 369 372 370 // 9.1.9.1-3-b If parent is not null, then … … 399 397 PropertyDescriptor existingDescriptor; 400 398 bool existingDescriptorFound = receiverObject->getOwnPropertyDescriptor(exec, propertyName, existingDescriptor); 401 if (UNLIKELY(scope.exception())) 402 return false; 399 RETURN_IF_EXCEPTION(scope, false); 403 400 404 401 // 9.1.9.1-4-d If existingDescriptor is not undefined, then … … 1291 1288 1292 1289 bool isExtensible = this->isExtensible(exec); 1293 if (UNLIKELY(scope.exception())) 1294 return false; 1290 RETURN_IF_EXCEPTION(scope, false); 1295 1291 1296 1292 if (!isExtensible) { … … 1534 1530 1535 1531 JSValue function = object->get(exec, propertyName); 1536 if (UNLIKELY(scope.exception())) 1537 return scope.exception(); 1532 RETURN_IF_EXCEPTION(scope, scope.exception()); 1538 1533 if (function.isUndefined() && mode == TypeHintMode::TakesHint) 1539 1534 return JSValue(); … … 1561 1556 1562 1557 JSValue result = call(exec, function, callType, callData, const_cast<JSObject*>(object), callArgs); 1558 RETURN_IF_EXCEPTION(scope, scope.exception()); 1563 1559 ASSERT(!result.isGetterSetter()); 1564 if (UNLIKELY(scope.exception()))1565 return scope.exception();1566 1560 if (result.isObject()) 1567 1561 return mode == TypeHintMode::DoesNotTakeHint ? JSValue() : throwTypeError(exec, scope, ASCIILiteral("Symbol.toPrimitive returned an object")); … … 1700 1694 while (true) { 1701 1695 JSValue objectValue = object->getPrototype(vm, exec); 1702 if (UNLIKELY(scope.exception())) 1703 return false; 1696 RETURN_IF_EXCEPTION(scope, false); 1704 1697 if (!objectValue.isObject()) 1705 1698 return false; … … 1724 1717 auto scope = DECLARE_THROW_SCOPE(vm); 1725 1718 object->methodTable(vm)->getOwnPropertyNames(object, exec, propertyNames, mode); 1726 if (UNLIKELY(scope.exception())) 1727 return; 1719 RETURN_IF_EXCEPTION(scope, void()); 1728 1720 1729 1721 JSValue nextProto = object->getPrototype(vm, exec); 1730 if (UNLIKELY(scope.exception())) 1731 return; 1722 RETURN_IF_EXCEPTION(scope, void()); 1732 1723 if (nextProto.isNull()) 1733 1724 return; … … 1740 1731 } 1741 1732 prototype->methodTable(vm)->getOwnPropertyNames(prototype, exec, propertyNames, mode); 1742 if (UNLIKELY(scope.exception())) 1743 return; 1733 RETURN_IF_EXCEPTION(scope, void()); 1744 1734 nextProto = prototype->getPrototype(vm, exec); 1745 if (UNLIKELY(scope.exception())) 1746 return; 1735 RETURN_IF_EXCEPTION(scope, void()); 1747 1736 if (nextProto.isNull()) 1748 1737 break; … … 1844 1833 auto scope = DECLARE_THROW_SCOPE(vm); 1845 1834 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 1848 1836 return primitive.toNumber(exec); 1849 1837 } … … 1854 1842 auto scope = DECLARE_THROW_SCOPE(vm); 1855 1843 JSValue primitive = toPrimitive(exec, PreferString); 1856 if (UNLIKELY(scope.exception())) 1857 return jsEmptyString(exec); 1844 RETURN_IF_EXCEPTION(scope, jsEmptyString(exec)); 1858 1845 return primitive.toString(exec); 1859 1846 } … … 3079 3066 bool isCurrentDefined = getOwnPropertyDescriptor(exec, propertyName, current); 3080 3067 bool isExtensible = this->isExtensible(exec); 3081 if (UNLIKELY(throwScope.exception())) 3082 return false; 3068 RETURN_IF_EXCEPTION(throwScope, false); 3083 3069 return validateAndApplyPropertyDescriptor(exec, this, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException); 3084 3070 } … … 3181 3167 auto scope = DECLARE_THROW_SCOPE(vm); 3182 3168 object->methodTable(vm)->getOwnPropertyNames(object, exec, propertyNames, EnumerationMode(mode, JSObjectPropertiesMode::Exclude)); 3183 if (UNLIKELY(scope.exception())) 3184 return; 3169 RETURN_IF_EXCEPTION(scope, void()); 3185 3170 3186 3171 JSValue nextProto = object->getPrototype(vm, exec); 3187 if (UNLIKELY(scope.exception())) 3188 return; 3172 RETURN_IF_EXCEPTION(scope, void()); 3189 3173 if (nextProto.isNull()) 3190 3174 return; … … 3197 3181 } 3198 3182 prototype->methodTable(vm)->getOwnPropertyNames(prototype, exec, propertyNames, mode); 3199 if (UNLIKELY(scope.exception())) 3200 return; 3183 RETURN_IF_EXCEPTION(scope, void()); 3201 3184 nextProto = prototype->getPrototype(vm, exec); 3202 if (UNLIKELY(scope.exception())) 3203 return; 3185 RETURN_IF_EXCEPTION(scope, void()); 3204 3186 if (nextProto.isNull()) 3205 3187 break; … … 3216 3198 3217 3199 JSValue method = get(exec, ident); 3218 if (UNLIKELY(scope.exception())) 3219 return jsUndefined(); 3200 RETURN_IF_EXCEPTION(scope, JSValue()); 3220 3201 3221 3202 if (!method.isCell()) { -
trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h
r206136 r206386 41 41 Vector<JSValue> result; 42 42 JSValue lengthProperty = arrayLikeValue.get(exec, vm.propertyNames->length); 43 if (UNLIKELY(scope.exception())) 44 return; 43 RETURN_IF_EXCEPTION(scope, void()); 45 44 double lengthAsDouble = lengthProperty.toLength(exec); 46 if (UNLIKELY(scope.exception())) 47 return; 45 RETURN_IF_EXCEPTION(scope, void()); 48 46 RELEASE_ASSERT(lengthAsDouble >= 0.0 && lengthAsDouble == std::trunc(lengthAsDouble)); 49 47 uint64_t length = static_cast<uint64_t>(lengthAsDouble); 50 48 for (uint64_t index = 0; index < length; index++) { 51 49 JSValue next = arrayLikeValue.get(exec, index); 52 if (UNLIKELY(scope.exception())) 53 return; 50 RETURN_IF_EXCEPTION(scope, void()); 54 51 55 52 RuntimeType type = runtimeTypeForValue(next); … … 100 97 auto scope = DECLARE_THROW_SCOPE(vm); 101 98 bool found = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); 102 if (UNLIKELY(scope.exception())) 103 return { }; 99 RETURN_IF_EXCEPTION(scope, { }); 104 100 return callback(found, slot); 105 101 } … … 116 112 if (structure.classInfo()->methodTable.getOwnPropertySlotByIndex(object, exec, propertyName, slot)) 117 113 return true; 118 if (UNLIKELY(scope.exception())) 119 return false; 114 RETURN_IF_EXCEPTION(scope, false); 120 115 JSValue prototype; 121 116 if (LIKELY(structure.classInfo()->methodTable.getPrototype == defaultGetPrototype || slot.internalMethodType() == PropertySlot::InternalMethodType::VMInquiry)) … … 123 118 else { 124 119 prototype = object->getPrototype(vm, exec); 125 if (UNLIKELY(scope.exception())) 126 return false; 120 RETURN_IF_EXCEPTION(scope, false); 127 121 } 128 122 if (!prototype.isObject()) … … 150 144 if (structure.classInfo()->methodTable.getOwnPropertySlot(object, exec, propertyName, slot)) 151 145 return true; 152 if (UNLIKELY(scope.exception())) 153 return false; 146 RETURN_IF_EXCEPTION(scope, false); 154 147 } 155 148 JSValue prototype; … … 158 151 else { 159 152 prototype = object->getPrototype(vm, exec); 160 if (UNLIKELY(scope.exception())) 161 return false; 153 RETURN_IF_EXCEPTION(scope, false); 162 154 } 163 155 if (!prototype.isObject()) -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
r206018 r206386 104 104 105 105 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()); 108 107 JSPromise* promise = JSPromise::create(vm, promiseStructure); 109 108 promise->initialize(exec, globalObject, exec->argument(0)); -
trunk/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp
r205729 r206386 58 58 59 59 JSValue deferred = newPromiseCapability(exec, globalObject, globalObject->promiseConstructor()); 60 if (UNLIKELY(scope.exception())) 61 return nullptr; 60 RETURN_IF_EXCEPTION(scope, nullptr); 62 61 63 62 JSValue promise = deferred.get(exec, vm.propertyNames->builtinNames().promisePrivateName()); -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.h
r206267 r206386 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 130 130 indexedLength = 0; 131 131 base->methodTable(vm)->getPropertyNames(base, exec, propertyNames, EnumerationMode()); 132 if (UNLIKELY(scope.exception())) 133 return nullptr; 132 RETURN_IF_EXCEPTION(scope, nullptr); 134 133 } 135 134 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
r205569 r206386 59 59 auto scope = DECLARE_THROW_SCOPE(vm); 60 60 JSPropertyNameEnumerator* enumerator = propertyNameEnumerator(exec, iteratedObject); 61 if (UNLIKELY(scope.exception())) 62 return nullptr; 61 RETURN_IF_EXCEPTION(scope, nullptr); 63 62 return JSPropertyNameIterator::create(exec, structure, iteratedObject, enumerator); 64 63 } -
trunk/Source/JavaScriptCore/runtime/JSScope.cpp
r205569 r206386 1 1 /* 2 * Copyright (C) 2012-201 5Apple Inc. All Rights Reserved.2 * Copyright (C) 2012-2016 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 207 207 208 208 JSValue unscopables = object->get(exec, exec->propertyNames().unscopablesSymbol); 209 if (UNLIKELY(throwScope.exception())) 210 return false; 209 RETURN_IF_EXCEPTION(throwScope, false); 211 210 if (!unscopables.isObject()) 212 211 return false; 213 212 JSValue blocked = jsCast<JSObject*>(unscopables)->get(exec, ident); 214 if (UNLIKELY(throwScope.exception())) 215 return false; 213 RETURN_IF_EXCEPTION(throwScope, false); 216 214 217 215 return blocked.toBoolean(exec); -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r205569 r206386 79 79 String str1 = value(exec); 80 80 String str2 = other->value(exec); 81 if (UNLIKELY(scope.exception())) 82 return false; 81 RETURN_IF_EXCEPTION(scope, false); 83 82 return WTF::equal(*str1.impl(), *str2.impl()); 84 83 } -
trunk/Source/JavaScriptCore/runtime/JSStringJoiner.cpp
r205569 r206386 109 109 110 110 unsigned length = joinedLength(state); 111 if (UNLIKELY(scope.exception())) 112 return jsUndefined(); 111 RETURN_IF_EXCEPTION(scope, JSValue()); 113 112 114 113 if (!length) -
trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp
r205666 r206386 1 1 /* 2 * Copyright (C) 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2009, 2016 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2012 Mathias Bynens (mathias@qiwi.be) 4 4 * … … 585 585 case StartParseArray: { 586 586 JSArray* array = constructEmptyArray(m_exec, 0); 587 if (UNLIKELY(scope.exception())) 588 return JSValue(); 587 RETURN_IF_EXCEPTION(scope, JSValue()); 589 588 objectStack.append(array); 590 589 } -
trunk/Source/JavaScriptCore/runtime/MapBase.h
r205520 r206386 76 76 auto scope = DECLARE_THROW_SCOPE(vm); 77 77 HashMapImplType* impl = HashMapImplType::create(exec, vm); 78 if (UNLIKELY(scope.exception())) 79 return; 78 RETURN_IF_EXCEPTION(scope, void()); 80 79 m_map.set(vm, this, impl); 81 80 } -
trunk/Source/JavaScriptCore/runtime/MapConstructor.cpp
r206018 r206386 62 62 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 63 63 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()); 66 65 JSMap* map = JSMap::create(exec, vm, mapStructure); 67 if (UNLIKELY(scope.exception())) 68 return JSValue::encode(JSValue()); 66 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 69 67 JSValue iterable = exec->argument(0); 70 68 if (iterable.isUndefinedOrNull()) … … 72 70 73 71 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()); 76 73 77 74 CallData adderFunctionCallData; … … 88 85 89 86 JSValue key = nextItem.get(exec, static_cast<unsigned>(0)); 90 if (UNLIKELY(scope.exception())) 91 return; 87 RETURN_IF_EXCEPTION(scope, void()); 92 88 93 89 JSValue value = nextItem.get(exec, static_cast<unsigned>(1)); 94 if (UNLIKELY(scope.exception())) 95 return; 90 RETURN_IF_EXCEPTION(scope, void()); 96 91 97 92 MarkedArgumentBuffer arguments; -
trunk/Source/JavaScriptCore/runtime/MathObject.cpp
r205828 r206386 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2007 , 2008, 2013, 2015Apple Inc. All Rights Reserved.3 * Copyright (C) 2007-2008, 2013, 2015-2016 Apple Inc. All Rights Reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 166 166 auto scope = DECLARE_THROW_SCOPE(vm); 167 167 uint32_t value = exec->argument(0).toUInt32(exec); 168 if (UNLIKELY(scope.exception())) 169 return JSValue::encode(jsNull()); 168 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 170 169 return JSValue::encode(JSValue(clz32(value))); 171 170 } … … 196 195 for (unsigned i = 0; i < argsCount; ++i) { 197 196 args.uncheckedAppend(exec->uncheckedArgument(i).toNumber(exec)); 198 if (UNLIKELY(scope.exception())) 199 return JSValue::encode(jsNull()); 197 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 200 198 if (std::isinf(args[i])) 201 199 return JSValue::encode(jsDoubleNumber(+std::numeric_limits<double>::infinity())); … … 300 298 auto scope = DECLARE_THROW_SCOPE(vm); 301 299 int32_t left = exec->argument(0).toInt32(exec); 302 if (UNLIKELY(scope.exception())) 303 return JSValue::encode(jsNull()); 300 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 304 301 int32_t right = exec->argument(1).toInt32(exec); 305 302 return JSValue::encode(jsNumber(left * right)); -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp
r206333 r206386 113 113 114 114 const Identifier moduleKey = exec->argument(0).toPropertyKey(exec); 115 if (UNLIKELY(scope.exception())) 116 return JSValue::encode(jsUndefined()); 115 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 117 116 118 117 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()); 121 119 122 120 SourceCode sourceCode = makeSource(source, moduleKey.impl()); … … 150 148 151 149 JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size()); 152 if (UNLIKELY(scope.exception())) 153 JSValue::encode(jsUndefined()); 150 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 154 151 size_t i = 0; 155 152 for (auto& key : moduleRecord->requestedModules()) … … 171 168 172 169 moduleRecord->link(exec); 173 if (UNLIKELY(scope.exception())) 174 return JSValue::encode(jsUndefined()); 170 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 175 171 176 172 return JSValue::encode(jsUndefined()); -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
r206018 r206386 68 68 JSValue message = exec->argument(0); 69 69 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()); 72 71 ASSERT(errorStructure); 73 72 return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)); -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp
r205569 r206386 90 90 double n = exec->argumentCount() ? exec->uncheckedArgument(0).toNumber(exec) : 0; 91 91 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()); 94 93 95 94 NumberObject* object = NumberObject::create(exec->vm(), structure); -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r205670 r206386 131 131 // a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%"). 132 132 Structure* objectStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->objectStructureForObjectConstructor()); 133 if (UNLIKELY(scope.exception())) 134 return nullptr; 133 RETURN_IF_EXCEPTION(scope, nullptr); 135 134 return constructEmptyObject(exec, objectStructure); 136 135 } … … 173 172 auto scope = DECLARE_THROW_SCOPE(vm); 174 173 JSObject* object = exec->argument(0).toObject(exec); 175 if (UNLIKELY(scope.exception())) 176 return JSValue::encode(jsUndefined()); 174 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 177 175 return JSValue::encode(object->getPrototype(exec->vm(), exec)); 178 176 } … … 192 190 193 191 JSObject* object = objectValue.toObject(exec); 194 if (UNLIKELY(scope.exception())) 195 return JSValue::encode(objectValue); 192 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 196 193 197 194 bool shouldThrowIfCantSet = true; … … 208 205 if (!object->getOwnPropertyDescriptor(exec, propertyName, descriptor)) 209 206 return jsUndefined(); 210 if (UNLIKELY(scope.exception())) 211 return jsUndefined(); 207 RETURN_IF_EXCEPTION(scope, JSValue()); 212 208 213 209 JSObject* result = constructObjectFromPropertyDescriptor(exec, descriptor); … … 223 219 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 224 220 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 225 if (UNLIKELY(scope.exception())) 226 return jsUndefined(); 221 RETURN_IF_EXCEPTION(scope, JSValue()); 227 222 228 223 JSObject* descriptors = constructEmptyObject(exec); 229 if (UNLIKELY(scope.exception())) 230 return jsUndefined(); 224 RETURN_IF_EXCEPTION(scope, JSValue()); 231 225 232 226 for (auto& propertyName : properties) { 233 227 PropertyDescriptor descriptor; 234 228 bool didGetDescriptor = object->getOwnPropertyDescriptor(exec, propertyName, descriptor); 235 if (UNLIKELY(scope.exception())) 236 return jsUndefined(); 229 RETURN_IF_EXCEPTION(scope, JSValue()); 237 230 238 231 if (!didGetDescriptor) … … 256 249 auto scope = DECLARE_THROW_SCOPE(vm); 257 250 JSObject* object = exec->argument(0).toObject(exec); 258 if (UNLIKELY(scope.exception())) 259 return JSValue::encode(jsUndefined()); 251 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 260 252 auto propertyName = exec->argument(1).toPropertyKey(exec); 261 if (UNLIKELY(scope.exception())) 262 return JSValue::encode(jsUndefined()); 253 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 263 254 return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName)); 264 255 } … … 269 260 auto scope = DECLARE_THROW_SCOPE(vm); 270 261 JSObject* object = exec->argument(0).toObject(exec); 271 if (UNLIKELY(scope.exception())) 272 return JSValue::encode(jsUndefined()); 262 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 273 263 return JSValue::encode(objectConstructorGetOwnPropertyDescriptors(exec, object)); 274 264 } … … 280 270 auto scope = DECLARE_THROW_SCOPE(vm); 281 271 JSObject* object = exec->argument(0).toObject(exec); 282 if (UNLIKELY(scope.exception())) 283 return JSValue::encode(jsNull()); 272 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 284 273 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include)); 285 274 } … … 291 280 auto scope = DECLARE_THROW_SCOPE(vm); 292 281 JSObject* object = exec->argument(0).toObject(exec); 293 if (UNLIKELY(scope.exception())) 294 return JSValue::encode(jsNull()); 282 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 295 283 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include)); 296 284 } … … 302 290 auto scope = DECLARE_THROW_SCOPE(vm); 303 291 JSObject* object = exec->argument(0).toObject(exec); 304 if (UNLIKELY(scope.exception())) 305 return JSValue::encode(jsNull()); 292 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 306 293 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude)); 307 294 } … … 312 299 auto scope = DECLARE_THROW_SCOPE(vm); 313 300 JSObject* object = exec->argument(0).toObject(exec); 314 if (UNLIKELY(scope.exception())) 315 return JSValue::encode(jsNull()); 301 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 316 302 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Exclude)); 317 303 } … … 332 318 if (description->hasProperty(exec, exec->propertyNames().enumerable)) { 333 319 JSValue value = description->get(exec, exec->propertyNames().enumerable); 334 if (UNLIKELY(scope.exception())) 335 return false; 320 RETURN_IF_EXCEPTION(scope, false); 336 321 desc.setEnumerable(value.toBoolean(exec)); 337 } else if (UNLIKELY(scope.exception()))338 return false;322 } else 323 RETURN_IF_EXCEPTION(scope, false); 339 324 340 325 if (description->hasProperty(exec, exec->propertyNames().configurable)) { 341 326 JSValue value = description->get(exec, exec->propertyNames().configurable); 342 if (UNLIKELY(scope.exception())) 343 return false; 327 RETURN_IF_EXCEPTION(scope, false); 344 328 desc.setConfigurable(value.toBoolean(exec)); 345 } else if (UNLIKELY(scope.exception()))346 return false;329 } else 330 RETURN_IF_EXCEPTION(scope, false); 347 331 348 332 JSValue value; 349 333 if (description->hasProperty(exec, exec->propertyNames().value)) { 350 334 JSValue value = description->get(exec, exec->propertyNames().value); 351 if (UNLIKELY(scope.exception())) 352 return false; 335 RETURN_IF_EXCEPTION(scope, false); 353 336 desc.setValue(value); 354 } else if (UNLIKELY(scope.exception()))355 return false;337 } else 338 RETURN_IF_EXCEPTION(scope, false); 356 339 357 340 if (description->hasProperty(exec, exec->propertyNames().writable)) { 358 341 JSValue value = description->get(exec, exec->propertyNames().writable); 359 if (UNLIKELY(scope.exception())) 360 return false; 342 RETURN_IF_EXCEPTION(scope, false); 361 343 desc.setWritable(value.toBoolean(exec)); 362 } else if (UNLIKELY(scope.exception()))363 return false;344 } else 345 RETURN_IF_EXCEPTION(scope, false); 364 346 365 347 if (description->hasProperty(exec, exec->propertyNames().get)) { 366 348 JSValue get = description->get(exec, exec->propertyNames().get); 367 if (UNLIKELY(scope.exception())) 368 return false; 349 RETURN_IF_EXCEPTION(scope, false); 369 350 if (!get.isUndefined()) { 370 351 CallData callData; … … 375 356 } 376 357 desc.setGetter(get); 377 } else if (UNLIKELY(scope.exception()))378 return false;358 } else 359 RETURN_IF_EXCEPTION(scope, false); 379 360 380 361 if (description->hasProperty(exec, exec->propertyNames().set)) { 381 362 JSValue set = description->get(exec, exec->propertyNames().set); 382 if (UNLIKELY(scope.exception())) 383 return false; 363 RETURN_IF_EXCEPTION(scope, false); 384 364 if (!set.isUndefined()) { 385 365 CallData callData; … … 390 370 } 391 371 desc.setSetter(set); 392 } else if (UNLIKELY(scope.exception()))393 return false;372 } else 373 RETURN_IF_EXCEPTION(scope, false); 394 374 395 375 if (!desc.isAccessorDescriptor()) … … 417 397 JSObject* obj = asObject(exec->argument(0)); 418 398 auto propertyName = exec->argument(1).toPropertyKey(exec); 419 if (UNLIKELY(scope.exception())) 420 return JSValue::encode(jsNull()); 399 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 421 400 PropertyDescriptor descriptor; 422 401 auto success = toPropertyDescriptor(exec, exec->argument(2), descriptor); … … 438 417 PropertyNameArray propertyNames(exec, PropertyNameMode::StringsAndSymbols); 439 418 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()); 442 420 size_t numProperties = propertyNames.size(); 443 421 Vector<PropertyDescriptor> descriptors; … … 445 423 for (size_t i = 0; i < numProperties; i++) { 446 424 JSValue prop = properties->get(exec, propertyNames[i]); 447 if (UNLIKELY(scope.exception())) 448 return jsNull(); 425 RETURN_IF_EXCEPTION(scope, JSValue()); 449 426 PropertyDescriptor descriptor; 450 427 if (!toPropertyDescriptor(exec, prop, descriptor)) … … 466 443 continue; 467 444 object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, descriptors[i], true); 468 if (UNLIKELY(scope.exception())) 469 return jsNull(); 445 RETURN_IF_EXCEPTION(scope, JSValue()); 470 446 } 471 447 return object; … … 523 499 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 524 500 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()); 527 502 PropertyNameArray::const_iterator end = properties.end(); 528 503 for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) { … … 538 513 // c. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments. 539 514 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()); 542 516 } 543 517 544 518 // 3. Set the [[Extensible]] internal property of O to false. 545 519 object->methodTable(vm)->preventExtensions(object, exec); 546 if (UNLIKELY(scope.exception())) 547 return JSValue::encode(JSValue()); 520 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 548 521 549 522 // 4. Return O. … … 564 537 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 565 538 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 566 if (UNLIKELY(scope.exception())) 567 return object; 539 RETURN_IF_EXCEPTION(scope, nullptr); 568 540 PropertyNameArray::const_iterator end = properties.end(); 569 541 for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) { … … 583 555 // d. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments. 584 556 object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, desc, true); 585 if (UNLIKELY(scope.exception())) 586 return object; 557 RETURN_IF_EXCEPTION(scope, nullptr); 587 558 } 588 559 589 560 // 3. Set the [[Extensible]] internal property of O to false. 590 561 object->methodTable(vm)->preventExtensions(object, exec); 591 if (UNLIKELY(scope.exception())) 592 return nullptr; 562 RETURN_IF_EXCEPTION(scope, nullptr); 593 563 594 564 // 4. Return O. … … 605 575 return JSValue::encode(obj); 606 576 JSObject* result = objectConstructorFreeze(exec, asObject(obj)); 607 if (UNLIKELY(scope.exception())) 608 return JSValue::encode(JSValue()); 577 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 609 578 return JSValue::encode(result); 610 579 } … … 637 606 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 638 607 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()); 641 609 PropertyNameArray::const_iterator end = properties.end(); 642 610 for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) { … … 656 624 // 4. Otherwise, return false. 657 625 bool isExtensible = object->isExtensible(exec); 658 if (UNLIKELY(scope.exception())) 659 return JSValue::encode(JSValue()); 626 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 660 627 return JSValue::encode(jsBoolean(!isExtensible)); 661 628 } … … 678 645 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 679 646 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()); 682 648 PropertyNameArray::const_iterator end = properties.end(); 683 649 for (PropertyNameArray::const_iterator iter = properties.begin(); iter != end; ++iter) { … … 698 664 // 4. Otherwise, return false. 699 665 bool isExtensible = object->isExtensible(exec); 700 if (UNLIKELY(scope.exception())) 701 return JSValue::encode(JSValue()); 666 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 702 667 return JSValue::encode(jsBoolean(!isExtensible)); 703 668 } … … 712 677 JSObject* object = asObject(obj); 713 678 bool isExtensible = object->isExtensible(exec); 714 if (UNLIKELY(scope.exception())) 715 return JSValue::encode(JSValue()); 679 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 716 680 return JSValue::encode(jsBoolean(isExtensible)); 717 681 } … … 729 693 PropertyNameArray properties(exec, propertyNameMode); 730 694 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(dontEnumPropertiesMode)); 731 if (UNLIKELY(scope.exception())) 732 return nullptr; 695 RETURN_IF_EXCEPTION(scope, nullptr); 733 696 734 697 JSArray* keys = constructEmptyArray(exec, 0); 735 if (UNLIKELY(scope.exception())) 736 return nullptr; 698 RETURN_IF_EXCEPTION(scope, nullptr); 737 699 738 700 switch (propertyNameMode) { -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h
r205670 r206386 1 1 /* 2 2 * 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. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 104 104 auto scope = DECLARE_THROW_SCOPE(vm); 105 105 JSObject* description = constructEmptyObject(exec); 106 if (UNLIKELY(scope.exception())) 107 return nullptr; 106 RETURN_IF_EXCEPTION(scope, nullptr); 108 107 109 108 if (!descriptor.isAccessorDescriptor()) { -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r206136 r206386 96 96 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 97 97 auto propertyName = exec->argument(0).toPropertyKey(exec); 98 if (UNLIKELY(scope.exception())) 99 return JSValue::encode(jsUndefined()); 98 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 100 99 JSObject* thisObject = thisValue.toObject(exec); 101 100 if (UNLIKELY(!thisObject)) … … 112 111 PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty); 113 112 bool result = thisObject->hasOwnProperty(exec, propertyName, slot); 114 if (UNLIKELY(scope.exception())) 115 return JSValue::encode(jsUndefined()); 113 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 116 114 117 115 hasOwnPropertyCache->tryAdd(vm, slot, thisObject, propertyName, result); … … 133 131 134 132 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()); 137 134 138 135 while (true) { … … 142 139 return JSValue::encode(jsBoolean(true)); 143 140 v = asObject(v)->getPrototype(vm, exec); 144 if (UNLIKELY(scope.exception())) 145 return JSValue::encode(JSValue()); 141 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 146 142 } 147 143 } … … 153 149 154 150 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()); 157 152 158 153 JSValue get = exec->argument(1); … … 162 157 163 158 auto propertyName = exec->argument(0).toPropertyKey(exec); 164 if (UNLIKELY(scope.exception())) 165 return JSValue::encode(jsUndefined()); 159 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 166 160 167 161 PropertyDescriptor descriptor; … … 182 176 183 177 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()); 186 179 187 180 JSValue set = exec->argument(1); … … 191 184 192 185 auto propertyName = exec->argument(0).toPropertyKey(exec); 193 if (UNLIKELY(scope.exception())) 194 return JSValue::encode(jsUndefined()); 186 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 195 187 196 188 PropertyDescriptor descriptor; … … 211 203 212 204 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()); 219 209 220 210 PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty); … … 241 231 242 232 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()); 249 237 250 238 PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty); … … 271 259 272 260 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()); 279 265 PropertyDescriptor descriptor; 280 266 bool enumerable = thisObject->getOwnPropertyDescriptor(exec, propertyName, descriptor) && descriptor.enumerable(); … … 290 276 // 1. Let O be the result of calling ToObject passing the this value as the argument. 291 277 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()); 294 279 295 280 // 2. Let toString be the result of calling the [[Get]] internal method of O passing "toString" as the argument. … … 326 311 if (found) { 327 312 JSValue stringTag = toStringTagSlot.getValue(exec, toStringTagSymbol); 328 if (UNLIKELY(scope.exception())) 329 return jsUndefined(); 313 RETURN_IF_EXCEPTION(scope, JSValue()); 330 314 if (stringTag.isString()) { 331 315 JSRopeString::RopeBuilder ropeBuilder(vm); … … 341 325 342 326 String tag = thisObject->methodTable(exec->vm())->toStringName(thisObject, exec); 343 if (UNLIKELY(scope.exception())) 344 return JSValue(); 327 RETURN_IF_EXCEPTION(scope, JSValue()); 345 328 String newString = WTF::tryMakeString("[object ", WTFMove(tag), "]"); 346 329 if (!newString) -
trunk/Source/JavaScriptCore/runtime/Operations.cpp
r205569 r206386 47 47 auto scope = DECLARE_THROW_SCOPE(vm); 48 48 JSValue p1 = v1.toPrimitive(callFrame); 49 if (UNLIKELY(scope.exception())) 50 return JSValue(); 49 RETURN_IF_EXCEPTION(scope, JSValue()); 51 50 JSValue p2 = v2.toPrimitive(callFrame); 52 if (UNLIKELY(scope.exception())) 53 return JSValue(); 51 RETURN_IF_EXCEPTION(scope, JSValue()); 54 52 55 53 if (p1.isString()) -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
r205569 r206386 80 80 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 81 81 GetterSetter* getterSetter = GetterSetter::create(vm, globalObject); 82 if (UNLIKELY(scope.exception())) 83 return nullptr; 82 RETURN_IF_EXCEPTION(scope, nullptr); 84 83 if (m_getter && !m_getter.isUndefined()) 85 84 getterSetter->setGetter(vm, globalObject, jsCast<JSObject*>(m_getter)); -
trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp
r206018 r206386 65 65 JSValue handler = args.at(1); 66 66 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()); 69 68 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()); 72 70 73 71 JSObject* result = constructEmptyObject(exec); 74 if (UNLIKELY(scope.exception())) 75 return JSValue::encode(JSValue()); 72 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 76 73 result->putDirect(vm, makeIdentifier(vm, "proxy"), proxy, None); 77 74 result->putDirect(vm, makeIdentifier(vm, "revoke"), revoke, None); -
trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp
r205569 r206386 142 142 CallType callType; 143 143 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()); 146 145 147 146 if (getHandler.isUndefined()) … … 153 152 arguments.append(receiver); 154 153 JSValue trapResult = call(exec, getHandler, callType, callData, handler, arguments); 155 if (UNLIKELY(scope.exception())) 156 return jsUndefined(); 154 RETURN_IF_EXCEPTION(scope, JSValue()); 157 155 158 156 PropertyDescriptor descriptor; … … 167 165 } 168 166 169 if (UNLIKELY(scope.exception())) 170 return jsUndefined(); 167 RETURN_IF_EXCEPTION(scope, JSValue()); 171 168 172 169 return trapResult; … … 178 175 auto scope = DECLARE_THROW_SCOPE(vm); 179 176 JSValue result = performProxyGet(exec, this, slot.thisValue(), propertyName); 180 if (UNLIKELY(scope.exception())) 181 return false; 177 RETURN_IF_EXCEPTION(scope, false); 182 178 unsigned ignoredAttributes = 0; 183 179 slot.setValue(this, ignoredAttributes, result); … … 212 208 CallType callType; 213 209 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); 216 211 if (getOwnPropertyDescriptorMethod.isUndefined()) 217 212 return performDefaultGetOwnProperty(); … … 221 216 arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid()))); 222 217 JSValue trapResult = call(exec, getOwnPropertyDescriptorMethod, callType, callData, handler, arguments); 223 if (UNLIKELY(scope.exception())) 224 return false; 218 RETURN_IF_EXCEPTION(scope, false); 225 219 226 220 if (!trapResult.isUndefined() && !trapResult.isObject()) { … … 231 225 PropertyDescriptor targetPropertyDescriptor; 232 226 bool isTargetPropertyDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, targetPropertyDescriptor); 233 if (UNLIKELY(scope.exception())) 234 return false; 227 RETURN_IF_EXCEPTION(scope, false); 235 228 236 229 if (trapResult.isUndefined()) { … … 244 237 // https://bugs.webkit.org/show_bug.cgi?id=154375 245 238 bool isExtensible = target->isExtensible(exec); 246 if (UNLIKELY(scope.exception())) 247 return false; 239 RETURN_IF_EXCEPTION(scope, false); 248 240 if (!isExtensible) { 249 241 // FIXME: Come up with a test for this error. I'm not sure how to because … … 258 250 259 251 bool isExtensible = target->isExtensible(exec); 260 if (UNLIKELY(scope.exception())) 261 return false; 252 RETURN_IF_EXCEPTION(scope, false); 262 253 PropertyDescriptor trapResultAsDescriptor; 263 254 toPropertyDescriptor(exec, trapResult, trapResultAsDescriptor); 264 if (UNLIKELY(scope.exception())) 265 return false; 255 RETURN_IF_EXCEPTION(scope, false); 266 256 bool throwException = false; 267 257 bool valid = validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible, … … 281 271 if (trapResultAsDescriptor.isAccessorDescriptor()) { 282 272 GetterSetter* getterSetter = trapResultAsDescriptor.slowGetterSetter(exec); 283 if (UNLIKELY(scope.exception())) 284 return false; 273 RETURN_IF_EXCEPTION(scope, false); 285 274 slot.setGetterSlot(this, trapResultAsDescriptor.attributes(), getterSetter); 286 275 } else if (trapResultAsDescriptor.isDataDescriptor() && !trapResultAsDescriptor.value().isEmpty()) … … 320 309 CallType callType; 321 310 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); 324 312 if (hasMethod.isUndefined()) 325 313 return performDefaultHasProperty(); … … 329 317 arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid()))); 330 318 JSValue trapResult = call(exec, hasMethod, callType, callData, handler, arguments); 331 if (UNLIKELY(scope.exception())) 332 return false; 319 RETURN_IF_EXCEPTION(scope, false); 333 320 334 321 bool trapResultAsBool = trapResult.toBoolean(exec); 335 if (UNLIKELY(scope.exception())) 336 return false; 322 RETURN_IF_EXCEPTION(scope, false); 337 323 338 324 if (!trapResultAsBool) { 339 325 PropertyDescriptor descriptor; 340 326 bool isPropertyDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, descriptor); 341 if (UNLIKELY(scope.exception())) 342 return false; 327 RETURN_IF_EXCEPTION(scope, false); 343 328 if (isPropertyDescriptorDefined) { 344 329 if (!descriptor.configurable()) { … … 347 332 } 348 333 bool isExtensible = target->isExtensible(exec); 349 if (UNLIKELY(scope.exception())) 350 return false; 334 RETURN_IF_EXCEPTION(scope, false); 351 335 if (!isExtensible) { 352 336 throwVMTypeError(exec, scope, ASCIILiteral("Proxy 'has' must return 'true' for a non-extensible 'target' object with a configurable property")); … … 420 404 CallType callType; 421 405 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); 424 407 JSObject* target = this->target(); 425 408 if (setMethod.isUndefined()) … … 432 415 arguments.append(thisValue); 433 416 JSValue trapResult = call(exec, setMethod, callType, callData, handler, arguments); 434 if (UNLIKELY(scope.exception())) 435 return false; 417 RETURN_IF_EXCEPTION(scope, false); 436 418 bool trapResultAsBool = trapResult.toBoolean(exec); 437 if (UNLIKELY(scope.exception())) 438 return false; 419 RETURN_IF_EXCEPTION(scope, false); 439 420 if (!trapResultAsBool) 440 421 return false; … … 473 454 auto scope = DECLARE_THROW_SCOPE(vm); 474 455 Identifier ident = Identifier::from(exec, propertyName); 475 if (UNLIKELY(scope.exception())) 476 return false; 456 RETURN_IF_EXCEPTION(scope, false); 477 457 auto performDefaultPut = [&] () { 478 458 JSObject* target = this->target(); … … 507 487 CallType callType; 508 488 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()); 511 490 JSObject* target = proxy->target(); 512 491 if (applyMethod.isUndefined()) { … … 518 497 519 498 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()); 522 500 MarkedArgumentBuffer arguments; 523 501 arguments.append(target); … … 557 535 CallType callType; 558 536 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()); 561 538 JSObject* target = proxy->target(); 562 539 if (constructMethod.isUndefined()) { … … 568 545 569 546 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()); 572 548 MarkedArgumentBuffer arguments; 573 549 arguments.append(target); … … 575 551 arguments.append(exec->newTarget()); 576 552 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()); 579 554 if (!result.isObject()) 580 555 return throwVMTypeError(exec, scope, ASCIILiteral("Result from Proxy handler's 'construct' method should be an object")); … … 618 593 CallType callType; 619 594 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); 622 596 JSObject* target = this->target(); 623 597 if (deletePropertyMethod.isUndefined()) … … 628 602 arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid()))); 629 603 JSValue trapResult = call(exec, deletePropertyMethod, callType, callData, handler, arguments); 630 if (UNLIKELY(scope.exception())) 631 return false; 604 RETURN_IF_EXCEPTION(scope, false); 632 605 633 606 bool trapResultAsBool = trapResult.toBoolean(exec); 634 if (UNLIKELY(scope.exception())) 635 return false; 607 RETURN_IF_EXCEPTION(scope, false); 636 608 637 609 if (!trapResultAsBool) … … 646 618 } 647 619 648 if (UNLIKELY(scope.exception())) 649 return false; 620 RETURN_IF_EXCEPTION(scope, false); 650 621 651 622 return true; … … 692 663 CallType callType; 693 664 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); 696 666 JSObject* target = this->target(); 697 667 if (preventExtensionsMethod.isUndefined()) … … 701 671 arguments.append(target); 702 672 JSValue trapResult = call(exec, preventExtensionsMethod, callType, callData, handler, arguments); 703 if (UNLIKELY(scope.exception())) 704 return false; 673 RETURN_IF_EXCEPTION(scope, false); 705 674 706 675 bool trapResultAsBool = trapResult.toBoolean(exec); 707 if (UNLIKELY(scope.exception())) 708 return false; 676 RETURN_IF_EXCEPTION(scope, false); 709 677 710 678 if (trapResultAsBool) { 711 679 bool targetIsExtensible = target->isExtensible(exec); 712 if (UNLIKELY(scope.exception())) 713 return false; 680 RETURN_IF_EXCEPTION(scope, false); 714 681 if (targetIsExtensible) { 715 682 throwVMTypeError(exec, scope, ASCIILiteral("Proxy's 'preventExtensions' trap returned true even though its target is extensible. It should have returned false")); … … 745 712 CallType callType; 746 713 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); 749 715 750 716 JSObject* target = this->target(); … … 755 721 arguments.append(target); 756 722 JSValue trapResult = call(exec, isExtensibleMethod, callType, callData, handler, arguments); 757 if (UNLIKELY(scope.exception())) 758 return false; 723 RETURN_IF_EXCEPTION(scope, false); 759 724 760 725 bool trapResultAsBool = trapResult.toBoolean(exec); 761 if (UNLIKELY(scope.exception())) 762 return false; 726 RETURN_IF_EXCEPTION(scope, false); 763 727 764 728 bool isTargetExtensible = target->isExtensible(exec); 765 if (UNLIKELY(scope.exception())) 766 return false; 729 RETURN_IF_EXCEPTION(scope, false); 767 730 768 731 if (trapResultAsBool != isTargetExtensible) { … … 812 775 CallType callType; 813 776 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); 816 778 817 779 if (definePropertyMethod.isUndefined()) … … 819 781 820 782 JSObject* descriptorObject = constructObjectFromPropertyDescriptor(exec, descriptor); 821 if (UNLIKELY(scope.exception())) 822 return false; 783 RETURN_IF_EXCEPTION(scope, false); 823 784 824 785 MarkedArgumentBuffer arguments; … … 827 788 arguments.append(descriptorObject); 828 789 JSValue trapResult = call(exec, definePropertyMethod, callType, callData, handler, arguments); 829 if (UNLIKELY(scope.exception())) 830 return false; 790 RETURN_IF_EXCEPTION(scope, false); 831 791 832 792 bool trapResultAsBool = trapResult.toBoolean(exec); 833 if (UNLIKELY(scope.exception())) 834 return false; 793 RETURN_IF_EXCEPTION(scope, false); 835 794 836 795 if (!trapResultAsBool) … … 839 798 PropertyDescriptor targetDescriptor; 840 799 bool isTargetDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, targetDescriptor); 841 if (UNLIKELY(scope.exception())) 842 return false; 800 RETURN_IF_EXCEPTION(scope, false); 843 801 844 802 bool targetIsExtensible = target->isExtensible(exec); 845 if (UNLIKELY(scope.exception())) 846 return false; 803 RETURN_IF_EXCEPTION(scope, false); 847 804 bool settingConfigurableToFalse = descriptor.configurablePresent() && !descriptor.configurable(); 848 805 … … 901 858 CallType callType; 902 859 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()); 905 861 JSObject* target = this->target(); 906 862 if (ownKeysMethod.isUndefined()) { … … 912 868 arguments.append(target); 913 869 JSValue arrayLikeObject = call(exec, ownKeysMethod, callType, callData, handler, arguments); 914 if (UNLIKELY(scope.exception())) 915 return; 870 RETURN_IF_EXCEPTION(scope, void()); 916 871 917 872 PropertyNameMode propertyNameMode = trapResult.mode(); … … 940 895 941 896 Identifier ident = value.toPropertyKey(exec); 942 if (UNLIKELY(scope.exception())) 943 return doExitEarly; 897 RETURN_IF_EXCEPTION(scope, doExitEarly); 944 898 945 899 uncheckedResultKeys.add(ident.impl()); … … 949 903 950 904 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()); 953 906 954 907 bool targetIsExensible = target->isExtensible(exec); … … 956 909 PropertyNameArray targetKeys(&vm, propertyNameMode); 957 910 target->methodTable(vm)->getOwnPropertyNames(target, exec, targetKeys, enumerationMode); 958 if (UNLIKELY(scope.exception())) 959 return; 911 RETURN_IF_EXCEPTION(scope, void()); 960 912 Vector<UniquedStringImpl*> targetConfigurableKeys; 961 913 Vector<UniquedStringImpl*> targetNonConfigurableKeys; … … 963 915 PropertyDescriptor descriptor; 964 916 bool isPropertyDefined = target->getOwnPropertyDescriptor(exec, ident.impl(), descriptor); 965 if (UNLIKELY(scope.exception())) 966 return; 917 RETURN_IF_EXCEPTION(scope, void()); 967 918 if (isPropertyDefined && !descriptor.configurable()) 968 919 targetNonConfigurableKeys.append(ident.impl()); … … 1052 1003 CallType callType; 1053 1004 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); 1056 1006 1057 1007 JSObject* target = this->target(); … … 1063 1013 arguments.append(prototype); 1064 1014 JSValue trapResult = call(exec, setPrototypeOfMethod, callType, callData, handler, arguments); 1065 if (UNLIKELY(scope.exception())) 1066 return false; 1015 RETURN_IF_EXCEPTION(scope, false); 1067 1016 1068 1017 bool trapResultAsBool = trapResult.toBoolean(exec); 1069 if (UNLIKELY(scope.exception())) 1070 return false; 1018 RETURN_IF_EXCEPTION(scope, false); 1071 1019 1072 1020 if (!trapResultAsBool) { … … 1077 1025 1078 1026 bool targetIsExtensible = target->isExtensible(exec); 1079 if (UNLIKELY(scope.exception())) 1080 return false; 1027 RETURN_IF_EXCEPTION(scope, false); 1081 1028 if (targetIsExtensible) 1082 1029 return true; 1083 1030 1084 1031 JSValue targetPrototype = target->getPrototype(vm, exec); 1085 if (UNLIKELY(scope.exception())) 1086 return false; 1032 RETURN_IF_EXCEPTION(scope, false); 1087 1033 if (!sameValue(exec, prototype, targetPrototype)) { 1088 1034 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")); … … 1117 1063 CallType callType; 1118 1064 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()); 1121 1066 1122 1067 JSObject* target = this->target(); … … 1127 1072 arguments.append(target); 1128 1073 JSValue trapResult = call(exec, getPrototypeOfMethod, callType, callData, handler, arguments); 1129 if (UNLIKELY(scope.exception())) 1130 return JSValue(); 1074 RETURN_IF_EXCEPTION(scope, JSValue()); 1131 1075 1132 1076 if (!trapResult.isObject() && !trapResult.isNull()) { … … 1136 1080 1137 1081 bool targetIsExtensible = target->isExtensible(exec); 1138 if (UNLIKELY(scope.exception())) 1139 return JSValue(); 1082 RETURN_IF_EXCEPTION(scope, JSValue()); 1140 1083 if (targetIsExtensible) 1141 1084 return trapResult; 1142 1085 1143 1086 JSValue targetPrototype = target->getPrototype(vm, exec); 1144 if (UNLIKELY(scope.exception())) 1145 return JSValue(); 1087 RETURN_IF_EXCEPTION(scope, JSValue()); 1146 1088 if (!sameValue(exec, targetPrototype, trapResult)) { 1147 1089 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 124 124 return false; 125 125 }); 126 if (UNLIKELY(scope.exception())) 127 return JSValue::encode(jsUndefined()); 126 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 128 127 129 128 return JSValue::encode(construct(exec, target, constructType, constructData, arguments, newTarget)); … … 140 139 return JSValue::encode(throwTypeError(exec, scope, ASCIILiteral("Reflect.defineProperty requires the first argument be an object"))); 141 140 auto propertyName = exec->argument(1).toPropertyKey(exec); 142 if (UNLIKELY(scope.exception())) 143 return JSValue::encode(jsUndefined()); 141 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 144 142 145 143 PropertyDescriptor descriptor; … … 179 177 180 178 const Identifier propertyName = exec->argument(1).toPropertyKey(exec); 181 if (UNLIKELY(scope.exception())) 182 return JSValue::encode(jsNull()); 179 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 183 180 184 181 JSValue receiver = target; … … 201 198 202 199 auto key = exec->argument(1).toPropertyKey(exec); 203 if (UNLIKELY(scope.exception())) 204 return JSValue::encode(jsUndefined()); 200 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 205 201 206 202 return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, asObject(target), key)); … … 230 226 231 227 bool isExtensible = asObject(target)->isExtensible(exec); 232 if (UNLIKELY(scope.exception())) 233 return JSValue::encode(JSValue()); 228 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 234 229 return JSValue::encode(jsBoolean(isExtensible)); 235 230 } … … 258 253 JSObject* object = asObject(target); 259 254 bool result = object->methodTable(vm)->preventExtensions(object, exec); 260 if (UNLIKELY(scope.exception())) 261 return JSValue::encode(JSValue()); 255 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 262 256 return JSValue::encode(jsBoolean(result)); 263 257 } … … 275 269 276 270 auto propertyName = exec->argument(1).toPropertyKey(exec); 277 if (UNLIKELY(scope.exception())) 278 return JSValue::encode(jsUndefined()); 271 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 279 272 280 273 JSValue receiver = target; … … 305 298 bool shouldThrowIfCantSet = false; 306 299 bool didSetPrototype = object->setPrototype(vm, exec, proto, shouldThrowIfCantSet); 307 if (UNLIKELY(scope.exception())) 308 return JSValue::encode(JSValue()); 300 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 309 301 return JSValue::encode(jsBoolean(didSetPrototype)); 310 302 } -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r206267 r206386 222 222 223 223 RegExpFlags result = regExpFlags(flagsString->value(exec)); 224 if (UNLIKELY(scope.exception())) 225 return InvalidFlags; 224 RETURN_IF_EXCEPTION(scope, InvalidFlags); 226 225 if (result == InvalidFlags) 227 226 throwSyntaxError(exec, scope, ASCIILiteral("Invalid flags supplied to RegExp constructor.")); … … 235 234 236 235 String pattern = patternArg.isUndefined() ? emptyString() : patternArg.toString(exec)->value(exec); 237 if (UNLIKELY(scope.exception())) 238 return nullptr; 236 RETURN_IF_EXCEPTION(scope, nullptr); 239 237 240 238 RegExpFlags flags = toFlags(exec, flagsArg); … … 247 245 248 246 Structure* structure = getRegExpStructure(exec, globalObject, newTarget); 249 if (UNLIKELY(scope.exception())) 250 return nullptr; 247 RETURN_IF_EXCEPTION(scope, nullptr); 251 248 return RegExpObject::create(vm, structure, regExp); 252 249 } … … 264 261 if (newTarget.isUndefined() && constructAsRegexp && flagsArg.isUndefined()) { 265 262 JSValue constructor = patternArg.get(exec, vm.propertyNames->constructor); 266 if (UNLIKELY(scope.exception())) 267 return nullptr; 263 RETURN_IF_EXCEPTION(scope, nullptr); 268 264 if (callee == constructor) { 269 265 // We know that patternArg is a object otherwise constructAsRegexp would be false. … … 275 271 RegExp* regExp = jsCast<RegExpObject*>(patternArg)->regExp(); 276 272 Structure* structure = getRegExpStructure(exec, globalObject, newTarget); 277 if (UNLIKELY(scope.exception())) 278 return nullptr; 273 RETURN_IF_EXCEPTION(scope, nullptr); 279 274 280 275 if (!flagsArg.isUndefined()) { -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h
r205569 r206386 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2007 , 2008Apple Inc. All Rights Reserved.3 * Copyright (C) 2003, 2007-2008, 2016 Apple Inc. All Rights Reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 140 140 JSObject* object = asObject(value); 141 141 JSValue matchValue = object->get(exec, vm.propertyNames->matchSymbol); 142 if (UNLIKELY(scope.exception())) 143 return false; 142 RETURN_IF_EXCEPTION(scope, false); 144 143 if (!matchValue.isUndefined()) 145 144 return matchValue.toBoolean(exec); -
trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp
r206267 r206386 1 1 /* 2 2 * 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. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 177 177 178 178 JSArray* array = constructEmptyArray(exec, nullptr); 179 if (UNLIKELY(scope.exception())) 180 return jsUndefined(); 179 RETURN_IF_EXCEPTION(scope, JSValue()); 181 180 182 181 auto iterate = [&] () { … … 237 236 238 237 setLastIndex(exec, 0); 239 if (UNLIKELY(scope.exception())) 240 return jsUndefined(); 238 RETURN_IF_EXCEPTION(scope, JSValue()); 241 239 242 240 String s = string->value(exec); -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
r206267 r206386 160 160 } else { 161 161 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()); 164 163 165 164 RegExpFlags flags = NoFlags; 166 165 if (!arg1.isUndefined()) { 167 166 flags = regExpFlags(arg1.toString(exec)->value(exec)); 168 if (UNLIKELY(scope.exception())) 169 return JSValue::encode(jsUndefined()); 167 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 170 168 if (flags == InvalidFlags) 171 169 return throwVMError(exec, scope, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor."))); … … 193 191 194 192 JSValue globalValue = regexp->get(exec, exec->propertyNames().global); 195 if (UNLIKELY(scope.exception())) 196 return string; 193 RETURN_IF_EXCEPTION(scope, string); 197 194 JSValue ignoreCaseValue = regexp->get(exec, exec->propertyNames().ignoreCase); 198 if (UNLIKELY(scope.exception())) 199 return string; 195 RETURN_IF_EXCEPTION(scope, string); 200 196 JSValue multilineValue = regexp->get(exec, exec->propertyNames().multiline); 201 if (UNLIKELY(scope.exception())) 202 return string; 197 RETURN_IF_EXCEPTION(scope, string); 203 198 JSValue unicodeValue = regexp->get(exec, exec->propertyNames().unicode); 204 if (UNLIKELY(scope.exception())) 205 return string; 199 RETURN_IF_EXCEPTION(scope, string); 206 200 JSValue stickyValue = regexp->get(exec, exec->propertyNames().sticky); 207 if (UNLIKELY(scope.exception())) 208 return string; 201 RETURN_IF_EXCEPTION(scope, string); 209 202 210 203 unsigned index = 0; … … 240 233 241 234 JSValue sourceValue = thisObject->get(exec, vm.propertyNames->source); 242 if (UNLIKELY(scope.exception())) 243 return JSValue::encode(jsUndefined()); 235 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 244 236 String source = sourceValue.toString(exec)->value(exec); 245 if (UNLIKELY(scope.exception())) 246 return JSValue::encode(jsUndefined()); 237 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 247 238 248 239 JSValue flagsValue = thisObject->get(exec, vm.propertyNames->flags); 249 if (UNLIKELY(scope.exception())) 250 return JSValue::encode(jsUndefined()); 240 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 251 241 String flags = flagsValue.toString(exec)->value(exec); 252 if (UNLIKELY(scope.exception())) 253 return JSValue::encode(jsUndefined()); 242 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 254 243 255 244 return JSValue::encode(jsMakeNontrivialString(exec, '/', source, '/', flags)); … … 341 330 342 331 auto flags = flagsString(exec, asObject(thisValue)); 343 if (UNLIKELY(scope.exception())) 344 return JSValue::encode(jsUndefined()); 332 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 345 333 346 334 return JSValue::encode(jsString(exec, flags.data())); … … 480 468 JSString* string = exec->uncheckedArgument(0).toString(exec); 481 469 String s = string->value(exec); 482 if (UNLIKELY(scope.exception())) 483 return JSValue::encode(jsUndefined()); 470 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 484 471 485 472 RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor(); … … 589 576 JSString* inputString = exec->argument(0).toString(exec); 590 577 String input = inputString->value(exec); 591 if (UNLIKELY(scope.exception())) 592 return JSValue::encode(jsUndefined()); 578 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 593 579 ASSERT(!input.isNull()); 594 580 … … 604 590 // 12. Let lengthA be 0. 605 591 JSArray* result = constructEmptyArray(exec, 0); 606 if (UNLIKELY(scope.exception())) 607 return JSValue::encode(jsUndefined()); 592 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 608 593 unsigned resultLength = 0; 609 594 -
trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp
r206018 r206386 62 62 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 63 63 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()); 66 65 JSSet* set = JSSet::create(exec, vm, setStructure); 67 if (UNLIKELY(scope.exception())) 68 return JSValue::encode(JSValue()); 66 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 69 67 JSValue iterable = exec->argument(0); 70 68 if (iterable.isUndefinedOrNull()) … … 72 70 73 71 JSValue adderFunction = set->get(exec, exec->propertyNames().add); 74 if (UNLIKELY(scope.exception())) 75 return JSValue::encode(jsUndefined()); 72 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 76 73 77 74 CallData adderFunctionCallData; -
trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp
r205569 r206386 101 101 for (unsigned i = 0; i < length; ++i) { 102 102 double codePointAsDouble = exec->uncheckedArgument(i).toNumber(exec); 103 if (UNLIKELY(scope.exception())) 104 return JSValue::encode(jsUndefined()); 103 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 105 104 106 105 uint32_t codePoint = static_cast<uint32_t>(codePointAsDouble); … … 127 126 128 127 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()); 131 129 132 130 if (!exec->argumentCount()) -
trunk/Source/JavaScriptCore/runtime/StringObject.cpp
r206267 r206386 122 122 ASSERT(isCurrentDefined); 123 123 bool isExtensible = thisObject->isExtensible(exec); 124 if (UNLIKELY(scope.exception())) 125 return false; 124 RETURN_IF_EXCEPTION(scope, false); 126 125 return validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException); 127 126 } -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r206267 r206386 481 481 const String& source = string->value(exec); 482 482 unsigned sourceLen = source.length(); 483 if (UNLIKELY(scope.exception())) 484 return JSValue::encode(jsUndefined()); 483 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 485 484 RegExpObject* regExpObject = asRegExpObject(searchValue); 486 485 RegExp* regExp = regExpObject->regExp(); … … 490 489 // ES5.1 15.5.4.10 step 8.a. 491 490 regExpObject->setLastIndex(exec, 0); 492 if (UNLIKELY(scope.exception())) 493 return JSValue::encode(jsUndefined()); 491 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 494 492 495 493 if (callType == CallType::None && !replacementString.length()) … … 513 511 JSFunction* func = jsCast<JSFunction*>(replaceValue); 514 512 CachedCall cachedCall(exec, func, argCount); 515 if (UNLIKELY(scope.exception())) 516 return JSValue::encode(jsUndefined()); 513 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 517 514 if (source.is8Bit()) { 518 515 while (true) { … … 541 538 JSValue jsResult = cachedCall.call(); 542 539 replacements.append(jsResult.toString(exec)->value(exec)); 543 if (UNLIKELY(scope.exception())) 544 return JSValue::encode(jsUndefined()); 540 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 545 541 546 542 lastIndex = result.end; … … 580 576 JSValue jsResult = cachedCall.call(); 581 577 replacements.append(jsResult.toString(exec)->value(exec)); 582 if (UNLIKELY(scope.exception())) 583 return JSValue::encode(jsUndefined()); 578 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 584 579 585 580 lastIndex = result.end; … … 619 614 args.append(string); 620 615 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()); 624 620 } else { 625 621 int replLen = replacementString.length(); … … 666 662 // ES5.1 15.5.4.10 step 8.a. 667 663 searchValue->setLastIndex(exec, 0); 668 if (UNLIKELY(scope.exception())) 669 return JSValue::encode(jsUndefined()); 664 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 670 665 return removeUsingRegExpSearch(vm, exec, thisValue, thisValue->value(exec), regExp); 671 666 } … … 698 693 if (callType == CallType::None) { 699 694 replacementString = replaceValue.toString(exec)->value(exec); 700 if (UNLIKELY(scope.exception())) 701 return JSValue::encode(jsUndefined()); 695 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 702 696 } 703 697 … … 712 706 const String& string = jsString->value(exec); 713 707 String searchString = searchValue.toString(exec)->value(exec); 714 if (UNLIKELY(scope.exception())) 715 return JSValue::encode(jsUndefined()); 708 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 716 709 717 710 size_t matchStart = string.find(searchString); … … 728 721 args.append(jsString); 729 722 replaceValue = call(exec, replaceValue, callType, callData, jsUndefined(), args); 730 if (UNLIKELY(scope.exception())) 731 return JSValue::encode(jsUndefined()); 723 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 732 724 } 733 725 734 726 String replaceString = replaceValue.toString(exec)->value(exec); 735 if (UNLIKELY(scope.exception())) 736 return JSValue::encode(jsUndefined()); 727 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 737 728 738 729 StringImpl* stringImpl = string.impl(); … … 818 809 return throwVMTypeError(exec, scope); 819 810 JSString* string = thisValue.toString(exec); 820 if (UNLIKELY(scope.exception())) 821 return JSValue::encode(jsUndefined()); 811 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 822 812 return replace(vm, exec, string, searchValue, replaceValue); 823 813 } … … 829 819 830 820 JSString* string = exec->thisValue().toString(exec); 831 if (UNLIKELY(scope.exception())) 832 return JSValue::encode(jsUndefined()); 821 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 833 822 834 823 JSValue searchValue = exec->argument(0); … … 845 834 846 835 JSString* string = exec->thisValue().toString(exec); 847 if (UNLIKELY(scope.exception())) 848 return JSValue::encode(jsUndefined()); 836 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 849 837 850 838 return replaceUsingStringSearch(exec->vm(), exec, string, exec->argument(0), exec->argument(1)); … … 954 942 } 955 943 956 if (UNLIKELY(scope.exception())) 957 return JSValue::encode(jsUndefined()); 944 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 958 945 959 946 double doublePosition = argument0.toInteger(exec); … … 1066 1053 return throwVMTypeError(exec, scope); 1067 1054 String s = thisValue.toString(exec)->value(exec); 1068 if (UNLIKELY(scope.exception())) 1069 return JSValue::encode(jsUndefined()); 1055 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1070 1056 1071 1057 int len = s.length(); … … 1131 1117 // 7. Let s be the number of characters in S. 1132 1118 String input = thisValue.toString(exec)->value(exec); 1133 if (UNLIKELY(scope.exception())) 1134 return JSValue::encode(jsUndefined()); 1119 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1135 1120 ASSERT(!input.isNull()); 1136 1121 … … 1138 1123 // where Array is the standard built-in constructor with that name. 1139 1124 JSArray* result = constructEmptyArray(exec, 0); 1140 if (UNLIKELY(scope.exception())) 1141 return JSValue::encode(jsUndefined()); 1125 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1142 1126 1143 1127 // 5. Let lengthA be 0. … … 1155 1139 JSValue separatorValue = exec->uncheckedArgument(0); 1156 1140 String separator = separatorValue.toString(exec)->value(exec); 1157 if (UNLIKELY(scope.exception())) 1158 return JSValue::encode(jsUndefined()); 1141 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1159 1142 1160 1143 // 10. If lim == 0, return A. … … 1264 1247 } else { 1265 1248 uString = thisValue.toString(exec)->value(exec); 1266 if (UNLIKELY(scope.exception())) 1267 return JSValue::encode(jsUndefined()); 1249 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1268 1250 len = uString.length(); 1269 1251 } … … 1317 1299 1318 1300 JSString* jsString = thisValue.toString(exec); 1319 if (UNLIKELY(scope.exception())) 1320 return JSValue::encode(jsUndefined()); 1301 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1321 1302 1322 1303 JSValue a0 = exec->argument(0); … … 1391 1372 return throwVMTypeError(exec, scope); 1392 1373 String s = thisValue.toString(exec)->value(exec); 1393 if (UNLIKELY(scope.exception())) 1394 return JSValue::encode(jsUndefined()); 1374 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1395 1375 1396 1376 JSValue a0 = exec->argument(0); 1397 1377 String str = a0.toString(exec)->value(exec); 1398 if (UNLIKELY(scope.exception())) 1399 return JSValue::encode(jsUndefined()); 1378 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1400 1379 return JSValue::encode(jsNumber(Collator().collate(s, str))); 1401 1380 } … … 1417 1396 1418 1397 // 3. ReturnIfAbrupt(S). 1419 if (UNLIKELY(scope.exception())) 1420 return JSValue::encode(jsUndefined()); 1398 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1421 1399 1422 1400 // Optimization for empty strings. … … 1428 1406 1429 1407 // 5. ReturnIfAbrupt(requestedLocales). 1430 if (UNLIKELY(scope.exception())) 1431 return JSValue::encode(jsUndefined()); 1408 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1432 1409 1433 1410 // 6. Let len be the number of elements in requestedLocales. … … 1512 1489 return throwVMTypeError(exec, scope); 1513 1490 String s = thisValue.toString(exec)->value(exec); 1514 if (UNLIKELY(scope.exception())) 1515 return JSValue::encode(jsUndefined()); 1491 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1516 1492 return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>")); 1517 1493 } … … 1526 1502 return throwVMTypeError(exec, scope); 1527 1503 String s = thisValue.toString(exec)->value(exec); 1528 if (UNLIKELY(scope.exception())) 1529 return JSValue::encode(jsUndefined()); 1504 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1530 1505 return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>")); 1531 1506 } … … 1540 1515 return throwVMTypeError(exec, scope); 1541 1516 String s = thisValue.toString(exec)->value(exec); 1542 if (UNLIKELY(scope.exception())) 1543 return JSValue::encode(jsUndefined()); 1517 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1544 1518 return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>")); 1545 1519 } … … 1554 1528 return throwVMTypeError(exec, scope); 1555 1529 String s = thisValue.toString(exec)->value(exec); 1556 if (UNLIKELY(scope.exception())) 1557 return JSValue::encode(jsUndefined()); 1530 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1558 1531 return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>")); 1559 1532 } … … 1568 1541 return throwVMTypeError(exec, scope); 1569 1542 String s = thisValue.toString(exec)->value(exec); 1570 if (UNLIKELY(scope.exception())) 1571 return JSValue::encode(jsUndefined()); 1543 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1572 1544 return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>")); 1573 1545 } … … 1582 1554 return throwVMTypeError(exec, scope); 1583 1555 String s = thisValue.toString(exec)->value(exec); 1584 if (UNLIKELY(scope.exception())) 1585 return JSValue::encode(jsUndefined()); 1556 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1586 1557 return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>")); 1587 1558 } … … 1596 1567 return throwVMTypeError(exec, scope); 1597 1568 String s = thisValue.toString(exec)->value(exec); 1598 if (UNLIKELY(scope.exception())) 1599 return JSValue::encode(jsUndefined()); 1569 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1600 1570 return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>")); 1601 1571 } … … 1610 1580 return throwVMTypeError(exec, scope); 1611 1581 String s = thisValue.toString(exec)->value(exec); 1612 if (UNLIKELY(scope.exception())) 1613 return JSValue::encode(jsUndefined()); 1582 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1614 1583 return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>")); 1615 1584 } … … 1624 1593 return throwVMTypeError(exec, scope); 1625 1594 String s = thisValue.toString(exec)->value(exec); 1626 if (UNLIKELY(scope.exception())) 1627 return JSValue::encode(jsUndefined()); 1595 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1628 1596 return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>")); 1629 1597 } … … 1638 1606 return throwVMTypeError(exec, scope); 1639 1607 String s = thisValue.toString(exec)->value(exec); 1640 if (UNLIKELY(scope.exception())) 1641 return JSValue::encode(jsUndefined()); 1608 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1642 1609 1643 1610 JSValue a0 = exec->argument(0); … … 1657 1624 return throwVMTypeError(exec, scope); 1658 1625 String s = thisValue.toString(exec)->value(exec); 1659 if (UNLIKELY(scope.exception())) 1660 return JSValue::encode(jsUndefined()); 1626 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1661 1627 1662 1628 JSValue a0 = exec->argument(0); … … 1712 1678 return throwVMTypeError(exec, scope); 1713 1679 String s = thisValue.toString(exec)->value(exec); 1714 if (UNLIKELY(scope.exception())) 1715 return JSValue::encode(jsUndefined()); 1680 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1716 1681 1717 1682 JSValue a0 = exec->argument(0); … … 1731 1696 return throwVMTypeError(exec, scope); 1732 1697 String s = thisValue.toString(exec)->value(exec); 1733 if (UNLIKELY(scope.exception())) 1734 return JSValue::encode(jsUndefined()); 1698 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1735 1699 1736 1700 JSValue a0 = exec->argument(0); … … 1779 1743 return throwTypeError(exec, scope); 1780 1744 String str = thisValue.toString(exec)->value(exec); 1781 if (UNLIKELY(scope.exception())) 1782 return jsUndefined(); 1745 RETURN_IF_EXCEPTION(scope, JSValue()); 1783 1746 1784 1747 unsigned left = 0; … … 1837 1800 1838 1801 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1839 if (UNLIKELY(scope.exception())) 1840 return JSValue::encode(jsUndefined()); 1802 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1841 1803 1842 1804 JSValue a0 = exec->argument(0); 1843 1805 bool isRegularExpression = isRegExp(vm, exec, a0); 1844 if (UNLIKELY(scope.exception())) 1845 return JSValue::encode(JSValue()); 1806 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1846 1807 if (isRegularExpression) 1847 1808 return throwVMTypeError(exec, scope, "Argument to String.prototype.startsWith cannot be a RegExp"); 1848 1809 1849 1810 String searchString = a0.toString(exec)->value(exec); 1850 if (UNLIKELY(scope.exception())) 1851 return JSValue::encode(jsUndefined()); 1811 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1852 1812 1853 1813 JSValue positionArg = exec->argument(1); … … 1858 1818 unsigned length = stringToSearchIn.length(); 1859 1819 start = clampAndTruncateToUnsigned(positionArg.toInteger(exec), 0, length); 1860 if (UNLIKELY(scope.exception())) 1861 return JSValue::encode(jsUndefined()); 1820 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1862 1821 } 1863 1822 … … 1875 1834 1876 1835 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1877 if (UNLIKELY(scope.exception())) 1878 return JSValue::encode(jsUndefined()); 1836 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1879 1837 1880 1838 JSValue a0 = exec->argument(0); 1881 1839 bool isRegularExpression = isRegExp(vm, exec, a0); 1882 if (UNLIKELY(scope.exception())) 1883 return JSValue::encode(JSValue()); 1840 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1884 1841 if (isRegularExpression) 1885 1842 return throwVMTypeError(exec, scope, "Argument to String.prototype.endsWith cannot be a RegExp"); 1886 1843 1887 1844 String searchString = a0.toString(exec)->value(exec); 1888 if (UNLIKELY(scope.exception())) 1889 return JSValue::encode(jsUndefined()); 1845 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1890 1846 1891 1847 unsigned length = stringToSearchIn.length(); … … 1897 1853 else if (!endPositionArg.isUndefined()) { 1898 1854 end = clampAndTruncateToUnsigned(endPositionArg.toInteger(exec), 0, length); 1899 if (UNLIKELY(scope.exception())) 1900 return JSValue::encode(jsUndefined()); 1855 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1901 1856 } 1902 1857 … … 1913 1868 unsigned length = stringToSearchIn.length(); 1914 1869 start = clampAndTruncateToUnsigned(positionArg.toInteger(exec), 0, length); 1915 if (UNLIKELY(scope.exception())) 1916 return JSValue::encode(jsUndefined()); 1870 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1917 1871 } 1918 1872 … … 1930 1884 1931 1885 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1932 if (UNLIKELY(scope.exception())) 1933 return JSValue::encode(jsUndefined()); 1886 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1934 1887 1935 1888 JSValue a0 = exec->argument(0); 1936 1889 bool isRegularExpression = isRegExp(vm, exec, a0); 1937 if (UNLIKELY(scope.exception())) 1938 return JSValue::encode(JSValue()); 1890 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1939 1891 if (isRegularExpression) 1940 1892 return throwVMTypeError(exec, scope, "Argument to String.prototype.includes cannot be a RegExp"); 1941 1893 1942 1894 String searchString = a0.toString(exec)->value(exec); 1943 if (UNLIKELY(scope.exception())) 1944 return JSValue::encode(jsUndefined()); 1895 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1945 1896 1946 1897 JSValue positionArg = exec->argument(1); … … 1958 1909 1959 1910 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1960 if (UNLIKELY(scope.exception())) 1961 return JSValue::encode(jsUndefined()); 1911 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1962 1912 1963 1913 JSValue a0 = exec->uncheckedArgument(0); 1964 1914 String searchString = a0.toString(exec)->value(exec); 1965 if (UNLIKELY(scope.exception())) 1966 return JSValue::encode(jsUndefined()); 1915 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 1967 1916 1968 1917 JSValue positionArg = exec->argument(1); … … 2019 1968 return throwVMTypeError(exec, scope); 2020 1969 JSString::SafeView source = thisValue.toString(exec)->view(exec); 2021 if (UNLIKELY(scope.exception())) 2022 return JSValue::encode(jsUndefined()); 1970 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2023 1971 2024 1972 UNormalizationMode form = UNORM_NFC; … … 2026 1974 if (!exec->argument(0).isUndefined()) { 2027 1975 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()); 2030 1977 2031 1978 if (formString == "NFC") -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp
r205569 r206386 101 101 102 102 JSString* stringKey = exec->argument(0).toString(exec); 103 if (UNLIKELY(scope.exception())) 104 return JSValue::encode(jsUndefined()); 103 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 105 104 String string = stringKey->value(exec); 106 if (UNLIKELY(scope.exception())) 107 return JSValue::encode(jsUndefined()); 105 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 108 106 109 107 return JSValue::encode(Symbol::create(exec->vm(), exec->vm().symbolRegistry().symbolForKey(string))); -
trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp
r205569 r206386 1 1 /* 2 2 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. 3 * Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 49 50 unsigned count = templateKey.cookedStrings().size(); 50 51 JSArray* templateObject = constructEmptyArray(exec, nullptr, count); 51 if (UNLIKELY(scope.exception())) 52 return nullptr; 52 RETURN_IF_EXCEPTION(scope, nullptr); 53 53 JSArray* rawObject = constructEmptyArray(exec, nullptr, count); 54 if (UNLIKELY(scope.exception())) 55 return nullptr; 54 RETURN_IF_EXCEPTION(scope, nullptr); 56 55 57 56 for (unsigned index = 0; index < count; ++index) { -
trunk/Source/JavaScriptCore/runtime/WeakMapConstructor.cpp
r206018 r206386 60 60 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 61 61 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()); 64 63 JSWeakMap* weakMap = JSWeakMap::create(exec, weakMapStructure); 65 64 JSValue iterable = exec->argument(0); … … 68 67 69 68 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()); 72 70 73 71 CallData adderFunctionCallData; … … 84 82 85 83 JSValue key = nextItem.get(exec, static_cast<unsigned>(0)); 86 if (UNLIKELY(scope.exception())) 87 return; 84 RETURN_IF_EXCEPTION(scope, void()); 88 85 89 86 JSValue value = nextItem.get(exec, static_cast<unsigned>(1)); 90 if (UNLIKELY(scope.exception())) 91 return; 87 RETURN_IF_EXCEPTION(scope, void()); 92 88 93 89 MarkedArgumentBuffer arguments; -
trunk/Source/JavaScriptCore/runtime/WeakSetConstructor.cpp
r206018 r206386 60 60 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 61 61 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()); 64 63 JSWeakSet* weakSet = JSWeakSet::create(exec, weakSetStructure); 65 64 JSValue iterable = exec->argument(0); … … 68 67 69 68 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()); 72 70 73 71 CallData adderFunctionCallData; -
trunk/Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp
r206154 r206386 313 313 for (unsigned i = 0; i < exec->argumentCount(); ++i) { 314 314 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()); 317 316 dataLog(argStr); 318 317 } -
trunk/Source/WebCore/ChangeLog
r206385 r206386 1 2016-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 1 173 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com> 2 174 -
trunk/Source/WebCore/bindings/js/ArrayValue.cpp
r205569 r206386 1 1 /* 2 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 94 95 95 96 value = indexedValue.toWTFString(m_exec); 96 if (UNLIKELY(scope.exception())) 97 return false; 97 RETURN_IF_EXCEPTION(scope, false); 98 98 99 99 return true; -
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp
r205744 r206386 98 98 unsigned size = inArray.size(); 99 99 auto outArray = constructEmptyArray(&state, 0, &globalObject, size); 100 if (UNLIKELY(scope.exception())) 101 return jsUndefined(); 100 RETURN_IF_EXCEPTION(scope, JSValue()); 102 101 for (size_t i = 0; i < size; ++i) 103 102 outArray->putDirectIndex(&state, i, toJS(state, globalObject, inArray.at(i).get())); -
trunk/Source/WebCore/bindings/js/JSApplePaySessionCustom.cpp
r205569 r206386 56 56 ExceptionCode ec = 0; 57 57 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()); 60 59 61 60 Dictionary newTotal = { &state, state.argument(1) }; 62 if (UNLIKELY(scope.exception())) 63 return jsUndefined(); 61 RETURN_IF_EXCEPTION(scope, JSValue()); 64 62 65 63 ArrayValue newLineItems { &state, state.argument(2) }; 66 if (UNLIKELY(scope.exception())) 67 return jsUndefined(); 64 RETURN_IF_EXCEPTION(scope, JSValue()); 68 65 impl.completeShippingMethodSelection(status, newTotal, newLineItems, ec); 69 66 setDOMException(&state, ec); … … 89 86 ExceptionCode ec = 0; 90 87 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()); 93 89 94 90 ArrayValue newShippingMethods { &state, state.argument(1) }; 95 if (UNLIKELY(scope.exception())) 96 return jsUndefined(); 91 RETURN_IF_EXCEPTION(scope, JSValue()); 97 92 98 93 Dictionary newTotal = { &state, state.argument(2) }; 99 if (UNLIKELY(scope.exception())) 100 return jsUndefined(); 94 RETURN_IF_EXCEPTION(scope, JSValue()); 101 95 102 96 ArrayValue newLineItems { &state, state.argument(3) }; 103 if (UNLIKELY(scope.exception())) 104 return jsUndefined(); 97 RETURN_IF_EXCEPTION(scope, JSValue()); 105 98 impl.completeShippingContactSelection(status, newShippingMethods, newTotal, newLineItems, ec); 106 99 setDOMException(&state, ec); … … 126 119 ExceptionCode ec = 0; 127 120 Dictionary newTotal = { &state, state.argument(0) }; 128 if (UNLIKELY(scope.exception())) 129 return jsUndefined(); 121 RETURN_IF_EXCEPTION(scope, JSValue()); 130 122 131 123 ArrayValue newLineItems { &state, state.argument(1) }; 132 if (UNLIKELY(scope.exception())) 133 return jsUndefined(); 124 RETURN_IF_EXCEPTION(scope, JSValue()); 134 125 impl.completePaymentMethodSelection(newTotal, newLineItems, ec); 135 126 setDOMException(&state, ec); -
trunk/Source/WebCore/bindings/js/JSAudioTrackCustom.cpp
r205569 r206386 48 48 49 49 auto& string = value.toString(&state)->value(&state); 50 if (UNLIKELY(scope.exception())) 51 return; 50 RETURN_IF_EXCEPTION(scope, void()); 52 51 wrapped().setKind(string); 53 52 #else … … 64 63 65 64 auto& string = value.toString(&state)->value(&state); 66 if (UNLIKELY(scope.exception())) 67 return; 65 RETURN_IF_EXCEPTION(scope, void()); 68 66 wrapped().setLanguage(string); 69 67 #else -
trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp
r205569 r206386 81 81 unsigned blobPartsLength = 0; 82 82 JSObject* blobParts = toJSSequence(exec, exec.uncheckedArgument(0), blobPartsLength); 83 if (UNLIKELY(scope.exception())) 84 return JSValue::encode(jsUndefined()); 83 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 85 84 ASSERT(blobParts); 86 85 … … 102 101 // Attempt to get the endings property and validate it. 103 102 bool containsEndings = dictionary.get("endings", endings); 104 if (UNLIKELY(scope.exception())) 105 return JSValue::encode(jsUndefined()); 103 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 106 104 107 105 if (containsEndings) { … … 112 110 // Attempt to get the type property. 113 111 dictionary.get("type", type); 114 if (UNLIKELY(scope.exception())) 115 return JSValue::encode(jsUndefined()); 112 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 116 113 } 117 114 … … 122 119 for (unsigned i = 0; i < blobPartsLength; ++i) { 123 120 JSValue item = blobParts->get(&exec, i); 124 if (UNLIKELY(scope.exception())) 125 return JSValue::encode(jsUndefined()); 121 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 126 122 127 123 if (ArrayBuffer* arrayBuffer = toArrayBuffer(item)) … … 133 129 else { 134 130 String string = item.toWTFString(&exec); 135 if (UNLIKELY(scope.exception())) 136 return JSValue::encode(jsUndefined()); 131 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 137 132 blobBuilder.append(string, endings); 138 133 } -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r205569 r206386 356 356 357 357 String propertyName = state.uncheckedArgument(0).toWTFString(&state); 358 if (UNLIKELY(scope.exception())) 359 return jsUndefined(); 358 RETURN_IF_EXCEPTION(scope, JSValue()); 360 359 361 360 RefPtr<CSSValue> cssValue = wrapped().getPropertyCSSValue(propertyName); -
trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp
r205569 r206386 1 1 /* 2 * Copyright (C) 2007 , 2008Apple Inc. All rights reserved.2 * Copyright (C) 2007-2008, 2016 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 4 * Copyright (C) 2010-2011 Google Inc. All rights reserved. … … 71 71 auto scope = DECLARE_THROW_SCOPE(vm); 72 72 JSArray* result = constructEmptyArray(&state, nullptr); 73 if (UNLIKELY(scope.exception())) 74 return nullptr; 73 RETURN_IF_EXCEPTION(scope, nullptr); 75 74 size_t handlersCount = listenerInfo.eventListenerVector.size(); 76 75 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) { -
trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp
r205569 r206386 81 81 } 82 82 83 if (UNLIKELY(scope.exception())) 84 return false; 83 RETURN_IF_EXCEPTION(scope, false); 85 84 86 85 if (!algorithmName.containsOnlyASCII()) { … … 114 113 115 114 JSValue hash = getProperty(exec, object, "hash"); 116 if (UNLIKELY(scope.exception())) 117 return false; 115 RETURN_IF_EXCEPTION(scope, false); 118 116 119 117 if (hash.isUndefinedOrNull()) { … … 137 135 138 136 JSValue iv = getProperty(exec, value.getObject(), "iv"); 139 if (UNLIKELY(scope.exception())) 140 return nullptr; 137 RETURN_IF_EXCEPTION(scope, nullptr); 141 138 142 139 auto result = adoptRef(*new CryptoAlgorithmAesCbcParams); … … 171 168 172 169 JSValue lengthValue = getProperty(&state, value.getObject(), "length"); 173 if (UNLIKELY(scope.exception())) 174 return nullptr; 170 RETURN_IF_EXCEPTION(scope, nullptr); 175 171 176 172 result->length = convert<uint16_t>(state, lengthValue, EnforceRange); … … 219 215 220 216 result->hasLength = jsDictionary.get("length", result->length); 221 if (UNLIKELY(scope.exception())) 222 return nullptr; 217 RETURN_IF_EXCEPTION(scope, nullptr); 223 218 224 219 return WTFMove(result); … … 239 234 240 235 JSValue modulusLengthValue = getProperty(&state, value.getObject(), "modulusLength"); 241 if (UNLIKELY(scope.exception())) 242 return nullptr; 236 RETURN_IF_EXCEPTION(scope, nullptr); 243 237 244 238 // FIXME: Why no EnforceRange? Filed as <https://www.w3.org/Bugs/Public/show_bug.cgi?id=23779>. 245 239 result->modulusLength = convert<uint32_t>(state, modulusLengthValue, NormalConversion); 246 if (UNLIKELY(scope.exception())) 247 return nullptr; 240 RETURN_IF_EXCEPTION(scope, nullptr); 248 241 249 242 JSValue publicExponentValue = getProperty(&state, value.getObject(), "publicExponent"); 250 if (UNLIKELY(scope.exception())) 251 return nullptr; 243 RETURN_IF_EXCEPTION(scope, nullptr); 252 244 253 245 RefPtr<Uint8Array> publicExponentArray = toUint8Array(publicExponentValue); … … 288 280 289 281 JSValue labelValue = getProperty(exec, value.getObject(), "label"); 290 if (UNLIKELY(scope.exception())) 291 return nullptr; 282 RETURN_IF_EXCEPTION(scope, nullptr); 292 283 293 284 result->hasLabel = !labelValue.isUndefinedOrNull(); -
trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp
r205569 r206386 89 89 if (!jsValue.getString(exec, result)) { 90 90 // Can get an out of memory exception. 91 if (UNLIKELY(scope.exception())) 92 return false; 91 RETURN_IF_EXCEPTION(scope, false); 93 92 throwTypeError(exec, scope, String::format("Expected a string value for \"%s\" JSON key", key)); 94 93 return false; … … 321 320 } 322 321 } else { 323 if (UNLIKELY(scope.exception())) 324 return; 322 RETURN_IF_EXCEPTION(scope, void()); 325 323 326 324 String jwkUseString; … … 438 436 439 437 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "d", modulus)) { 440 if (scope.exception()) 441 return nullptr; 438 RETURN_IF_EXCEPTION(scope, nullptr); 442 439 return CryptoKeyDataRSAComponents::createPublic(modulus, exponent); 443 440 } … … 447 444 Vector<CryptoKeyDataRSAComponents::PrimeInfo> otherPrimeInfos; 448 445 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "p", firstPrimeInfo.primeFactor)) { 449 if (scope.exception()) 450 return nullptr; 446 RETURN_IF_EXCEPTION(scope, nullptr); 451 447 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); 452 448 } 453 449 454 450 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "dp", firstPrimeInfo.factorCRTExponent)) { 455 if (scope.exception()) 456 return nullptr; 451 RETURN_IF_EXCEPTION(scope, nullptr); 457 452 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); 458 453 } 459 454 460 455 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "q", secondPrimeInfo.primeFactor)) { 461 if (scope.exception()) 462 return nullptr; 456 RETURN_IF_EXCEPTION(scope, nullptr); 463 457 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); 464 458 } 465 459 466 460 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "dq", secondPrimeInfo.factorCRTExponent)) { 467 if (scope.exception()) 468 return nullptr; 461 RETURN_IF_EXCEPTION(scope, nullptr); 469 462 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); 470 463 } 471 464 472 465 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "qi", secondPrimeInfo.factorCRTCoefficient)) { 473 if (scope.exception()) 474 return nullptr; 466 RETURN_IF_EXCEPTION(scope, nullptr); 475 467 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); 476 468 } … … 478 470 JSArray* otherPrimeInfoJSArray; 479 471 if (!getJSArrayFromJSON(m_exec, m_json.get(), "oth", otherPrimeInfoJSArray)) { 480 if (scope.exception()) 481 return nullptr; 472 RETURN_IF_EXCEPTION(scope, nullptr); 482 473 return CryptoKeyDataRSAComponents::createPrivateWithAdditionalData(modulus, exponent, privateExponent, firstPrimeInfo, secondPrimeInfo, otherPrimeInfos); 483 474 } … … 486 477 CryptoKeyDataRSAComponents::PrimeInfo info; 487 478 JSValue element = otherPrimeInfoJSArray->getIndex(m_exec, i); 488 if (UNLIKELY(scope.exception())) 489 return nullptr; 479 RETURN_IF_EXCEPTION(scope, nullptr); 490 480 if (!element.isObject()) { 491 481 throwTypeError(m_exec, scope, ASCIILiteral("JWK \"oth\" array member is not an object")); … … 575 565 576 566 JSArray* oth = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), data.otherPrimeInfos().size()); 577 if (UNLIKELY(scope.exception())) 578 return; 567 RETURN_IF_EXCEPTION(scope, void()); 579 568 for (size_t i = 0, size = data.otherPrimeInfos().size(); i < size; ++i) { 580 569 JSObject* jsPrimeInfo = constructEmptyObject(exec); … … 703 692 auto scope = DECLARE_THROW_SCOPE(vm); 704 693 JSArray* keyOps = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), 0); 705 if (UNLIKELY(scope.exception())) 706 return; 694 RETURN_IF_EXCEPTION(scope, void()); 707 695 708 696 unsigned index = 0; … … 742 730 743 731 addJWKAlgorithmToJSON(exec, result, key); 744 if (UNLIKELY(scope.exception())) 745 return String(); 732 RETURN_IF_EXCEPTION(scope, String()); 746 733 747 734 addBoolToJSON(exec, result, "ext", key.extractable()); 748 735 749 736 addUsagesToJSON(exec, result, key.usagesBitmap()); 750 if (UNLIKELY(scope.exception())) 751 return String(); 737 RETURN_IF_EXCEPTION(scope, String()); 752 738 753 739 if (is<CryptoKeyDataOctetSequence>(*keyData)) … … 759 745 return String(); 760 746 } 761 if (UNLIKELY(scope.exception())) 762 return String(); 747 RETURN_IF_EXCEPTION(scope, String()); 763 748 764 749 return JSONStringify(exec, result, 0); -
trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp
r205569 r206386 112 112 JSValue newElement = construct(&state, constructor, constructType, constructData, args); 113 113 InspectorInstrumentation::didCallFunction(cookie, &document); 114 if (UNLIKELY(scope.exception())) 115 return nullptr; 114 RETURN_IF_EXCEPTION(scope, nullptr); 116 115 117 116 ASSERT(!newElement.isEmpty()); … … 168 167 JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, *m_isolatedWorld); 169 168 ExecState* state = globalObject->globalExec(); 170 if (UNLIKELY(scope.exception())) 171 return; 169 RETURN_IF_EXCEPTION(scope, void()); 172 170 173 171 ConstructData constructData; -
trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
r206252 r206386 47 47 48 48 JSValue callback = prototype.get(&state, id); 49 if (UNLIKELY(scope.exception())) 50 return nullptr; 49 RETURN_IF_EXCEPTION(scope, nullptr); 51 50 if (callback.isUndefined()) 52 51 return nullptr; … … 89 88 90 89 AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state)); 91 if (UNLIKELY(scope.exception())) 92 return jsUndefined(); 90 RETURN_IF_EXCEPTION(scope, JSValue()); 93 91 94 92 JSValue constructorValue = state.uncheckedArgument(1); … … 119 117 120 118 JSValue prototypeValue = constructor->get(&state, vm.propertyNames->prototype); 121 if (UNLIKELY(scope.exception())) 122 return jsUndefined(); 119 RETURN_IF_EXCEPTION(scope, JSValue()); 123 120 if (!prototypeValue.isObject()) 124 121 return throwTypeError(&state, scope, ASCIILiteral("Custom element constructor's prototype must be an object")); … … 130 127 if (auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"))) 131 128 elementInterface->setConnectedCallback(connectedCallback); 132 if (UNLIKELY(scope.exception())) 133 return jsUndefined(); 129 RETURN_IF_EXCEPTION(scope, JSValue()); 134 130 135 131 if (auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"))) 136 132 elementInterface->setDisconnectedCallback(disconnectedCallback); 137 if (UNLIKELY(scope.exception())) 138 return jsUndefined(); 133 RETURN_IF_EXCEPTION(scope, JSValue()); 139 134 140 135 if (auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"))) 141 136 elementInterface->setAdoptedCallback(adoptedCallback); 142 if (UNLIKELY(scope.exception())) 143 return jsUndefined(); 137 RETURN_IF_EXCEPTION(scope, JSValue()); 144 138 145 139 auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback")); 146 if (UNLIKELY(scope.exception())) 147 return jsUndefined(); 140 RETURN_IF_EXCEPTION(scope, JSValue()); 148 141 if (attributeChangedCallback) { 149 142 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()); 152 144 if (value) 153 145 elementInterface->setAttributeChangedCallback(attributeChangedCallback, *value); … … 171 163 172 164 AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state)); 173 if (UNLIKELY(scope.exception())) 174 return jsUndefined(); 165 RETURN_IF_EXCEPTION(scope, JSValue()); 175 166 176 167 if (!validateCustomElementNameAndThrowIfNeeded(state, localName)) { -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r206354 r206386 124 124 125 125 String string = value.toWTFString(exec); 126 if (UNLIKELY(scope.exception())) 127 return { }; 126 RETURN_IF_EXCEPTION(scope, { }); 128 127 StringView view { string }; 129 128 … … 403 402 CallType callType; 404 403 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); 407 405 408 406 return !applyMethod.isUndefined(); … … 542 540 543 541 double x = value.toNumber(&state); 544 if (UNLIKELY(scope.exception())) 545 return 0; 542 RETURN_IF_EXCEPTION(scope, 0); 546 543 547 544 switch (configuration) { … … 589 586 590 587 double x = value.toNumber(&state); 591 if (UNLIKELY(scope.exception())) 592 return 0; 588 RETURN_IF_EXCEPTION(scope, 0); 593 589 594 590 switch (configuration) { … … 682 678 683 679 double x = value.toNumber(&state); 684 if (UNLIKELY(scope.exception())) 685 return 0; 680 RETURN_IF_EXCEPTION(scope, 0); 686 681 return enforceRange(state, x, kMinInt32, kMaxInt32); 687 682 } … … 715 710 716 711 double x = value.toNumber(&state); 717 if (UNLIKELY(scope.exception())) 718 return 0; 712 RETURN_IF_EXCEPTION(scope, 0); 719 713 return enforceRange(state, x, 0, kMaxUInt32); 720 714 } … … 726 720 727 721 double x = value.toNumber(&state); 728 if (UNLIKELY(scope.exception())) 729 return 0; 722 RETURN_IF_EXCEPTION(scope, 0); 730 723 return enforceRange(state, x, -kJSMaxInteger, kJSMaxInteger); 731 724 } … … 737 730 738 731 double x = value.toNumber(&state); 739 if (UNLIKELY(scope.exception())) 740 return 0; 732 RETURN_IF_EXCEPTION(scope, 0); 741 733 return enforceRange(state, x, 0, kJSMaxInteger); 742 734 } -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r206354 r206386 580 580 581 581 JSC::JSValue lengthValue = object->get(&exec, exec.propertyNames().length); 582 if (UNLIKELY(scope.exception())) 583 return nullptr; 582 RETURN_IF_EXCEPTION(scope, nullptr); 584 583 585 584 if (lengthValue.isUndefinedOrNull()) { … … 589 588 590 589 length = lengthValue.toUInt32(&exec); 591 if (UNLIKELY(scope.exception())) 592 return nullptr; 590 RETURN_IF_EXCEPTION(scope, nullptr); 593 591 594 592 return object; … … 636 634 637 635 JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size()); 638 if (UNLIKELY(scope.exception())) 639 return JSC::jsUndefined(); 636 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 640 637 for (size_t i = 0; i < vector.size(); ++i) 641 638 array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i])); … … 649 646 650 647 JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size()); 651 if (UNLIKELY(scope.exception())) 652 return JSC::jsUndefined(); 648 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 653 649 for (size_t i = 0; i < vector.size(); ++i) 654 650 array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i].get())); … … 739 735 for (auto& element : vector) { 740 736 list.append(JSValueTraits<T>::arrayJSValue(exec, globalObject, element)); 741 if (UNLIKELY(scope.exception())) 742 return JSC::jsUndefined(); 737 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 743 738 } 744 739 auto* array = JSC::constructArray(exec, nullptr, globalObject, list); 745 if (UNLIKELY(scope.exception())) 746 return JSC::jsUndefined(); 740 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 747 741 return JSC::objectConstructorFreeze(exec, array); 748 742 } -
trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp
r206252 r206386 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 107 107 auto scope = DECLARE_CATCH_SCOPE(vm); 108 108 109 if ( !scope.exception())109 if (LIKELY(!scope.exception())) 110 110 return; 111 111 -
trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
r205569 r206386 83 83 84 84 String stringValue = value.toString(exec)->value(exec); 85 if (UNLIKELY(scope.exception())) 86 return false; 85 RETURN_IF_EXCEPTION(scope, false); 87 86 88 87 ExceptionCode ec = 0; -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r206359 r206386 398 398 399 399 String locationString = value.toString(&state)->value(&state); 400 if (UNLIKELY(scope.exception())) 401 return; 400 RETURN_IF_EXCEPTION(scope, void()); 402 401 403 402 if (Location* location = wrapped().location()) … … 426 425 427 426 String urlString = valueToUSVStringWithUndefinedOrNullCheck(&state, state.argument(0)); 428 if (UNLIKELY(scope.exception())) 429 return jsUndefined(); 427 RETURN_IF_EXCEPTION(scope, JSValue()); 430 428 JSValue targetValue = state.argument(1); 431 429 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()); 434 431 String windowFeaturesString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(2)); 435 if (UNLIKELY(scope.exception())) 436 return jsUndefined(); 432 RETURN_IF_EXCEPTION(scope, JSValue()); 437 433 438 434 RefPtr<DOMWindow> openedWindow = wrapped().open(urlString, target, windowFeaturesString, activeDOMWindow(&state), firstDOMWindow(&state)); … … 489 485 490 486 String urlString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(0)); 491 if (UNLIKELY(scope.exception())) 492 return jsUndefined(); 487 RETURN_IF_EXCEPTION(scope, JSValue()); 493 488 String dialogFeaturesString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(2)); 494 if (UNLIKELY(scope.exception())) 495 return jsUndefined(); 489 RETURN_IF_EXCEPTION(scope, JSValue()); 496 490 497 491 DialogHandler handler(state); … … 530 524 fillMessagePortArray(state, state.argument(transferablesArgIndex), messagePorts, arrayBuffers); 531 525 } 532 if (UNLIKELY(scope.exception())) 533 return jsUndefined(); 526 RETURN_IF_EXCEPTION(scope, JSValue()); 534 527 535 528 auto message = SerializedScriptValue::create(&state, state.uncheckedArgument(0), &messagePorts, &arrayBuffers); 536 529 537 if (UNLIKELY(scope.exception())) 538 return jsUndefined(); 530 RETURN_IF_EXCEPTION(scope, JSValue()); 539 531 540 532 String targetOrigin = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(targetOriginArgIndex)); 541 if (UNLIKELY(scope.exception())) 542 return jsUndefined(); 533 RETURN_IF_EXCEPTION(scope, JSValue()); 543 534 544 535 ExceptionCode ec = 0; … … 564 555 ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr; 565 556 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()); 568 558 569 559 if (!action) … … 589 579 ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr; 590 580 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()); 593 582 int delay = state.argument(1).toInt32(&state); 594 583 -
trunk/Source/WebCore/bindings/js/JSDataCueCustom.cpp
r205569 r206386 59 59 60 60 double startTime(exec.uncheckedArgument(0).toNumber(&exec)); 61 if (UNLIKELY(scope.exception())) 62 return JSValue::encode(jsUndefined()); 61 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 63 62 64 63 double endTime(exec.uncheckedArgument(1).toNumber(&exec)); 65 if (UNLIKELY(scope.exception())) 66 return JSValue::encode(jsUndefined()); 64 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 67 65 68 66 ScriptExecutionContext* context = castedThis->scriptExecutionContext(); … … 88 86 89 87 ArrayBuffer* data = toArrayBuffer(valueArgument); 90 if (UNLIKELY(scope.exception())) 91 return JSValue::encode(jsUndefined()); 88 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 92 89 93 90 if (UNLIKELY(!data)) { -
trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
r205569 r206386 56 56 57 57 JSValue xValue = object->get(&state, Identifier::fromString(&state, "x")); 58 if (UNLIKELY(scope.exception())) 59 return nullptr; 58 RETURN_IF_EXCEPTION(scope, nullptr); 60 59 bool canProvideX = !xValue.isUndefinedOrNull(); 61 60 double x = xValue.toNumber(&state); 62 if (UNLIKELY(scope.exception())) 63 return nullptr; 61 RETURN_IF_EXCEPTION(scope, nullptr); 64 62 65 63 JSValue yValue = object->get(&state, Identifier::fromString(&state, "y")); 66 if (UNLIKELY(scope.exception())) 67 return nullptr; 64 RETURN_IF_EXCEPTION(scope, nullptr); 68 65 bool canProvideY = !yValue.isUndefinedOrNull(); 69 66 double y = yValue.toNumber(&state); 70 if (UNLIKELY(scope.exception())) 71 return nullptr; 67 RETURN_IF_EXCEPTION(scope, nullptr); 72 68 73 69 JSValue zValue = object->get(&state, Identifier::fromString(&state, "z")); 74 if (UNLIKELY(scope.exception())) 75 return nullptr; 70 RETURN_IF_EXCEPTION(scope, nullptr); 76 71 bool canProvideZ = !zValue.isUndefinedOrNull(); 77 72 double z = zValue.toNumber(&state); 78 if (UNLIKELY(scope.exception())) 79 return nullptr; 73 RETURN_IF_EXCEPTION(scope, nullptr); 80 74 81 75 if (!canProvideX && !canProvideY && !canProvideZ) … … 98 92 99 93 JSValue alphaValue = object->get(&state, Identifier::fromString(&state, "alpha")); 100 if (UNLIKELY(scope.exception())) 101 return nullptr; 94 RETURN_IF_EXCEPTION(scope, nullptr); 102 95 bool canProvideAlpha = !alphaValue.isUndefinedOrNull(); 103 96 double alpha = alphaValue.toNumber(&state); 104 if (UNLIKELY(scope.exception())) 105 return nullptr; 97 RETURN_IF_EXCEPTION(scope, nullptr); 106 98 107 99 JSValue betaValue = object->get(&state, Identifier::fromString(&state, "beta")); 108 if (UNLIKELY(scope.exception())) 109 return nullptr; 100 RETURN_IF_EXCEPTION(scope, nullptr); 110 101 bool canProvideBeta = !betaValue.isUndefinedOrNull(); 111 102 double beta = betaValue.toNumber(&state); 112 if (UNLIKELY(scope.exception())) 113 return nullptr; 103 RETURN_IF_EXCEPTION(scope, nullptr); 114 104 115 105 JSValue gammaValue = object->get(&state, Identifier::fromString(&state, "gamma")); 116 if (UNLIKELY(scope.exception())) 117 return nullptr; 106 RETURN_IF_EXCEPTION(scope, nullptr); 118 107 bool canProvideGamma = !gammaValue.isUndefinedOrNull(); 119 108 double gamma = gammaValue.toNumber(&state); 120 if (UNLIKELY(scope.exception())) 121 return nullptr; 109 RETURN_IF_EXCEPTION(scope, nullptr); 122 110 123 111 if (!canProvideAlpha && !canProvideBeta && !canProvideGamma) … … 189 177 // Otherwise, use the standard JavaScript conversion. 190 178 RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(state.argument(3), state); 191 if (UNLIKELY(scope.exception())) 192 return jsUndefined(); 179 RETURN_IF_EXCEPTION(scope, JSValue()); 193 180 194 181 RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(state.argument(4), state); 195 if (UNLIKELY(scope.exception())) 196 return jsUndefined(); 182 RETURN_IF_EXCEPTION(scope, JSValue()); 197 183 198 184 RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(state.argument(5), state); 199 if (UNLIKELY(scope.exception())) 200 return jsUndefined(); 185 RETURN_IF_EXCEPTION(scope, JSValue()); 201 186 202 187 bool intervalProvided = !state.argument(6).isUndefinedOrNull(); -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r205569 r206386 89 89 return true; 90 90 }); 91 if (UNLIKELY(scope.exception())) 92 return ExceptionThrown; 91 RETURN_IF_EXCEPTION(scope, ExceptionThrown); 93 92 return propertyFound ? PropertyFound : NoPropertyFound; 94 93 } … … 162 161 unsigned length = 0; 163 162 JSObject* object = toJSSequence(*exec, value, length); 164 if (UNLIKELY(scope.exception())) 165 return; 163 RETURN_IF_EXCEPTION(scope, void()); 166 164 167 165 for (unsigned i = 0 ; i < length; ++i) { 168 166 JSValue itemValue = object->get(exec, i); 169 if (UNLIKELY(scope.exception())) 170 return; 167 RETURN_IF_EXCEPTION(scope, void()); 171 168 result.append(itemValue.toString(exec)->value(exec)); 172 169 } … … 237 234 unsigned length = 0; 238 235 JSObject* object = toJSSequence(*exec, value, length); 239 if (UNLIKELY(scope.exception())) 240 return; 236 RETURN_IF_EXCEPTION(scope, void()); 241 237 242 238 for (unsigned i = 0 ; i < length; ++i) { 243 239 JSValue itemValue = object->get(exec, i); 244 if (UNLIKELY(scope.exception())) 245 return; 240 RETURN_IF_EXCEPTION(scope, void()); 246 241 result.add(itemValue.toString(exec)->value(exec)); 247 242 } … … 314 309 unsigned length = 0; 315 310 JSObject* object = toJSSequence(*exec, value, length); 316 if (UNLIKELY(scope.exception())) 317 return; 311 RETURN_IF_EXCEPTION(scope, void()); 318 312 319 313 for (unsigned i = 0 ; i < length; ++i) { 320 314 JSValue itemValue = object->get(exec, i); 321 if (UNLIKELY(scope.exception())) 322 return; 315 RETURN_IF_EXCEPTION(scope, void()); 323 316 324 317 auto stream = JSMediaStream::toWrapped(itemValue); -
trunk/Source/WebCore/bindings/js/JSDictionary.h
r205569 r206386 216 216 convertValue(m_exec, value, result); 217 217 218 if (UNLIKELY(scope.exception())) 219 return ExceptionThrown; 218 RETURN_IF_EXCEPTION(scope, ExceptionThrown); 220 219 221 220 setter(context, result); -
trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp
r205569 r206386 154 154 return throwException(&state, scope, createNotEnoughArgumentsError(&state)); 155 155 auto contextId = state.uncheckedArgument(0).toWTFString(&state); 156 if (UNLIKELY(scope.exception())) 157 return jsUndefined(); 156 RETURN_IF_EXCEPTION(scope, JSValue()); 158 157 auto name = state.uncheckedArgument(1).toWTFString(&state); 159 if (UNLIKELY(scope.exception())) 160 return jsUndefined(); 158 RETURN_IF_EXCEPTION(scope, JSValue()); 161 159 auto width = convert<int32_t>(state, state.uncheckedArgument(2), NormalConversion); 162 if (UNLIKELY(scope.exception())) 163 return jsUndefined(); 160 RETURN_IF_EXCEPTION(scope, JSValue()); 164 161 auto height = convert<int32_t>(state, state.uncheckedArgument(3), NormalConversion); 165 if (UNLIKELY(scope.exception())) 166 return jsUndefined(); 162 RETURN_IF_EXCEPTION(scope, JSValue()); 167 163 168 164 auto* context = wrapped().getCSSCanvasContext(WTFMove(contextId), WTFMove(name), WTFMove(width), WTFMove(height)); -
trunk/Source/WebCore/bindings/js/JSFileCustom.cpp
r205569 r206386 61 61 unsigned blobPartsLength = 0; 62 62 JSObject* blobParts = toJSSequence(exec, arg, blobPartsLength); 63 if (UNLIKELY(scope.exception())) 64 return JSValue::encode(jsUndefined()); 63 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 65 64 ASSERT(blobParts); 66 65 … … 70 69 71 70 String filename = arg.toWTFString(&exec).replace('/', ':'); 72 if (UNLIKELY(scope.exception())) 73 return JSValue::encode(jsUndefined()); 71 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 74 72 75 73 String normalizedType; … … 88 86 String type; 89 87 dictionary.get("type", type); 90 if (UNLIKELY(scope.exception())) 91 return JSValue::encode(jsUndefined()); 88 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 92 89 93 90 normalizedType = Blob::normalizedContentType(type); … … 96 93 if (type.isEmpty() || !normalizedType.isEmpty()) { 97 94 dictionary.get("lastModified", lastModified); 98 if (UNLIKELY(scope.exception())) 99 return JSValue::encode(jsUndefined()); 95 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 100 96 } 101 97 } … … 108 104 for (unsigned i = 0; i < blobPartsLength; ++i) { 109 105 JSValue item = blobParts->get(&exec, i); 110 if (UNLIKELY(scope.exception())) 111 return JSValue::encode(jsUndefined()); 106 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 112 107 113 108 if (ArrayBuffer* arrayBuffer = toArrayBuffer(item)) … … 119 114 else { 120 115 String string = item.toWTFString(&exec); 121 if (UNLIKELY(scope.exception())) 122 return JSValue::encode(jsUndefined()); 116 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 123 117 blobBuilder.append(string, ASCIILiteral("transparent")); 124 118 } -
trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp
r205569 r206386 109 109 110 110 auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0)); 111 if (UNLIKELY(scope.exception())) 112 return jsUndefined(); 111 RETURN_IF_EXCEPTION(scope, JSValue()); 113 112 ASSERT(positionCallback); 114 113 115 114 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()); 118 116 119 117 auto positionOptions = createPositionOptions(&state, state.argument(2)); 120 if (UNLIKELY(scope.exception())) 121 return jsUndefined(); 118 RETURN_IF_EXCEPTION(scope, JSValue()); 122 119 ASSERT(positionOptions); 123 120 … … 134 131 135 132 auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0)); 136 if (UNLIKELY(scope.exception())) 137 return jsUndefined(); 133 RETURN_IF_EXCEPTION(scope, JSValue()); 138 134 ASSERT(positionCallback); 139 135 140 136 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()); 143 138 144 139 auto positionOptions = createPositionOptions(&state, state.argument(2)); 145 if (UNLIKELY(scope.exception())) 146 return jsUndefined(); 140 RETURN_IF_EXCEPTION(scope, JSValue()); 147 141 ASSERT(positionOptions); 148 142 -
trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
r205569 r206386 69 69 // Support for document.all(<index>) etc. 70 70 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()); 73 72 if (Optional<uint32_t> index = parseIndex(*string.impl())) 74 73 return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection.item(index.value()))); … … 80 79 // The second arg, if set, is the index of the item we want 81 80 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()); 84 82 if (Optional<uint32_t> index = parseIndex(*exec->argument(1).toWTFString(exec).impl())) { 85 83 if (auto* item = collection.namedItemWithIndex(string, index.value())) -
trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
r205569 r206386 87 87 if (HTMLCanvasElement::is3dType(contextId)) { 88 88 get3DContextAttributes(state, attrs); 89 if (UNLIKELY(scope.exception())) 90 return jsUndefined(); 89 RETURN_IF_EXCEPTION(scope, JSValue()); 91 90 } 92 91 #endif -
trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
r205569 r206386 79 79 Structure* baseStructure = getDOMStructure<JSHTMLElement>(vm, *globalObject); 80 80 auto* newElementStructure = InternalFunction::createSubclassStructure(&exec, newTargetValue, baseStructure); 81 if (UNLIKELY(scope.exception())) 82 return JSValue::encode(jsUndefined()); 81 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 83 82 84 83 Ref<HTMLElement> element = HTMLElement::create(elementInterface->name(), document); … … 99 98 100 99 JSValue newPrototype = newTarget->get(&exec, vm.propertyNames->prototype); 101 if (UNLIKELY(scope.exception())) 102 return JSValue::encode(jsUndefined()); 100 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 103 101 104 102 JSObject* elementWrapperObject = asObject(elementWrapperValue); 105 103 JSObject::setPrototype(elementWrapperObject, &exec, newPrototype, true /* shouldThrowIfCantSet */); 106 if (UNLIKELY(scope.exception())) 107 return JSValue::encode(jsUndefined()); 104 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 108 105 109 106 elementInterface->didUpgradeLastElementInConstructionStack(); -
trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp
r205569 r206386 64 64 65 65 auto historyState = SerializedScriptValue::create(&state, state.uncheckedArgument(0), 0, 0); 66 if (UNLIKELY(scope.exception())) 67 return jsUndefined(); 66 RETURN_IF_EXCEPTION(scope, JSValue()); 68 67 69 68 // FIXME: title should not be nullable. 70 69 String title = valueToStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(1)); 71 if (UNLIKELY(scope.exception())) 72 return jsUndefined(); 70 RETURN_IF_EXCEPTION(scope, JSValue()); 73 71 74 72 String url; 75 73 if (argCount > 2) { 76 74 url = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(2)); 77 if (UNLIKELY(scope.exception())) 78 return jsUndefined(); 75 RETURN_IF_EXCEPTION(scope, JSValue()); 79 76 } 80 77 … … 98 95 99 96 auto historyState = SerializedScriptValue::create(&state, state.uncheckedArgument(0), 0, 0); 100 if (UNLIKELY(scope.exception())) 101 return jsUndefined(); 97 RETURN_IF_EXCEPTION(scope, JSValue()); 102 98 103 99 // FIXME: title should not be nullable. 104 100 String title = valueToStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(1)); 105 if (UNLIKELY(scope.exception())) 106 return jsUndefined(); 101 RETURN_IF_EXCEPTION(scope, JSValue()); 107 102 108 103 String url; 109 104 if (argCount > 2) { 110 105 url = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(2)); 111 if (UNLIKELY(scope.exception())) 112 return jsUndefined(); 106 RETURN_IF_EXCEPTION(scope, JSValue()); 113 107 } 114 108 -
trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp
r205569 r206386 56 56 57 57 String name = state.argument(0).toString(&state)->value(&state); 58 if (UNLIKELY(scope.exception())) 59 return jsUndefined(); 58 RETURN_IF_EXCEPTION(scope, JSValue()); 60 59 61 60 JSValue optionsValue = state.argument(1); … … 67 66 if (!optionsValue.isUndefinedOrNull()) { 68 67 JSValue keyPathValue = optionsValue.get(&state, Identifier::fromString(&state, "keyPath")); 69 if (UNLIKELY(scope.exception())) 70 return jsUndefined(); 68 RETURN_IF_EXCEPTION(scope, JSValue()); 71 69 72 70 if (!keyPathValue.isUndefinedOrNull()) { 73 71 keyPath = idbKeyPathFromValue(state, keyPathValue); 74 if (UNLIKELY(scope.exception())) 75 return jsUndefined(); 72 RETURN_IF_EXCEPTION(scope, JSValue()); 76 73 } 77 74 78 75 autoIncrement = optionsValue.get(&state, Identifier::fromString(&state, "autoIncrement")).toBoolean(&state); 79 if (UNLIKELY(scope.exception())) 80 return jsUndefined(); 76 RETURN_IF_EXCEPTION(scope, JSValue()); 81 77 } 82 78 -
trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp
r205569 r206386 120 120 arrayBuffers = std::make_unique<ArrayBufferArray>(); 121 121 fillMessagePortArray(state, state.argument(7), *messagePorts, *arrayBuffers); 122 if (UNLIKELY(scope.exception())) 123 return jsUndefined(); 122 RETURN_IF_EXCEPTION(scope, JSValue()); 124 123 } 125 124 Deprecated::ScriptValue dataArg(vm, state.argument(3)); 126 if (UNLIKELY(scope.exception())) 127 return jsUndefined(); 125 RETURN_IF_EXCEPTION(scope, JSValue()); 128 126 129 127 MessageEvent& event = jsEvent->wrapped(); -
trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp
r205569 r206386 74 74 unsigned length = 0; 75 75 JSObject* object = toJSSequence(state, value, length); 76 if (UNLIKELY(scope.exception())) 77 return; 76 RETURN_IF_EXCEPTION(scope, void()); 78 77 79 78 for (unsigned i = 0 ; i < length; ++i) { 80 79 JSValue value = object->get(&state, i); 81 if (UNLIKELY(scope.exception())) 82 return; 80 RETURN_IF_EXCEPTION(scope, void()); 83 81 // Validation of non-null objects, per HTML5 spec 10.3.3. 84 82 if (value.isUndefinedOrNull()) { -
trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h
r205569 r206386 62 62 fillMessagePortArray(state, state.argument(1), portArray, arrayBufferArray); 63 63 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()); 66 65 67 66 ExceptionCode ec = 0; -
trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp
r205569 r206386 63 63 64 64 uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) }; 65 if (UNLIKELY(scope.exception())) 66 return; 65 RETURN_IF_EXCEPTION(scope, void()); 67 66 68 67 DecisionPoint decisionPoint { static_cast<DecisionPoint>(nativeValue) }; … … 99 98 100 99 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); 103 101 104 102 Decision decision { static_cast<Decision>(nativeValue) }; … … 124 122 125 123 Decision decision { toDecision(state, value) }; 126 if (UNLIKELY(scope.exception())) 127 return; 124 RETURN_IF_EXCEPTION(scope, void()); 128 125 129 126 wrapped().setDecision(decision); … … 141 138 142 139 Decision unblockRequestDecision { toDecision(state, value) }; 143 if (UNLIKELY(scope.exception())) 144 return; 140 RETURN_IF_EXCEPTION(scope, void()); 145 141 146 142 wrapped().setUnblockRequestDecision(unblockRequestDecision); -
trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
r205569 r206386 50 50 MarkedArgumentBuffer args; 51 51 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); 54 53 55 54 NakedPtr<Exception> returnedException; … … 64 63 65 64 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); 68 66 69 67 return result; -
trunk/Source/WebCore/bindings/js/JSNodeOrString.cpp
r205569 r206386 51 51 else { 52 52 String string = value.toWTFString(&state); 53 if (UNLIKELY(scope.exception())) 54 return { }; 53 RETURN_IF_EXCEPTION(scope, { }); 55 54 result.uncheckedAppend(string); 56 55 } -
trunk/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp
r205569 r206386 54 54 55 55 String sqlStatement = state.argument(0).toString(&state)->value(&state); 56 if (UNLIKELY(scope.exception())) 57 return jsUndefined(); 56 RETURN_IF_EXCEPTION(scope, JSValue()); 58 57 59 58 // Now assemble the list of SQL arguments … … 67 66 68 67 JSValue lengthValue = object->get(&state, state.propertyNames().length); 69 if (UNLIKELY(scope.exception())) 70 return jsUndefined(); 68 RETURN_IF_EXCEPTION(scope, JSValue()); 71 69 unsigned length = lengthValue.toUInt32(&state); 72 if (UNLIKELY(scope.exception())) 73 return jsUndefined(); 70 RETURN_IF_EXCEPTION(scope, JSValue()); 74 71 75 72 for (unsigned i = 0 ; i < length; ++i) { 76 73 JSValue value = object->get(&state, i); 77 if (UNLIKELY(scope.exception())) 78 return jsUndefined(); 74 RETURN_IF_EXCEPTION(scope, JSValue()); 79 75 80 76 if (value.isUndefinedOrNull()) … … 85 81 // Convert the argument to a string and append it 86 82 sqlValues.append(value.toString(&state)->value(&state)); 87 if (UNLIKELY(scope.exception())) 88 return jsUndefined(); 83 RETURN_IF_EXCEPTION(scope, JSValue()); 89 84 } 90 85 } -
trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp
r205569 r206386 91 91 92 92 unsigned short unitType = state.uncheckedArgument(0).toUInt32(&state); 93 if (UNLIKELY(scope.exception())) 94 return jsUndefined(); 93 RETURN_IF_EXCEPTION(scope, JSValue()); 95 94 96 95 ExceptionCode ec = 0; -
trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp
r205569 r206386 87 87 unsigned length = thisObject->wrapped().length(ec); 88 88 setDOMException(exec, ec); 89 if (UNLIKELY(scope.exception())) 90 return; 89 RETURN_IF_EXCEPTION(scope, void()); 91 90 for (unsigned i = 0; i < length; ++i) { 92 91 propertyNames.add(Identifier::fromString(exec, thisObject->wrapped().key(i, ec))); 93 92 setDOMException(exec, ec); 94 if (UNLIKELY(scope.exception())) 95 return; 93 RETURN_IF_EXCEPTION(scope, void()); 96 94 } 97 95 -
trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp
r205569 r206386 49 49 50 50 auto& string = value.toString(&state)->value(&state); 51 if (UNLIKELY(scope.exception())) 52 return; 51 RETURN_IF_EXCEPTION(scope, void()); 53 52 wrapped().setLanguage(string); 54 53 #else -
trunk/Source/WebCore/bindings/js/JSVideoTrackCustom.cpp
r205569 r206386 48 48 49 49 auto& string = value.toString(&state)->value(&state); 50 if (UNLIKELY(scope.exception())) 51 return; 50 RETURN_IF_EXCEPTION(scope, void()); 52 51 wrapped().setKind(string); 53 52 #else … … 64 63 65 64 auto& string = value.toString(&state)->value(&state); 66 if (UNLIKELY(scope.exception())) 67 return; 65 RETURN_IF_EXCEPTION(scope, void()); 68 66 wrapped().setLanguage(string); 69 67 #else -
trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp
r205569 r206386 107 107 WebGL2RenderingContext& context = wrapped(); 108 108 unsigned pname = exec.uncheckedArgument(0).toInt32(&exec); 109 if (UNLIKELY(scope.exception())) 110 return jsUndefined(); 109 RETURN_IF_EXCEPTION(scope, JSValue()); 111 110 unsigned index = exec.uncheckedArgument(1).toInt32(&exec); 112 if (UNLIKELY(scope.exception())) 113 return jsUndefined(); 111 RETURN_IF_EXCEPTION(scope, JSValue()); 114 112 WebGLGetInfo info = context.getIndexedParameter(pname, index); 115 113 return toJS(&exec, globalObject(), info); -
trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp
r205569 r206386 200 200 WebGLRenderingContextBase& context = obj->wrapped(); 201 201 unsigned target = state.uncheckedArgument(0).toInt32(&state); 202 if (UNLIKELY(scope.exception())) 203 return jsUndefined(); 202 RETURN_IF_EXCEPTION(scope, JSValue()); 204 203 unsigned pname = state.uncheckedArgument(1).toInt32(&state); 205 if (UNLIKELY(scope.exception())) 206 return jsUndefined(); 204 RETURN_IF_EXCEPTION(scope, JSValue()); 207 205 WebGLGetInfo info; 208 206 switch (objectType) { … … 336 334 WebGLRenderingContextBase& context = wrapped(); 337 335 const String name = state.uncheckedArgument(0).toString(&state)->value(&state); 338 if (UNLIKELY(scope.exception())) 339 return jsUndefined(); 336 RETURN_IF_EXCEPTION(scope, JSValue()); 340 337 WebGLExtension* extension = context.getExtension(name); 341 338 return toJS(&state, globalObject(), extension); … … 358 355 WebGLRenderingContextBase& context = wrapped(); 359 356 unsigned target = state.uncheckedArgument(0).toInt32(&state); 360 if (UNLIKELY(scope.exception())) 361 return jsUndefined(); 357 RETURN_IF_EXCEPTION(scope, JSValue()); 362 358 unsigned attachment = state.uncheckedArgument(1).toInt32(&state); 363 if (UNLIKELY(scope.exception())) 364 return jsUndefined(); 359 RETURN_IF_EXCEPTION(scope, JSValue()); 365 360 unsigned pname = state.uncheckedArgument(2).toInt32(&state); 366 if (UNLIKELY(scope.exception())) 367 return jsUndefined(); 361 RETURN_IF_EXCEPTION(scope, JSValue()); 368 362 WebGLGetInfo info = context.getFramebufferAttachmentParameter(target, attachment, pname, ec); 369 363 if (ec) { … … 385 379 WebGLRenderingContextBase& context = wrapped(); 386 380 unsigned pname = state.uncheckedArgument(0).toInt32(&state); 387 if (UNLIKELY(scope.exception())) 388 return jsUndefined(); 381 RETURN_IF_EXCEPTION(scope, JSValue()); 389 382 WebGLGetInfo info = context.getParameter(pname, ec); 390 383 if (ec) { … … 409 402 return throwTypeError(&state, scope); 410 403 unsigned pname = state.uncheckedArgument(1).toInt32(&state); 411 if (UNLIKELY(scope.exception())) 412 return jsUndefined(); 404 RETURN_IF_EXCEPTION(scope, JSValue()); 413 405 WebGLGetInfo info = context.getProgramParameter(program, pname, ec); 414 406 if (ec) { … … 438 430 WebGLShader* shader = JSWebGLShader::toWrapped(state.uncheckedArgument(0)); 439 431 unsigned pname = state.uncheckedArgument(1).toInt32(&state); 440 if (UNLIKELY(scope.exception())) 441 return jsUndefined(); 432 RETURN_IF_EXCEPTION(scope, JSValue()); 442 433 WebGLGetInfo info = context.getShaderParameter(shader, pname, ec); 443 434 if (ec) { … … 512 503 for (int32_t i = 0; i < length; ++i) { 513 504 JSC::JSValue v = object->get(&state, i); 514 if (UNLIKELY(scope.exception())) 515 return false; 505 RETURN_IF_EXCEPTION(scope, false); 516 506 vector[i] = static_cast<T>(v.toNumber(&state)); 517 507 } … … 560 550 index = state.uncheckedArgument(0).toInt32(&state); 561 551 562 if (UNLIKELY(scope.exception())) 563 return jsUndefined(); 552 RETURN_IF_EXCEPTION(scope, JSValue()); 564 553 565 554 RefPtr<Float32Array> webGLArray = toFloat32Array(state.uncheckedArgument(1)); 566 if (UNLIKELY(scope.exception())) 567 return jsUndefined(); 555 RETURN_IF_EXCEPTION(scope, JSValue()); 568 556 569 557 ExceptionCode ec = 0; … … 711 699 712 700 bool transpose = state.uncheckedArgument(1).toBoolean(&state); 713 if (UNLIKELY(scope.exception())) 714 return jsUndefined(); 701 RETURN_IF_EXCEPTION(scope, JSValue()); 715 702 716 703 RefPtr<Float32Array> webGLArray = toFloat32Array(state.uncheckedArgument(2)); -
trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp
r206252 r206386 85 85 86 86 String keyFormatString = value.toString(&state)->value(&state); 87 if (UNLIKELY(scope.exception())) 88 return false; 87 RETURN_IF_EXCEPTION(scope, false); 89 88 if (keyFormatString == "raw") 90 89 result = CryptoKeyFormat::Raw; … … 118 117 JSValue element = array->getIndex(&state, i); 119 118 String usageString = element.toString(&state)->value(&state); 120 if (UNLIKELY(scope.exception())) 121 return false; 119 RETURN_IF_EXCEPTION(scope, false); 122 120 if (usageString == "encrypt") 123 121 result |= CryptoKeyUsageEncrypt; … … 422 420 if (state.argumentCount() >= 2) { 423 421 extractable = state.uncheckedArgument(1).toBoolean(&state); 424 if (UNLIKELY(scope.exception())) 425 return jsUndefined(); 422 RETURN_IF_EXCEPTION(scope, JSValue()); 426 423 } 427 424 … … 475 472 } 476 473 keySerialization = std::make_unique<JSCryptoKeySerializationJWK>(&state, jwkString); 477 if (UNLIKELY(scope.exception())) 478 return; 474 RETURN_IF_EXCEPTION(scope, void()); 479 475 break; 480 476 } … … 492 488 return; 493 489 } 494 if (UNLIKELY(scope.exception())) 495 return; 490 RETURN_IF_EXCEPTION(scope, void()); 496 491 497 492 algorithm = reconciledResult->algorithm; … … 504 499 505 500 keySerialization->reconcileExtractable(extractable); 506 if (UNLIKELY(scope.exception())) 507 return; 501 RETURN_IF_EXCEPTION(scope, void()); 508 502 509 503 keySerialization->reconcileUsages(keyUsages); 510 if (UNLIKELY(scope.exception())) 511 return; 504 RETURN_IF_EXCEPTION(scope, void()); 512 505 513 506 auto keyData = keySerialization->keyData(); 514 if (UNLIKELY(scope.exception())) 515 return; 507 RETURN_IF_EXCEPTION(scope, void()); 516 508 517 509 ExceptionCode ec = 0; … … 558 550 if (state.argumentCount() >= 4) { 559 551 extractable = state.uncheckedArgument(3).toBoolean(&state); 560 if (UNLIKELY(scope.exception())) 561 return jsUndefined(); 552 RETURN_IF_EXCEPTION(scope, JSValue()); 562 553 } 563 554 … … 580 571 581 572 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()); 584 574 585 575 return promise; … … 607 597 case CryptoKeyFormat::JWK: { 608 598 String result = JSCryptoKeySerializationJWK::serialize(&state, key); 609 if (UNLIKELY(scope.exception())) 610 return; 599 RETURN_IF_EXCEPTION(scope, void()); 611 600 CString utf8String = result.utf8(StrictConversion); 612 601 Vector<uint8_t> resultBuffer; … … 649 638 650 639 WebCore::exportKey(state, keyFormat, *key, WTFMove(successCallback), WTFMove(failureCallback)); 651 if (UNLIKELY(scope.exception())) 652 return jsUndefined(); 640 RETURN_IF_EXCEPTION(scope, JSValue()); 653 641 654 642 return promise; … … 781 769 if (state.argumentCount() >= 6) { 782 770 extractable = state.uncheckedArgument(5).toBoolean(&state); 783 if (UNLIKELY(scope.exception())) 784 return jsUndefined(); 771 RETURN_IF_EXCEPTION(scope, JSValue()); 785 772 } 786 773 -
trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp
r205569 r206386 57 57 58 58 String scriptURL = exec.uncheckedArgument(0).toWTFString(&exec); 59 if (UNLIKELY(scope.exception())) 60 return JSValue::encode(JSValue()); 59 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 61 60 62 61 // See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject. -
trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp
r205569 r206386 71 71 for (unsigned i = 0; i < state.argumentCount(); ++i) { 72 72 urls.append(valueToUSVString(&state, state.uncheckedArgument(i))); 73 if (UNLIKELY(scope.exception())) 74 return jsUndefined(); 73 RETURN_IF_EXCEPTION(scope, JSValue()); 75 74 } 76 75 ExceptionCode ec = 0; … … 90 89 91 90 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()); 94 92 if (!action) 95 93 return jsNumber(0); … … 107 105 108 106 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()); 111 108 if (!action) 112 109 return jsNumber(0); -
trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp
r205569 r206386 54 54 55 55 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()); 58 57 59 58 if (!function.isFunction()) { -
trunk/Source/WebCore/bindings/js/ScheduledAction.cpp
r205569 r206386 58 58 return nullptr; 59 59 String string = v.toString(exec)->value(exec); 60 if (UNLIKELY(scope.exception())) 61 return nullptr; 60 RETURN_IF_EXCEPTION(scope, nullptr); 62 61 return std::unique_ptr<ScheduledAction>(new ScheduledAction(string, isolatedWorld)); 63 62 } -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r206354 r206386 1027 1027 foreach my $member (@{$dictionary->members}) { 1028 1028 if ($needExceptionCheck) { 1029 $result .= " if (UNLIKELY(throwScope.exception()))\n"; 1030 $result .= " return Nullopt;\n"; 1029 $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n"; 1031 1030 } 1032 1031 # FIXME: Eventually we will want this to share a lot more code with JSValueToNative. … … 3249 3248 push(@implContent, " nativeValue = $nativeValue;\n"); 3250 3249 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"); 3253 3251 } 3254 3252 push(@implContent, " if (UNLIKELY(!nativeValue)) {\n"); … … 3260 3258 push(@implContent, " auto nativeValue = $nativeValue;\n"); 3261 3259 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"); 3264 3261 } 3265 3262 } … … 4009 4006 4010 4007 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"); 4013 4009 } 4014 4010 else { … … 4052 4048 4053 4049 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"); 4056 4051 push(@$outputArray, "$indent if (UNLIKELY(!$optionalValue))\n"); 4057 4052 push(@$outputArray, "$indent return throwArgumentMustBeEnumError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, expectedEnumerationValues<$className>());\n"); … … 4078 4073 push(@$outputArray, " $name = $nativeValue;\n"); 4079 4074 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"); 4082 4076 } 4083 4077 push(@$outputArray, " if (UNLIKELY(!$name))\n"); … … 4121 4115 $value = "WTFMove($name)"; 4122 4116 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"); 4125 4118 } 4126 4119 } … … 4498 4491 4499 4492 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"); 4502 4494 } 4503 4495 … … 5320 5312 5321 5313 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()); 5324 5315 5325 5316 ${interfaceName}Init eventInit; … … 5472 5463 5473 5464 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"); 5476 5466 } 5477 5467 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r206350 r206386 4049 4049 JSC::Identifier controlsHost = JSC::Identifier::fromString(&vm, "controlsHost"); 4050 4050 JSC::JSValue controlsHostJSWrapper = mediaJSWrapperObject->get(&exec, controlsHost); 4051 if (UNLIKELY(scope.exception())) 4052 return JSC::jsNull(); 4051 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 4053 4052 4054 4053 JSC::JSObject* controlsHostJSWrapperObject = JSC::jsDynamicCast<JSC::JSObject*>(controlsHostJSWrapper); … … 4058 4057 JSC::Identifier controllerID = JSC::Identifier::fromString(&vm, "controller"); 4059 4058 JSC::JSValue controllerJSWrapper = controlsHostJSWrapperObject->get(&exec, controllerID); 4060 if (UNLIKELY(scope.exception())) 4061 return JSC::jsNull(); 4059 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 4062 4060 4063 4061 return controllerJSWrapper; … … 6836 6834 JSC::JSObject* controllerObject = controllerValue.toObject(exec); 6837 6835 6838 if (UNLIKELY(scope.exception())) 6839 return; 6836 RETURN_IF_EXCEPTION(scope, void()); 6840 6837 6841 6838 JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "handlePresentationModeChange")); … … 6879 6876 JSC::JSObject* controllerObject = controllerValue.toObject(exec); 6880 6877 6881 if (UNLIKELY(scope.exception())) 6882 return emptyString(); 6878 RETURN_IF_EXCEPTION(scope, emptyString()); 6883 6879 6884 6880 JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "getCurrentControlsStatus")); … … 6896 6892 JSC::JSValue outputValue = JSC::call(exec, function, callType, callData, controllerObject, argList); 6897 6893 6898 if (UNLIKELY(scope.exception())) 6899 return emptyString(); 6894 RETURN_IF_EXCEPTION(scope, emptyString()); 6900 6895 6901 6896 return outputValue.getString(exec);
Note:
See TracChangeset
for help on using the changeset viewer.