Changeset 205569 in webkit
- Timestamp:
- Sep 7, 2016, 3:10:50 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 added
- 221 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/APIUtils.h
r197983 r205569 39 39 inline ExceptionStatus handleExceptionIfNeeded(JSC::ExecState* exec, JSValueRef* returnedExceptionRef) 40 40 { 41 if (exec->hadException()) { 42 JSC::Exception* exception = exec->exception(); 41 JSC::VM& vm = exec->vm(); 42 auto scope = DECLARE_CATCH_SCOPE(vm); 43 if (UNLIKELY(scope.exception())) { 44 JSC::Exception* exception = scope.exception(); 43 45 if (returnedExceptionRef) 44 46 *returnedExceptionRef = toRef(exec, exception->value()); 45 exec->clearException();47 scope.clearException(); 46 48 #if ENABLE(REMOTE_INSPECTOR) 47 49 exec->vmEntryGlobalObject()->inspectorController().reportAPIException(exec, exception); -
trunk/Source/JavaScriptCore/CMakeLists.txt
r205558 r205569 632 632 runtime/BooleanPrototype.cpp 633 633 runtime/CallData.cpp 634 runtime/CatchScope.cpp 634 635 runtime/ClonedArguments.cpp 635 636 runtime/CodeCache.cpp … … 661 662 runtime/ErrorPrototype.cpp 662 663 runtime/Exception.cpp 664 runtime/ExceptionEvent.cpp 665 runtime/ExceptionEventLocation.cpp 663 666 runtime/ExceptionFuzz.cpp 664 667 runtime/ExceptionHelpers.cpp 668 runtime/ExceptionScope.cpp 665 669 runtime/Executable.cpp 666 670 runtime/FunctionConstructor.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r205568 r205569 1 2016-09-07 Mark Lam <mark.lam@apple.com> 2 3 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. 4 https://bugs.webkit.org/show_bug.cgi?id=161498 5 6 Reviewed by Geoffrey Garen. 7 8 This patch refactors the ThrowScope class, and introduces a base ExceptionScope 9 that ThrowScope extends. A CatchScope which extends the ExceptionScope is also 10 introduced. 11 12 ENABLE(THROW_SCOPE_VERIFICATION) is now renamed to ENABLE(EXCEPTION_SCOPE_VERIFICATION) 13 which is a more suitable name now. 14 15 Note: exception scope verification is still disabled by default. There are still 16 many places that need to be fixed up or re-expressed in a way that is friendly 17 to the verification. I'll address those in subsequent patches. 18 19 After this patch, the code will statically enforce that: 20 1. all calls to throwException() go through a ThrowScope. 21 2. all calls to clearException() go through a CatchScope. 22 3. all exception checks go through an ExceptionScope in the form of a ThrowScope 23 or CatchScope. 24 25 A Summary of how to use ExceptionScopes 26 ======================================= 27 1. If a function can throw a JS exception, it should declare a ThrowScope at the 28 top of the function (as early as possible). 29 30 2. If a function can clear JS exceptions, it should declare a CatchScope at the 31 top of the function (as early as possible). 32 33 Declaring a ThrowScope in a function means that the function may throw an exception 34 that its caller will have to handle. Declaring a CatchScope in a function means 35 that the function intends to clear pending exceptions before returning to its 36 caller. 37 38 For more details, see the notes below. 39 40 Everything you may want to know about ExceptionScopes 41 ===================================================== 42 ExceptionScope verification works to simulate exception throws and detect cases 43 where exception checks are missing. The notes below will cover: 44 45 1. The VM::m_needExceptionCheck bit 46 2. ThrowScopes and CatchScopes 47 3. Verification of needed exception checks 48 3. Checking Exceptions 49 4. Simulating throws 50 5. Using ThrowScope::release() 51 6. Checking exceptions with ThrowScope::exception() / CatchScope::exception() 52 7. Checking exceptions by checking callee results 53 8. Debugging verification errors 54 55 1. The VM::m_needExceptionCheck bit 56 57 The VM has a m_needExceptionCheck bit that indicates when an exception may be 58 thrown. You can think of the m_needExceptionCheck bit being set as a simulated 59 throw. 60 61 2. ThrowScopes and CatchScopes 62 63 Only ThrowScopes may throwException. Only CatchScopes may catchException. 64 65 Every throw site must declare a ThrowScope instance using DECLARE_THROW_SCOPE 66 at the top of its function (as early as possible) e.g. 67 68 void foo(...) 69 { 70 auto scope = DECLARE_THROW_SCOPE(vm); 71 ... 72 throwException(exec, scope, ...); 73 } 74 75 Note: by convention, every throw helper function must take a ThrowScope argument 76 instead of instantiating its own ThrowScope. This allows the throw to be 77 attributed to the client code rather than the throw helper itself. 78 79 Every catch site (i.e. a site that calls clearException()) must declare a 80 CatchScope instance using DECLARE_CATCH_SCOPE at the top of its function. 81 82 If a function can both throw or clear exceptions, then the ThrowScope should 83 be declared first so that it can simulate a throw to the function's caller. 84 85 Note: ThrowScope and CatchScope both extend ExceptionScope so that ThrowScopes 86 can be aware if there's an enclosing CatchScope between it and the point where 87 C++ code returns to JS code. This is needed to determine if the ThrowScope 88 should simulate a re-throw or not. See (4) below for more details on returning 89 to JS code. 90 91 3. Verification of needed exception checks 92 93 a. On construction, each ThrowScope and CatchScope will verify that 94 VM::m_needExceptionCheck is not set. 95 96 This ensures that the caller of the current function has checked for exceptions 97 where needed before doing more work which lead to calling the current function. 98 99 b. On destruction, each ThrowScope and CatchScope will verify that 100 VM::m_needExceptionCheck is not set. This verification will be skipped if 101 the ThrowScope has been released (see (5) below). 102 103 This ensures that the function that owns this exception scope is not missing 104 any exception checks before returning. 105 106 c. When throwing an exception, the ThrowScope will verify that VM::m_needExceptionCheck 107 is not already set, unless it's been ask to rethrow the same Exception object. 108 109 4. Simulating throws 110 111 Throws are simulated by setting the m_needExceptionCheck bit. 112 113 The bit will only be set in the ThrowScope destructor except when the ThrowScope 114 detects the caller is a LLInt or JIT function. LLInt or JIT functions will always 115 check for exceptions after a host C++ function returns to it. However, they will 116 not clear the m_needExceptionCheck bit. 117 118 Hence, if the ThrowScope destructor detects the caller is a LLInt or JIT function, 119 it will just skip the setting of the bit. 120 121 Note: it is not needed nor correct to set the m_needExceptionCheck bit in the 122 throwException methods. This is because, in practice, we always return 123 immediately after throwing an exception. It doesn't make sense to set the bit in 124 the throw just to have to clear it immediately after before we do verification in 125 the ThrowScope destructor. 126 127 5. Using ThrowScope::release() 128 129 Calling release() means that the scope is released from its obligation to 130 verify the VM::m_needExceptionCheck bit on destruction. 131 132 release() should only be used at the bottom of a function if: 133 134 a. This function is going to let its caller check and handle the exception, e.g. 135 136 void foo(...) 137 { 138 auto scope = DECLARE_THROW_SCOPE(vm); 139 auto result = goo(); // may throw. 140 141 ... // Code that will are not affected by a pending exceptions. 142 143 scope.release(); // tell the ThrowScope that the caller will handle the exception. 144 return result; 145 } 146 147 b. This function is going to do a tail call that may throw. 148 149 void foo(...) 150 { 151 auto scope = DECLARE_THROW_SCOPE(vm); 152 ... 153 scope.release(); // tell the ThrowScope that the caller will handle the exception. 154 return goo(); // may throw. 155 } 156 157 release() should not be used in code paths that branch. For example: 158 159 void foo(...) 160 { 161 auto scope = DECLARE_THROW_SCOPE(vm); 162 163 auto result = goo1(); // may throw. 164 scope.release(); // WRONG !!! Don't do this. 165 if (result) 166 return; 167 168 result = goo2(); // may throw. 169 ... 170 return result; 171 } 172 173 The above will result in a verification error in goo2()'s ThrowScope. The 174 proper way to fix this verification is to do either (6) or (7) below. 175 176 6. Checking exceptions with ThrowScope::exception() / CatchScope::exception() 177 178 ThrowScope/CatchScope::exception() returns the thrown Exception object if 179 there is one pending. Else, it returns nullptr. 180 181 It also clears the m_needExceptionCheck bit thereby indicating that we've 182 satisfied the needed exception check. For example, 183 184 void foo(...) 185 { 186 auto scope = DECLARE_THROW_SCOPE(vm); 187 188 auto result = goo1(); // may throw. 189 if (scope.exception()) 190 return; 191 192 result = goo2(); // may throw. 193 ... 194 return result; 195 } 196 197 But sometimes, for optimization reasons, we may choose to test the result of 198 the callee function instead doing a load of the VM exception value. See (7) 199 below. 200 201 7. Checking exceptions by checking callee results 202 203 This approach should only be applied when it makes a difference to performance. 204 If we need to do this, we should add an ASSERT() that invokes the scope's 205 exception() method to verify the result. Since exception scope verification 206 is only done on DEBUG builds, this ASSERT will satisfy the verification 207 requirements without impacting performance. For example, 208 209 void foo(...) 210 { 211 auto scope = DECLARE_THROW_SCOPE(vm); 212 213 bool failed = goo1(); // may throw. 214 ASSERT(!!scope.exception() == failed) 215 if (failed) 216 return; 217 218 result = goo2(); // may throw. 219 ... 220 return result; 221 } 222 223 8. Debugging verification errors 224 225 a. When verification fails, you will see a message followed by an assertion 226 failure. For example: 227 228 ERROR: Unchecked JS exception: 229 This scope can throw a JS exception: setUpCall @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1245 230 (ExceptionScope::m_recursionDepth was ...) 231 But the exception was unchecked as of this scope: varargsSetup @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1398 232 (ExceptionScope::m_recursionDepth was ...) 233 [ backtrace here ] 234 235 The message tells you that failure was detected at in varargsSetup() at 236 LLIntSlowPaths.cpp line 1398, and that the missing exception check should 237 have happened somewhere between the call to setUpCall() at LLIntSlowPaths.cpp 238 line 1245 and it. 239 240 If that is insufficient information, you can ... 241 242 b. Dump simulated throws 243 244 Re-run the test case with JSC_dumpSimulatedThrows=true. You will also see 245 back traces at each simulated throw. 246 247 c. Narrowing down the source of a simulated throw 248 249 Another technique for narrowing down the source of simulated throws is by 250 further dividing a function to smaller regions by separating each region 251 with additional local throw scopes. For example, 252 253 ... // Region 1 254 { auto scope = DECLARE_THROW_SCOPE(vm); } 255 ... // Region 2 256 { auto scope = DECLARE_THROW_SCOPE(vm); } 257 ... // Region 3 258 259 * API/APIUtils.h: 260 (handleExceptionIfNeeded): 261 * CMakeLists.txt: 262 * JavaScriptCore.xcodeproj/project.pbxproj: 263 * bindings/ScriptFunctionCall.cpp: 264 (Deprecated::ScriptFunctionCall::call): 265 * bindings/ScriptValue.cpp: 266 (Deprecated::ScriptValue::toString): 267 * debugger/Debugger.cpp: 268 (JSC::Debugger::pauseIfNeeded): 269 * debugger/DebuggerCallFrame.cpp: 270 (JSC::DebuggerCallFrame::evaluateWithScopeExtension): 271 * dfg/DFGOSRExitCompiler.cpp: 272 * dfg/DFGOperations.cpp: 273 (JSC::DFG::operationPutByValInternal): 274 * inspector/InjectedScriptManager.cpp: 275 (Inspector::InjectedScriptManager::createInjectedScript): 276 * inspector/JSGlobalObjectInspectorController.cpp: 277 (Inspector::JSGlobalObjectInspectorController::reportAPIException): 278 * inspector/JSInjectedScriptHost.cpp: 279 (Inspector::JSInjectedScriptHost::evaluateWithScopeExtension): 280 (Inspector::JSInjectedScriptHost::getInternalProperties): 281 (Inspector::JSInjectedScriptHost::weakMapEntries): 282 (Inspector::JSInjectedScriptHost::weakSetEntries): 283 (Inspector::JSInjectedScriptHost::iteratorEntries): 284 * inspector/JSJavaScriptCallFrame.cpp: 285 (Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension): 286 * inspector/ScriptCallStackFactory.cpp: 287 (Inspector::extractSourceInformationFromException): 288 * interpreter/CachedCall.h: 289 (JSC::CachedCall::CachedCall): 290 * interpreter/CallFrame.h: 291 (JSC::ExecState::clearException): Deleted. 292 (JSC::ExecState::exception): Deleted. 293 (JSC::ExecState::hadException): Deleted. 294 (JSC::ExecState::lastException): Deleted. 295 (JSC::ExecState::clearLastException): Deleted. 296 * interpreter/Interpreter.cpp: 297 (JSC::eval): 298 (JSC::sizeOfVarargs): 299 (JSC::notifyDebuggerOfUnwinding): 300 (JSC::Interpreter::unwind): 301 (JSC::Interpreter::execute): 302 (JSC::Interpreter::executeCall): 303 (JSC::Interpreter::executeConstruct): 304 (JSC::Interpreter::prepareForRepeatCall): 305 (JSC::Interpreter::debug): 306 * interpreter/Interpreter.h: 307 (JSC::SuspendExceptionScope::SuspendExceptionScope): 308 * interpreter/ShadowChicken.cpp: 309 (JSC::ShadowChicken::functionsOnStack): 310 * jit/JITCode.cpp: 311 (JSC::JITCode::execute): 312 * jit/JITExceptions.cpp: 313 (JSC::genericUnwind): 314 * jit/JITOperations.cpp: 315 (JSC::getByVal): 316 * jsc.cpp: 317 (WTF::ImpureGetter::getOwnPropertySlot): 318 (GlobalObject::moduleLoaderResolve): 319 (GlobalObject::moduleLoaderFetch): 320 (functionCreateElement): 321 (functionRun): 322 (functionRunString): 323 (functionLoad): 324 (functionLoadString): 325 (functionReadFile): 326 (functionCheckSyntax): 327 (functionSetRandomSeed): 328 (functionLoadModule): 329 (functionCreateBuiltin): 330 (functionCheckModuleSyntax): 331 (functionGenerateHeapSnapshot): 332 (functionSamplingProfilerStackTraces): 333 (dumpException): 334 (checkUncaughtException): 335 (runWithScripts): 336 (runInteractive): 337 * llint/LLIntExceptions.cpp: 338 (JSC::LLInt::returnToThrow): 339 (JSC::LLInt::callToThrow): 340 * llint/LLIntSlowPaths.cpp: 341 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 342 * profiler/ProfilerBytecodeSequence.cpp: 343 (JSC::Profiler::BytecodeSequence::addSequenceProperties): 344 * profiler/ProfilerCompilation.cpp: 345 (JSC::Profiler::Compilation::toJS): 346 * profiler/ProfilerDatabase.cpp: 347 (JSC::Profiler::Database::toJS): 348 * profiler/ProfilerOSRExitSite.cpp: 349 (JSC::Profiler::OSRExitSite::toJS): 350 * profiler/ProfilerOriginStack.cpp: 351 (JSC::Profiler::OriginStack::toJS): 352 * runtime/ArrayPrototype.cpp: 353 (JSC::speciesConstructArray): 354 (JSC::shift): 355 (JSC::unshift): 356 (JSC::arrayProtoFuncToString): 357 (JSC::arrayProtoFuncToLocaleString): 358 (JSC::slowJoin): 359 (JSC::fastJoin): 360 (JSC::arrayProtoFuncJoin): 361 (JSC::arrayProtoFuncPop): 362 (JSC::arrayProtoFuncPush): 363 (JSC::arrayProtoFuncReverse): 364 (JSC::arrayProtoFuncShift): 365 (JSC::arrayProtoFuncSlice): 366 (JSC::arrayProtoFuncSplice): 367 (JSC::arrayProtoFuncUnShift): 368 (JSC::arrayProtoFuncIndexOf): 369 (JSC::arrayProtoFuncLastIndexOf): 370 (JSC::moveElements): 371 (JSC::concatAppendOne): 372 (JSC::arrayProtoPrivateFuncConcatMemcpy): 373 * runtime/BooleanConstructor.cpp: 374 (JSC::constructWithBooleanConstructor): 375 * runtime/CallData.cpp: 376 (JSC::call): 377 * runtime/CatchScope.cpp: Added. 378 (JSC::CatchScope::CatchScope): 379 (JSC::CatchScope::~CatchScope): 380 * runtime/CatchScope.h: Added. 381 (JSC::CatchScope::clearException): 382 (JSC::CatchScope::CatchScope): 383 * runtime/CommonSlowPaths.cpp: 384 (JSC::SLOW_PATH_DECL): 385 * runtime/CommonSlowPaths.h: 386 (JSC::CommonSlowPaths::opIn): 387 * runtime/CommonSlowPathsExceptions.cpp: 388 (JSC::CommonSlowPaths::interpreterThrowInCaller): 389 * runtime/Completion.cpp: 390 (JSC::evaluate): 391 (JSC::rejectPromise): 392 (JSC::loadAndEvaluateModule): 393 (JSC::loadModule): 394 * runtime/ConsoleObject.cpp: 395 (JSC::consoleProtoFuncAssert): 396 (JSC::consoleProtoFuncProfile): 397 (JSC::consoleProtoFuncProfileEnd): 398 (JSC::consoleProtoFuncTakeHeapSnapshot): 399 (JSC::consoleProtoFuncTime): 400 (JSC::consoleProtoFuncTimeEnd): 401 * runtime/DateConstructor.cpp: 402 (JSC::constructDate): 403 (JSC::dateParse): 404 * runtime/DatePrototype.cpp: 405 (JSC::dateProtoFuncToPrimitiveSymbol): 406 (JSC::dateProtoFuncToJSON): 407 * runtime/ErrorConstructor.cpp: 408 (JSC::Interpreter::constructWithErrorConstructor): 409 * runtime/ErrorInstance.cpp: 410 (JSC::ErrorInstance::sanitizedToString): 411 * runtime/ErrorPrototype.cpp: 412 (JSC::errorProtoFuncToString): 413 * runtime/ExceptionEventLocation.cpp: Added. 414 (WTF::printInternal): 415 * runtime/ExceptionEventLocation.h: Copied from Source/JavaScriptCore/runtime/ThrowScopeLocation.h. 416 (JSC::ExceptionEventLocation::ExceptionEventLocation): 417 (JSC::ThrowScopeLocation::ThrowScopeLocation): Deleted. 418 * runtime/ExceptionHelpers.h: 419 * runtime/ExceptionScope.cpp: Added. 420 (JSC::ExceptionScope::ExceptionScope): 421 (JSC::ExceptionScope::~ExceptionScope): 422 * runtime/ExceptionScope.h: Added. 423 (JSC::ExceptionScope::vm): 424 (JSC::ExceptionScope::recursionDepth): 425 (JSC::ExceptionScope::exception): 426 (JSC::ExceptionScope::ExceptionScope): 427 * runtime/FunctionConstructor.cpp: 428 (JSC::constructFunctionSkippingEvalEnabledCheck): 429 * runtime/FunctionPrototype.cpp: 430 (JSC::functionProtoFuncBind): 431 * runtime/GenericArgumentsInlines.h: 432 (JSC::GenericArguments<Type>::copyToArguments): 433 * runtime/GetterSetter.cpp: 434 (JSC::callGetter): 435 * runtime/InspectorInstrumentationObject.cpp: 436 (JSC::inspectorInstrumentationObjectLog): 437 * runtime/InternalFunction.cpp: 438 (JSC::InternalFunction::createSubclassStructure): 439 * runtime/IntlCollator.cpp: 440 (JSC::IntlCollator::initializeCollator): 441 (JSC::IntlCollator::createCollator): 442 (JSC::IntlCollator::resolvedOptions): 443 * runtime/IntlCollatorConstructor.cpp: 444 (JSC::constructIntlCollator): 445 (JSC::IntlCollatorConstructorFuncSupportedLocalesOf): 446 * runtime/IntlCollatorPrototype.cpp: 447 (JSC::IntlCollatorFuncCompare): 448 (JSC::IntlCollatorPrototypeGetterCompare): 449 * runtime/IntlDateTimeFormat.cpp: 450 (JSC::toDateTimeOptionsAnyDate): 451 (JSC::IntlDateTimeFormat::initializeDateTimeFormat): 452 (JSC::IntlDateTimeFormat::resolvedOptions): 453 (JSC::IntlDateTimeFormat::format): 454 * runtime/IntlDateTimeFormatConstructor.cpp: 455 (JSC::constructIntlDateTimeFormat): 456 (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf): 457 * runtime/IntlDateTimeFormatPrototype.cpp: 458 (JSC::IntlDateTimeFormatFuncFormatDateTime): 459 (JSC::IntlDateTimeFormatPrototypeGetterFormat): 460 * runtime/IntlNumberFormat.cpp: 461 (JSC::IntlNumberFormat::initializeNumberFormat): 462 (JSC::IntlNumberFormat::createNumberFormat): 463 (JSC::IntlNumberFormat::resolvedOptions): 464 * runtime/IntlNumberFormatConstructor.cpp: 465 (JSC::constructIntlNumberFormat): 466 (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf): 467 * runtime/IntlNumberFormatPrototype.cpp: 468 (JSC::IntlNumberFormatFuncFormatNumber): 469 (JSC::IntlNumberFormatPrototypeGetterFormat): 470 * runtime/IntlObject.cpp: 471 (JSC::intlBooleanOption): 472 (JSC::intlStringOption): 473 (JSC::intlNumberOption): 474 (JSC::canonicalizeLocaleList): 475 (JSC::supportedLocales): 476 * runtime/IntlObjectInlines.h: 477 (JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor): 478 * runtime/IteratorOperations.cpp: 479 (JSC::iteratorNext): 480 (JSC::iteratorStep): 481 (JSC::iteratorClose): 482 (JSC::iteratorForIterable): 483 * runtime/IteratorOperations.h: 484 (JSC::forEachInIterable): 485 * runtime/JSArray.cpp: 486 (JSC::JSArray::pop): 487 (JSC::JSArray::push): 488 (JSC::JSArray::copyToArguments): 489 * runtime/JSArrayBufferConstructor.cpp: 490 (JSC::constructArrayBuffer): 491 * runtime/JSArrayBufferPrototype.cpp: 492 (JSC::arrayBufferProtoFuncSlice): 493 * runtime/JSArrayInlines.h: 494 (JSC::getLength): 495 (JSC::toLength): 496 * runtime/JSBoundFunction.cpp: 497 (JSC::getBoundFunctionStructure): 498 (JSC::JSBoundFunction::create): 499 * runtime/JSCJSValue.cpp: 500 (JSC::JSValue::putToPrimitive): 501 (JSC::JSValue::putToPrimitiveByIndex): 502 (JSC::JSValue::toStringSlowCase): 503 * runtime/JSCJSValueInlines.h: 504 (JSC::toPreferredPrimitiveType): 505 (JSC::JSValue::getPropertySlot): 506 (JSC::JSValue::equalSlowCaseInline): 507 * runtime/JSDataViewPrototype.cpp: 508 (JSC::getData): 509 (JSC::setData): 510 * runtime/JSFunction.cpp: 511 (JSC::JSFunction::setFunctionName): 512 * runtime/JSGenericTypedArrayView.h: 513 (JSC::JSGenericTypedArrayView::setIndex): 514 * runtime/JSGenericTypedArrayViewConstructorInlines.h: 515 (JSC::constructGenericTypedArrayViewFromIterator): 516 (JSC::constructGenericTypedArrayViewWithArguments): 517 (JSC::constructGenericTypedArrayView): 518 * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: 519 (JSC::speciesConstruct): 520 (JSC::genericTypedArrayViewProtoFuncCopyWithin): 521 (JSC::genericTypedArrayViewProtoFuncIncludes): 522 (JSC::genericTypedArrayViewProtoFuncIndexOf): 523 (JSC::genericTypedArrayViewProtoFuncJoin): 524 (JSC::genericTypedArrayViewProtoFuncLastIndexOf): 525 (JSC::genericTypedArrayViewProtoFuncSlice): 526 (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate): 527 * runtime/JSGlobalObject.h: 528 (JSC::constructEmptyArray): 529 (JSC::constructArray): 530 (JSC::constructArrayNegativeIndexed): 531 * runtime/JSGlobalObjectFunctions.cpp: 532 (JSC::globalFuncEval): 533 * runtime/JSJob.cpp: 534 (JSC::JSJobMicrotask::run): 535 * runtime/JSModuleEnvironment.cpp: 536 (JSC::JSModuleEnvironment::getOwnPropertySlot): 537 * runtime/JSModuleLoader.cpp: 538 (JSC::JSModuleLoader::fetch): 539 * runtime/JSModuleNamespaceObject.cpp: 540 (JSC::JSModuleNamespaceObject::finishCreation): 541 (JSC::JSModuleNamespaceObject::getOwnPropertySlot): 542 * runtime/JSModuleRecord.cpp: 543 (JSC::JSModuleRecord::instantiateDeclarations): 544 * runtime/JSONObject.cpp: 545 (JSC::Stringifier::Stringifier): 546 (JSC::Stringifier::stringify): 547 (JSC::Stringifier::toJSON): 548 (JSC::Stringifier::appendStringifiedValue): 549 (JSC::Stringifier::Holder::appendNextProperty): 550 (JSC::Walker::walk): 551 (JSC::JSONProtoFuncParse): 552 * runtime/JSObject.cpp: 553 (JSC::ordinarySetSlow): 554 (JSC::JSObject::setPrototypeWithCycleCheck): 555 (JSC::callToPrimitiveFunction): 556 (JSC::JSObject::ordinaryToPrimitive): 557 (JSC::JSObject::defaultHasInstance): 558 (JSC::JSObject::getPropertyNames): 559 (JSC::JSObject::toNumber): 560 (JSC::JSObject::toString): 561 (JSC::JSObject::defineOwnNonIndexProperty): 562 (JSC::JSObject::getGenericPropertyNames): 563 (JSC::JSObject::getMethod): 564 * runtime/JSObjectInlines.h: 565 (JSC::createListFromArrayLike): 566 (JSC::JSObject::getPropertySlot): 567 (JSC::JSObject::getNonIndexPropertySlot): 568 * runtime/JSPromiseConstructor.cpp: 569 (JSC::constructPromise): 570 * runtime/JSPropertyNameEnumerator.h: 571 (JSC::propertyNameEnumerator): 572 * runtime/JSPropertyNameIterator.cpp: 573 (JSC::JSPropertyNameIterator::create): 574 * runtime/JSScope.cpp: 575 (JSC::isUnscopable): 576 (JSC::JSScope::resolve): 577 * runtime/JSString.cpp: 578 (JSC::JSString::equalSlowCase): 579 * runtime/JSStringJoiner.cpp: 580 (JSC::JSStringJoiner::join): 581 * runtime/LiteralParser.cpp: 582 (JSC::LiteralParser<CharType>::parse): 583 * runtime/MapConstructor.cpp: 584 (JSC::constructMap): 585 * runtime/MathObject.cpp: 586 (JSC::mathProtoFuncClz32): 587 (JSC::mathProtoFuncHypot): 588 (JSC::mathProtoFuncIMul): 589 * runtime/ModuleLoaderPrototype.cpp: 590 (JSC::moduleLoaderPrototypeParseModule): 591 (JSC::moduleLoaderPrototypeRequestedModules): 592 (JSC::moduleLoaderPrototypeModuleDeclarationInstantiation): 593 * runtime/NativeErrorConstructor.cpp: 594 (JSC::Interpreter::constructWithNativeErrorConstructor): 595 * runtime/NumberConstructor.cpp: 596 (JSC::constructWithNumberConstructor): 597 * runtime/ObjectConstructor.cpp: 598 (JSC::constructObject): 599 (JSC::objectConstructorGetPrototypeOf): 600 (JSC::objectConstructorSetPrototypeOf): 601 (JSC::objectConstructorGetOwnPropertyDescriptor): 602 (JSC::objectConstructorGetOwnPropertyDescriptors): 603 (JSC::objectConstructorGetOwnPropertyNames): 604 (JSC::objectConstructorGetOwnPropertySymbols): 605 (JSC::objectConstructorKeys): 606 (JSC::ownEnumerablePropertyKeys): 607 (JSC::toPropertyDescriptor): 608 (JSC::objectConstructorDefineProperty): 609 (JSC::defineProperties): 610 (JSC::objectConstructorSeal): 611 (JSC::objectConstructorFreeze): 612 (JSC::objectConstructorIsSealed): 613 (JSC::objectConstructorIsFrozen): 614 (JSC::objectConstructorIsExtensible): 615 (JSC::ownPropertyKeys): 616 * runtime/ObjectConstructor.h: 617 (JSC::constructObjectFromPropertyDescriptor): 618 * runtime/ObjectPrototype.cpp: 619 (JSC::objectProtoFuncHasOwnProperty): 620 (JSC::objectProtoFuncIsPrototypeOf): 621 (JSC::objectProtoFuncDefineGetter): 622 (JSC::objectProtoFuncDefineSetter): 623 (JSC::objectProtoFuncLookupGetter): 624 (JSC::objectProtoFuncLookupSetter): 625 (JSC::objectProtoFuncPropertyIsEnumerable): 626 (JSC::objectProtoFuncToLocaleString): 627 (JSC::objectProtoFuncToString): 628 * runtime/Operations.cpp: 629 (JSC::jsAddSlowCase): 630 * runtime/Options.h: 631 * runtime/PropertyDescriptor.cpp: 632 (JSC::PropertyDescriptor::slowGetterSetter): 633 * runtime/ProxyConstructor.cpp: 634 (JSC::makeRevocableProxy): 635 * runtime/ProxyObject.cpp: 636 (JSC::ProxyObject::toStringName): 637 (JSC::performProxyGet): 638 (JSC::ProxyObject::performGet): 639 (JSC::ProxyObject::performInternalMethodGetOwnProperty): 640 (JSC::ProxyObject::performHasProperty): 641 (JSC::ProxyObject::performPut): 642 (JSC::ProxyObject::putByIndexCommon): 643 (JSC::performProxyCall): 644 (JSC::performProxyConstruct): 645 (JSC::ProxyObject::performDelete): 646 (JSC::ProxyObject::performPreventExtensions): 647 (JSC::ProxyObject::performIsExtensible): 648 (JSC::ProxyObject::performDefineOwnProperty): 649 (JSC::ProxyObject::performGetOwnPropertyNames): 650 (JSC::ProxyObject::performSetPrototype): 651 (JSC::ProxyObject::performGetPrototype): 652 * runtime/ReflectObject.cpp: 653 (JSC::reflectObjectConstruct): 654 (JSC::reflectObjectDefineProperty): 655 (JSC::reflectObjectGet): 656 (JSC::reflectObjectGetOwnPropertyDescriptor): 657 (JSC::reflectObjectIsExtensible): 658 (JSC::reflectObjectPreventExtensions): 659 (JSC::reflectObjectSet): 660 (JSC::reflectObjectSetPrototypeOf): 661 * runtime/RegExpConstructor.cpp: 662 (JSC::toFlags): 663 (JSC::regExpCreate): 664 (JSC::constructRegExp): 665 * runtime/RegExpConstructor.h: 666 (JSC::isRegExp): 667 * runtime/RegExpObject.cpp: 668 (JSC::collectMatches): 669 (JSC::RegExpObject::matchGlobal): 670 * runtime/RegExpPrototype.cpp: 671 (JSC::regExpProtoFuncCompile): 672 (JSC::flagsString): 673 (JSC::regExpProtoFuncToString): 674 (JSC::regExpProtoGetterFlags): 675 (JSC::regExpProtoFuncSearchFast): 676 (JSC::regExpProtoFuncSplitFast): 677 * runtime/SetConstructor.cpp: 678 (JSC::constructSet): 679 * runtime/StringConstructor.cpp: 680 (JSC::stringFromCodePoint): 681 (JSC::constructWithStringConstructor): 682 * runtime/StringObject.cpp: 683 (JSC::StringObject::defineOwnProperty): 684 * runtime/StringPrototype.cpp: 685 (JSC::replaceUsingRegExpSearch): 686 (JSC::operationStringProtoFuncReplaceRegExpEmptyStr): 687 (JSC::replaceUsingStringSearch): 688 (JSC::replace): 689 (JSC::stringProtoFuncReplaceUsingRegExp): 690 (JSC::stringProtoFuncReplaceUsingStringSearch): 691 (JSC::stringProtoFuncCodePointAt): 692 (JSC::stringProtoFuncSlice): 693 (JSC::stringProtoFuncSplitFast): 694 (JSC::stringProtoFuncSubstr): 695 (JSC::stringProtoFuncSubstring): 696 (JSC::stringProtoFuncLocaleCompare): 697 (JSC::toLocaleCase): 698 (JSC::stringProtoFuncBig): 699 (JSC::stringProtoFuncSmall): 700 (JSC::stringProtoFuncBlink): 701 (JSC::stringProtoFuncBold): 702 (JSC::stringProtoFuncFixed): 703 (JSC::stringProtoFuncItalics): 704 (JSC::stringProtoFuncStrike): 705 (JSC::stringProtoFuncSub): 706 (JSC::stringProtoFuncSup): 707 (JSC::stringProtoFuncFontcolor): 708 (JSC::stringProtoFuncFontsize): 709 (JSC::stringProtoFuncAnchor): 710 (JSC::stringProtoFuncLink): 711 (JSC::trimString): 712 (JSC::stringProtoFuncStartsWith): 713 (JSC::stringProtoFuncEndsWith): 714 (JSC::stringIncludesImpl): 715 (JSC::stringProtoFuncIncludes): 716 (JSC::builtinStringIncludesInternal): 717 (JSC::stringProtoFuncNormalize): 718 * runtime/SymbolConstructor.cpp: 719 (JSC::symbolConstructorFor): 720 * runtime/TemplateRegistry.cpp: 721 (JSC::TemplateRegistry::getTemplateObject): 722 * runtime/ThrowScope.cpp: 723 (JSC::ThrowScope::ThrowScope): 724 (JSC::ThrowScope::~ThrowScope): 725 (JSC::ThrowScope::throwException): 726 (JSC::ThrowScope::simulateThrow): 727 (JSC::ThrowScope::printIfNeedCheck): Deleted. 728 (JSC::ThrowScope::verifyExceptionCheckNeedIsSatisfied): Deleted. 729 * runtime/ThrowScope.h: 730 (JSC::ThrowScope::release): 731 (JSC::ThrowScope::ThrowScope): 732 (JSC::ThrowScope::throwException): 733 (JSC::ThrowScope::vm): Deleted. 734 (JSC::ThrowScope::exception): Deleted. 735 * runtime/ThrowScopeLocation.h: Removed. 736 * runtime/VM.cpp: 737 (JSC::VM::verifyExceptionCheckNeedIsSatisfied): 738 * runtime/VM.h: 739 (JSC::VM::exception): 740 (JSC::VM::clearException): 741 (JSC::VM::setException): Deleted. 742 * runtime/WeakMapConstructor.cpp: 743 (JSC::constructWeakMap): 744 * runtime/WeakSetConstructor.cpp: 745 (JSC::constructWeakSet): 746 * tools/JSDollarVMPrototype.cpp: 747 (JSC::functionPrint): 748 1 749 2016-09-07 Andy VanWagoner <thetalecrafter@gmail.com> 2 750 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r205552 r205569 2149 2149 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */; }; 2150 2150 FE5932A8183C5A2600A1ECCC /* VMEntryScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2151 FE6029D91D6E1E4F0030204D /* ThrowScopeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6029D81D6E1E330030204D /* ThrowScopeLocation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2151 FE6029D91D6E1E4F0030204D /* ExceptionEventLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6029D81D6E1E330030204D /* ExceptionEventLocation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2152 FE6491371D78F01D00A694D4 /* ExceptionScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6491361D78F01300A694D4 /* ExceptionScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2153 FE6491391D78F3AF00A694D4 /* ExceptionScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6491381D78F3A300A694D4 /* ExceptionScope.cpp */; }; 2152 2154 FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2153 2155 FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */; }; … … 2155 2157 FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2156 2158 FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; }; 2159 FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80C1961D775B27008510C0 /* CatchScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2160 FE80C1991D775FBE008510C0 /* CatchScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80C1981D775FB4008510C0 /* CatchScope.cpp */; }; 2161 FE80C19B1D776A98008510C0 /* ExceptionEventLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80C19A1D7768FD008510C0 /* ExceptionEventLocation.cpp */; }; 2157 2162 FE99B2491C24C3D300C82159 /* JITNegGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE99B2481C24B6D300C82159 /* JITNegGenerator.h */; }; 2158 2163 FE99B24A1C24C3D700C82159 /* JITNegGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */; }; … … 4476 4481 FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMEntryScope.cpp; sourceTree = "<group>"; }; 4477 4482 FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMEntryScope.h; sourceTree = "<group>"; }; 4478 FE6029D81D6E1E330030204D /* ThrowScopeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThrowScopeLocation.h; sourceTree = "<group>"; }; 4483 FE6029D81D6E1E330030204D /* ExceptionEventLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionEventLocation.h; sourceTree = "<group>"; }; 4484 FE6491361D78F01300A694D4 /* ExceptionScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionScope.h; sourceTree = "<group>"; }; 4485 FE6491381D78F3A300A694D4 /* ExceptionScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionScope.cpp; sourceTree = "<group>"; }; 4479 4486 FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerPrinter.cpp; sourceTree = "<group>"; }; 4480 4487 FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerPrinter.h; sourceTree = "<group>"; }; 4481 4488 FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapVerifier.cpp; sourceTree = "<group>"; }; 4482 4489 FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapVerifier.h; sourceTree = "<group>"; }; 4490 FE80C1961D775B27008510C0 /* CatchScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatchScope.h; sourceTree = "<group>"; }; 4491 FE80C1981D775FB4008510C0 /* CatchScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CatchScope.cpp; sourceTree = "<group>"; }; 4492 FE80C19A1D7768FD008510C0 /* ExceptionEventLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionEventLocation.cpp; sourceTree = "<group>"; }; 4483 4493 FE90BB3A1B7CF64E006B3F03 /* VMInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInlines.h; sourceTree = "<group>"; }; 4484 4494 FE98B5B61BB9AE110073E7A6 /* JITSubGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITSubGenerator.h; sourceTree = "<group>"; }; … … 5738 5748 BCA62DFE0E2826230004F30D /* CallData.cpp */, 5739 5749 145C507F0D9DF63B0088F6B9 /* CallData.h */, 5750 FE80C1981D775FB4008510C0 /* CatchScope.cpp */, 5751 FE80C1961D775B27008510C0 /* CatchScope.h */, 5740 5752 BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */, 5741 5753 0FE0501C1AA9095600D33B33 /* ClonedArguments.cpp */, … … 5802 5814 FE1C0FFE1B194FD100B53FCA /* Exception.cpp */, 5803 5815 FE1C0FFC1B193E9800B53FCA /* Exception.h */, 5816 FE80C19A1D7768FD008510C0 /* ExceptionEventLocation.cpp */, 5817 FE6029D81D6E1E330030204D /* ExceptionEventLocation.h */, 5804 5818 0F12DE0D1979D5FD0006FF4E /* ExceptionFuzz.cpp */, 5805 5819 0F12DE0E1979D5FD0006FF4E /* ExceptionFuzz.h */, 5806 5820 1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */, 5807 5821 A72701B30DADE94900E548D7 /* ExceptionHelpers.h */, 5822 FE6491381D78F3A300A694D4 /* ExceptionScope.cpp */, 5823 FE6491361D78F01300A694D4 /* ExceptionScope.h */, 5808 5824 86CA032D1038E8440028A609 /* Executable.cpp */, 5809 5825 86CAFEE21035DDE60028A609 /* Executable.h */, … … 6205 6221 FE2E6A7A1D6EA5FE0060F896 /* ThrowScope.cpp */, 6206 6222 FE3422111D6B818C0032BE88 /* ThrowScope.h */, 6207 FE6029D81D6E1E330030204D /* ThrowScopeLocation.h */,6208 6223 0F55989717C86C5600A1E543 /* ToNativeFromValue.h */, 6209 6224 0F2B66D817B6B5AB00A7AE3F /* TypedArrayAdaptors.h */, … … 7760 7775 708EBE241CE8F35800453146 /* IntlObjectInlines.h in Headers */, 7761 7776 0F070A481D543A90006E7232 /* CellContainerInlines.h in Headers */, 7762 FE6029D91D6E1E4F0030204D /* ThrowScopeLocation.h in Headers */,7777 FE6029D91D6E1E4F0030204D /* ExceptionEventLocation.h in Headers */, 7763 7778 0FE0501B1AA9091100D33B33 /* GenericOffset.h in Headers */, 7764 7779 0F2B66E017B6B5AB00A7AE3F /* GenericTypedArrayView.h in Headers */, … … 8281 8296 BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */, 8282 8297 7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */, 8298 FE6491371D78F01D00A694D4 /* ExceptionScope.h in Headers */, 8283 8299 2AAAA31218BD49D100394CC8 /* StructureIDBlob.h in Headers */, 8284 8300 436E54531C468E7400B5AF73 /* B3LegalizeMemoryOffsets.h in Headers */, … … 8374 8390 BC18C47A0E16F5CD00B34460 /* WebKitAvailability.h in Headers */, 8375 8391 A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */, 8392 FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */, 8376 8393 2A4EC90C1860D6C20094F782 /* WriteBarrierBuffer.h in Headers */, 8377 8394 C2B6D75318A33793004A9301 /* WriteBarrierInlines.h in Headers */, … … 8906 8923 files = ( 8907 8924 0FFA549716B8835000B3A982 /* A64DOpcode.cpp in Sources */, 8925 FE6491391D78F3AF00A694D4 /* ExceptionScope.cpp in Sources */, 8908 8926 0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */, 8909 8927 0FEC856D1BDACDC70080FF74 /* AirAllocateStack.cpp in Sources */, … … 9388 9406 0F2B66E817B6B5AB00A7AE3F /* JSArrayBufferView.cpp in Sources */, 9389 9407 A5311C371C77CECA00E6B1B6 /* HeapSnapshotBuilder.cpp in Sources */, 9408 FE80C1991D775FBE008510C0 /* CatchScope.cpp in Sources */, 9390 9409 1421359B0A677F4F00A8195E /* JSBase.cpp in Sources */, 9391 9410 86FA9E91142BBB2E001773B7 /* JSBoundFunction.cpp in Sources */, … … 9500 9519 0F0B839C14BCF46300885B4F /* LLIntThunks.cpp in Sources */, 9501 9520 14469DDE107EC7E700650446 /* Lookup.cpp in Sources */, 9521 FE80C19B1D776A98008510C0 /* ExceptionEventLocation.cpp in Sources */, 9502 9522 0F4680CC14BBB17A00BFE272 /* LowLevelInterpreter.cpp in Sources */, 9503 9523 A5AB49DC1BEC8082007020FB /* PerGlobalObjectWrapperWorld.cpp in Sources */, -
trunk/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp
r199642 r205569 106 106 JSObject* thisObject = m_thisObject.jsObject(); 107 107 108 JSLockHolder lock(m_exec); 108 VM& vm = m_exec->vm(); 109 JSLockHolder lock(vm); 110 auto scope = DECLARE_THROW_SCOPE(vm); 109 111 110 112 JSValue function = thisObject->get(m_exec, Identifier::fromString(m_exec, m_name)); 111 if ( m_exec->hadException()) {113 if (UNLIKELY(scope.exception())) { 112 114 hadException = true; 113 115 return { }; -
trunk/Source/JavaScriptCore/bindings/ScriptValue.cpp
r205462 r205569 122 122 String ScriptValue::toString(ExecState* scriptState) const 123 123 { 124 VM& vm = scriptState->vm(); 125 auto scope = DECLARE_CATCH_SCOPE(vm); 126 124 127 String result = m_value.get().toString(scriptState)->value(scriptState); 125 128 // Handle the case where an exception is thrown as part of invoking toString on the object. 126 if ( scriptState->hadException())127 sc riptState->clearException();129 if (UNLIKELY(scope.exception())) 130 scope.clearException(); 128 131 return result; 129 132 } -
trunk/Source/JavaScriptCore/debugger/Debugger.cpp
r204440 r205569 624 624 void Debugger::pauseIfNeeded(CallFrame* callFrame) 625 625 { 626 VM& vm = callFrame->vm(); 627 auto scope = DECLARE_THROW_SCOPE(vm); 628 626 629 if (m_isPaused) 627 630 return; … … 663 666 PauseReasonDeclaration reason(*this, didHitBreakpoint ? PausedForBreakpoint : m_reasonForPause); 664 667 handlePause(vmEntryGlobalObject, m_reasonForPause); 665 RELEASE_ASSERT(! callFrame->hadException());668 RELEASE_ASSERT(!scope.exception()); 666 669 } 667 670 -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r202242 r205569 218 218 return jsUndefined(); 219 219 220 JSLockHolder lock(callFrame); 220 VM& vm = callFrame->vm(); 221 JSLockHolder lock(vm); 222 auto catchScope = DECLARE_CATCH_SCOPE(vm); 221 223 222 224 CodeBlock* codeBlock = nullptr; … … 229 231 230 232 DebuggerEvalEnabler evalEnabler(callFrame); 231 VM& vm = callFrame->vm();232 233 233 234 EvalContextType evalContextType; … … 244 245 245 246 EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock->isStrictMode(), codeBlock->unlinkedCodeBlock()->derivedContextType(), codeBlock->unlinkedCodeBlock()->isArrowFunction(), evalContextType, &variablesUnderTDZ); 246 if ( vm.exception()) {247 exception = vm.exception();248 vm.clearException();247 if (UNLIKELY(catchScope.exception())) { 248 exception = catchScope.exception(); 249 catchScope.clearException(); 249 250 return jsUndefined(); 250 251 } … … 258 259 JSValue thisValue = this->thisValue(); 259 260 JSValue result = vm.interpreter->execute(eval, callFrame, thisValue, scope()->jsScope()); 260 if ( vm.exception()) {261 exception = vm.exception();262 vm.clearException();261 if (UNLIKELY(catchScope.exception())) { 262 exception = catchScope.exception(); 263 catchScope.clearException(); 263 264 } 264 265 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp
r203364 r205569 113 113 void compileOSRExit(ExecState* exec) 114 114 { 115 if (exec->vm().callFrameForCatch) 116 RELEASE_ASSERT(exec->vm().callFrameForCatch == exec); 115 VM* vm = &exec->vm(); 116 auto scope = DECLARE_THROW_SCOPE(*vm); 117 118 if (vm->callFrameForCatch) 119 RELEASE_ASSERT(vm->callFrameForCatch == exec); 117 120 118 121 CodeBlock* codeBlock = exec->codeBlock(); 119 122 ASSERT(codeBlock); 120 123 ASSERT(codeBlock->jitType() == JITCode::DFGJIT); 121 122 VM* vm = &exec->vm();123 124 124 125 // It's sort of preferable that we don't GC while in here. Anyways, doing so wouldn't … … 132 133 ASSERT(exit.m_kind == GenericUnwind); 133 134 if (exit.isExceptionHandler()) 134 ASSERT (!!vm->exception());135 ASSERT_UNUSED(scope, !!scope.exception()); 135 136 136 137 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r205520 r205569 98 98 { 99 99 VM* vm = &exec->vm(); 100 auto scope = DECLARE_THROW_SCOPE(*vm); 100 101 NativeCallFrameTracer tracer(vm, exec); 101 102 … … 122 123 // Don't put to an object if toString throws an exception. 123 124 auto propertyName = property.toPropertyKey(exec); 124 if ( vm->exception())125 if (UNLIKELY(scope.exception())) 125 126 return; 126 127 … … 182 183 VM& vm = exec->vm(); 183 184 NativeCallFrameTracer tracer(&vm, exec); 185 auto scope = DECLARE_THROW_SCOPE(vm); 184 186 if (constructor->type() == JSFunctionType) 185 187 return constructEmptyObject(exec, jsCast<JSFunction*>(constructor)->rareData(exec, inlineCapacity)->objectAllocationProfile()->structure()); 186 188 187 189 JSValue proto = constructor->get(exec, exec->propertyNames().prototype); 188 if ( vm.exception())190 if (UNLIKELY(scope.exception())) 189 191 return nullptr; 190 192 if (proto.isObject()) … … 210 212 VM* vm = &exec->vm(); 211 213 NativeCallFrameTracer tracer(vm, exec); 214 auto scope = DECLARE_THROW_SCOPE(*vm); 212 215 213 216 JSValue op1 = JSValue::decode(encodedOp1); … … 215 218 216 219 int32_t a = op1.toInt32(exec); 217 if (UNLIKELY( vm->exception()))220 if (UNLIKELY(scope.exception())) 218 221 return JSValue::encode(JSValue()); 219 222 int32_t b = op2.toInt32(exec); … … 225 228 VM* vm = &exec->vm(); 226 229 NativeCallFrameTracer tracer(vm, exec); 230 auto scope = DECLARE_THROW_SCOPE(*vm); 227 231 228 232 JSValue op1 = JSValue::decode(encodedOp1); … … 230 234 231 235 int32_t a = op1.toInt32(exec); 232 if (UNLIKELY( vm->exception()))236 if (UNLIKELY(scope.exception())) 233 237 return JSValue::encode(JSValue()); 234 238 int32_t b = op2.toInt32(exec); … … 240 244 VM* vm = &exec->vm(); 241 245 NativeCallFrameTracer tracer(vm, exec); 246 auto scope = DECLARE_THROW_SCOPE(*vm); 242 247 243 248 JSValue op1 = JSValue::decode(encodedOp1); … … 245 250 246 251 int32_t a = op1.toInt32(exec); 247 if (UNLIKELY( vm->exception()))252 if (UNLIKELY(scope.exception())) 248 253 return JSValue::encode(JSValue()); 249 254 int32_t b = op2.toInt32(exec); … … 255 260 VM* vm = &exec->vm(); 256 261 NativeCallFrameTracer tracer(vm, exec); 262 auto scope = DECLARE_THROW_SCOPE(*vm); 257 263 258 264 JSValue op1 = JSValue::decode(encodedOp1); … … 260 266 261 267 int32_t a = op1.toInt32(exec); 262 if (UNLIKELY( vm->exception()))268 if (UNLIKELY(scope.exception())) 263 269 return JSValue::encode(JSValue()); 264 270 uint32_t b = op2.toUInt32(exec); … … 270 276 VM* vm = &exec->vm(); 271 277 NativeCallFrameTracer tracer(vm, exec); 278 auto scope = DECLARE_THROW_SCOPE(*vm); 272 279 273 280 JSValue op1 = JSValue::decode(encodedOp1); … … 275 282 276 283 int32_t a = op1.toInt32(exec); 277 if (UNLIKELY( vm->exception()))284 if (UNLIKELY(scope.exception())) 278 285 return JSValue::encode(JSValue()); 279 286 uint32_t b = op2.toUInt32(exec); … … 285 292 VM* vm = &exec->vm(); 286 293 NativeCallFrameTracer tracer(vm, exec); 294 auto scope = DECLARE_THROW_SCOPE(*vm); 287 295 288 296 JSValue op1 = JSValue::decode(encodedOp1); … … 290 298 291 299 uint32_t a = op1.toUInt32(exec); 292 if (UNLIKELY( vm->exception()))300 if (UNLIKELY(scope.exception())) 293 301 return JSValue::encode(JSValue()); 294 302 uint32_t b = op2.toUInt32(exec); … … 316 324 VM* vm = &exec->vm(); 317 325 NativeCallFrameTracer tracer(vm, exec); 326 auto scope = DECLARE_THROW_SCOPE(*vm); 318 327 319 328 JSValue op1 = JSValue::decode(encodedOp1); … … 321 330 322 331 double a = op1.toNumber(exec); 323 if (UNLIKELY( vm->exception()))332 if (UNLIKELY(scope.exception())) 324 333 return JSValue::encode(JSValue()); 325 334 double b = op2.toNumber(exec); … … 331 340 VM* vm = &exec->vm(); 332 341 NativeCallFrameTracer tracer(vm, exec); 342 auto scope = DECLARE_THROW_SCOPE(*vm); 333 343 334 344 JSValue op1 = JSValue::decode(encodedOp1); 335 345 double a = op1.toNumber(exec); 336 if (UNLIKELY( vm->exception()))346 if (UNLIKELY(scope.exception())) 337 347 return PNaN; 338 348 return fabs(a); … … 343 353 VM* vm = &exec->vm(); 344 354 NativeCallFrameTracer tracer(vm, exec); 355 auto scope = DECLARE_THROW_SCOPE(*vm); 345 356 346 357 JSValue op1 = JSValue::decode(encodedOp1); 347 358 uint32_t value = op1.toUInt32(exec); 348 if (UNLIKELY( vm->exception()))359 if (UNLIKELY(scope.exception())) 349 360 return 0; 350 361 return clz32(value); … … 355 366 VM* vm = &exec->vm(); 356 367 NativeCallFrameTracer tracer(vm, exec); 368 auto scope = DECLARE_THROW_SCOPE(*vm); 357 369 358 370 JSValue op1 = JSValue::decode(encodedOp1); 359 371 double a = op1.toNumber(exec); 360 if (UNLIKELY( vm->exception()))372 if (UNLIKELY(scope.exception())) 361 373 return JSValue::encode(JSValue()); 362 374 return cos(a); … … 367 379 VM* vm = &exec->vm(); 368 380 NativeCallFrameTracer tracer(vm, exec); 381 auto scope = DECLARE_THROW_SCOPE(*vm); 369 382 370 383 JSValue op1 = JSValue::decode(encodedOp1); 371 384 double a = op1.toNumber(exec); 372 if (UNLIKELY( vm->exception()))385 if (UNLIKELY(scope.exception())) 373 386 return PNaN; 374 387 return static_cast<float>(a); … … 379 392 VM* vm = &exec->vm(); 380 393 NativeCallFrameTracer tracer(vm, exec); 394 auto scope = DECLARE_THROW_SCOPE(*vm); 381 395 382 396 JSValue op1 = JSValue::decode(encodedOp1); 383 397 double a = op1.toNumber(exec); 384 if (UNLIKELY( vm->exception()))398 if (UNLIKELY(scope.exception())) 385 399 return PNaN; 386 400 return log(a); … … 391 405 VM* vm = &exec->vm(); 392 406 NativeCallFrameTracer tracer(vm, exec); 407 auto scope = DECLARE_THROW_SCOPE(*vm); 393 408 394 409 JSValue op1 = JSValue::decode(encodedOp1); 395 410 double a = op1.toNumber(exec); 396 if (UNLIKELY( vm->exception()))411 if (UNLIKELY(scope.exception())) 397 412 return PNaN; 398 413 return sin(a); … … 403 418 VM* vm = &exec->vm(); 404 419 NativeCallFrameTracer tracer(vm, exec); 420 auto scope = DECLARE_THROW_SCOPE(*vm); 405 421 406 422 JSValue op1 = JSValue::decode(encodedOp1); 407 423 double a = op1.toNumber(exec); 408 if (UNLIKELY( vm->exception()))424 if (UNLIKELY(scope.exception())) 409 425 return PNaN; 410 426 return sqrt(a); … … 432 448 VM& vm = exec->vm(); 433 449 NativeCallFrameTracer tracer(&vm, exec); 434 450 auto scope = DECLARE_THROW_SCOPE(vm); 451 435 452 JSValue baseValue = JSValue::decode(encodedBase); 436 453 JSValue property = JSValue::decode(encodedProperty); … … 458 475 459 476 baseValue.requireObjectCoercible(exec); 460 if ( vm.exception())477 if (UNLIKELY(scope.exception())) 461 478 return JSValue::encode(jsUndefined()); 462 479 auto propertyName = property.toPropertyKey(exec); 463 if ( vm.exception())480 if (UNLIKELY(scope.exception())) 464 481 return JSValue::encode(jsUndefined()); 465 482 return JSValue::encode(baseValue.get(exec, propertyName)); … … 470 487 VM& vm = exec->vm(); 471 488 NativeCallFrameTracer tracer(&vm, exec); 472 489 auto scope = DECLARE_THROW_SCOPE(vm); 490 473 491 JSValue property = JSValue::decode(encodedProperty); 474 492 … … 491 509 492 510 auto propertyName = property.toPropertyKey(exec); 493 if ( vm.exception())511 if (UNLIKELY(scope.exception())) 494 512 return JSValue::encode(jsUndefined()); 495 513 return JSValue::encode(JSValue(base).get(exec, propertyName)); … … 860 878 VM& vm = exec->vm(); 861 879 NativeCallFrameTracer tracer(&vm, exec); 880 auto scope = DECLARE_THROW_SCOPE(vm); 862 881 863 882 JSValue baseValue = JSValue::decode(encodedBase); … … 885 904 886 905 baseValue.requireObjectCoercible(exec); 887 if ( vm.exception())906 if (UNLIKELY(scope.exception())) 888 907 return JSValue::encode(JSValue()); 889 908 890 909 auto property = subscript.toPropertyKey(exec); 891 if ( vm.exception())910 if (UNLIKELY(scope.exception())) 892 911 return JSValue::encode(JSValue()); 893 912 return JSValue::encode(baseValue.get(exec, property, slot)); … … 914 933 VM& vm = exec->vm(); 915 934 NativeCallFrameTracer tracer(&vm, exec); 935 auto scope = DECLARE_THROW_SCOPE(vm); 916 936 917 937 Identifier property = JSValue::decode(encodedSubscript).toPropertyKey(exec); 918 if ( vm.exception())938 if (UNLIKELY(scope.exception())) 919 939 return; 920 940 putWithThis<true>(exec, encodedBase, encodedThis, encodedValue, property); … … 925 945 VM& vm = exec->vm(); 926 946 NativeCallFrameTracer tracer(&vm, exec); 947 auto scope = DECLARE_THROW_SCOPE(vm); 927 948 928 949 Identifier property = JSValue::decode(encodedSubscript).toPropertyKey(exec); 929 if ( vm.exception())950 if (UNLIKELY(scope.exception())) 930 951 return; 931 952 putWithThis<false>(exec, encodedBase, encodedThis, encodedValue, property); … … 1442 1463 1443 1464 JSString* str1 = JSValue::decode(a).toString(exec); 1444 ASSERT(! vm.exception()); // Impossible, since we must have been given primitives.1465 ASSERT(!scope.exception()); // Impossible, since we must have been given primitives. 1445 1466 JSString* str2 = JSValue::decode(b).toString(exec); 1446 ASSERT(! vm.exception());1467 ASSERT(!scope.exception()); 1447 1468 1448 1469 if (sumOverflows<int32_t>(str1->length(), str2->length())) { … … 1461 1482 1462 1483 JSString* str1 = JSValue::decode(a).toString(exec); 1463 ASSERT(! vm.exception()); // Impossible, since we must have been given primitives.1484 ASSERT(!scope.exception()); // Impossible, since we must have been given primitives. 1464 1485 JSString* str2 = JSValue::decode(b).toString(exec); 1465 ASSERT(! vm.exception());1486 ASSERT(!scope.exception()); 1466 1487 JSString* str3 = JSValue::decode(c).toString(exec); 1467 ASSERT(! vm.exception());1488 ASSERT(!scope.exception()); 1468 1489 1469 1490 if (sumOverflows<int32_t>(str1->length(), str2->length(), str3->length())) { -
trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
r205462 r205569 135 135 JSC::JSObject* InjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id) 136 136 { 137 JSLockHolder lock(scriptState); 137 VM& vm = scriptState->vm(); 138 JSLockHolder lock(vm); 139 auto scope = DECLARE_CATCH_SCOPE(vm); 138 140 139 141 SourceCode sourceCode = makeSource(source); … … 158 160 159 161 JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args); 160 sc riptState->clearException();162 scope.clearException(); 161 163 return result.getObject(); 162 164 } -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
r205462 r205569 222 222 return; 223 223 224 ErrorHandlingScope errorScope(exec->vm()); 224 VM& vm = exec->vm(); 225 auto scope = DECLARE_CATCH_SCOPE(vm); 226 ErrorHandlingScope errorScope(vm); 225 227 226 228 RefPtr<ScriptCallStack> callStack = createScriptCallStackFromException(exec, exception, ScriptCallStack::maxCallStackSizeToCapture); … … 231 233 // If this is a custom exception object, call toString on it to try and get a nice string representation for the exception. 232 234 String errorMessage = exception->value().toString(exec)->value(exec); 233 exec->clearException();235 scope.clearException(); 234 236 235 237 if (JSGlobalObjectConsoleClient::logToSystemConsole()) { -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
r205198 r205569 104 104 105 105 String program = scriptValue.toString(exec)->value(exec); 106 if ( exec->hadException())106 if (UNLIKELY(scope.exception())) 107 107 return jsUndefined(); 108 108 … … 260 260 261 261 VM& vm = exec->vm(); 262 auto scope = DECLARE_THROW_SCOPE(vm); 262 263 JSValue value = exec->uncheckedArgument(0); 263 264 … … 265 266 unsigned index = 0; 266 267 JSArray* array = constructEmptyArray(exec, nullptr); 267 if (UNLIKELY( vm.exception()))268 if (UNLIKELY(scope.exception())) 268 269 return jsUndefined(); 269 270 switch (promise->status(exec->vm())) { … … 287 288 unsigned index = 0; 288 289 JSArray* array = constructEmptyArray(exec, nullptr); 289 if (UNLIKELY( vm.exception()))290 if (UNLIKELY(scope.exception())) 290 291 return jsUndefined(); 291 292 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction())); … … 299 300 unsigned index = 0; 300 301 JSArray* array = constructEmptyArray(exec, nullptr, 2); 301 if (UNLIKELY( vm.exception()))302 if (UNLIKELY(scope.exception())) 302 303 return jsUndefined(); 303 304 array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target())); … … 313 314 unsigned index = 0; 314 315 JSArray* array = constructEmptyArray(exec, nullptr, 2); 315 if (UNLIKELY( vm.exception()))316 if (UNLIKELY(scope.exception())) 316 317 return jsUndefined(); 317 318 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue)); … … 336 337 unsigned index = 0; 337 338 JSArray* array = constructEmptyArray(exec, nullptr, 2); 338 if (UNLIKELY( vm.exception()))339 if (UNLIKELY(scope.exception())) 339 340 return jsUndefined(); 340 341 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue())); … … 358 359 unsigned index = 0; 359 360 JSArray* array = constructEmptyArray(exec, nullptr, 2); 360 if (UNLIKELY( vm.exception()))361 if (UNLIKELY(scope.exception())) 361 362 return jsUndefined(); 362 363 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue())); … … 368 369 unsigned index = 0; 369 370 JSArray* array = constructEmptyArray(exec, nullptr, 1); 370 if (UNLIKELY( vm.exception()))371 if (UNLIKELY(scope.exception())) 371 372 return jsUndefined(); 372 373 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec))); … … 377 378 unsigned index = 0; 378 379 JSArray* array = constructEmptyArray(exec, nullptr, 1); 379 if (UNLIKELY( vm.exception()))380 if (UNLIKELY(scope.exception())) 380 381 return jsUndefined(); 381 382 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue())); … … 405 406 406 407 VM& vm = exec->vm(); 408 auto scope = DECLARE_THROW_SCOPE(vm); 407 409 JSValue value = exec->uncheckedArgument(0); 408 410 JSWeakMap* weakMap = jsDynamicCast<JSWeakMap*>(value); … … 419 421 420 422 JSArray* array = constructEmptyArray(exec, nullptr); 421 if (UNLIKELY( vm.exception()))423 if (UNLIKELY(scope.exception())) 422 424 return jsUndefined(); 423 425 for (auto it = weakMap->weakMapData()->begin(); it != weakMap->weakMapData()->end(); ++it) { … … 452 454 453 455 VM& vm = exec->vm(); 456 auto scope = DECLARE_THROW_SCOPE(vm); 454 457 JSValue value = exec->uncheckedArgument(0); 455 458 JSWeakSet* weakSet = jsDynamicCast<JSWeakSet*>(value); … … 466 469 467 470 JSArray* array = constructEmptyArray(exec, nullptr); 468 if (UNLIKELY( vm.exception()))471 if (UNLIKELY(scope.exception())) 469 472 return jsUndefined(); 470 473 for (auto it = weakSet->weakMapData()->begin(); it != weakSet->weakMapData()->end(); ++it) { … … 496 499 497 500 VM& vm = exec->vm(); 501 auto scope = DECLARE_THROW_SCOPE(vm); 498 502 JSValue iterator; 499 503 JSValue value = exec->uncheckedArgument(0); … … 506 510 else if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value)) { 507 511 iterator = propertyNameIterator->clone(exec); 508 if (UNLIKELY( vm.exception()))512 if (UNLIKELY(scope.exception())) 509 513 return JSValue(); 510 514 } else { … … 526 530 527 531 JSArray* array = constructEmptyArray(exec, nullptr); 528 if (UNLIKELY( vm.exception()))532 if (UNLIKELY(scope.exception())) 529 533 return jsUndefined(); 530 534 531 535 for (unsigned i = 0; i < numberToFetch; ++i) { 532 536 JSValue next = iteratorStep(exec, iterator); 533 if (UNLIKELY( vm.exception()))537 if (UNLIKELY(scope.exception())) 534 538 break; 535 539 if (next.isFalse()) … … 537 541 538 542 JSValue nextValue = iteratorValue(exec, next); 539 if (UNLIKELY( vm.exception()))543 if (UNLIKELY(scope.exception())) 540 544 break; 541 545 -
trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp
r205462 r205569 84 84 85 85 String script = scriptValue.toString(exec)->value(exec); 86 if ( exec->hadException())86 if (UNLIKELY(scope.exception())) 87 87 return jsUndefined(); 88 88 -
trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp
r204740 r205569 120 120 static void extractSourceInformationFromException(JSC::ExecState* exec, JSObject* exceptionObject, int* lineNumber, int* columnNumber, String* sourceURL) 121 121 { 122 VM& vm = exec->vm(); 123 auto scope = DECLARE_CATCH_SCOPE(vm); 124 122 125 // FIXME: <http://webkit.org/b/115087> Web Inspector: Should not need to evaluate JavaScript handling exceptions 123 126 JSValue lineValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "line")); … … 127 130 JSValue sourceURLValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "sourceURL")); 128 131 *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toString(exec)->value(exec) : ASCIILiteral("undefined"); 129 exec->clearException();132 scope.clearException(); 130 133 } 131 134 -
trunk/Source/JavaScriptCore/interpreter/CachedCall.h
r205462 r205569 55 55 } else 56 56 throwStackOverflowError(callFrame, scope); 57 m_valid = ! callFrame->hadException();57 m_valid = !scope.exception(); 58 58 } 59 59 -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r204439 r205569 116 116 // pointer, so these are inefficient, and should be used sparingly in new code. 117 117 // But they're used in many places in legacy code, so they're not going away any time soon. 118 119 void clearException() { vm().clearException(); }120 121 Exception* exception() const { return vm().exception(); }122 bool hadException() const { return !!vm().exception(); }123 124 Exception* lastException() const { return vm().lastException(); }125 void clearLastException() { vm().clearLastException(); }126 118 127 119 AtomicStringTable* atomicStringTable() const { return vm().atomicStringTable(); } -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r205462 r205569 106 106 } 107 107 String programSource = asString(program)->value(callFrame); 108 if ( callFrame->hadException())108 if (UNLIKELY(scope.exception())) 109 109 return JSValue(); 110 110 … … 146 146 147 147 // If the literal parser bailed, it should not have thrown exceptions. 148 ASSERT(! vm.exception());148 ASSERT(!scope.exception()); 149 149 150 150 eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock, callerCodeBlock->isStrictMode(), derivedContextType, evalContextType, isArrowFunctionContext, programSource, callerScopeChain); … … 189 189 RELEASE_ASSERT(arguments.isObject()); 190 190 length = getLength(callFrame, jsCast<JSObject*>(cell)); 191 if (UNLIKELY( callFrame->hadException()))191 if (UNLIKELY(scope.exception())) 192 192 return 0; 193 193 break; … … 587 587 ALWAYS_INLINE static void notifyDebuggerOfUnwinding(CallFrame* callFrame) 588 588 { 589 VM& vm = callFrame->vm(); 590 auto throwScope = DECLARE_THROW_SCOPE(vm); 589 591 if (Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger()) { 590 SuspendExceptionScope scope(& callFrame->vm());592 SuspendExceptionScope scope(&vm); 591 593 if (jsDynamicCast<JSFunction*>(callFrame->callee())) 592 594 debugger->returnEvent(callFrame); 593 595 else 594 596 debugger->didExecuteProgram(callFrame); 595 ASSERT (!callFrame->hadException());597 ASSERT_UNUSED(throwScope, !throwScope.exception()); 596 598 } 597 599 } … … 681 683 NEVER_INLINE HandlerInfo* Interpreter::unwind(VM& vm, CallFrame*& callFrame, Exception* exception, UnwindStart unwindStart) 682 684 { 685 auto scope = DECLARE_THROW_SCOPE(vm); 686 683 687 if (unwindStart == UnwindFromCallerFrame) { 684 688 if (callFrame->callerFrameOrVMEntryFrame() == vm.topVMEntryFrame) … … 699 703 exceptionValue = jsNull(); 700 704 701 ASSERT (vm.exception() && vm.exception()->stack().size());705 ASSERT_UNUSED(scope, scope.exception() && scope.exception()->stack().size()); 702 706 703 707 // Calculate an exception handler vPC, unwinding call frames as necessary. … … 898 902 // Execute the code: 899 903 JSValue result = program->generatedJITCode()->execute(&vm, &protoCallFrame); 900 904 throwScope.release(); 901 905 return checkedReturn(result); 902 906 } … … 907 911 auto throwScope = DECLARE_THROW_SCOPE(vm); 908 912 909 ASSERT(! callFrame->hadException());913 ASSERT(!throwScope.exception()); 910 914 ASSERT(!vm.isCollectorBusy()); 911 915 if (vm.isCollectorBusy()) … … 970 974 auto throwScope = DECLARE_THROW_SCOPE(vm); 971 975 972 ASSERT(! callFrame->hadException());976 ASSERT(!throwScope.exception()); 973 977 ASSERT(!vm.isCollectorBusy()); 974 978 // We throw in this case because we have to return something "valid" but we're … … 1021 1025 result = JSValue::decode(vmEntryToNative(reinterpret_cast<void*>(constructData.native.function), &vm, &protoCallFrame)); 1022 1026 1023 if ( !callFrame->hadException())1027 if (LIKELY(!throwScope.exception())) 1024 1028 RELEASE_ASSERT(result.isObject()); 1025 1029 } 1026 1030 } 1027 1031 1028 if ( callFrame->hadException())1032 if (UNLIKELY(throwScope.exception())) 1029 1033 return 0; 1030 1034 ASSERT(result.isObject()); … … 1036 1040 VM& vm = *scope->vm(); 1037 1041 auto throwScope = DECLARE_THROW_SCOPE(vm); 1038 ASSERT(! vm.exception());1042 ASSERT(!throwScope.exception()); 1039 1043 1040 1044 if (vm.isCollectorBusy()) … … 1085 1089 1086 1090 ASSERT(scope->vm() == &callFrame->vm()); 1087 ASSERT(! vm.exception());1091 ASSERT(!throwScope.exception()); 1088 1092 ASSERT(!vm.isCollectorBusy()); 1089 1093 RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock()); … … 1191 1195 1192 1196 ASSERT(scope->vm() == &callFrame->vm()); 1193 ASSERT(! vm.exception());1197 ASSERT(!throwScope.exception()); 1194 1198 ASSERT(!vm.isCollectorBusy()); 1195 1199 RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock()); … … 1232 1236 NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID) 1233 1237 { 1238 VM& vm = callFrame->vm(); 1239 auto scope = DECLARE_CATCH_SCOPE(vm); 1234 1240 Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger(); 1235 1241 if (!debugger) … … 1237 1243 1238 1244 ASSERT(callFrame->codeBlock()->hasDebuggerRequests()); 1239 ASSERT (!callFrame->hadException());1245 ASSERT_UNUSED(scope, !scope.exception()); 1240 1246 1241 1247 switch (debugHookID) { … … 1259 1265 break; 1260 1266 } 1261 ASSERT(! callFrame->hadException());1262 } 1267 ASSERT(!scope.exception()); 1268 } 1263 1269 1264 1270 } // namespace JSC -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r205462 r205569 32 32 33 33 #include "ArgList.h" 34 #include "CatchScope.h" 34 35 #include "JSCJSValue.h" 35 36 #include "JSCell.h" … … 39 40 #include "StackAlignment.h" 40 41 #include "StackFrame.h" 42 #include "ThrowScope.h" 41 43 #include <wtf/HashMap.h> 42 44 #include <wtf/text/StringBuilder.h> … … 93 95 : m_vm(vm) 94 96 { 95 oldException = vm->exception(); 96 vm->clearException(); 97 auto scope = DECLARE_CATCH_SCOPE(*vm); 98 oldException = scope.exception(); 99 scope.clearException(); 97 100 } 98 101 ~SuspendExceptionScope() -
trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp
r201787 r205569 437 437 { 438 438 VM& vm = exec->vm(); 439 auto scope = DECLARE_THROW_SCOPE(vm); 439 440 JSArray* result = constructEmptyArray(exec, 0); 440 if (UNLIKELY( vm.exception()))441 if (UNLIKELY(scope.exception())) 441 442 return nullptr; 442 443 -
trunk/Source/JavaScriptCore/jit/JITCode.cpp
r191058 r205569 70 70 JSValue JITCode::execute(VM* vm, ProtoCallFrame* protoCallFrame) 71 71 { 72 auto scope = DECLARE_THROW_SCOPE(*vm); 72 73 void* entryAddress; 73 74 JSFunction* function = jsDynamicCast<JSFunction*>(protoCallFrame->callee()); … … 79 80 entryAddress = addressForCall(MustCheckArity).executableAddress(); 80 81 JSValue result = JSValue::decode(vmEntryToJavaScript(entryAddress, vm, protoCallFrame)); 81 return vm->exception() ? jsNull() : result;82 return scope.exception() ? jsNull() : result; 82 83 } 83 84 -
trunk/Source/JavaScriptCore/jit/JITExceptions.cpp
r205462 r205569 43 43 void genericUnwind(VM* vm, ExecState* callFrame, UnwindStart unwindStart) 44 44 { 45 auto scope = DECLARE_THROW_SCOPE(*vm); 45 46 if (Options::breakOnThrow()) { 46 47 CodeBlock* codeBlock = callFrame->codeBlock(); … … 59 60 vm->shadowChicken().log(*vm, shadowChickenTopFrame, ShadowChicken::Packet::throwPacket()); 60 61 61 Exception* exception = vm->exception();62 Exception* exception = scope.exception(); 62 63 RELEASE_ASSERT(exception); 63 64 HandlerInfo* handler = vm->interpreter->unwind(*vm, callFrame, exception, unwindStart); // This may update callFrame. -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r205462 r205569 276 276 PropertySlot slot(base, PropertySlot::InternalMethodType::HasProperty); 277 277 bool result = asObject(base)->getPropertySlot(exec, ident, slot); 278 if ( vm->exception())278 if (UNLIKELY(scope.exception())) 279 279 return JSValue::encode(jsUndefined()); 280 280 … … 490 490 { 491 491 VM& vm = callFrame->vm(); 492 auto scope = DECLARE_THROW_SCOPE(vm); 492 493 if (LIKELY(subscript.isUInt32())) { 493 494 byValInfo->tookSlowPath = true; … … 511 512 auto property = subscript.toPropertyKey(callFrame); 512 513 // Don't put to an object if toString threw an exception. 513 if ( callFrame->vm().exception())514 if (UNLIKELY(scope.exception())) 514 515 return; 515 516 … … 523 524 static void directPutByVal(CallFrame* callFrame, JSObject* baseObject, JSValue subscript, JSValue value, ByValInfo* byValInfo) 524 525 { 526 VM& vm = callFrame->vm(); 527 auto scope = DECLARE_THROW_SCOPE(vm); 525 528 bool isStrictMode = callFrame->codeBlock()->isStrictMode(); 526 529 if (LIKELY(subscript.isUInt32())) { … … 554 557 // Don't put to an object if toString threw an exception. 555 558 auto property = subscript.toPropertyKey(callFrame); 556 if ( callFrame->vm().exception())559 if (UNLIKELY(scope.exception())) 557 560 return; 558 561 … … 775 778 EncodedJSValue JIT_OPERATION operationCallEval(ExecState* exec, ExecState* execCallee) 776 779 { 777 UNUSED_PARAM(exec); 780 VM* vm = &exec->vm(); 781 auto scope = DECLARE_THROW_SCOPE(*vm); 778 782 779 783 execCallee->setCodeBlock(0); … … 782 786 return JSValue::encode(JSValue()); 783 787 784 VM* vm = &execCallee->vm();785 788 JSValue result = eval(execCallee); 786 if ( vm->exception())789 if (UNLIKELY(scope.exception())) 787 790 return EncodedJSValue(); 788 791 … … 808 811 execCallee->setCallee(asObject(callee)); 809 812 vm->hostCallReturnValue = JSValue::decode(callData.native.function(execCallee)); 810 if ( vm->exception()) {813 if (UNLIKELY(scope.exception())) { 811 814 return encodeResult( 812 815 vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(), … … 837 840 execCallee->setCallee(asObject(callee)); 838 841 vm->hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee)); 839 if ( vm->exception()) {842 if (UNLIKELY(scope.exception())) { 840 843 return encodeResult( 841 844 vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(), … … 1463 1466 static void putAccessorByVal(ExecState* exec, JSObject* base, JSValue subscript, int32_t attribute, JSObject* accessor, AccessorType accessorType) 1464 1467 { 1468 VM& vm = exec->vm(); 1469 auto scope = DECLARE_THROW_SCOPE(vm); 1465 1470 auto propertyKey = subscript.toPropertyKey(exec); 1466 if ( exec->hadException())1471 if (UNLIKELY(scope.exception())) 1467 1472 return; 1468 1473 … … 1609 1614 static JSValue getByVal(ExecState* exec, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 1610 1615 { 1616 VM& vm = exec->vm(); 1617 auto scope = DECLARE_THROW_SCOPE(vm); 1618 1611 1619 if (LIKELY(baseValue.isCell() && subscript.isString())) { 1612 VM& vm = exec->vm();1613 1620 Structure& structure = *baseValue.asCell()->structure(vm); 1614 1621 if (JSCell::canUseFastGetOwnProperty(structure)) { … … 1652 1659 1653 1660 baseValue.requireObjectCoercible(exec); 1654 if ( exec->hadException())1661 if (UNLIKELY(scope.exception())) 1655 1662 return jsUndefined(); 1656 1663 auto property = subscript.toPropertyKey(exec); 1657 if ( exec->hadException())1664 if (UNLIKELY(scope.exception())) 1658 1665 return jsUndefined(); 1659 1666 … … 1846 1853 VM& vm = exec->vm(); 1847 1854 NativeCallFrameTracer tracer(&vm, exec); 1855 auto scope = DECLARE_THROW_SCOPE(vm); 1848 1856 JSValue baseValue = JSValue::decode(encodedBase); 1849 1857 JSValue subscript = JSValue::decode(encodedSubscript); … … 1863 1871 } else { 1864 1872 baseValue.requireObjectCoercible(exec); 1865 if ( exec->hadException())1873 if (UNLIKELY(scope.exception())) 1866 1874 return JSValue::encode(jsUndefined()); 1867 1875 auto property = subscript.toPropertyKey(exec); 1868 if ( exec->hadException())1876 if (UNLIKELY(scope.exception())) 1869 1877 return JSValue::encode(jsUndefined()); 1870 1878 result = baseValue.get(exec, property); … … 1915 1923 couldDelete = baseObj->methodTable(vm)->deletePropertyByIndex(baseObj, exec, index); 1916 1924 else { 1917 if ( vm.exception())1925 if (UNLIKELY(scope.exception())) 1918 1926 return false; 1919 1927 Identifier property = key.toPropertyKey(exec); 1920 if ( vm.exception())1928 if (UNLIKELY(scope.exception())) 1921 1929 return false; 1922 1930 couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, property); … … 2123 2131 scope->methodTable()->put(scope, exec, ident, value, slot); 2124 2132 2125 if ( vm.exception())2133 if (UNLIKELY(throwScope.exception())) 2126 2134 return; 2127 2135 … … 2372 2380 ALWAYS_INLINE static EncodedJSValue unprofiledMul(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2373 2381 { 2382 auto scope = DECLARE_THROW_SCOPE(vm); 2374 2383 JSValue op1 = JSValue::decode(encodedOp1); 2375 2384 JSValue op2 = JSValue::decode(encodedOp2); 2376 2385 2377 2386 double a = op1.toNumber(exec); 2378 if (UNLIKELY( vm.exception()))2387 if (UNLIKELY(scope.exception())) 2379 2388 return JSValue::encode(JSValue()); 2380 2389 double b = op2.toNumber(exec); … … 2384 2393 ALWAYS_INLINE static EncodedJSValue profiledMul(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile, bool shouldObserveLHSAndRHSTypes = true) 2385 2394 { 2395 auto scope = DECLARE_THROW_SCOPE(vm); 2386 2396 JSValue op1 = JSValue::decode(encodedOp1); 2387 2397 JSValue op2 = JSValue::decode(encodedOp2); … … 2391 2401 2392 2402 double a = op1.toNumber(exec); 2393 if (UNLIKELY( vm.exception()))2403 if (UNLIKELY(scope.exception())) 2394 2404 return JSValue::encode(JSValue()); 2395 2405 double b = op2.toNumber(exec); 2396 if (UNLIKELY( vm.exception()))2406 if (UNLIKELY(scope.exception())) 2397 2407 return JSValue::encode(JSValue()); 2398 2408 … … 2469 2479 ALWAYS_INLINE static EncodedJSValue unprofiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2470 2480 { 2481 auto scope = DECLARE_THROW_SCOPE(vm); 2471 2482 JSValue op1 = JSValue::decode(encodedOp1); 2472 2483 JSValue op2 = JSValue::decode(encodedOp2); 2473 2484 2474 2485 double a = op1.toNumber(exec); 2475 if (UNLIKELY( vm.exception()))2486 if (UNLIKELY(scope.exception())) 2476 2487 return JSValue::encode(JSValue()); 2477 2488 double b = op2.toNumber(exec); … … 2481 2492 ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile, bool shouldObserveLHSAndRHSTypes = true) 2482 2493 { 2494 auto scope = DECLARE_THROW_SCOPE(vm); 2483 2495 JSValue op1 = JSValue::decode(encodedOp1); 2484 2496 JSValue op2 = JSValue::decode(encodedOp2); … … 2488 2500 2489 2501 double a = op1.toNumber(exec); 2490 if (UNLIKELY( vm.exception()))2502 if (UNLIKELY(scope.exception())) 2491 2503 return JSValue::encode(JSValue()); 2492 2504 double b = op2.toNumber(exec); 2493 if (UNLIKELY( vm.exception()))2505 if (UNLIKELY(scope.exception())) 2494 2506 return JSValue::encode(JSValue()); 2495 2507 … … 2581 2593 VM& vm = exec->vm(); 2582 2594 NativeCallFrameTracer tracer(&vm, exec); 2583 RELEASE_ASSERT(!!vm.exception()); 2584 2585 if (isTerminatedExecutionException(vm.exception())) { 2595 auto scope = DECLARE_THROW_SCOPE(vm); 2596 RELEASE_ASSERT(!!scope.exception()); 2597 2598 if (isTerminatedExecutionException(scope.exception())) { 2586 2599 genericUnwind(&vm, exec); 2587 2600 return 1; 2588 } else2589 2601 } 2602 return 0; 2590 2603 } 2591 2604 -
trunk/Source/JavaScriptCore/jsc.cpp
r205462 r205569 302 302 static bool getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName name, PropertySlot& slot) 303 303 { 304 VM& vm = exec->vm(); 305 auto scope = DECLARE_THROW_SCOPE(vm); 304 306 ImpureGetter* thisObject = jsCast<ImpureGetter*>(object); 305 307 … … 307 309 if (thisObject->m_delegate->getPropertySlot(exec, name, slot)) 308 310 return true; 309 if ( exec->hadException())311 if (UNLIKELY(scope.exception())) 310 312 return false; 311 313 } … … 1038 1040 JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue) 1039 1041 { 1042 VM& vm = globalObject->vm(); 1043 auto scope = DECLARE_CATCH_SCOPE(vm); 1044 1040 1045 JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject); 1041 1046 const Identifier key = keyValue.toPropertyKey(exec); 1042 if ( exec->hadException()) {1043 JSValue exception = exec->exception();1044 exec->clearException();1047 if (UNLIKELY(scope.exception())) { 1048 JSValue exception = scope.exception(); 1049 scope.clearException(); 1045 1050 return deferred->reject(exec, exception); 1046 1051 } … … 1055 1060 } else { 1056 1061 const Identifier referrer = referrerValue.toPropertyKey(exec); 1057 if ( exec->hadException()) {1058 JSValue exception = exec->exception();1059 exec->clearException();1062 if (UNLIKELY(scope.exception())) { 1063 JSValue exception = scope.exception(); 1064 scope.clearException(); 1060 1065 return deferred->reject(exec, exception); 1061 1066 } … … 1143 1148 JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key, JSValue) 1144 1149 { 1150 VM& vm = globalObject->vm(); 1151 auto scope = DECLARE_CATCH_SCOPE(vm); 1145 1152 JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject); 1146 1153 String moduleKey = key.toWTFString(exec); 1147 if ( exec->hadException()) {1148 JSValue exception = exec->exception();1149 exec->clearException();1154 if (UNLIKELY(scope.exception())) { 1155 JSValue exception = scope.exception(); 1156 scope.clearException(); 1150 1157 return deferred->reject(exec, exception); 1151 1158 } … … 1258 1265 { 1259 1266 VM& vm = exec->vm(); 1267 JSLockHolder lock(vm); 1260 1268 auto scope = DECLARE_THROW_SCOPE(vm); 1261 1269 1262 JSLockHolder lock(exec);1263 1270 Root* root = jsDynamicCast<Root*>(exec->argument(0)); 1264 1271 if (!root) … … 1448 1455 1449 1456 String fileName = exec->argument(0).toWTFString(exec); 1450 if ( exec->hadException())1457 if (UNLIKELY(scope.exception())) 1451 1458 return JSValue::encode(jsUndefined()); 1452 1459 Vector<char> script; … … 1482 1489 1483 1490 String source = exec->argument(0).toWTFString(exec); 1484 if ( exec->hadException())1491 if (UNLIKELY(scope.exception())) 1485 1492 return JSValue::encode(jsUndefined()); 1486 1493 … … 1510 1517 1511 1518 String fileName = exec->argument(0).toWTFString(exec); 1512 if ( exec->hadException())1519 if (UNLIKELY(scope.exception())) 1513 1520 return JSValue::encode(jsUndefined()); 1514 1521 Vector<char> script; … … 1531 1538 1532 1539 String sourceCode = exec->argument(0).toWTFString(exec); 1533 if ( exec->hadException())1540 if (UNLIKELY(scope.exception())) 1534 1541 return JSValue::encode(jsUndefined()); 1535 1542 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); … … 1548 1555 1549 1556 String fileName = exec->argument(0).toWTFString(exec); 1550 if ( exec->hadException())1557 if (UNLIKELY(scope.exception())) 1551 1558 return JSValue::encode(jsUndefined()); 1552 1559 Vector<char> script; … … 1563 1570 1564 1571 String fileName = exec->argument(0).toWTFString(exec); 1565 if ( exec->hadException())1572 if (UNLIKELY(scope.exception())) 1566 1573 return JSValue::encode(jsUndefined()); 1567 1574 Vector<char> script; … … 1623 1630 EncodedJSValue JSC_HOST_CALL functionSetRandomSeed(ExecState* exec) 1624 1631 { 1632 VM& vm = exec->vm(); 1633 auto scope = DECLARE_THROW_SCOPE(vm); 1634 1625 1635 unsigned seed = exec->argument(0).toUInt32(exec); 1626 if ( exec->hadException())1636 if (UNLIKELY(scope.exception())) 1627 1637 return JSValue::encode(jsUndefined()); 1628 1638 exec->lexicalGlobalObject()->weakRandom().setSeed(seed); … … 1877 1887 1878 1888 String fileName = exec->argument(0).toWTFString(exec); 1879 if ( exec->hadException())1889 if (UNLIKELY(scope.exception())) 1880 1890 return JSValue::encode(jsUndefined()); 1881 1891 Vector<char> script; … … 1884 1894 1885 1895 JSInternalPromise* promise = loadAndEvaluateModule(exec, fileName); 1886 if ( exec->hadException())1896 if (UNLIKELY(scope.exception())) 1887 1897 return JSValue::encode(jsUndefined()); 1888 1898 … … 1902 1912 EncodedJSValue JSC_HOST_CALL functionCreateBuiltin(ExecState* exec) 1903 1913 { 1914 VM& vm = exec->vm(); 1915 auto scope = DECLARE_THROW_SCOPE(vm); 1916 1904 1917 if (exec->argumentCount() < 1 || !exec->argument(0).isString()) 1905 1918 return JSValue::encode(jsUndefined()); 1906 1919 1907 1920 String functionText = exec->argument(0).toWTFString(exec); 1908 if ( exec->hadException())1921 if (UNLIKELY(scope.exception())) 1909 1922 return JSValue::encode(JSValue()); 1910 1923 1911 VM& vm = exec->vm();1912 1924 const SourceCode& source = makeSource(functionText); 1913 1925 JSFunction* func = JSFunction::createBuiltinFunction(vm, createBuiltinExecutable(vm, source, Identifier::fromString(&vm, "foo"), ConstructorKind::None, ConstructAbility::CannotConstruct)->link(vm, source), exec->lexicalGlobalObject()); … … 1928 1940 1929 1941 String source = exec->argument(0).toWTFString(exec); 1930 if ( exec->hadException())1942 if (UNLIKELY(scope.exception())) 1931 1943 return JSValue::encode(jsUndefined()); 1932 1944 … … 1954 1966 EncodedJSValue JSC_HOST_CALL functionGenerateHeapSnapshot(ExecState* exec) 1955 1967 { 1956 JSLockHolder lock(exec); 1968 VM& vm = exec->vm(); 1969 JSLockHolder lock(vm); 1970 auto scope = DECLARE_THROW_SCOPE(vm); 1957 1971 1958 1972 HeapSnapshotBuilder snapshotBuilder(exec->vm().ensureHeapProfiler()); … … 1961 1975 String jsonString = snapshotBuilder.json(); 1962 1976 EncodedJSValue result = JSValue::encode(JSONParse(exec, jsonString)); 1963 RELEASE_ASSERT(! exec->hadException());1977 RELEASE_ASSERT(!scope.exception()); 1964 1978 return result; 1965 1979 } … … 1999 2013 String jsonString = vm.samplingProfiler()->stackTracesAsJSON(); 2000 2014 EncodedJSValue result = JSValue::encode(JSONParse(exec, jsonString)); 2001 RELEASE_ASSERT(! exec->hadException());2015 RELEASE_ASSERT(!scope.exception()); 2002 2016 return result; 2003 2017 } … … 2102 2116 static void dumpException(GlobalObject* globalObject, JSValue exception) 2103 2117 { 2118 VM& vm = globalObject->vm(); 2119 auto scope = DECLARE_CATCH_SCOPE(vm); 2120 2121 #define CHECK_EXCEPTION() do { \ 2122 if (scope.exception()) { \ 2123 scope.clearException(); \ 2124 return; \ 2125 } \ 2126 } while (false) 2127 2104 2128 printf("Exception: %s\n", exception.toWTFString(globalObject->globalExec()).utf8().data()); 2105 2129 … … 2110 2134 2111 2135 JSValue nameValue = exception.get(globalObject->globalExec(), nameID); 2136 CHECK_EXCEPTION(); 2112 2137 JSValue fileNameValue = exception.get(globalObject->globalExec(), fileNameID); 2138 CHECK_EXCEPTION(); 2113 2139 JSValue lineNumberValue = exception.get(globalObject->globalExec(), lineNumberID); 2140 CHECK_EXCEPTION(); 2114 2141 JSValue stackValue = exception.get(globalObject->globalExec(), stackID); 2142 CHECK_EXCEPTION(); 2115 2143 2116 2144 if (nameValue.toWTFString(globalObject->globalExec()) == "SyntaxError" … … 2124 2152 if (!stackValue.isUndefinedOrNull()) 2125 2153 printf("%s\n", stackValue.toWTFString(globalObject->globalExec()).utf8().data()); 2154 2155 #undef CHECK_EXCEPTION 2126 2156 } 2127 2157 2128 2158 static bool checkUncaughtException(VM& vm, GlobalObject* globalObject, JSValue exception, const String& expectedExceptionName, bool alwaysDumpException) 2129 2159 { 2130 vm.clearException(); 2160 auto scope = DECLARE_CATCH_SCOPE(vm); 2161 scope.clearException(); 2131 2162 if (!exception) { 2132 2163 printf("Expected uncaught exception with name '%s' but none was thrown\n", expectedExceptionName.utf8().data()); … … 2136 2167 ExecState* exec = globalObject->globalExec(); 2137 2168 JSValue exceptionClass = globalObject->get(exec, Identifier::fromString(exec, expectedExceptionName)); 2138 if (!exceptionClass.isObject() || vm.exception()) {2169 if (!exceptionClass.isObject() || scope.exception()) { 2139 2170 printf("Expected uncaught exception with name '%s' but given exception class is not defined\n", expectedExceptionName.utf8().data()); 2140 2171 return false; … … 2142 2173 2143 2174 bool isInstanceOfExpectedException = jsCast<JSObject*>(exceptionClass)->hasInstance(exec, exception); 2144 if ( vm.exception()) {2175 if (scope.exception()) { 2145 2176 printf("Expected uncaught exception with name '%s' but given exception class fails performing hasInstance\n", expectedExceptionName.utf8().data()); 2146 2177 return false; … … 2166 2197 2167 2198 VM& vm = globalObject->vm(); 2199 auto scope = DECLARE_CATCH_SCOPE(vm); 2168 2200 bool success = true; 2169 2201 … … 2208 2240 if (!promise) 2209 2241 promise = loadAndEvaluateModule(globalObject->globalExec(), jscSource(scriptBuffer, fileName)); 2210 vm.clearException();2242 scope.clearException(); 2211 2243 2212 2244 JSFunction* fulfillHandler = JSNativeStdFunction::create(vm, globalObject, 1, String(), [&, isLastFile](ExecState* exec) { … … 2225 2257 NakedPtr<Exception> evaluationException; 2226 2258 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, fileName), JSValue(), evaluationException); 2259 ASSERT(!scope.exception()); 2227 2260 if (evaluationException) 2228 2261 returnValue = evaluationException->value(); … … 2231 2264 2232 2265 scriptBuffer.clear(); 2233 vm.clearException();2266 scope.clearException(); 2234 2267 } 2235 2268 … … 2244 2277 static void runInteractive(GlobalObject* globalObject) 2245 2278 { 2279 VM& vm = globalObject->vm(); 2280 auto scope = DECLARE_CATCH_SCOPE(vm); 2281 2246 2282 String interpreterName(ASCIILiteral("Interpreter")); 2247 2283 … … 2294 2330 printf("%s\n", returnValue.toWTFString(globalObject->globalExec()).utf8().data()); 2295 2331 2296 globalObject->globalExec()->clearException();2332 scope.clearException(); 2297 2333 globalObject->vm().drainMicrotasks(); 2298 2334 } -
trunk/Source/JavaScriptCore/llint/LLIntExceptions.cpp
r205462 r205569 47 47 #if LLINT_SLOW_PATH_TRACING 48 48 VM* vm = &exec->vm(); 49 dataLog("Throwing exception ", vm->exception(), " (returnToThrow).\n"); 49 auto scope = DECLARE_THROW_SCOPE(*vm); 50 dataLog("Throwing exception ", scope.exception(), " (returnToThrow).\n"); 50 51 #endif 51 52 return LLInt::exceptionInstructions(); … … 57 58 #if LLINT_SLOW_PATH_TRACING 58 59 VM* vm = &exec->vm(); 59 dataLog("Throwing exception ", vm->exception(), " (callToThrow).\n"); 60 auto scope = DECLARE_THROW_SCOPE(*vm); 61 dataLog("Throwing exception ", scope.exception(), " (callToThrow).\n"); 60 62 #endif 61 63 return LLInt::getCodePtr(llint_throw_during_call_trampoline); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r205198 r205569 883 883 // Don't put to an object if toString threw an exception. 884 884 auto property = subscript.toPropertyKey(exec); 885 if ( exec->vm().exception())885 if (throwScope.exception()) 886 886 LLINT_END(); 887 887 -
trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp
r205462 r205569 80 80 { 81 81 VM& vm = exec->vm(); 82 auto scope = DECLARE_THROW_SCOPE(vm); 82 83 JSArray* header = constructEmptyArray(exec, 0); 83 if (UNLIKELY( vm.exception()))84 if (UNLIKELY(scope.exception())) 84 85 return; 85 86 for (unsigned i = 0; i < m_header.size(); ++i) … … 88 89 89 90 JSArray* sequence = constructEmptyArray(exec, 0); 90 if (UNLIKELY( vm.exception()))91 if (UNLIKELY(scope.exception())) 91 92 return; 92 93 for (unsigned i = 0; i < m_sequence.size(); ++i) -
trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp
r201787 r205569 116 116 { 117 117 VM& vm = exec->vm(); 118 auto scope = DECLARE_THROW_SCOPE(vm); 118 119 JSObject* result = constructEmptyObject(exec); 119 if (UNLIKELY( vm.exception()))120 if (UNLIKELY(scope.exception())) 120 121 return jsUndefined(); 121 122 result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id())); … … 123 124 124 125 JSArray* profiledBytecodes = constructEmptyArray(exec, 0); 125 if (UNLIKELY( vm.exception()))126 if (UNLIKELY(scope.exception())) 126 127 return jsUndefined(); 127 128 for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i) … … 130 131 131 132 JSArray* descriptions = constructEmptyArray(exec, 0); 132 if (UNLIKELY( vm.exception()))133 if (UNLIKELY(scope.exception())) 133 134 return jsUndefined(); 134 135 for (unsigned i = 0; i < m_descriptions.size(); ++i) … … 137 138 138 139 JSArray* counters = constructEmptyArray(exec, 0); 139 if (UNLIKELY( vm.exception()))140 if (UNLIKELY(scope.exception())) 140 141 return jsUndefined(); 141 142 for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) { … … 148 149 149 150 JSArray* exitSites = constructEmptyArray(exec, 0); 150 if (UNLIKELY( vm.exception()))151 if (UNLIKELY(scope.exception())) 151 152 return jsUndefined(); 152 153 for (unsigned i = 0; i < m_osrExitSites.size(); ++i) … … 155 156 156 157 JSArray* exits = constructEmptyArray(exec, 0); 157 if (UNLIKELY( vm.exception()))158 if (UNLIKELY(scope.exception())) 158 159 return jsUndefined(); 159 160 for (unsigned i = 0; i < m_osrExits.size(); ++i) -
trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
r201787 r205569 101 101 { 102 102 VM& vm = exec->vm(); 103 auto scope = DECLARE_THROW_SCOPE(vm); 103 104 JSObject* result = constructEmptyObject(exec); 104 105 105 106 JSArray* bytecodes = constructEmptyArray(exec, 0); 106 if (UNLIKELY( vm.exception()))107 if (UNLIKELY(scope.exception())) 107 108 return jsUndefined(); 108 109 for (unsigned i = 0; i < m_bytecodes.size(); ++i) … … 111 112 112 113 JSArray* compilations = constructEmptyArray(exec, 0); 113 if (UNLIKELY( vm.exception()))114 if (UNLIKELY(scope.exception())) 114 115 return jsUndefined(); 115 116 for (unsigned i = 0; i < m_compilations.size(); ++i) … … 118 119 119 120 JSArray* events = constructEmptyArray(exec, 0); 120 if (UNLIKELY( vm.exception()))121 if (UNLIKELY(scope.exception())) 121 122 return jsUndefined(); 122 123 for (unsigned i = 0; i < m_events.size(); ++i) -
trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp
r201787 r205569 38 38 { 39 39 VM& vm = exec->vm(); 40 auto scope = DECLARE_THROW_SCOPE(vm); 40 41 JSArray* result = constructEmptyArray(exec, 0); 41 if (UNLIKELY( vm.exception()))42 if (UNLIKELY(scope.exception())) 42 43 return jsUndefined(); 43 44 for (unsigned i = 0; i < m_codeAddresses.size(); ++i) -
trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp
r201787 r205569 102 102 { 103 103 VM& vm = exec->vm(); 104 auto scope = DECLARE_THROW_SCOPE(vm); 104 105 JSArray* result = constructEmptyArray(exec, 0); 105 if (UNLIKELY( vm.exception()))106 if (UNLIKELY(scope.exception())) 106 107 return jsUndefined(); 107 108 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r205462 r205569 197 197 static ALWAYS_INLINE std::pair<SpeciesConstructResult, JSObject*> speciesConstructArray(ExecState* exec, JSObject* thisObject, unsigned length) 198 198 { 199 VM& vm = exec->vm(); 200 auto scope = DECLARE_THROW_SCOPE(vm); 201 199 202 // ECMA 9.4.2.3: https://tc39.github.io/ecma262/#sec-arrayspeciescreate 200 203 JSValue constructor = jsUndefined(); … … 206 209 207 210 constructor = thisObject->get(exec, exec->propertyNames().constructor); 208 if ( exec->hadException())211 if (UNLIKELY(scope.exception())) 209 212 return std::make_pair(SpeciesConstructResult::Exception, nullptr); 210 213 if (constructor.isConstructor()) { … … 215 218 if (constructor.isObject()) { 216 219 constructor = constructor.get(exec, exec->propertyNames().speciesSymbol); 217 if ( exec->hadException())220 if (UNLIKELY(scope.exception())) 218 221 return std::make_pair(SpeciesConstructResult::Exception, nullptr); 219 222 if (constructor.isNull()) 220 223 return std::make_pair(SpeciesConstructResult::FastPath, nullptr);; 221 224 } 222 } else if ( exec->hadException())225 } else if (UNLIKELY(scope.exception())) 223 226 return std::make_pair(SpeciesConstructResult::Exception, nullptr); 224 227 … … 229 232 args.append(jsNumber(length)); 230 233 JSObject* newObject = construct(exec, constructor, args, "Species construction did not get a valid constructor"); 231 if ( exec->hadException())234 if (UNLIKELY(scope.exception())) 232 235 return std::make_pair(SpeciesConstructResult::Exception, nullptr); 233 236 return std::make_pair(SpeciesConstructResult::CreatedObject, newObject); … … 285 288 unsigned to = k + resultCount; 286 289 if (JSValue value = getProperty(exec, thisObj, from)) { 287 if ( exec->hadException())290 if (UNLIKELY(scope.exception())) 288 291 return; 289 292 thisObj->putByIndexInline(exec, to, value, true); 290 if ( exec->hadException())293 if (UNLIKELY(scope.exception())) 291 294 return; 292 295 } else if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, to)) { … … 331 334 unsigned to = k + resultCount - 1; 332 335 if (JSValue value = getProperty(exec, thisObj, from)) { 333 if ( exec->hadException())336 if (UNLIKELY(scope.exception())) 334 337 return; 335 338 thisObj->putByIndexInline(exec, to, value, true); … … 338 341 return; 339 342 } 340 if ( exec->hadException())343 if (UNLIKELY(scope.exception())) 341 344 return; 342 345 } … … 345 348 EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) 346 349 { 350 VM& vm = exec->vm(); 351 auto scope = DECLARE_THROW_SCOPE(vm); 347 352 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 348 353 349 354 // 1. Let array be the result of calling ToObject on the this value. 350 355 JSObject* thisObject = thisValue.toObject(exec); 351 VM& vm = exec->vm(); 352 if (UNLIKELY(vm.exception())) 356 if (UNLIKELY(scope.exception())) 353 357 return JSValue::encode(jsUndefined()); 354 358 355 359 // 2. Let func be the result of calling the [[Get]] internal method of array with argument "join". 356 360 JSValue function = JSValue(thisObject).get(exec, exec->propertyNames().join); 357 if (UNLIKELY( vm.exception()))361 if (UNLIKELY(scope.exception())) 358 362 return JSValue::encode(jsUndefined()); 359 363 … … 384 388 385 389 JSStringJoiner joiner(*exec, ',', length); 386 if (UNLIKELY( vm.exception()))390 if (UNLIKELY(scope.exception())) 387 391 return JSValue::encode(jsUndefined()); 388 392 … … 391 395 if (!element) { 392 396 element = thisArray->get(exec, i); 393 if (UNLIKELY( vm.exception()))397 if (UNLIKELY(scope.exception())) 394 398 return JSValue::encode(jsUndefined()); 395 399 } 396 400 joiner.append(*exec, element); 397 if (UNLIKELY( vm.exception()))401 if (UNLIKELY(scope.exception())) 398 402 return JSValue::encode(jsUndefined()); 399 403 } … … 404 408 EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) 405 409 { 410 VM& vm = exec->vm(); 411 auto scope = DECLARE_THROW_SCOPE(vm); 406 412 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 407 413 408 414 JSObject* thisObject = thisValue.toObject(exec); 409 if ( exec->hadException())415 if (UNLIKELY(scope.exception())) 410 416 return JSValue::encode(jsUndefined()); 411 417 412 418 unsigned length = getLength(exec, thisObject); 413 if ( exec->hadException())419 if (UNLIKELY(scope.exception())) 414 420 return JSValue::encode(jsUndefined()); 415 421 … … 419 425 420 426 JSStringJoiner stringJoiner(*exec, ',', length); 421 if ( exec->hadException())427 if (UNLIKELY(scope.exception())) 422 428 return JSValue::encode(jsUndefined()); 423 429 … … 426 432 for (unsigned i = 0; i < length; ++i) { 427 433 JSValue element = thisObject->getIndex(exec, i); 428 if ( exec->hadException())434 if (UNLIKELY(scope.exception())) 429 435 return JSValue::encode(jsUndefined()); 430 436 if (element.isUndefinedOrNull()) … … 432 438 else { 433 439 JSValue conversionFunction = element.get(exec, exec->propertyNames().toLocaleString); 434 if ( exec->hadException())440 if (UNLIKELY(scope.exception())) 435 441 return JSValue::encode(jsUndefined()); 436 442 CallData callData; … … 438 444 if (callType != CallType::None) { 439 445 element = call(exec, conversionFunction, callType, callData, element, arguments); 440 if ( exec->hadException())446 if (UNLIKELY(scope.exception())) 441 447 return JSValue::encode(jsUndefined()); 442 448 } 443 449 } 444 450 stringJoiner.append(*exec, element); 445 if ( exec->hadException())451 if (UNLIKELY(scope.exception())) 446 452 return JSValue::encode(jsUndefined()); 447 453 } … … 449 455 for (unsigned i = 0; i < length; ++i) { 450 456 JSValue element = thisObject->getIndex(exec, i); 451 if ( exec->hadException())457 if (UNLIKELY(scope.exception())) 452 458 return JSValue::encode(jsUndefined()); 453 459 if (element.isUndefinedOrNull()) 454 460 continue; 455 461 JSValue conversionFunction = element.get(exec, exec->propertyNames().toLocaleString); 456 if ( exec->hadException())462 if (UNLIKELY(scope.exception())) 457 463 return JSValue::encode(jsUndefined()); 458 464 CallData callData; … … 460 466 if (callType != CallType::None) { 461 467 element = call(exec, conversionFunction, callType, callData, element, exec->emptyList()); 462 if ( exec->hadException())468 if (UNLIKELY(scope.exception())) 463 469 return JSValue::encode(jsUndefined()); 464 470 } 465 471 stringJoiner.append(*exec, element); 466 if ( exec->hadException())472 if (UNLIKELY(scope.exception())) 467 473 return JSValue::encode(jsUndefined()); 468 474 } … … 499 505 static JSValue slowJoin(ExecState& exec, JSObject* thisObject, JSString* separator, uint64_t length) 500 506 { 507 VM& vm = exec.vm(); 508 auto scope = DECLARE_THROW_SCOPE(vm); 509 501 510 // 5. If len is zero, return the empty String. 502 511 if (!length) 503 512 return jsEmptyString(&exec); 504 513 505 VM& vm = exec.vm();506 507 514 // 6. Let element0 be Get(O, "0"). 508 515 JSValue element0 = thisObject->getIndex(&exec, 0); 509 if ( vm.exception())516 if (UNLIKELY(scope.exception())) 510 517 return JSValue(); 511 518 … … 516 523 else 517 524 r = element0.toString(&exec); 518 if ( vm.exception())525 if (UNLIKELY(scope.exception())) 519 526 return JSValue(); 520 527 … … 525 532 // b. Let element be ? Get(O, ! ToString(k)). 526 533 JSValue element = thisObject->get(&exec, Identifier::fromString(&exec, AtomicString::number(k))); 527 if ( vm.exception())534 if (UNLIKELY(scope.exception())) 528 535 return JSValue(); 529 536 … … 536 543 } else 537 544 next = element.toString(&exec); 538 if ( vm.exception())545 if (UNLIKELY(scope.exception())) 539 546 return JSValue(); 540 547 … … 562 569 static inline JSValue fastJoin(ExecState& state, JSObject* thisObject, StringView separator, unsigned length) 563 570 { 571 VM& vm = state.vm(); 572 auto scope = DECLARE_THROW_SCOPE(vm); 573 564 574 switch (thisObject->indexingType()) { 565 575 case ALL_CONTIGUOUS_INDEXING_TYPES: … … 569 579 break; 570 580 JSStringJoiner joiner(state, separator, length); 571 if ( state.hadException())581 if (UNLIKELY(scope.exception())) 572 582 return jsUndefined(); 573 583 auto data = butterfly.contiguous().data(); … … 593 603 break; 594 604 JSStringJoiner joiner(state, separator, length); 595 if ( state.hadException())605 if (UNLIKELY(scope.exception())) 596 606 return jsUndefined(); 597 607 auto data = butterfly.contiguousDouble().data(); … … 603 613 else { 604 614 if (!holesKnownToBeOK) { 605 if (thisObject->structure( state.vm())->holesMustForwardToPrototype(state.vm()))615 if (thisObject->structure(vm)->holesMustForwardToPrototype(vm)) 606 616 goto generalCase; 607 617 holesKnownToBeOK = true; … … 616 626 generalCase: 617 627 JSStringJoiner joiner(state, separator, length); 618 if ( state.hadException())628 if (UNLIKELY(scope.exception())) 619 629 return jsUndefined(); 620 630 for (unsigned i = 0; i < length; ++i) { 621 631 JSValue element = thisObject->getIndex(&state, i); 622 if ( state.hadException())632 if (UNLIKELY(scope.exception())) 623 633 return jsUndefined(); 624 634 joiner.append(state, element); 625 if ( state.hadException())635 if (UNLIKELY(scope.exception())) 626 636 return jsUndefined(); 627 637 } … … 631 641 EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec) 632 642 { 643 VM& vm = exec->vm(); 644 auto scope = DECLARE_THROW_SCOPE(vm); 645 633 646 // 1. Let O be ? ToObject(this value). 634 647 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); … … 642 655 // 2. Let len be ? ToLength(? Get(O, "length")). 643 656 double length = toLength(exec, thisObject); 644 if ( exec->hadException())657 if (UNLIKELY(scope.exception())) 645 658 return JSValue::encode(JSValue()); 646 659 … … 654 667 ASSERT(static_cast<double>(length64) == length); 655 668 JSString* jsSeparator = jsSingleCharacterString(exec, comma); 656 if ( exec->hadException())669 if (UNLIKELY(scope.exception())) 657 670 return JSValue::encode(JSValue()); 658 671 … … 667 680 // 4. Let sep be ? ToString(separator). 668 681 JSString* jsSeparator = separatorValue.toString(exec); 669 if ( exec->hadException())682 if (UNLIKELY(scope.exception())) 670 683 return JSValue::encode(jsUndefined()); 671 684 … … 693 706 return JSValue::encode(JSValue()); 694 707 unsigned length = getLength(exec, thisObj); 695 if ( exec->hadException())708 if (UNLIKELY(scope.exception())) 696 709 return JSValue::encode(jsUndefined()); 697 710 … … 702 715 } else { 703 716 result = thisObj->get(exec, length - 1); 704 if ( exec->hadException())717 if (UNLIKELY(scope.exception())) 705 718 return JSValue::encode(jsUndefined()); 706 719 if (!thisObj->methodTable(vm)->deletePropertyByIndex(thisObj, exec, length - 1)) { … … 715 728 EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) 716 729 { 730 VM& vm = exec->vm(); 731 auto scope = DECLARE_THROW_SCOPE(vm); 717 732 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 718 733 … … 727 742 return JSValue::encode(JSValue()); 728 743 unsigned length = getLength(exec, thisObj); 729 if ( exec->hadException())744 if (UNLIKELY(scope.exception())) 730 745 return JSValue::encode(jsUndefined()); 731 746 … … 739 754 thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot); 740 755 } 741 if ( exec->hadException())756 if (UNLIKELY(scope.exception())) 742 757 return JSValue::encode(jsUndefined()); 743 758 } … … 758 773 759 774 unsigned length = getLength(exec, thisObject); 760 if ( vm.exception())775 if (UNLIKELY(scope.exception())) 761 776 return JSValue::encode(jsUndefined()); 762 777 … … 799 814 unsigned upper = length - lower - 1; 800 815 bool lowerExists = thisObject->hasProperty(exec, lower); 801 if ( vm.exception())816 if (UNLIKELY(scope.exception())) 802 817 return JSValue::encode(jsUndefined()); 803 818 JSValue lowerValue; 804 819 if (lowerExists) { 805 820 lowerValue = thisObject->get(exec, lower); 806 if (UNLIKELY( vm.exception()))821 if (UNLIKELY(scope.exception())) 807 822 return JSValue::encode(jsUndefined()); 808 823 } 809 824 810 825 bool upperExists = thisObject->hasProperty(exec, upper); 811 if (UNLIKELY( vm.exception()))826 if (UNLIKELY(scope.exception())) 812 827 return JSValue::encode(jsUndefined()); 813 828 JSValue upperValue; 814 829 if (upperExists) { 815 830 upperValue = thisObject->get(exec, upper); 816 if (UNLIKELY( vm.exception()))831 if (UNLIKELY(scope.exception())) 817 832 return JSValue::encode(jsUndefined()); 818 833 } … … 820 835 if (upperExists) { 821 836 thisObject->putByIndexInline(exec, lower, upperValue, true); 822 if ( vm.exception())837 if (UNLIKELY(scope.exception())) 823 838 return JSValue::encode(JSValue()); 824 839 } else if (!thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, lower)) { 825 if (! vm.exception())840 if (!scope.exception()) 826 841 throwTypeError(exec, scope, ASCIILiteral("Unable to delete property.")); 827 842 return JSValue::encode(JSValue()); … … 830 845 if (lowerExists) { 831 846 thisObject->putByIndexInline(exec, upper, lowerValue, true); 832 if ( vm.exception())847 if (UNLIKELY(scope.exception())) 833 848 return JSValue::encode(JSValue()); 834 849 } else if (!thisObject->methodTable(vm)->deletePropertyByIndex(thisObject, exec, upper)) { 835 if (! vm.exception())850 if (!scope.exception()) 836 851 throwTypeError(exec, scope, ASCIILiteral("Unable to delete property.")); 837 852 return JSValue::encode(JSValue()); … … 843 858 EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) 844 859 { 860 VM& vm = exec->vm(); 861 auto scope = DECLARE_THROW_SCOPE(vm); 845 862 JSObject* thisObj = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 846 863 if (!thisObj) 847 864 return JSValue::encode(JSValue()); 848 865 unsigned length = getLength(exec, thisObj); 849 if ( exec->hadException())866 if (UNLIKELY(scope.exception())) 850 867 return JSValue::encode(jsUndefined()); 851 868 … … 857 874 result = thisObj->getIndex(exec, 0); 858 875 shift<JSArray::ShiftCountForShift>(exec, thisObj, 0, 1, 0, length); 859 if ( exec->hadException())876 if (UNLIKELY(scope.exception())) 860 877 return JSValue::encode(jsUndefined()); 861 878 putLength(exec, thisObj, jsNumber(length - 1)); … … 868 885 // http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10 869 886 VM& vm = exec->vm(); 887 auto scope = DECLARE_THROW_SCOPE(vm); 870 888 JSObject* thisObj = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 871 889 if (!thisObj) 872 890 return JSValue::encode(JSValue()); 873 891 unsigned length = getLength(exec, thisObj); 874 if (UNLIKELY( vm.exception()))892 if (UNLIKELY(scope.exception())) 875 893 return JSValue::encode(jsUndefined()); 876 894 … … 893 911 else { 894 912 result = constructEmptyArray(exec, nullptr, end - begin); 895 if (UNLIKELY( vm.exception()))913 if (UNLIKELY(scope.exception())) 896 914 return JSValue::encode(jsUndefined()); 897 915 } … … 900 918 for (unsigned k = begin; k < end; k++, n++) { 901 919 JSValue v = getProperty(exec, thisObj, k); 902 if (UNLIKELY( vm.exception()))920 if (UNLIKELY(scope.exception())) 903 921 return JSValue::encode(jsUndefined()); 904 922 if (v) … … 920 938 return JSValue::encode(JSValue()); 921 939 unsigned length = getLength(exec, thisObj); 922 if (UNLIKELY( vm.exception()))940 if (UNLIKELY(scope.exception())) 923 941 return JSValue::encode(jsUndefined()); 924 942 … … 933 951 else { 934 952 result = constructEmptyArray(exec, nullptr); 935 if (UNLIKELY( vm.exception()))953 if (UNLIKELY(scope.exception())) 936 954 return JSValue::encode(jsUndefined()); 937 955 } … … 968 986 for (unsigned k = 0; k < deleteCount; ++k) { 969 987 JSValue v = getProperty(exec, thisObj, k + begin); 970 if (UNLIKELY( vm.exception()))988 if (UNLIKELY(scope.exception())) 971 989 return JSValue::encode(jsUndefined()); 972 990 if (UNLIKELY(!v)) 973 991 continue; 974 992 result->putByIndexInline(exec, k, v, true); 975 if (UNLIKELY( vm.exception()))993 if (UNLIKELY(scope.exception())) 976 994 return JSValue::encode(jsUndefined()); 977 995 } … … 983 1001 for (unsigned k = 0; k < deleteCount; ++k) { 984 1002 JSValue v = getProperty(exec, thisObj, k + begin); 985 if (UNLIKELY( vm.exception()))1003 if (UNLIKELY(scope.exception())) 986 1004 return JSValue::encode(jsUndefined()); 987 1005 if (UNLIKELY(!v)) … … 995 1013 if (additionalArgs < deleteCount) { 996 1014 shift<JSArray::ShiftCountForSplice>(exec, thisObj, begin, deleteCount, additionalArgs, length); 997 if (UNLIKELY( vm.exception()))1015 if (UNLIKELY(scope.exception())) 998 1016 return JSValue::encode(jsUndefined()); 999 1017 } else if (additionalArgs > deleteCount) { 1000 1018 unshift<JSArray::ShiftCountForSplice>(exec, thisObj, begin, deleteCount, additionalArgs, length); 1001 if (UNLIKELY( vm.exception()))1019 if (UNLIKELY(scope.exception())) 1002 1020 return JSValue::encode(jsUndefined()); 1003 1021 } 1004 1022 for (unsigned k = 0; k < additionalArgs; ++k) { 1005 1023 thisObj->putByIndexInline(exec, k + begin, exec->uncheckedArgument(k + 2), true); 1006 if (UNLIKELY( vm.exception()))1024 if (UNLIKELY(scope.exception())) 1007 1025 return JSValue::encode(jsUndefined()); 1008 1026 } … … 1014 1032 EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec) 1015 1033 { 1034 VM& vm = exec->vm(); 1035 auto scope = DECLARE_THROW_SCOPE(vm); 1016 1036 // 15.4.4.13 1017 1037 … … 1020 1040 return JSValue::encode(JSValue()); 1021 1041 unsigned length = getLength(exec, thisObj); 1022 if ( exec->hadException())1042 if (UNLIKELY(scope.exception())) 1023 1043 return JSValue::encode(jsUndefined()); 1024 1044 … … 1026 1046 if (nrArgs) { 1027 1047 unshift<JSArray::ShiftCountForShift>(exec, thisObj, 0, 0, nrArgs, length); 1028 if ( exec->hadException())1048 if (UNLIKELY(scope.exception())) 1029 1049 return JSValue::encode(jsUndefined()); 1030 1050 } 1031 1051 for (unsigned k = 0; k < nrArgs; ++k) { 1032 1052 thisObj->putByIndexInline(exec, k, exec->uncheckedArgument(k), true); 1033 if ( exec->hadException())1053 if (UNLIKELY(scope.exception())) 1034 1054 return JSValue::encode(jsUndefined()); 1035 1055 } … … 1041 1061 EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec) 1042 1062 { 1063 VM& vm = exec->vm(); 1064 auto scope = DECLARE_THROW_SCOPE(vm); 1065 1043 1066 // 15.4.4.14 1044 1067 JSObject* thisObj = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 1045 1068 if (!thisObj) 1046 1069 return JSValue::encode(JSValue()); 1047 VM& vm = exec->vm();1048 1070 unsigned length = getLength(exec, thisObj); 1049 if (UNLIKELY( vm.exception()))1071 if (UNLIKELY(scope.exception())) 1050 1072 return JSValue::encode(jsUndefined()); 1051 1073 … … 1054 1076 for (; index < length; ++index) { 1055 1077 JSValue e = getProperty(exec, thisObj, index); 1056 if (UNLIKELY( vm.exception()))1078 if (UNLIKELY(scope.exception())) 1057 1079 return JSValue::encode(jsUndefined()); 1058 1080 if (!e) … … 1060 1082 if (JSValue::strictEqual(exec, searchElement, e)) 1061 1083 return JSValue::encode(jsNumber(index)); 1062 if (UNLIKELY( vm.exception()))1084 if (UNLIKELY(scope.exception())) 1063 1085 return JSValue::encode(jsUndefined()); 1064 1086 } … … 1069 1091 EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) 1070 1092 { 1093 VM& vm = exec->vm(); 1094 auto scope = DECLARE_THROW_SCOPE(vm); 1095 1071 1096 // 15.4.4.15 1072 1097 JSObject* thisObj = exec->thisValue().toThis(exec, StrictMode).toObject(exec); … … 1090 1115 } 1091 1116 1092 VM& vm = exec->vm();1093 1117 JSValue searchElement = exec->argument(0); 1094 1118 do { 1095 1119 RELEASE_ASSERT(index < length); 1096 1120 JSValue e = getProperty(exec, thisObj, index); 1097 if (UNLIKELY( vm.exception()))1121 if (UNLIKELY(scope.exception())) 1098 1122 return JSValue::encode(jsUndefined()); 1099 1123 if (!e) … … 1101 1125 if (JSValue::strictEqual(exec, searchElement, e)) 1102 1126 return JSValue::encode(jsNumber(index)); 1103 if (UNLIKELY( vm.exception()))1127 if (UNLIKELY(scope.exception())) 1104 1128 return JSValue::encode(jsUndefined()); 1105 1129 } while (index--); … … 1110 1134 static bool moveElements(ExecState* exec, VM& vm, JSArray* target, unsigned targetOffset, JSArray* source, unsigned sourceLength) 1111 1135 { 1136 auto scope = DECLARE_THROW_SCOPE(vm); 1137 1112 1138 if (LIKELY(!hasAnyArrayStorage(source->indexingType()) && !source->structure()->holesMustForwardToPrototype(vm))) { 1113 1139 for (unsigned i = 0; i < sourceLength; ++i) { … … 1115 1141 if (value) { 1116 1142 target->putDirectIndex(exec, targetOffset + i, value); 1117 if ( vm.exception())1143 if (UNLIKELY(scope.exception())) 1118 1144 return false; 1119 1145 } … … 1122 1148 for (unsigned i = 0; i < sourceLength; ++i) { 1123 1149 JSValue value = getProperty(exec, source, i); 1124 if ( vm.exception())1150 if (UNLIKELY(scope.exception())) 1125 1151 return false; 1126 1152 if (value) { 1127 1153 target->putDirectIndex(exec, targetOffset + i, value); 1128 if ( vm.exception())1154 if (UNLIKELY(scope.exception())) 1129 1155 return false; 1130 1156 } … … 1155 1181 if (!result->appendMemcpy(exec, vm, 0, first)) { 1156 1182 if (!moveElements(exec, vm, result, 0, first, firstArraySize)) { 1157 ASSERT( vm.exception());1183 ASSERT(scope.exception()); 1158 1184 return JSValue::encode(JSValue()); 1159 1185 } … … 1200 1226 if (type == NonArray || !firstArray->canFastCopy(vm, secondArray) || firstArraySize + secondArraySize >= MIN_SPARSE_ARRAY_INDEX) { 1201 1227 JSArray* result = constructEmptyArray(exec, nullptr, firstArraySize + secondArraySize); 1202 if ( vm.exception())1228 if (UNLIKELY(scope.exception())) 1203 1229 return JSValue::encode(JSValue()); 1204 1230 1205 1231 if (!moveElements(exec, vm, result, 0, firstArray, firstArraySize) 1206 1232 || !moveElements(exec, vm, result, firstArraySize, secondArray, secondArraySize)) { 1207 ASSERT( vm.exception());1233 ASSERT(scope.exception()); 1208 1234 return JSValue::encode(JSValue()); 1209 1235 } -
trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
r197614 r205569 49 49 static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* exec) 50 50 { 51 VM& vm = exec->vm(); 52 auto scope = DECLARE_THROW_SCOPE(vm); 51 53 JSValue boolean = jsBoolean(exec->argument(0).toBoolean(exec)); 52 54 Structure* booleanStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); 53 if ( exec->hadException())55 if (UNLIKELY(scope.exception())) 54 56 return JSValue::encode(JSValue()); 55 BooleanObject* obj = BooleanObject::create( exec->vm(), booleanStructure);56 obj->setInternalValue( exec->vm(), boolean);57 BooleanObject* obj = BooleanObject::create(vm, booleanStructure); 58 obj->setInternalValue(vm, boolean); 57 59 return JSValue::encode(obj); 58 60 } -
trunk/Source/JavaScriptCore/runtime/CallData.cpp
r197614 r205569 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.2 * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 43 43 JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args, NakedPtr<Exception>& returnedException) 44 44 { 45 VM& vm = exec->vm(); 46 auto scope = DECLARE_CATCH_SCOPE(vm); 45 47 JSValue result = call(exec, functionObject, callType, callData, thisValue, args); 46 if ( exec->hadException()) {47 returnedException = exec->exception();48 exec->clearException();48 if (UNLIKELY(scope.exception())) { 49 returnedException = scope.exception(); 50 scope.clearException(); 49 51 return jsUndefined(); 50 52 } -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r205321 r205569 63 63 #define BEGIN_NO_SET_PC() \ 64 64 VM& vm = exec->vm(); \ 65 NativeCallFrameTracer tracer(&vm, exec) 65 NativeCallFrameTracer tracer(&vm, exec); \ 66 auto throwScope = DECLARE_THROW_SCOPE(vm); \ 67 UNUSED_PARAM(throwScope) 66 68 67 69 #ifndef NDEBUG … … 100 102 #define CHECK_EXCEPTION() do { \ 101 103 doExceptionFuzzingIfEnabled(exec, "CommonSlowPaths", pc); \ 102 if (UNLIKELY( vm.exception())) {\103 RETURN_TO_THROW(exec, pc); 104 if (UNLIKELY(throwScope.exception())) { \ 105 RETURN_TO_THROW(exec, pc); \ 104 106 END_IMPL(); \ 105 } 107 } \ 106 108 } while (false) 107 109 … … 145 147 ExecState* cceExec = (exec); \ 146 148 Instruction* ccePC = (pc); \ 147 if (UNLIKELY( vm.exception()))\149 if (UNLIKELY(throwScope.exception())) \ 148 150 CALL_END_IMPL(cceExec, LLInt::callToThrow(cceExec)); \ 149 151 } while (false) … … 428 430 JSValue right = OP_C(3).jsValue(); 429 431 double a = left.toNumber(exec); 430 if (UNLIKELY( vm.exception()))432 if (UNLIKELY(throwScope.exception())) 431 433 RETURN(JSValue()); 432 434 double b = right.toNumber(exec); … … 443 445 JSValue right = OP_C(3).jsValue(); 444 446 double a = left.toNumber(exec); 445 if (UNLIKELY( vm.exception()))447 if (UNLIKELY(throwScope.exception())) 446 448 RETURN(JSValue()); 447 449 double b = right.toNumber(exec); … … 458 460 JSValue right = OP_C(3).jsValue(); 459 461 double a = left.toNumber(exec); 460 if (UNLIKELY( vm.exception()))462 if (UNLIKELY(throwScope.exception())) 461 463 RETURN(JSValue()); 462 464 double b = right.toNumber(exec); 463 if (UNLIKELY( vm.exception()))465 if (UNLIKELY(throwScope.exception())) 464 466 RETURN(JSValue()); 465 467 JSValue result = jsNumber(a / b); … … 473 475 BEGIN(); 474 476 double a = OP_C(2).jsValue().toNumber(exec); 475 if (UNLIKELY( vm.exception()))477 if (UNLIKELY(throwScope.exception())) 476 478 RETURN(JSValue()); 477 479 double b = OP_C(3).jsValue().toNumber(exec); … … 483 485 BEGIN(); 484 486 double a = OP_C(2).jsValue().toNumber(exec); 485 if (UNLIKELY( vm.exception()))487 if (UNLIKELY(throwScope.exception())) 486 488 RETURN(JSValue()); 487 489 double b = OP_C(3).jsValue().toNumber(exec); 488 if (UNLIKELY( vm.exception()))490 if (UNLIKELY(throwScope.exception())) 489 491 RETURN(JSValue()); 490 492 RETURN(jsNumber(operationMathPow(a, b))); … … 495 497 BEGIN(); 496 498 int32_t a = OP_C(2).jsValue().toInt32(exec); 497 if (UNLIKELY( vm.exception()))499 if (UNLIKELY(throwScope.exception())) 498 500 RETURN(JSValue()); 499 501 uint32_t b = OP_C(3).jsValue().toUInt32(exec); … … 505 507 BEGIN(); 506 508 int32_t a = OP_C(2).jsValue().toInt32(exec); 507 if (UNLIKELY( vm.exception()))509 if (UNLIKELY(throwScope.exception())) 508 510 RETURN(JSValue()); 509 511 uint32_t b = OP_C(3).jsValue().toUInt32(exec); … … 515 517 BEGIN(); 516 518 uint32_t a = OP_C(2).jsValue().toUInt32(exec); 517 if (UNLIKELY( vm.exception()))519 if (UNLIKELY(throwScope.exception())) 518 520 RETURN(JSValue()); 519 521 uint32_t b = OP_C(3).jsValue().toUInt32(exec); … … 532 534 BEGIN(); 533 535 int32_t a = OP_C(2).jsValue().toInt32(exec); 534 if (UNLIKELY( vm.exception()))536 if (UNLIKELY(throwScope.exception())) 535 537 RETURN(JSValue()); 536 538 int32_t b = OP_C(3).jsValue().toInt32(exec); … … 542 544 BEGIN(); 543 545 int32_t a = OP_C(2).jsValue().toInt32(exec); 544 if (UNLIKELY( vm.exception()))546 if (UNLIKELY(throwScope.exception())) 545 547 RETURN(JSValue()); 546 548 int32_t b = OP_C(3).jsValue().toInt32(exec); … … 552 554 BEGIN(); 553 555 int32_t a = OP_C(2).jsValue().toInt32(exec); 554 if (UNLIKELY( vm.exception()))556 if (UNLIKELY(throwScope.exception())) 555 557 RETURN(JSValue()); 556 558 int32_t b = OP_C(3).jsValue().toInt32(exec); -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h
r205198 r205569 88 88 89 89 auto property = propName.toPropertyKey(exec); 90 if ( vm.exception())90 if (scope.exception()) 91 91 return false; 92 92 return baseObj->hasProperty(exec, property); -
trunk/Source/JavaScriptCore/runtime/CommonSlowPathsExceptions.cpp
r205462 r205569 44 44 throwException(exec, scope, error); 45 45 #if LLINT_SLOW_PATH_TRACING 46 dataLog("Throwing exception ", vm->exception(), ".\n");46 dataLog("Throwing exception ", scope.exception(), ".\n"); 47 47 #endif 48 48 } -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r205335 r205569 88 88 JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, NakedPtr<Exception>& returnedException) 89 89 { 90 JSLockHolder lock(exec); 91 RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); 92 RELEASE_ASSERT(!exec->vm().isCollectorBusy()); 90 VM& vm = exec->vm(); 91 JSLockHolder lock(vm); 92 auto scope = DECLARE_CATCH_SCOPE(vm); 93 RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); 94 RELEASE_ASSERT(!vm.isCollectorBusy()); 93 95 94 96 CodeProfiling profile(source); 95 97 96 98 ProgramExecutable* program = ProgramExecutable::create(exec, source); 99 ASSERT(scope.exception() || program); 97 100 if (!program) { 98 returnedException = exec->vm().exception();99 exec->vm().clearException();101 returnedException = scope.exception(); 102 scope.clearException(); 100 103 return jsUndefined(); 101 104 } … … 106 109 JSValue result = exec->interpreter()->execute(program, exec, thisObj); 107 110 108 if ( exec->hadException()) {109 returnedException = exec->exception();110 exec->clearException();111 if (scope.exception()) { 112 returnedException = scope.exception(); 113 scope.clearException(); 111 114 return jsUndefined(); 112 115 } … … 148 151 static JSInternalPromise* rejectPromise(ExecState* exec, JSGlobalObject* globalObject) 149 152 { 150 ASSERT(exec->hadException()); 151 JSValue exception = exec->exception()->value(); 152 exec->clearException(); 153 VM& vm = exec->vm(); 154 auto scope = DECLARE_CATCH_SCOPE(vm); 155 ASSERT(scope.exception()); 156 JSValue exception = scope.exception()->value(); 157 scope.clearException(); 153 158 JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject); 154 159 deferred->reject(exec, exception); … … 177 182 JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const SourceCode& source, JSValue initiator) 178 183 { 179 JSLockHolder lock(exec); 180 RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); 181 RELEASE_ASSERT(!exec->vm().isCollectorBusy()); 182 183 Symbol* key = createSymbolForEntryPointModule(exec->vm()); 184 VM& vm = exec->vm(); 185 JSLockHolder lock(vm); 186 auto scope = DECLARE_THROW_SCOPE(vm); 187 RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); 188 RELEASE_ASSERT(!vm.isCollectorBusy()); 189 190 Symbol* key = createSymbolForEntryPointModule(vm); 184 191 185 192 JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); … … 187 194 // Insert the given source code to the ModuleLoader registry as the fetched registry entry. 188 195 globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString()); 189 if ( exec->hadException())196 if (UNLIKELY(scope.exception())) 190 197 return rejectPromise(exec, globalObject); 191 198 … … 214 221 JSInternalPromise* loadModule(ExecState* exec, const SourceCode& source, JSValue initiator) 215 222 { 216 JSLockHolder lock(exec); 217 RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); 218 RELEASE_ASSERT(!exec->vm().isCollectorBusy()); 219 220 Symbol* key = createSymbolForEntryPointModule(exec->vm()); 223 VM& vm = exec->vm(); 224 JSLockHolder lock(vm); 225 auto scope = DECLARE_THROW_SCOPE(vm); 226 RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); 227 RELEASE_ASSERT(!vm.isCollectorBusy()); 228 229 Symbol* key = createSymbolForEntryPointModule(vm); 221 230 222 231 JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); … … 225 234 // FIXME: Introduce JSSourceCode object to wrap around this source. 226 235 globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString()); 227 if ( exec->hadException())236 if (UNLIKELY(scope.exception())) 228 237 return rejectPromise(exec, globalObject); 229 238 -
trunk/Source/JavaScriptCore/runtime/ConsoleObject.cpp
r200404 r205569 197 197 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState* exec) 198 198 { 199 VM& vm = exec->vm(); 200 auto scope = DECLARE_THROW_SCOPE(vm); 199 201 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 200 202 if (!client) … … 202 204 203 205 bool condition = exec->argument(0).toBoolean(exec); 204 if ( exec->hadException())206 if (UNLIKELY(scope.exception())) 205 207 return JSValue::encode(jsUndefined()); 206 208 … … 226 228 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState* exec) 227 229 { 230 VM& vm = exec->vm(); 231 auto scope = DECLARE_THROW_SCOPE(vm); 228 232 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 229 233 if (!client) … … 237 241 238 242 const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); 239 if ( exec->hadException())243 if (UNLIKELY(scope.exception())) 240 244 return JSValue::encode(jsUndefined()); 241 245 … … 246 250 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState* exec) 247 251 { 252 VM& vm = exec->vm(); 253 auto scope = DECLARE_THROW_SCOPE(vm); 248 254 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 249 255 if (!client) … … 257 263 258 264 const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); 259 if ( exec->hadException())265 if (UNLIKELY(scope.exception())) 260 266 return JSValue::encode(jsUndefined()); 261 267 … … 266 272 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState* exec) 267 273 { 274 VM& vm = exec->vm(); 275 auto scope = DECLARE_THROW_SCOPE(vm); 268 276 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 269 277 if (!client) … … 277 285 278 286 const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); 279 if ( exec->hadException())287 if (UNLIKELY(scope.exception())) 280 288 return JSValue::encode(jsUndefined()); 281 289 … … 293 301 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec) 294 302 { 303 VM& vm = exec->vm(); 304 auto scope = DECLARE_THROW_SCOPE(vm); 295 305 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 296 306 if (!client) … … 302 312 else { 303 313 title = valueOrDefaultLabelString(exec, exec->argument(0)); 304 if ( exec->hadException())314 if (UNLIKELY(scope.exception())) 305 315 return JSValue::encode(jsUndefined()); 306 316 } … … 312 322 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec) 313 323 { 324 VM& vm = exec->vm(); 325 auto scope = DECLARE_THROW_SCOPE(vm); 314 326 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 315 327 if (!client) … … 321 333 else { 322 334 title = valueOrDefaultLabelString(exec, exec->argument(0)); 323 if ( exec->hadException())335 if (UNLIKELY(scope.exception())) 324 336 return JSValue::encode(jsUndefined()); 325 337 } -
trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp
r201448 r205569 148 148 { 149 149 VM& vm = exec->vm(); 150 auto scope = DECLARE_THROW_SCOPE(vm); 150 151 int numArgs = args.size(); 151 152 … … 168 169 169 170 Structure* dateStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->dateStructure()); 170 if ( exec->hadException())171 if (UNLIKELY(scope.exception())) 171 172 return nullptr; 172 173 … … 203 204 EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec) 204 205 { 206 VM& vm = exec->vm(); 207 auto scope = DECLARE_THROW_SCOPE(vm); 205 208 String dateStr = exec->argument(0).toString(exec)->value(exec); 206 if ( exec->hadException())209 if (UNLIKELY(scope.exception())) 207 210 return JSValue::encode(jsUndefined()); 208 return JSValue::encode(jsNumber(parseDate( exec->vm(), dateStr)));211 return JSValue::encode(jsNumber(parseDate(vm, dateStr))); 209 212 } 210 213 -
trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp
r205198 r205569 604 604 EncodedJSValue JSC_HOST_CALL dateProtoFuncToPrimitiveSymbol(ExecState* exec) 605 605 { 606 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 606 VM& vm = exec->vm(); 607 auto scope = DECLARE_THROW_SCOPE(vm); 607 608 JSValue thisValue = exec->thisValue(); 608 609 if (!thisValue.isObject()) … … 615 616 JSValue hintValue = exec->uncheckedArgument(0); 616 617 PreferredPrimitiveType type = toPreferredPrimitiveType(exec, hintValue); 617 if ( exec->hadException())618 if (UNLIKELY(scope.exception())) 618 619 return JSValue::encode(JSValue()); 619 620 … … 1124 1125 EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec) 1125 1126 { 1126 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 1127 VM& vm = exec->vm(); 1128 auto scope = DECLARE_THROW_SCOPE(vm); 1127 1129 JSValue thisValue = exec->thisValue(); 1128 1130 JSObject* object = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode)); 1129 if ( exec->hadException())1131 if (UNLIKELY(scope.exception())) 1130 1132 return JSValue::encode(jsNull()); 1131 1133 1132 1134 JSValue timeValue = object->toPrimitive(exec, PreferNumber); 1133 if ( exec->hadException())1135 if (UNLIKELY(scope.exception())) 1134 1136 return JSValue::encode(jsNull()); 1135 1137 if (timeValue.isNumber() && !(timeValue.isInt32() || std::isfinite(timeValue.asDouble()))) 1136 1138 return JSValue::encode(jsNull()); 1137 1139 1138 JSValue toISOValue = object->get(exec, exec->vm().propertyNames->toISOString);1139 if ( exec->hadException())1140 JSValue toISOValue = object->get(exec, vm.propertyNames->toISOString); 1141 if (UNLIKELY(scope.exception())) 1140 1142 return JSValue::encode(jsNull()); 1141 1143 … … 1146 1148 1147 1149 JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList()); 1148 if ( exec->hadException())1150 if (UNLIKELY(scope.exception())) 1149 1151 return JSValue::encode(jsNull()); 1150 1152 if (result.isObject()) -
trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
r198469 r205569 51 51 EncodedJSValue JSC_HOST_CALL Interpreter::constructWithErrorConstructor(ExecState* exec) 52 52 { 53 VM& vm = exec->vm(); 54 auto scope = DECLARE_THROW_SCOPE(vm); 53 55 JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); 54 56 Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->errorStructure()); 55 if ( exec->hadException())57 if (UNLIKELY(scope.exception())) 56 58 return JSValue::encode(JSValue()); 57 59 return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)); -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp
r205462 r205569 159 159 { 160 160 VM& vm = exec->vm(); 161 auto scope = DECLARE_THROW_SCOPE(vm); 161 162 162 163 JSValue nameValue; … … 178 179 currentObj = obj->getPrototypeDirect(); 179 180 } 180 ASSERT(! vm.exception());181 ASSERT(!scope.exception()); 181 182 182 183 String nameString; … … 185 186 else { 186 187 nameString = nameValue.toString(exec)->value(exec); 187 if ( vm.exception())188 if (UNLIKELY(scope.exception())) 188 189 return String(); 189 190 } … … 194 195 if (JSObject::getOwnPropertySlot(this, exec, messagePropertName, messageSlot) && messageSlot.isValue()) 195 196 messageValue = messageSlot.getValue(exec, messagePropertName); 196 ASSERT(! vm.exception());197 ASSERT(!scope.exception()); 197 198 198 199 String messageString; … … 201 202 else { 202 203 messageString = messageValue.toString(exec)->value(exec); 203 if ( vm.exception())204 if (UNLIKELY(scope.exception())) 204 205 return String(); 205 206 } -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r205198 r205569 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 ( exec->hadException())88 if (UNLIKELY(scope.exception())) 89 89 return JSValue::encode(jsUndefined()); 90 90 … … 95 95 else { 96 96 nameString = name.toString(exec)->value(exec); 97 if ( exec->hadException())97 if (UNLIKELY(scope.exception())) 98 98 return JSValue::encode(jsUndefined()); 99 99 } … … 101 101 // 5. Let msg be the result of calling the [[Get]] internal method of O with argument "message". 102 102 JSValue message = thisObj->get(exec, exec->propertyNames().message); 103 if ( exec->hadException())103 if (UNLIKELY(scope.exception())) 104 104 return JSValue::encode(jsUndefined()); 105 105 … … 112 112 else { 113 113 messageString = message.toString(exec)->value(exec); 114 if ( exec->hadException())114 if (UNLIKELY(scope.exception())) 115 115 return JSValue::encode(jsUndefined()); 116 116 } -
trunk/Source/JavaScriptCore/runtime/ExceptionEventLocation.h
r205568 r205569 28 28 namespace JSC { 29 29 30 struct ThrowScopeLocation {31 ThrowScopeLocation() { }32 ThrowScopeLocation(const char* functionName, const char* file, unsigned line)30 struct ExceptionEventLocation { 31 ExceptionEventLocation() { } 32 ExceptionEventLocation(const char* functionName, const char* file, unsigned line) 33 33 : functionName(functionName) 34 34 , file(file) … … 42 42 43 43 } // namespace JSC 44 45 namespace WTF { 46 47 class PrintStream; 48 49 void printInternal(PrintStream&, JSC::ExceptionEventLocation); 50 51 } // namespace WTF -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.h
r205198 r205569 30 30 #define ExceptionHelpers_h 31 31 32 #include "CatchScope.h" 32 33 #include "ErrorInstance.h" 33 34 #include "JSObject.h" -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r205198 r205569 127 127 128 128 Structure* subclassStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->functionStructure()); 129 if ( exec->hadException())129 if (UNLIKELY(scope.exception())) 130 130 return nullptr; 131 131 -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
r205198 r205569 161 161 unsigned length = 0; 162 162 if (targetObject->hasOwnProperty(exec, exec->propertyNames().length)) { 163 if ( exec->hadException())163 if (UNLIKELY(scope.exception())) 164 164 return JSValue::encode(jsUndefined()); 165 165 -
trunk/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
r198270 r205569 220 220 void GenericArguments<Type>::copyToArguments(ExecState* exec, VirtualRegister firstElementDest, unsigned offset, unsigned length) 221 221 { 222 VM& vm = exec->vm(); 223 auto scope = DECLARE_THROW_SCOPE(vm); 224 222 225 Type* thisObject = static_cast<Type*>(this); 223 226 for (unsigned i = 0; i < length; ++i) { … … 226 229 else { 227 230 exec->r(firstElementDest + i) = get(exec, i + offset); 228 if (UNLIKELY( exec->vm().exception()))231 if (UNLIKELY(scope.exception())) 229 232 return; 230 233 } -
trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp
r205198 r205569 74 74 JSValue callGetter(ExecState* exec, JSValue base, JSValue getterSetter) 75 75 { 76 VM& vm = exec->vm(); 77 auto scope = DECLARE_THROW_SCOPE(vm); 76 78 // FIXME: Some callers may invoke get() without checking for an exception first. 77 79 // We work around that by checking here. 78 if ( exec->hadException())79 return exec->exception()->value();80 if (UNLIKELY(scope.exception())) 81 return scope.exception()->value(); 80 82 81 83 JSObject* getter = jsCast<GetterSetter*>(getterSetter)->getter(); 82 84 83 85 CallData callData; 84 CallType callType = getter->methodTable( exec->vm())->getCallData(getter, callData);86 CallType callType = getter->methodTable(vm)->getCallData(getter, callData); 85 87 return call(exec, getter, callType, callData, base, ArgList()); 86 88 } -
trunk/Source/JavaScriptCore/runtime/InspectorInstrumentationObject.cpp
r201448 r205569 84 84 EncodedJSValue JSC_HOST_CALL inspectorInstrumentationObjectLog(ExecState* exec) 85 85 { 86 VM& vm = exec->vm(); 87 auto scope = DECLARE_THROW_SCOPE(vm); 86 88 JSValue target = exec->argument(0); 87 89 String value = target.toString(exec)->value(exec); 88 if ( exec->hadException())90 if (UNLIKELY(scope.exception())) 89 91 return JSValue::encode(jsUndefined()); 90 92 dataLog(value, "\n"); -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r205462 r205569 98 98 99 99 VM& vm = exec->vm(); 100 auto scope = DECLARE_THROW_SCOPE(vm); 100 101 // We allow newTarget == JSValue() because the API needs to be able to create classes without having a real JS frame. 101 102 // Since we don't allow subclassing in the API we just treat newTarget == JSValue() as newTarget == exec->callee() … … 113 114 // Note, Reflect.construct might cause the profile to churn but we don't care. 114 115 JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype); 115 if (UNLIKELY( vm.exception()))116 if (UNLIKELY(scope.exception())) 116 117 return nullptr; 117 118 if (JSObject* prototype = jsDynamicCast<JSObject*>(prototypeValue)) … … 119 120 } else { 120 121 JSValue prototypeValue = newTarget.get(exec, exec->propertyNames().prototype); 121 if (UNLIKELY( vm.exception()))122 if (UNLIKELY(scope.exception())) 122 123 return nullptr; 123 124 if (JSObject* prototype = jsDynamicCast<JSObject*>(prototypeValue)) { -
trunk/Source/JavaScriptCore/runtime/IntlCollator.cpp
r205462 r205569 163 163 void IntlCollator::initializeCollator(ExecState& state, JSValue locales, JSValue optionsValue) 164 164 { 165 VM& vm = state.vm(); 166 auto scope = DECLARE_THROW_SCOPE(vm); 167 165 168 // 10.1.1 InitializeCollator (collator, locales, options) (ECMA-402 2.0) 166 169 // 1. If collator has an [[initializedIntlObject]] internal slot with value true, throw a TypeError exception. … … 170 173 auto requestedLocales = canonicalizeLocaleList(state, locales); 171 174 // 4. ReturnIfAbrupt(requestedLocales). 172 if ( state.hadException())175 if (UNLIKELY(scope.exception())) 173 176 return; 174 177 … … 182 185 options = optionsValue.toObject(&state); 183 186 // b. ReturnIfAbrupt(options). 184 if ( state.hadException())187 if (UNLIKELY(scope.exception())) 185 188 return; 186 189 } 187 190 188 191 // 7. Let u be GetOption(options, "usage", "string", «"sort", "search"», "sort"). 189 String usageString = intlStringOption(state, options, state.vm().propertyNames->usage, { "sort", "search" }, "usage must be either \"sort\" or \"search\"", "sort");192 String usageString = intlStringOption(state, options, vm.propertyNames->usage, { "sort", "search" }, "usage must be either \"sort\" or \"search\"", "sort"); 190 193 // 8. ReturnIfAbrupt(u). 191 if ( state.hadException())194 if (UNLIKELY(scope.exception())) 192 195 return; 193 196 // 9. Set collator.[[usage]] to u. … … 213 216 214 217 // 13. Let matcher be GetOption(options, "localeMatcher", "string", «"lookup", "best fit"», "best fit"). 215 String matcher = intlStringOption(state, options, state.vm().propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit");218 String matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 216 219 // 14. ReturnIfAbrupt(matcher). 217 if ( state.hadException())220 if (UNLIKELY(scope.exception())) 218 221 return; 219 222 // 15. Set opt.[[localeMatcher]] to matcher. … … 234 237 String numericString; 235 238 bool usesFallback; 236 bool numeric = intlBooleanOption(state, options, state.vm().propertyNames->numeric, usesFallback);237 if ( state.hadException())239 bool numeric = intlBooleanOption(state, options, vm.propertyNames->numeric, usesFallback); 240 if (UNLIKELY(scope.exception())) 238 241 return; 239 242 if (!usesFallback) … … 242 245 } 243 246 { 244 String caseFirst = intlStringOption(state, options, state.vm().propertyNames->caseFirst, { "upper", "lower", "false" }, "caseFirst must be either \"upper\", \"lower\", or \"false\"", nullptr);245 if ( state.hadException())247 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())) 246 249 return; 247 250 opt.add(ASCIILiteral("kf"), caseFirst); … … 278 281 279 282 // 24. Let s be GetOption(options, "sensitivity", "string", «"base", "accent", "case", "variant"», undefined). 280 String sensitivityString = intlStringOption(state, options, state.vm().propertyNames->sensitivity, { "base", "accent", "case", "variant" }, "sensitivity must be either \"base\", \"accent\", \"case\", or \"variant\"", nullptr);283 String sensitivityString = intlStringOption(state, options, vm.propertyNames->sensitivity, { "base", "accent", "case", "variant" }, "sensitivity must be either \"base\", \"accent\", \"case\", or \"variant\"", nullptr); 281 284 // 25. ReturnIfAbrupt(s). 282 if ( state.hadException())285 if (UNLIKELY(scope.exception())) 283 286 return; 284 287 // 26. If s is undefined, then … … 301 304 // 28. Let ip be GetOption(options, "ignorePunctuation", "boolean", undefined, false). 302 305 bool usesFallback; 303 bool ignorePunctuation = intlBooleanOption(state, options, state.vm().propertyNames->ignorePunctuation, usesFallback);306 bool ignorePunctuation = intlBooleanOption(state, options, vm.propertyNames->ignorePunctuation, usesFallback); 304 307 if (usesFallback) 305 308 ignorePunctuation = false; 306 309 // 29. ReturnIfAbrupt(ip). 307 if ( state.hadException())310 if (UNLIKELY(scope.exception())) 308 311 return; 309 312 // 30. Set collator.[[ignorePunctuation]] to ip. … … 319 322 void IntlCollator::createCollator(ExecState& state) 320 323 { 324 VM& vm = state.vm(); 325 auto scope = DECLARE_CATCH_SCOPE(vm); 321 326 ASSERT(!m_collator); 322 327 323 328 if (!m_initializedCollator) { 324 329 initializeCollator(state, jsUndefined(), jsUndefined()); 325 ASSERT (!state.hadException());330 ASSERT_UNUSED(scope, !scope.exception()); 326 331 } 327 332 … … 417 422 JSObject* IntlCollator::resolvedOptions(ExecState& state) 418 423 { 424 VM& vm = state.vm(); 425 auto scope = DECLARE_THROW_SCOPE(vm); 426 419 427 // 10.3.5 Intl.Collator.prototype.resolvedOptions() (ECMA-402 2.0) 420 428 // The function returns a new object whose properties and attributes are set as if … … 428 436 if (!m_initializedCollator) { 429 437 initializeCollator(state, jsUndefined(), jsUndefined()); 430 ASSERT(!state.hadException()); 431 } 432 433 VM& vm = state.vm(); 438 ASSERT_UNUSED(scope, !scope.exception()); 439 } 440 434 441 JSObject* options = constructEmptyObject(&state); 435 442 options->putDirect(vm, vm.propertyNames->locale, jsString(&state, m_locale)); -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp
r205462 r205569 84 84 static EncodedJSValue JSC_HOST_CALL constructIntlCollator(ExecState* state) 85 85 { 86 VM& vm = state->vm(); 87 auto scope = DECLARE_THROW_SCOPE(vm); 86 88 // 10.1.2 Intl.Collator ([locales [, options]]) (ECMA-402 2.0) 87 89 // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. … … 89 91 // 3. ReturnIfAbrupt(collator). 90 92 Structure* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), jsCast<IntlCollatorConstructor*>(state->callee())->collatorStructure()); 91 if ( state->hadException())93 if (UNLIKELY(scope.exception())) 92 94 return JSValue::encode(jsUndefined()); 93 IntlCollator* collator = IntlCollator::create( state->vm(), structure);95 IntlCollator* collator = IntlCollator::create(vm, structure); 94 96 ASSERT(collator); 95 97 … … 135 137 EncodedJSValue JSC_HOST_CALL IntlCollatorConstructorFuncSupportedLocalesOf(ExecState* state) 136 138 { 139 VM& vm = state->vm(); 140 auto scope = DECLARE_THROW_SCOPE(vm); 137 141 // 10.2.2 Intl.Collator.supportedLocalesOf(locales [, options]) (ECMA-402 2.0) 138 142 … … 141 145 142 146 // 2. ReturnIfAbrupt(requestedLocales). 143 if ( state->hadException())147 if (UNLIKELY(scope.exception())) 144 148 return JSValue::encode(jsUndefined()); 145 149 -
trunk/Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp
r205462 r205569 79 79 static EncodedJSValue JSC_HOST_CALL IntlCollatorFuncCompare(ExecState* state) 80 80 { 81 VM& vm = state->vm(); 82 auto scope = DECLARE_THROW_SCOPE(vm); 81 83 // 10.3.4 Collator Compare Functions (ECMA-402 2.0) 82 84 // 1. Let collator be the this value. … … 89 91 JSString* x = state->argument(0).toString(state); 90 92 // 6. ReturnIfAbrupt(X). 91 if ( state->hadException())93 if (UNLIKELY(scope.exception())) 92 94 return JSValue::encode(jsUndefined()); 93 95 … … 95 97 JSString* y = state->argument(1).toString(state); 96 98 // 8. ReturnIfAbrupt(Y). 97 if ( state->hadException())99 if (UNLIKELY(scope.exception())) 98 100 return JSValue::encode(jsUndefined()); 99 101 … … 123 125 // c. Let bc be BoundFunctionCreate(F, «this value»). 124 126 boundCompare = JSBoundFunction::create(vm, state, globalObject, targetObject, collator, nullptr, 2, ASCIILiteral("compare")); 125 if ( vm.exception())127 if (UNLIKELY(scope.exception())) 126 128 return JSValue::encode(JSValue()); 127 129 // d. Set collator.[[boundCompare]] to bc. -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
r205462 r205569 216 216 // 12.1.1 ToDateTimeOptions abstract operation (ECMA-402 2.0) 217 217 VM& vm = exec.vm(); 218 auto scope = DECLARE_THROW_SCOPE(vm); 218 219 219 220 // 1. If options is undefined, then let options be null, else let options be ToObject(options). … … 225 226 else { 226 227 JSObject* originalToObject = originalOptions.toObject(&exec); 227 if ( exec.hadException())228 if (UNLIKELY(scope.exception())) 228 229 return nullptr; 229 230 options = constructEmptyObject(&exec, originalToObject); … … 242 243 // iv. If value is not undefined, then let needDefaults be false. 243 244 JSValue weekday = options->get(&exec, vm.propertyNames->weekday); 244 if ( exec.hadException())245 if (UNLIKELY(scope.exception())) 245 246 return nullptr; 246 247 if (!weekday.isUndefined()) … … 248 249 249 250 JSValue year = options->get(&exec, vm.propertyNames->year); 250 if ( exec.hadException())251 if (UNLIKELY(scope.exception())) 251 252 return nullptr; 252 253 if (!year.isUndefined()) … … 254 255 255 256 JSValue month = options->get(&exec, vm.propertyNames->month); 256 if ( exec.hadException())257 if (UNLIKELY(scope.exception())) 257 258 return nullptr; 258 259 if (!month.isUndefined()) … … 260 261 261 262 JSValue day = options->get(&exec, vm.propertyNames->day); 262 if ( exec.hadException())263 if (UNLIKELY(scope.exception())) 263 264 return nullptr; 264 265 if (!day.isUndefined()) … … 274 275 // iv. If value is not undefined, then let needDefaults be false. 275 276 JSValue hour = options->get(&exec, vm.propertyNames->hour); 276 if ( exec.hadException())277 if (UNLIKELY(scope.exception())) 277 278 return nullptr; 278 279 if (!hour.isUndefined()) … … 280 281 281 282 JSValue minute = options->get(&exec, vm.propertyNames->minute); 282 if ( exec.hadException())283 if (UNLIKELY(scope.exception())) 283 284 return nullptr; 284 285 if (!minute.isUndefined()) … … 286 287 287 288 JSValue second = options->get(&exec, vm.propertyNames->second); 288 if ( exec.hadException())289 if (UNLIKELY(scope.exception())) 289 290 return nullptr; 290 291 if (!second.isUndefined()) … … 300 301 301 302 options->putDirect(vm, vm.propertyNames->year, numeric); 302 if ( exec.hadException())303 if (UNLIKELY(scope.exception())) 303 304 return nullptr; 304 305 305 306 options->putDirect(vm, vm.propertyNames->month, numeric); 306 if ( exec.hadException())307 if (UNLIKELY(scope.exception())) 307 308 return nullptr; 308 309 309 310 options->putDirect(vm, vm.propertyNames->day, numeric); 310 if ( exec.hadException())311 if (UNLIKELY(scope.exception())) 311 312 return nullptr; 312 313 } … … 429 430 Vector<String> requestedLocales = canonicalizeLocaleList(exec, locales); 430 431 // 4. ReturnIfAbrupt(requestedLocales), 431 if ( exec.hadException())432 if (UNLIKELY(scope.exception())) 432 433 return; 433 434 … … 435 436 JSObject* options = toDateTimeOptionsAnyDate(exec, originalOptions); 436 437 // 6. ReturnIfAbrupt(options). 437 if ( exec.hadException())438 if (UNLIKELY(scope.exception())) 438 439 return; 439 440 … … 444 445 String localeMatcher = intlStringOption(exec, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 445 446 // 9. ReturnIfAbrupt(matcher). 446 if ( exec.hadException())447 if (UNLIKELY(scope.exception())) 447 448 return; 448 449 // 10. Set opt.[[localeMatcher]] to matcher. … … 473 474 JSValue tzValue = options->get(&exec, vm.propertyNames->timeZone); 474 475 // 18. ReturnIfAbrupt(tz). 475 if ( exec.hadException())476 if (UNLIKELY(scope.exception())) 476 477 return; 477 478 … … 482 483 String originalTz = tzValue.toWTFString(&exec); 483 484 // b. ReturnIfAbrupt(tz). 484 if ( exec.hadException())485 if (UNLIKELY(scope.exception())) 485 486 return; 486 487 // c. If the result of IsValidTimeZoneName(tz) is false, then i. Throw a RangeError exception. … … 515 516 516 517 String weekday = intlStringOption(exec, options, vm.propertyNames->weekday, narrowShortLong, "weekday must be \"narrow\", \"short\", or \"long\"", nullptr); 517 if ( exec.hadException())518 if (UNLIKELY(scope.exception())) 518 519 return; 519 520 if (!weekday.isNull()) { … … 527 528 528 529 String era = intlStringOption(exec, options, vm.propertyNames->era, narrowShortLong, "era must be \"narrow\", \"short\", or \"long\"", nullptr); 529 if ( exec.hadException())530 if (UNLIKELY(scope.exception())) 530 531 return; 531 532 if (!era.isNull()) { … … 539 540 540 541 String year = intlStringOption(exec, options, vm.propertyNames->year, twoDigitNumeric, "year must be \"2-digit\" or \"numeric\"", nullptr); 541 if ( exec.hadException())542 if (UNLIKELY(scope.exception())) 542 543 return; 543 544 if (!year.isNull()) { … … 549 550 550 551 String month = intlStringOption(exec, options, vm.propertyNames->month, twoDigitNumericNarrowShortLong, "month must be \"2-digit\", \"numeric\", \"narrow\", \"short\", or \"long\"", nullptr); 551 if ( exec.hadException())552 if (UNLIKELY(scope.exception())) 552 553 return; 553 554 if (!month.isNull()) { … … 565 566 566 567 String day = intlStringOption(exec, options, vm.propertyNames->day, twoDigitNumeric, "day must be \"2-digit\" or \"numeric\"", nullptr); 567 if ( exec.hadException())568 if (UNLIKELY(scope.exception())) 568 569 return; 569 570 if (!day.isNull()) { … … 575 576 576 577 String hour = intlStringOption(exec, options, vm.propertyNames->hour, twoDigitNumeric, "hour must be \"2-digit\" or \"numeric\"", nullptr); 577 if ( exec.hadException())578 if (UNLIKELY(scope.exception())) 578 579 return; 579 580 … … 583 584 bool hr12 = intlBooleanOption(exec, options, vm.propertyNames->hour12, isHour12Undefined); 584 585 // 33. ReturnIfAbrupt(hr12). 585 if ( exec.hadException())586 if (UNLIKELY(scope.exception())) 586 587 return; 587 588 … … 606 607 607 608 String minute = intlStringOption(exec, options, vm.propertyNames->minute, twoDigitNumeric, "minute must be \"2-digit\" or \"numeric\"", nullptr); 608 if ( exec.hadException())609 if (UNLIKELY(scope.exception())) 609 610 return; 610 611 if (!minute.isNull()) { … … 616 617 617 618 String second = intlStringOption(exec, options, vm.propertyNames->second, twoDigitNumeric, "second must be \"2-digit\" or \"numeric\"", nullptr); 618 if ( exec.hadException())619 if (UNLIKELY(scope.exception())) 619 620 return; 620 621 if (!second.isNull()) { … … 626 627 627 628 String timeZoneName = intlStringOption(exec, options, vm.propertyNames->timeZoneName, shortLong, "timeZoneName must be \"short\" or \"long\"", nullptr); 628 if ( exec.hadException())629 if (UNLIKELY(scope.exception())) 629 630 return; 630 631 if (!timeZoneName.isNull()) { … … 640 641 intlStringOption(exec, options, vm.propertyNames->formatMatcher, { "basic", "best fit" }, "formatMatcher must be either \"basic\" or \"best fit\"", "best fit"); 641 642 // 27. ReturnIfAbrupt(matcher). 642 if ( exec.hadException())643 if (UNLIKELY(scope.exception())) 643 644 return; 644 645 … … 835 836 JSObject* IntlDateTimeFormat::resolvedOptions(ExecState& exec) 836 837 { 838 VM& vm = exec.vm(); 839 auto scope = DECLARE_THROW_SCOPE(vm); 840 837 841 // 12.3.5 Intl.DateTimeFormat.prototype.resolvedOptions() (ECMA-402 2.0) 838 842 // The function returns a new object whose properties and attributes are set as if constructed by an object literal assigning to each of the following properties the value of the corresponding internal slot of this DateTimeFormat object (see 12.4): locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day, hour, minute, second, and timeZoneName. Properties whose corresponding internal slots are not present are not assigned. … … 840 844 if (!m_initializedDateTimeFormat) { 841 845 initializeDateTimeFormat(exec, jsUndefined(), jsUndefined()); 842 ASSERT(!exec.hadException()); 843 } 844 845 VM& vm = exec.vm(); 846 ASSERT_UNUSED(scope, !scope.exception()); 847 } 848 846 849 JSObject* options = constructEmptyObject(&exec); 847 850 options->putDirect(vm, vm.propertyNames->locale, jsNontrivialString(&exec, m_locale)); … … 890 893 if (!m_initializedDateTimeFormat) { 891 894 initializeDateTimeFormat(exec, jsUndefined(), jsUndefined()); 892 ASSERT(! exec.hadException());895 ASSERT(!scope.exception()); 893 896 } 894 897 -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp
r205462 r205569 84 84 static EncodedJSValue JSC_HOST_CALL constructIntlDateTimeFormat(ExecState* state) 85 85 { 86 VM& vm = state->vm(); 87 auto scope = DECLARE_THROW_SCOPE(vm); 86 88 // 12.1.2 Intl.DateTimeFormat ([locales [, options]]) (ECMA-402 2.0) 87 89 // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. … … 89 91 // 3. ReturnIfAbrupt(dateTimeFormat). 90 92 Structure* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), jsCast<IntlDateTimeFormatConstructor*>(state->callee())->dateTimeFormatStructure()); 91 if ( state->hadException())93 if (UNLIKELY(scope.exception())) 92 94 return JSValue::encode(jsUndefined()); 93 IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create( state->vm(), structure);95 IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create(vm, structure); 94 96 ASSERT(dateTimeFormat); 95 97 … … 135 137 EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatConstructorFuncSupportedLocalesOf(ExecState* state) 136 138 { 139 VM& vm = state->vm(); 140 auto scope = DECLARE_THROW_SCOPE(vm); 137 141 // 12.2.2 Intl.DateTimeFormat.supportedLocalesOf(locales [, options]) (ECMA-402 2.0) 138 142 … … 143 147 // 2. Let requestedLocales be CanonicalizeLocaleList(locales). 144 148 Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0)); 145 if ( state->hadException())149 if (UNLIKELY(scope.exception())) 146 150 return JSValue::encode(jsUndefined()); 147 151 -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp
r205462 r205569 83 83 static EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatFuncFormatDateTime(ExecState* state) 84 84 { 85 VM& vm = state->vm(); 86 auto scope = DECLARE_THROW_SCOPE(vm); 85 87 // 12.3.4 DateTime Format Functions (ECMA-402 2.0) 86 88 // 1. Let dtf be the this value. … … 100 102 value = date.toNumber(state); 101 103 // b. ReturnIfAbrupt(x). 102 if ( state->hadException())104 if (UNLIKELY(scope.exception())) 103 105 return JSValue::encode(jsUndefined()); 104 106 } … … 139 141 // c. Let bf be BoundFunctionCreate(F, «this value»). 140 142 boundFormat = JSBoundFunction::create(vm, state, globalObject, targetObject, dtf, boundArgs, 1, ASCIILiteral("format")); 141 if ( vm.exception())143 if (UNLIKELY(scope.exception())) 142 144 return JSValue::encode(JSValue()); 143 145 // d. Set dtf.[[boundFormat]] to bf. -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp
r205462 r205569 165 165 auto requestedLocales = canonicalizeLocaleList(state, locales); 166 166 // 4. ReturnIfAbrupt(requestedLocales). 167 if ( state.hadException())167 if (UNLIKELY(scope.exception())) 168 168 return; 169 169 … … 177 177 options = optionsValue.toObject(&state); 178 178 // b. ReturnIfAbrupt(options). 179 if ( state.hadException())179 if (UNLIKELY(scope.exception())) 180 180 return; 181 181 } … … 187 187 String matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 188 188 // 9. ReturnIfAbrupt(matcher). 189 if ( state.hadException())189 if (UNLIKELY(scope.exception())) 190 190 return; 191 191 // 10. Set opt.[[localeMatcher]] to matcher. … … 208 208 String styleString = intlStringOption(state, options, Identifier::fromString(&vm, "style"), { "decimal", "percent", "currency" }, "style must be either \"decimal\", \"percent\", or \"currency\"", "decimal"); 209 209 // 17. ReturnIfAbrupt(s). 210 if ( state.hadException())210 if (UNLIKELY(scope.exception())) 211 211 return; 212 212 // 18. Set numberFormat.[[style]] to s. … … 223 223 String currency = intlStringOption(state, options, Identifier::fromString(&vm, "currency"), { }, nullptr, nullptr); 224 224 // 20. ReturnIfAbrupt(c). 225 if ( state.hadException())225 if (UNLIKELY(scope.exception())) 226 226 return; 227 227 // 21. If c is not undefined, then … … 254 254 String currencyDisplayString = intlStringOption(state, options, Identifier::fromString(&vm, "currencyDisplay"), { "code", "symbol", "name" }, "currencyDisplay must be either \"code\", \"symbol\", or \"name\"", "symbol"); 255 255 // 25. ReturnIfAbrupt(cd). 256 if ( state.hadException())256 if (UNLIKELY(scope.exception())) 257 257 return; 258 258 // 26. If s is "currency", set numberFormat.[[currencyDisplay]] to cd. … … 272 272 // 29. Set numberFormat.[[minimumIntegerDigits]] to mnid. 273 273 unsigned minimumIntegerDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumIntegerDigits"), 1, 21, 1); 274 if ( state.hadException())274 if (UNLIKELY(scope.exception())) 275 275 return; 276 276 m_minimumIntegerDigits = minimumIntegerDigits; … … 283 283 // 33. Set numberFormat.[[minimumFractionDigits]] to mnfd. 284 284 unsigned minimumFractionDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumFractionDigits"), 0, 20, minimumFractionDigitsDefault); 285 if ( state.hadException())285 if (UNLIKELY(scope.exception())) 286 286 return; 287 287 m_minimumFractionDigits = minimumFractionDigits; … … 300 300 // 37. Set numberFormat.[[maximumFractionDigits]] to mxfd. 301 301 unsigned maximumFractionDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "maximumFractionDigits"), minimumFractionDigits, 20, maximumFractionDigitsDefault); 302 if ( state.hadException())302 if (UNLIKELY(scope.exception())) 303 303 return; 304 304 m_maximumFractionDigits = maximumFractionDigits; … … 307 307 JSValue minimumSignificantDigitsValue = options->get(&state, Identifier::fromString(&vm, "minimumSignificantDigits")); 308 308 // 39. ReturnIfAbrupt(mnsd). 309 if ( state.hadException())309 if (UNLIKELY(scope.exception())) 310 310 return; 311 311 … … 313 313 JSValue maximumSignificantDigitsValue = options->get(&state, Identifier::fromString(&vm, "maximumSignificantDigits")); 314 314 // 41. ReturnIfAbrupt(mxsd). 315 if ( state.hadException())315 if (UNLIKELY(scope.exception())) 316 316 return; 317 317 … … 321 321 unsigned minimumSignificantDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "minimumSignificantDigits"), 1, 21, 1); 322 322 // b. ReturnIfAbrupt(mnsd). 323 if ( state.hadException())323 if (UNLIKELY(scope.exception())) 324 324 return; 325 325 // c. Let mxsd be GetNumberOption(options, "maximumSignificantDigits", mnsd, 21, 21). 326 326 unsigned maximumSignificantDigits = intlNumberOption(state, options, Identifier::fromString(&vm, "maximumSignificantDigits"), minimumSignificantDigits, 21, 21); 327 327 // d. ReturnIfAbrupt(mxsd). 328 if ( state.hadException())328 if (UNLIKELY(scope.exception())) 329 329 return; 330 330 // e. Set numberFormat.[[minimumSignificantDigits]] to mnsd. … … 340 340 useGrouping = true; 341 341 // 44. ReturnIfAbrupt(g). 342 if ( state.hadException())342 if (UNLIKELY(scope.exception())) 343 343 return; 344 344 // 45. Set numberFormat.[[useGrouping]] to g. … … 362 362 void IntlNumberFormat::createNumberFormat(ExecState& state) 363 363 { 364 VM& vm = state.vm(); 365 auto scope = DECLARE_CATCH_SCOPE(vm); 366 364 367 ASSERT(!m_numberFormat); 365 368 366 369 if (!m_initializedNumberFormat) { 367 370 initializeNumberFormat(state, jsUndefined(), jsUndefined()); 368 ASSERT (!state.hadException());371 ASSERT_UNUSED(scope, !scope.exception()); 369 372 } 370 373 … … 480 483 JSObject* IntlNumberFormat::resolvedOptions(ExecState& state) 481 484 { 485 VM& vm = state.vm(); 486 auto scope = DECLARE_THROW_SCOPE(vm); 487 482 488 // 11.3.5 Intl.NumberFormat.prototype.resolvedOptions() (ECMA-402 2.0) 483 489 // The function returns a new object whose properties and attributes are set as if … … 491 497 if (!m_initializedNumberFormat) { 492 498 initializeNumberFormat(state, jsUndefined(), jsUndefined()); 493 ASSERT(!state.hadException()); 494 } 495 496 VM& vm = state.vm(); 499 ASSERT_UNUSED(scope, !scope.exception()); 500 } 501 497 502 JSObject* options = constructEmptyObject(&state); 498 503 options->putDirect(vm, vm.propertyNames->locale, jsString(&state, m_locale)); -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp
r205462 r205569 84 84 static EncodedJSValue JSC_HOST_CALL constructIntlNumberFormat(ExecState* state) 85 85 { 86 VM& vm = state->vm(); 87 auto scope = DECLARE_THROW_SCOPE(vm); 86 88 // 11.1.2 Intl.NumberFormat ([locales [, options]]) (ECMA-402 2.0) 87 89 // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. … … 89 91 // 3. ReturnIfAbrupt(numberFormat). 90 92 Structure* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), jsCast<IntlNumberFormatConstructor*>(state->callee())->numberFormatStructure()); 91 if ( state->hadException())93 if (UNLIKELY(scope.exception())) 92 94 return JSValue::encode(jsUndefined()); 93 IntlNumberFormat* numberFormat = IntlNumberFormat::create( state->vm(), structure);95 IntlNumberFormat* numberFormat = IntlNumberFormat::create(vm, structure); 94 96 ASSERT(numberFormat); 95 97 … … 135 137 EncodedJSValue JSC_HOST_CALL IntlNumberFormatConstructorFuncSupportedLocalesOf(ExecState* state) 136 138 { 139 VM& vm = state->vm(); 140 auto scope = DECLARE_THROW_SCOPE(vm); 137 141 // 11.2.2 Intl.NumberFormat.supportedLocalesOf(locales [, options]) (ECMA-402 2.0) 138 142 … … 143 147 // 2. Let requestedLocales be CanonicalizeLocaleList(locales). 144 148 Vector<String> requestedLocales = canonicalizeLocaleList(*state, state->argument(0)); 145 if ( state->hadException())149 if (UNLIKELY(scope.exception())) 146 150 return JSValue::encode(jsUndefined()); 147 151 -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp
r205462 r205569 81 81 static EncodedJSValue JSC_HOST_CALL IntlNumberFormatFuncFormatNumber(ExecState* state) 82 82 { 83 VM& vm = state->vm(); 84 auto scope = DECLARE_THROW_SCOPE(vm); 83 85 // 11.3.4 Format Number Functions (ECMA-402 2.0) 84 86 // 1. Let nf be the this value. … … 90 92 double number = state->argument(0).toNumber(state); 91 93 // 5. ReturnIfAbrupt(x). 92 if ( state->hadException())94 if (UNLIKELY(scope.exception())) 93 95 return JSValue::encode(jsUndefined()); 94 96 … … 127 129 // c. Let bf be BoundFunctionCreate(F, «this value»). 128 130 boundFormat = JSBoundFunction::create(vm, state, globalObject, targetObject, nf, boundArgs, 1, ASCIILiteral("format")); 129 if ( vm.exception())131 if (UNLIKELY(scope.exception())) 130 132 return JSValue::encode(JSValue()); 131 133 // d. Set nf.[[boundFormat]] to bf. -
trunk/Source/JavaScriptCore/runtime/IntlObject.cpp
r205568 r205569 125 125 bool intlBooleanOption(ExecState& state, JSValue options, PropertyName property, bool& usesFallback) 126 126 { 127 VM& vm = state.vm(); 128 auto scope = DECLARE_THROW_SCOPE(vm); 129 127 130 // 9.2.9 GetOption (options, property, type, values, fallback) 128 131 // For type="boolean". values is always undefined. … … 132 135 133 136 // 2. ReturnIfAbrupt(opts). 134 if ( state.hadException())137 if (UNLIKELY(scope.exception())) 135 138 return false; 136 139 … … 139 142 140 143 // 4. ReturnIfAbrupt(value). 141 if ( state.hadException())144 if (UNLIKELY(scope.exception())) 142 145 return false; 143 146 … … 174 177 175 178 // 2. ReturnIfAbrupt(opts). 176 if ( state.hadException())179 if (UNLIKELY(scope.exception())) 177 180 return { }; 178 181 … … 181 184 182 185 // 4. ReturnIfAbrupt(value). 183 if ( state.hadException())186 if (UNLIKELY(scope.exception())) 184 187 return { }; 185 188 … … 194 197 195 198 // ii. ReturnIfAbrupt(value). 196 if ( state.hadException())199 if (UNLIKELY(scope.exception())) 197 200 return { }; 198 201 … … 222 225 223 226 // 2. ReturnIfAbrupt(opts). 224 if ( state.hadException())227 if (UNLIKELY(scope.exception())) 225 228 return 0; 226 229 … … 229 232 230 233 // 4. ReturnIfAbrupt(value). 231 if ( state.hadException())234 if (UNLIKELY(scope.exception())) 232 235 return 0; 233 236 … … 237 240 double doubleValue = value.toNumber(&state); 238 241 // b. ReturnIfAbrupt(value). 239 if ( state.hadException())242 if (UNLIKELY(scope.exception())) 240 243 return 0; 241 244 // 1. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception. … … 558 561 559 562 // 5. ReturnIfAbrupt(O). 560 if ( state.hadException())563 if (UNLIKELY(scope.exception())) 561 564 return Vector<String>(); 562 565 563 566 // 6. Let len be ToLength(Get(O, "length")). 564 567 JSValue lengthProperty = localesObject->get(&state, vm.propertyNames->length); 565 if ( state.hadException())568 if (UNLIKELY(scope.exception())) 566 569 return Vector<String>(); 567 570 568 571 double length = lengthProperty.toLength(&state); 569 if ( state.hadException())572 if (UNLIKELY(scope.exception())) 570 573 return Vector<String>(); 571 574 … … 583 586 584 587 // c. ReturnIfAbrupt(kPresent). 585 if ( state.hadException())588 if (UNLIKELY(scope.exception())) 586 589 return Vector<String>(); 587 590 … … 592 595 593 596 // ii. ReturnIfAbrupt(kValue). 594 if ( state.hadException())597 if (UNLIKELY(scope.exception())) 595 598 return Vector<String>(); 596 599 … … 605 608 606 609 // v. ReturnIfAbrupt(tag). 607 if ( state.hadException())610 if (UNLIKELY(scope.exception())) 608 611 return Vector<String>(); 609 612 … … 935 938 // 9.2.8 SupportedLocales (availableLocales, requestedLocales, options) 936 939 VM& vm = state.vm(); 940 auto scope = DECLARE_THROW_SCOPE(vm); 937 941 String matcher; 938 942 … … 942 946 matcher = intlStringOption(state, options, vm.propertyNames->localeMatcher, { "lookup", "best fit" }, "localeMatcher must be either \"lookup\" or \"best fit\"", "best fit"); 943 947 // b. ReturnIfAbrupt(matcher). 944 if ( state.hadException())948 if (UNLIKELY(scope.exception())) 945 949 return jsUndefined(); 946 950 } else { … … 962 966 } 963 967 964 if ( state.hadException())968 if (UNLIKELY(scope.exception())) 965 969 return jsUndefined(); 966 970 … … 971 975 PropertyNameArray keys(&state, PropertyNameMode::Strings); 972 976 supportedLocales->getOwnPropertyNames(supportedLocales, &state, keys, EnumerationMode()); 973 if ( state.hadException())977 if (UNLIKELY(scope.exception())) 974 978 return jsUndefined(); 975 979 … … 988 992 989 993 // c. Assert: status is not abrupt completion. 990 if ( state.hadException())994 if (UNLIKELY(scope.exception())) 991 995 return jsUndefined(); 992 996 } -
trunk/Source/JavaScriptCore/runtime/IntlObjectInlines.h
r202280 r205569 41 41 // https://bugs.webkit.org/show_bug.cgi?id=153679 42 42 VM& vm = state.vm(); 43 auto scope = DECLARE_THROW_SCOPE(vm); 44 43 45 if (!jsDynamicCast<IntlInstance*>(thisValue)) { 44 46 JSValue prototype = callee->getDirect(vm, vm.propertyNames->prototype); 45 47 if (JSObject::defaultHasInstance(&state, thisValue, prototype)) { 46 48 JSObject* thisObject = thisValue.toObject(&state); 47 if ( state.hadException())49 if (UNLIKELY(scope.exception())) 48 50 return jsUndefined(); 49 51 50 52 IntlInstance* instance = factory(vm); 51 if ( state.hadException())53 if (UNLIKELY(scope.exception())) 52 54 return jsUndefined(); 53 55 -
trunk/Source/JavaScriptCore/runtime/IteratorOperations.cpp
r205198 r205569 42 42 43 43 JSValue nextFunction = iterator.get(exec, vm.propertyNames->next); 44 if ( exec->hadException())44 if (UNLIKELY(scope.exception())) 45 45 return jsUndefined(); 46 46 … … 54 54 nextFunctionArguments.append(value); 55 55 JSValue result = call(exec, nextFunction, nextFunctionCallType, nextFunctionCallData, iterator, nextFunctionArguments); 56 if ( exec->hadException())56 if (UNLIKELY(scope.exception())) 57 57 return jsUndefined(); 58 58 … … 81 81 JSValue iteratorStep(ExecState* exec, JSValue iterator) 82 82 { 83 VM& vm = exec->vm(); 84 auto scope = DECLARE_THROW_SCOPE(vm); 85 83 86 JSValue result = iteratorNext(exec, iterator); 84 if ( exec->hadException())87 if (UNLIKELY(scope.exception())) 85 88 return jsUndefined(); 86 89 bool done = iteratorComplete(exec, result); 87 if ( exec->hadException())90 if (UNLIKELY(scope.exception())) 88 91 return jsUndefined(); 89 92 if (done) … … 95 98 { 96 99 VM& vm = exec->vm(); 97 auto scope = DECLARE_THROW_SCOPE(vm); 100 auto throwScope = DECLARE_THROW_SCOPE(vm); 101 auto catchScope = DECLARE_CATCH_SCOPE(vm); 98 102 99 103 Exception* exception = nullptr; 100 if ( exec->hadException()) {101 exception = exec->exception();102 exec->clearException();104 if (UNLIKELY(catchScope.exception())) { 105 exception = catchScope.exception(); 106 catchScope.clearException(); 103 107 } 104 108 JSValue returnFunction = iterator.get(exec, vm.propertyNames->returnKeyword); 105 if ( exec->hadException())109 if (UNLIKELY(throwScope.exception())) 106 110 return; 107 111 108 112 if (returnFunction.isUndefined()) { 109 113 if (exception) 110 throwException(exec, scope, exception);114 throwException(exec, throwScope, exception); 111 115 return; 112 116 } … … 116 120 if (returnFunctionCallType == CallType::None) { 117 121 if (exception) 118 throwException(exec, scope, exception);122 throwException(exec, throwScope, exception); 119 123 else 120 throwTypeError(exec, scope);124 throwTypeError(exec, throwScope); 121 125 return; 122 126 } … … 126 130 127 131 if (exception) { 128 throwException(exec, scope, exception);132 throwException(exec, throwScope, exception); 129 133 return; 130 134 } 131 135 132 if ( exec->hadException())136 if (UNLIKELY(throwScope.exception())) 133 137 return; 134 138 135 139 if (!innerResult.isObject()) { 136 throwTypeError(exec, scope, ASCIILiteral("Iterator result interface is not an object."));140 throwTypeError(exec, throwScope, ASCIILiteral("Iterator result interface is not an object.")); 137 141 return; 138 142 } … … 168 172 169 173 JSValue iteratorFunction = iterable.get(state, state->propertyNames().iteratorSymbol); 170 if ( state->hadException())174 if (UNLIKELY(scope.exception())) 171 175 return JSValue(); 172 176 … … 180 184 ArgList iteratorFunctionArguments; 181 185 JSValue iterator = call(state, iteratorFunction, iteratorFunctionCallType, iteratorFunctionCallData, iterable, iteratorFunctionArguments); 182 if ( state->hadException())186 if (UNLIKELY(scope.exception())) 183 187 return JSValue(); 184 188 -
trunk/Source/JavaScriptCore/runtime/IteratorOperations.h
r204500 r205569 29 29 #include "JSCJSValue.h" 30 30 #include "JSObject.h" 31 #include "ThrowScope.h" 31 32 32 33 namespace JSC { … … 48 49 { 49 50 auto& vm = state->vm(); 51 auto scope = DECLARE_THROW_SCOPE(vm); 52 50 53 JSValue iterator = iteratorForIterable(state, iterable); 51 if ( vm.exception())54 if (UNLIKELY(scope.exception())) 52 55 return; 53 56 while (true) { 54 57 JSValue next = iteratorStep(state, iterator); 55 if (next.isFalse() || vm.exception())58 if (next.isFalse() || UNLIKELY(scope.exception())) 56 59 return; 57 60 58 61 JSValue nextValue = iteratorValue(state, next); 59 if ( vm.exception())62 if (UNLIKELY(scope.exception())) 60 63 return; 61 64 62 65 callback(vm, state, nextValue); 63 if ( vm.exception()) {66 if (UNLIKELY(scope.exception())) { 64 67 iteratorClose(state, iterator); 65 68 return; -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r205462 r205569 655 655 // Let element be the result of calling the [[Get]] internal method of O with argument indx. 656 656 JSValue element = get(exec, index); 657 if ( exec->hadException())657 if (UNLIKELY(scope.exception())) 658 658 return jsUndefined(); 659 659 // Call the [[Delete]] internal method of O with arguments indx and true. … … 707 707 if (length > MAX_ARRAY_INDEX) { 708 708 methodTable(vm)->putByIndex(this, exec, length, value, true); 709 if (! exec->hadException())709 if (!scope.exception()) 710 710 throwException(exec, scope, createRangeError(exec, ASCIILiteral("Invalid array length"))); 711 711 return; … … 727 727 if (length > MAX_ARRAY_INDEX) { 728 728 methodTable(vm)->putByIndex(this, exec, length, value, true); 729 if (! exec->hadException())729 if (!scope.exception()) 730 730 throwException(exec, scope, createRangeError(exec, ASCIILiteral("Invalid array length"))); 731 731 return; … … 759 759 if (length > MAX_ARRAY_INDEX) { 760 760 methodTable(vm)->putByIndex(this, exec, length, value, true); 761 if (! exec->hadException())761 if (!scope.exception()) 762 762 throwException(exec, scope, createRangeError(exec, ASCIILiteral("Invalid array length"))); 763 763 return; … … 772 772 bool putResult = false; 773 773 if (attemptToInterceptPutByIndexOnHole(exec, oldLength, value, true, putResult)) { 774 if (! exec->hadException() && oldLength < 0xFFFFFFFFu)774 if (!scope.exception() && oldLength < 0xFFFFFFFFu) 775 775 setLength(exec, oldLength + 1, true); 776 776 return; … … 795 795 methodTable(vm)->putByIndex(this, exec, storage->length(), value, true); 796 796 // Per ES5.1 15.4.4.7 step 6 & 15.4.5.1 step 3.d. 797 if (! exec->hadException())797 if (!scope.exception()) 798 798 throwException(exec, scope, createRangeError(exec, ASCIILiteral("Invalid array length"))); 799 799 return; … … 1258 1258 void JSArray::copyToArguments(ExecState* exec, VirtualRegister firstElementDest, unsigned offset, unsigned length) 1259 1259 { 1260 VM& vm = exec->vm(); 1261 auto scope = DECLARE_THROW_SCOPE(vm); 1262 1260 1263 unsigned i = offset; 1261 1264 WriteBarrier<Unknown>* vector; … … 1322 1325 for (; i < length; ++i) { 1323 1326 exec->r(firstElementDest + i - offset) = get(exec, i); 1324 if (UNLIKELY( exec->vm().exception()))1327 if (UNLIKELY(scope.exception())) 1325 1328 return; 1326 1329 } -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
r205198 r205569 89 89 if (exec->argumentCount()) { 90 90 length = exec->uncheckedArgument(0).toUInt32(exec); 91 if ( exec->hadException())91 if (UNLIKELY(scope.exception())) 92 92 return JSValue::encode(jsUndefined()); 93 93 } else { … … 103 103 104 104 Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure()); 105 if ( exec->hadException())105 if (UNLIKELY(scope.exception())) 106 106 return JSValue::encode(JSValue()); 107 107 JSArrayBuffer* result = JSArrayBuffer::create(vm, arrayBufferStructure, WTFMove(buffer)); -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp
r205198 r205569 51 51 52 52 int32_t begin = exec->argument(0).toInt32(exec); 53 if ( exec->hadException())53 if (UNLIKELY(scope.exception())) 54 54 return JSValue::encode(jsUndefined()); 55 55 … … 57 57 if (exec->argumentCount() >= 2) { 58 58 end = exec->uncheckedArgument(1).toInt32(exec); 59 if ( exec->hadException())59 if (UNLIKELY(scope.exception())) 60 60 return JSValue::encode(jsUndefined()); 61 61 } else -
trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h
r205324 r205569 71 71 ALWAYS_INLINE unsigned getLength(ExecState* exec, JSObject* obj) 72 72 { 73 VM& vm = exec->vm(); 74 auto scope = DECLARE_THROW_SCOPE(vm); 73 75 if (isJSArray(obj)) 74 76 return jsCast<JSArray*>(obj)->length(); 75 77 76 VM& vm = exec->vm();77 78 JSValue lengthValue = obj->get(exec, vm.propertyNames->length); 78 if (UNLIKELY( vm.exception()))79 if (UNLIKELY(scope.exception())) 79 80 return UINT_MAX; 80 81 return lengthValue.toUInt32(exec); … … 83 84 ALWAYS_INLINE double toLength(ExecState* exec, JSObject* obj) 84 85 { 86 VM& vm = exec->vm(); 87 auto scope = DECLARE_THROW_SCOPE(vm); 85 88 if (isJSArray(obj)) 86 89 return jsCast<JSArray*>(obj)->length(); 87 90 88 VM& vm = exec->vm();89 91 JSValue lengthValue = obj->get(exec, vm.propertyNames->length); 90 if (UNLIKELY( vm.exception()))92 if (UNLIKELY(scope.exception())) 91 93 return PNaN; 92 94 return lengthValue.toLength(exec); -
trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
r204321 r205569 127 127 inline Structure* getBoundFunctionStructure(VM& vm, ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction) 128 128 { 129 auto scope = DECLARE_THROW_SCOPE(vm); 129 130 JSValue prototype = targetFunction->getPrototype(vm, exec); 130 if (UNLIKELY( vm.exception()))131 if (UNLIKELY(scope.exception())) 131 132 return nullptr; 132 133 JSFunction* targetJSFunction = jsDynamicCast<JSFunction*>(targetFunction); … … 159 160 JSBoundFunction* JSBoundFunction::create(VM& vm, ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSArray* boundArgs, int length, const String& name) 160 161 { 162 auto scope = DECLARE_THROW_SCOPE(vm); 161 163 ConstructData constructData; 162 164 ConstructType constructType = JSC::getConstructData(targetFunction, constructData); … … 171 173 name); 172 174 Structure* structure = getBoundFunctionStructure(vm, exec, globalObject, targetFunction); 173 if (UNLIKELY( vm.exception()))175 if (UNLIKELY(scope.exception())) 174 176 return nullptr; 175 177 JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(vm, globalObject, structure, targetFunction, boundThis, boundArgs); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r205462 r205569 193 193 194 194 prototype = obj->getPrototype(vm, exec); 195 if ( vm.exception())195 if (UNLIKELY(scope.exception())) 196 196 return false; 197 197 if (prototype.isNull()) … … 216 216 JSObject* prototype = synthesizePrototype(exec); 217 217 if (UNLIKELY(!prototype)) { 218 ASSERT( exec->hadException());218 ASSERT(scope.exception()); 219 219 return false; 220 220 } … … 382 382 ASSERT(isCell()); 383 383 JSValue value = asCell()->toPrimitive(exec, PreferString); 384 if ( vm.exception())384 if (UNLIKELY(scope.exception())) 385 385 return errorValue(); 386 386 ASSERT(!value.isObject()); 387 387 JSString* result = value.toString(exec); 388 if ( vm.exception())388 if (UNLIKELY(scope.exception())) 389 389 return errorValue(); 390 390 return result; -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r205520 r205569 643 643 644 644 StringImpl* hintString = jsCast<JSString*>(value)->value(exec).impl(); 645 if ( exec->hadException())645 if (UNLIKELY(scope.exception())) 646 646 return NoPreference; 647 647 … … 785 785 ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot&)>::type JSValue::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot, CallbackWhenNoException callback) const 786 786 { 787 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 787 788 bool found = getPropertySlot(exec, propertyName, slot); 788 if (UNLIKELY( exec->hadException()))789 if (UNLIKELY(scope.exception())) 789 790 return { }; 790 791 return callback(found, slot); … … 898 899 { 899 900 VM& vm = exec->vm(); 901 auto scope = DECLARE_THROW_SCOPE(vm); 900 902 do { 901 903 if (v1.isNumber() && v2.isNumber()) … … 925 927 return v1 == v2; 926 928 JSValue p1 = v1.toPrimitive(exec); 927 if ( exec->hadException())929 if (UNLIKELY(scope.exception())) 928 930 return false; 929 931 v1 = p1; … … 935 937 if (v2.isObject()) { 936 938 JSValue p2 = v2.toPrimitive(exec); 937 if ( exec->hadException())939 if (UNLIKELY(scope.exception())) 938 940 return false; 939 941 v2 = p2; -
trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp
r205198 r205569 134 134 135 135 unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec); 136 if ( exec->hadException())136 if (UNLIKELY(scope.exception())) 137 137 return JSValue::encode(jsUndefined()); 138 138 … … 141 141 if (elementSize > 1 && exec->argumentCount() >= 2) { 142 142 littleEndian = exec->uncheckedArgument(1).toBoolean(exec); 143 if ( exec->hadException())143 if (UNLIKELY(scope.exception())) 144 144 return JSValue::encode(jsUndefined()); 145 145 } … … 182 182 183 183 unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec); 184 if ( exec->hadException())184 if (UNLIKELY(scope.exception())) 185 185 return JSValue::encode(jsUndefined()); 186 186 … … 192 192 193 193 u.value = toNativeFromValue<Adaptor>(exec, exec->uncheckedArgument(1)); 194 if ( exec->hadException())194 if (UNLIKELY(scope.exception())) 195 195 return JSValue::encode(jsUndefined()); 196 196 … … 199 199 if (elementSize > 1 && exec->argumentCount() >= 3) { 200 200 littleEndian = exec->uncheckedArgument(2).toBoolean(exec); 201 if ( exec->hadException())201 if (UNLIKELY(scope.exception())) 202 202 return JSValue::encode(jsUndefined()); 203 203 } -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r205462 r205569 593 593 { 594 594 VM& vm = exec->vm(); 595 auto scope = DECLARE_THROW_SCOPE(vm); 596 595 597 // The "name" property may have been already been defined as part of a property list in an 596 598 // object literal (and therefore reified). … … 609 611 } else { 610 612 JSString* jsStr = value.toString(exec); 611 if ( vm.exception())613 if (UNLIKELY(scope.exception())) 612 614 return; 613 615 name = jsStr->value(exec); 614 if ( vm.exception())616 if (UNLIKELY(scope.exception())) 615 617 return; 616 618 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
r205508 r205569 174 174 175 175 typename Adaptor::Type value = toNativeFromValue<Adaptor>(exec, jsValue); 176 if ( exec->hadException())176 if (UNLIKELY(scope.exception())) 177 177 return false; 178 178 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
r205198 r205569 90 90 while (true) { 91 91 JSValue next = iteratorStep(exec, iterator); 92 if ( exec->hadException())92 if (UNLIKELY(scope.exception())) 93 93 return nullptr; 94 94 … … 97 97 98 98 JSValue nextItem = iteratorValue(exec, next); 99 if ( exec->hadException())99 if (UNLIKELY(scope.exception())) 100 100 return nullptr; 101 101 … … 105 105 ViewClass* result = ViewClass::createUninitialized(exec, structure, storage.size()); 106 106 if (!result) { 107 ASSERT( exec->hadException());107 ASSERT(scope.exception()); 108 108 return nullptr; 109 109 } … … 111 111 for (unsigned i = 0; i < storage.size(); ++i) { 112 112 if (!result->setIndex(exec, i, storage.at(i))) { 113 ASSERT( exec->hadException());113 ASSERT(scope.exception()); 114 114 return nullptr; 115 115 } … … 163 163 164 164 JSValue iteratorFunc = object->get(exec, vm.propertyNames->iteratorSymbol); 165 if ( exec->hadException())165 if (UNLIKELY(scope.exception())) 166 166 return nullptr; 167 167 … … 184 184 ArgList arguments; 185 185 JSValue iterator = call(exec, iteratorFunc, callType, callData, object, arguments); 186 if ( exec->hadException())186 if (UNLIKELY(scope.exception())) 187 187 return nullptr; 188 188 … … 191 191 192 192 length = lengthSlot.isUnset() ? 0 : lengthSlot.getValue(exec, vm.propertyNames->length).toUInt32(exec); 193 if ( exec->hadException())193 if (UNLIKELY(scope.exception())) 194 194 return nullptr; 195 195 } … … 198 198 ViewClass* result = ViewClass::createUninitialized(exec, structure, length); 199 199 if (!result) { 200 ASSERT( exec->hadException());200 ASSERT(scope.exception()); 201 201 return nullptr; 202 202 } … … 236 236 Structure* parentStructure = function->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType); 237 237 Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), parentStructure); 238 if ( exec->hadException())238 if (UNLIKELY(scope.exception())) 239 239 return JSValue::encode(JSValue()); 240 240 … … 253 253 if (jsDynamicCast<JSArrayBuffer*>(firstValue) && argCount > 1) { 254 254 offset = exec->uncheckedArgument(1).toUInt32(exec); 255 if ( exec->hadException())255 if (UNLIKELY(scope.exception())) 256 256 return JSValue::encode(jsUndefined()); 257 257 258 258 if (argCount > 2) { 259 259 length = exec->uncheckedArgument(2).toUInt32(exec); 260 if ( exec->hadException())260 if (UNLIKELY(scope.exception())) 261 261 return JSValue::encode(jsUndefined()); 262 262 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
r205198 r205569 52 52 53 53 JSValue constructor = exemplar->get(exec, exec->propertyNames().constructor); 54 if ( exec->hadException())54 if (UNLIKELY(scope.exception())) 55 55 return nullptr; 56 56 … … 63 63 64 64 JSValue species = constructor.get(exec, exec->propertyNames().speciesSymbol); 65 if ( exec->hadException())65 if (UNLIKELY(scope.exception())) 66 66 return nullptr; 67 67 … … 70 70 71 71 JSValue result = construct(exec, species, args, "species is not a constructor"); 72 if ( exec->hadException())72 if (UNLIKELY(scope.exception())) 73 73 return nullptr; 74 74 … … 148 148 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncCopyWithin(VM& vm, ExecState* exec) 149 149 { 150 // VM& vm = exec->vm();151 150 auto scope = DECLARE_THROW_SCOPE(vm); 152 151 … … 158 157 long length = thisObject->length(); 159 158 long to = argumentClampedIndexFromStartOrEnd(exec, 0, length); 160 if ( vm.exception())159 if (UNLIKELY(scope.exception())) 161 160 return encodedJSValue(); 162 161 long from = argumentClampedIndexFromStartOrEnd(exec, 1, length); 163 if ( vm.exception())162 if (UNLIKELY(scope.exception())) 164 163 return encodedJSValue(); 165 164 long final = argumentClampedIndexFromStartOrEnd(exec, 2, length, length); 166 if ( vm.exception())165 if (UNLIKELY(scope.exception())) 167 166 return encodedJSValue(); 168 167 … … 184 183 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncIncludes(VM& vm, ExecState* exec) 185 184 { 186 // VM& vm = exec->vm();187 185 auto scope = DECLARE_THROW_SCOPE(vm); 188 186 … … 199 197 200 198 unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length); 201 if ( vm.exception())199 if (UNLIKELY(scope.exception())) 202 200 return JSValue::encode(jsUndefined()); 203 201 … … 210 208 return JSValue::encode(jsBoolean(false)); 211 209 212 ASSERT(! vm.exception());210 ASSERT(!scope.exception()); 213 211 RELEASE_ASSERT(!thisObject->isNeutered()); 214 212 … … 231 229 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncIndexOf(VM& vm, ExecState* exec) 232 230 { 233 // VM& vm = exec->vm();234 231 auto scope = DECLARE_THROW_SCOPE(vm); 235 232 … … 246 243 JSValue valueToFind = exec->argument(0); 247 244 unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length); 248 if ( vm.exception())245 if (UNLIKELY(scope.exception())) 249 246 return encodedJSValue(); 250 247 … … 256 253 if (!targetOption) 257 254 return JSValue::encode(jsNumber(-1)); 258 ASSERT(! vm.exception());255 ASSERT(!scope.exception()); 259 256 RELEASE_ASSERT(!thisObject->isNeutered()); 260 257 … … 270 267 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncJoin(VM& vm, ExecState* exec) 271 268 { 272 // VM& vm = exec->vm();273 269 auto scope = DECLARE_THROW_SCOPE(vm); 274 270 … … 283 279 284 280 JSStringJoiner joiner(*exec, separator, length); 285 if ( exec->hadException())281 if (UNLIKELY(scope.exception())) 286 282 return JSValue::encode(jsUndefined()); 287 283 for (unsigned i = 0; i < length; i++) { 288 284 joiner.append(*exec, thisObject->getIndexQuickly(i)); 289 if ( exec->hadException())285 if (UNLIKELY(scope.exception())) 290 286 return JSValue::encode(jsUndefined()); 291 287 } … … 300 296 301 297 JSString* separatorString = separatorValue.toString(exec); 302 if ( exec->hadException())298 if (UNLIKELY(scope.exception())) 303 299 return JSValue::encode(jsUndefined()); 304 300 … … 311 307 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncLastIndexOf(VM& vm, ExecState* exec) 312 308 { 313 // VM& vm = exec->vm();314 309 auto scope = DECLARE_THROW_SCOPE(vm); 315 310 … … 339 334 } 340 335 341 if ( vm.exception())336 if (UNLIKELY(scope.exception())) 342 337 return JSValue::encode(JSValue()); 343 338 … … 350 345 351 346 typename ViewClass::ElementType* array = thisObject->typedVector(); 352 ASSERT(! vm.exception());347 ASSERT(!scope.exception()); 353 348 RELEASE_ASSERT(!thisObject->isNeutered()); 354 349 … … 433 428 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncSlice(VM& vm, ExecState* exec) 434 429 { 435 // VM& vm = exec->vm();436 430 auto scope = DECLARE_THROW_SCOPE(vm); 437 431 … … 446 440 447 441 unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength); 448 if ( vm.exception())442 if (UNLIKELY(scope.exception())) 449 443 return encodedJSValue(); 450 444 unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, thisLength, thisLength); 451 if ( vm.exception())445 if (UNLIKELY(scope.exception())) 452 446 return encodedJSValue(); 453 447 … … 468 462 return ViewClass::createUninitialized(exec, structure, length); 469 463 }); 470 if ( exec->hadException())464 if (UNLIKELY(scope.exception())) 471 465 return JSValue::encode(JSValue()); 472 466 … … 519 513 EncodedJSValue JSC_HOST_CALL genericTypedArrayViewPrivateFuncSubarrayCreate(VM&vm, ExecState* exec) 520 514 { 521 // VM& vm = exec->vm();522 515 auto scope = DECLARE_THROW_SCOPE(vm); 523 516 … … 538 531 ASSERT(exec->argument(1).isUndefined() || exec->argument(1).isNumber()); 539 532 unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength); 540 ASSERT(! vm.exception());533 ASSERT(!scope.exception()); 541 534 unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, thisLength, thisLength); 542 ASSERT(! vm.exception());535 ASSERT(!scope.exception()); 543 536 544 537 RELEASE_ASSERT(!thisObject->isNeutered()); … … 573 566 574 567 JSObject* result = construct(exec, species, args, "species is not a constructor"); 575 if ( exec->hadException())568 if (UNLIKELY(scope.exception())) 576 569 return JSValue::encode(JSValue()); 577 570 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r205372 r205569 1 1 /* 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2007 , 2008,2009, 2014-2016 Apple Inc. All rights reserved.3 * Copyright (C) 2007-2009, 2014-2016 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 816 816 inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, unsigned initialLength = 0, JSValue newTarget = JSValue()) 817 817 { 818 VM& vm = globalObject->vm(); 819 auto scope = DECLARE_THROW_SCOPE(vm); 818 820 Structure* structure; 819 821 if (initialLength >= MIN_ARRAY_STORAGE_CONSTRUCTION_LENGTH) … … 821 823 else 822 824 structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 823 if ( exec->hadException())825 if (UNLIKELY(scope.exception())) 824 826 return nullptr; 825 827 … … 834 836 inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const ArgList& values, JSValue newTarget = JSValue()) 835 837 { 838 VM& vm = globalObject->vm(); 839 auto scope = DECLARE_THROW_SCOPE(vm); 836 840 Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 837 if ( exec->hadException())841 if (UNLIKELY(scope.exception())) 838 842 return nullptr; 839 843 return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, structure, values)); … … 847 851 inline JSArray* constructArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const JSValue* values, unsigned length, JSValue newTarget = JSValue()) 848 852 { 853 VM& vm = globalObject->vm(); 854 auto scope = DECLARE_THROW_SCOPE(vm); 849 855 Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 850 if ( exec->hadException())856 if (UNLIKELY(scope.exception())) 851 857 return nullptr; 852 858 return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArray(exec, structure, values, length)); … … 860 866 inline JSArray* constructArrayNegativeIndexed(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, const JSValue* values, unsigned length, JSValue newTarget = JSValue()) 861 867 { 868 VM& vm = globalObject->vm(); 869 auto scope = DECLARE_THROW_SCOPE(vm); 862 870 Structure* structure = globalObject->arrayStructureForProfileDuringAllocation(exec, profile, newTarget); 863 if ( exec->hadException())871 if (UNLIKELY(scope.exception())) 864 872 return nullptr; 865 873 return ArrayAllocationProfile::updateLastAllocationFor(profile, constructArrayNegativeIndexed(exec, structure, values, length)); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r205372 r205569 661 661 662 662 String s = x.toString(exec)->value(exec); 663 if ( exec->hadException())663 if (UNLIKELY(scope.exception())) 664 664 return JSValue::encode(jsUndefined()); 665 665 -
trunk/Source/JavaScriptCore/runtime/JSJob.cpp
r205462 r205569 63 63 void JSJobMicrotask::run(ExecState* exec) 64 64 { 65 VM& vm = exec->vm(); 66 auto scope = DECLARE_CATCH_SCOPE(vm); 67 65 68 CallData handlerCallData; 66 69 CallType handlerCallType = getCallData(m_job.get(), handlerCallData); … … 71 74 handlerArguments.append(m_arguments->JSArray::get(exec, index)); 72 75 profiledCall(exec, ProfilingReason::Microtask, m_job.get(), handlerCallType, handlerCallData, jsUndefined(), handlerArguments); 73 exec->vm().clearException();76 scope.clearException(); 74 77 } 75 78 -
trunk/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
r205198 r205569 79 79 bool JSModuleEnvironment::getOwnPropertySlot(JSObject* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) 80 80 { 81 VM& vm = exec->vm(); 82 auto scope = DECLARE_THROW_SCOPE(vm); 81 83 JSModuleEnvironment* thisObject = jsCast<JSModuleEnvironment*>(cell); 82 84 JSModuleRecord::Resolution resolution = thisObject->moduleRecord()->resolveImport(exec, Identifier::fromUid(exec, propertyName.uid())); … … 85 87 JSModuleEnvironment* importedModuleEnvironment = resolution.moduleRecord->moduleEnvironment(); 86 88 PropertySlot redirectSlot(importedModuleEnvironment, PropertySlot::InternalMethodType::Get); 87 bool result = importedModuleEnvironment->methodTable( exec->vm())->getOwnPropertySlot(importedModuleEnvironment, exec, resolution.localName, redirectSlot);89 bool result = importedModuleEnvironment->methodTable(vm)->getOwnPropertySlot(importedModuleEnvironment, exec, resolution.localName, redirectSlot); 88 90 ASSERT_UNUSED(result, result); 89 91 ASSERT(redirectSlot.isValue()); 90 92 JSValue value = redirectSlot.getValue(exec, resolution.localName); 91 ASSERT (!exec->hadException());93 ASSERT_UNUSED(scope, !scope.exception()); 92 94 slot.setValue(thisObject, redirectSlot.attributes(), value); 93 95 return true; -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
r205520 r205569 153 153 154 154 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 155 VM& vm = globalObject->vm(); 156 auto scope = DECLARE_CATCH_SCOPE(vm); 155 157 if (globalObject->globalObjectMethodTable()->moduleLoaderFetch) 156 158 return globalObject->globalObjectMethodTable()->moduleLoaderFetch(globalObject, exec, this, key, initiator); 157 159 JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject); 158 160 String moduleKey = key.toString(exec)->value(exec); 159 if ( exec->hadException()) {160 JSValue exception = exec->exception()->value();161 exec->clearException();161 if (UNLIKELY(scope.exception())) { 162 JSValue exception = scope.exception()->value(); 163 scope.clearException(); 162 164 deferred->reject(exec, exception); 163 165 return deferred->promise(); -
trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
r205462 r205569 49 49 { 50 50 VM& vm = exec->vm(); 51 auto scope = DECLARE_THROW_SCOPE(vm); 51 52 Base::finishCreation(vm); 52 53 ASSERT(inherits(info())); … … 78 79 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-preventextensions 79 80 methodTable(vm)->preventExtensions(this, exec); 80 ASSERT (!exec->hadException());81 ASSERT_UNUSED(scope, !scope.exception()); 81 82 } 82 83 … … 133 134 134 135 JSValue value = trampolineSlot.getValue(exec, propertyName); 135 ASSERT(! exec->hadException());136 ASSERT(!scope.exception()); 136 137 137 138 // If the value is filled with TDZ value, throw a reference error. -
trunk/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
r205520 r205569 779 779 if (importEntry.isNamespace(vm)) { 780 780 JSModuleNamespaceObject* namespaceObject = importedModule->getModuleNamespace(exec); 781 if ( exec->hadException())781 if (UNLIKELY(scope.exception())) 782 782 return; 783 783 bool putResult = false; -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r205198 r205569 221 221 , m_gap(gap(exec, space.get())) 222 222 { 223 VM& vm = exec->vm(); 224 auto scope = DECLARE_THROW_SCOPE(vm); 223 225 if (!m_replacer.isObject()) 224 226 return; … … 227 229 m_usingArrayReplacer = true; 228 230 Handle<JSObject> array = m_replacer.asObject(); 229 unsigned length = array->get(exec, exec->vm().propertyNames->length).toUInt32(exec);231 unsigned length = array->get(exec, vm.propertyNames->length).toUInt32(exec); 230 232 for (unsigned i = 0; i < length; ++i) { 231 233 JSValue name = array->get(exec, i); 232 if ( exec->hadException())234 if (UNLIKELY(scope.exception())) 233 235 break; 234 236 … … 249 251 Local<Unknown> Stringifier::stringify(Handle<Unknown> value) 250 252 { 253 VM& vm = m_exec->vm(); 254 auto scope = DECLARE_THROW_SCOPE(vm); 251 255 JSObject* object = constructEmptyObject(m_exec); 252 if ( m_exec->hadException())253 return Local<Unknown>( m_exec->vm(), jsNull());254 255 PropertyNameForFunctionCall emptyPropertyName( m_exec->vm().propertyNames->emptyIdentifier);256 object->putDirect( m_exec->vm(), m_exec->vm().propertyNames->emptyIdentifier, value.get());256 if (UNLIKELY(scope.exception())) 257 return Local<Unknown>(vm, jsNull()); 258 259 PropertyNameForFunctionCall emptyPropertyName(vm.propertyNames->emptyIdentifier); 260 object->putDirect(vm, vm.propertyNames->emptyIdentifier, value.get()); 257 261 258 262 StringBuilder result; 259 263 if (appendStringifiedValue(result, value.get(), object, emptyPropertyName) != StringifySucceeded) 260 return Local<Unknown>( m_exec->vm(), jsUndefined());261 if ( m_exec->hadException())262 return Local<Unknown>( m_exec->vm(), jsNull());263 264 return Local<Unknown>( m_exec->vm(), jsString(m_exec, result.toString()));264 return Local<Unknown>(vm, jsUndefined()); 265 if (UNLIKELY(scope.exception())) 266 return Local<Unknown>(vm, jsNull()); 267 268 return Local<Unknown>(vm, jsString(m_exec, result.toString())); 265 269 } 266 270 267 271 ALWAYS_INLINE JSValue Stringifier::toJSON(JSValue value, const PropertyNameForFunctionCall& propertyName) 268 272 { 269 ASSERT(!m_exec->hadException()); 273 VM& vm = m_exec->vm(); 274 auto scope = DECLARE_THROW_SCOPE(vm); 275 ASSERT(!scope.exception()); 270 276 if (!value.isObject()) 271 277 return value; 272 278 273 279 JSObject* object = asObject(value); 274 VM& vm = m_exec->vm();275 280 PropertySlot slot(object, PropertySlot::InternalMethodType::Get); 276 281 if (!object->getPropertySlot(m_exec, vm.propertyNames->toJSON, slot)) … … 278 283 279 284 JSValue toJSONFunction = slot.getValue(m_exec, vm.propertyNames->toJSON); 280 if ( vm.exception())285 if (UNLIKELY(scope.exception())) 281 286 return jsNull(); 282 287 return toJSONImpl(value, toJSONFunction, propertyName); … … 302 307 // Call the toJSON function. 303 308 value = toJSON(value, propertyName); 304 if ( vm.exception())309 if (UNLIKELY(scope.exception())) 305 310 return StringifyFailed; 306 311 … … 311 316 args.append(value); 312 317 value = call(m_exec, m_replacer.get(), m_replacerCallType, m_replacerCallData, holder, args); 313 if ( vm.exception())318 if (UNLIKELY(scope.exception())) 314 319 return StringifyFailed; 315 320 } … … 325 330 value = unwrapBoxedPrimitive(m_exec, value); 326 331 327 if ( vm.exception())332 if (UNLIKELY(scope.exception())) 328 333 return StringifyFailed; 329 334 … … 378 383 bool holderStackWasEmpty = m_holderStack.isEmpty(); 379 384 m_holderStack.append(Holder(vm, m_exec, object)); 380 if (UNLIKELY( vm.exception()))385 if (UNLIKELY(scope.exception())) 381 386 return StringifyFailed; 382 387 if (!holderStackWasEmpty) … … 385 390 do { 386 391 while (m_holderStack.last().appendNextProperty(*this, builder)) { 387 if ( vm.exception())392 if (UNLIKELY(scope.exception())) 388 393 return StringifyFailed; 389 394 } … … 437 442 438 443 ExecState* exec = stringifier.m_exec; 444 VM& vm = exec->vm(); 445 auto scope = DECLARE_THROW_SCOPE(vm); 439 446 440 447 // First time through, initialize. … … 445 452 m_size = asArray(m_object.get())->length(); 446 453 else 447 m_size = m_object->get(exec, exec->vm().propertyNames->length).toUInt32(exec);454 m_size = m_object->get(exec, vm.propertyNames->length).toUInt32(exec); 448 455 builder.append('['); 449 456 } else { … … 453 460 PropertyNameArray objectPropertyNames(exec, PropertyNameMode::Strings); 454 461 m_object->methodTable()->getOwnPropertyNames(m_object.get(), exec, objectPropertyNames, EnumerationMode()); 455 if (UNLIKELY( exec->hadException()))462 if (UNLIKELY(scope.exception())) 456 463 return false; 457 464 m_propertyNames = objectPropertyNames.releaseData(); … … 487 494 else 488 495 value = jsUndefined(); 489 if (UNLIKELY( exec->hadException()))496 if (UNLIKELY(scope.exception())) 490 497 return false; 491 498 } … … 505 512 return true; 506 513 JSValue value = slot.getValue(exec, propertyName); 507 if ( exec->hadException())514 if (UNLIKELY(scope.exception())) 508 515 return false; 509 516 … … 641 648 else 642 649 inValue = jsUndefined(); 643 if ( m_exec->hadException())650 if (UNLIKELY(scope.exception())) 644 651 return jsNull(); 645 652 } … … 659 666 else 660 667 array->putDirectIndex(m_exec, indexStack.last(), filteredValue); 661 if ( m_exec->hadException())668 if (UNLIKELY(scope.exception())) 662 669 return jsNull(); 663 670 indexStack.last()++; … … 676 683 propertyStack.append(PropertyNameArray(m_exec, PropertyNameMode::Strings)); 677 684 object->methodTable()->getOwnPropertyNames(object, m_exec, propertyStack.last(), EnumerationMode()); 678 if (UNLIKELY( m_exec->hadException()))685 if (UNLIKELY(scope.exception())) 679 686 return jsNull(); 680 687 } … … 699 706 700 707 // The holder may be modified by the reviver function so any lookup may throw 701 if ( m_exec->hadException())708 if (UNLIKELY(scope.exception())) 702 709 return jsNull(); 703 710 … … 718 725 else 719 726 object->methodTable()->put(object, m_exec, prop, filteredValue, slot); 720 if ( m_exec->hadException())727 if (UNLIKELY(scope.exception())) 721 728 return jsNull(); 722 729 indexStack.last()++; … … 755 762 return throwVMError(exec, scope, createError(exec, ASCIILiteral("JSON.parse requires at least one parameter"))); 756 763 JSString::SafeView source = exec->uncheckedArgument(0).toString(exec)->view(exec); 757 if ( exec->hadException())764 if (UNLIKELY(scope.exception())) 758 765 return JSValue::encode(jsNull()); 759 766 -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r205462 r205569 352 352 353 353 VM& vm = exec->vm(); 354 auto scope = DECLARE_THROW_SCOPE(vm); 354 355 JSObject* current = object; 355 356 PropertyDescriptor ownDescriptor; … … 363 364 // 9.1.9.1-2 Let ownDesc be ? O.[[GetOwnProperty]](P). 364 365 bool ownDescriptorFound = current->getOwnPropertyDescriptor(exec, propertyName, ownDescriptor); 365 if (UNLIKELY( vm.exception()))366 if (UNLIKELY(scope.exception())) 366 367 return false; 367 368 … … 369 370 // 9.1.9.1-3-a Let parent be ? O.[[GetPrototypeOf]](). 370 371 JSValue prototype = current->getPrototype(vm, exec); 371 if (UNLIKELY( vm.exception()))372 if (UNLIKELY(scope.exception())) 372 373 return false; 373 374 … … 401 402 PropertyDescriptor existingDescriptor; 402 403 bool existingDescriptorFound = receiverObject->getOwnPropertyDescriptor(exec, propertyName, existingDescriptor); 403 if (UNLIKELY( vm.exception()))404 if (UNLIKELY(scope.exception())) 404 405 return false; 405 406 … … 1293 1294 1294 1295 bool isExtensible = this->isExtensible(exec); 1295 if ( vm.exception())1296 if (UNLIKELY(scope.exception())) 1296 1297 return false; 1297 1298 … … 1553 1554 1554 1555 JSValue function = object->get(exec, propertyName); 1555 if ( scope.exception())1556 if (UNLIKELY(scope.exception())) 1556 1557 return scope.exception(); 1557 1558 if (function.isUndefined() && mode == TypeHintMode::TakesHint) … … 1581 1582 JSValue result = call(exec, function, callType, callData, const_cast<JSObject*>(object), callArgs); 1582 1583 ASSERT(!result.isGetterSetter()); 1583 if ( scope.exception())1584 if (UNLIKELY(scope.exception())) 1584 1585 return scope.exception(); 1585 1586 if (result.isObject()) … … 1619 1620 } 1620 1621 1621 ASSERT(! exec->hadException());1622 ASSERT(!scope.exception()); 1622 1623 1623 1624 return throwTypeError(exec, scope, ASCIILiteral("No default value")); … … 1719 1720 while (true) { 1720 1721 JSValue objectValue = object->getPrototype(vm, exec); 1721 if (UNLIKELY( vm.exception()))1722 if (UNLIKELY(scope.exception())) 1722 1723 return false; 1723 1724 if (!objectValue.isObject()) … … 1741 1742 { 1742 1743 VM& vm = exec->vm(); 1744 auto scope = DECLARE_THROW_SCOPE(vm); 1743 1745 object->methodTable(vm)->getOwnPropertyNames(object, exec, propertyNames, mode); 1744 if (UNLIKELY( vm.exception()))1746 if (UNLIKELY(scope.exception())) 1745 1747 return; 1746 1748 1747 1749 JSValue nextProto = object->getPrototype(vm, exec); 1748 if (UNLIKELY( vm.exception()))1750 if (UNLIKELY(scope.exception())) 1749 1751 return; 1750 1752 if (nextProto.isNull()) … … 1758 1760 } 1759 1761 prototype->methodTable(vm)->getOwnPropertyNames(prototype, exec, propertyNames, mode); 1760 if (UNLIKELY( vm.exception()))1762 if (UNLIKELY(scope.exception())) 1761 1763 return; 1762 1764 nextProto = prototype->getPrototype(vm, exec); 1763 if (UNLIKELY( vm.exception()))1765 if (UNLIKELY(scope.exception())) 1764 1766 return; 1765 1767 if (nextProto.isNull()) … … 1859 1861 double JSObject::toNumber(ExecState* exec) const 1860 1862 { 1863 VM& vm = exec->vm(); 1864 auto scope = DECLARE_THROW_SCOPE(vm); 1861 1865 JSValue primitive = toPrimitive(exec, PreferNumber); 1862 if ( exec->hadException()) // should be picked up soon in Nodes.cpp1866 if (UNLIKELY(scope.exception())) // should be picked up soon in Nodes.cpp 1863 1867 return 0.0; 1864 1868 return primitive.toNumber(exec); … … 1867 1871 JSString* JSObject::toString(ExecState* exec) const 1868 1872 { 1873 VM& vm = exec->vm(); 1874 auto scope = DECLARE_THROW_SCOPE(vm); 1869 1875 JSValue primitive = toPrimitive(exec, PreferString); 1870 if ( exec->hadException())1876 if (UNLIKELY(scope.exception())) 1871 1877 return jsEmptyString(exec); 1872 1878 return primitive.toString(exec); … … 3077 3083 bool JSObject::defineOwnNonIndexProperty(ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool throwException) 3078 3084 { 3085 VM& vm = exec->vm(); 3086 auto throwScope = DECLARE_THROW_SCOPE(vm); 3087 3079 3088 // Track on the globaldata that we're in define property. 3080 3089 // Currently DefineOwnProperty uses delete to remove properties when they are being replaced 3081 3090 // (particularly when changing attributes), however delete won't allow non-configurable (i.e. 3082 3091 // DontDelete) properties to be deleted. For now, we can use this flag to make this work. 3083 VM::DeletePropertyModeScope scope( exec->vm(), VM::DeletePropertyMode::IgnoreConfigurable);3092 VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); 3084 3093 PropertyDescriptor current; 3085 3094 bool isCurrentDefined = getOwnPropertyDescriptor(exec, propertyName, current); 3086 3095 bool isExtensible = this->isExtensible(exec); 3087 if (UNLIKELY( exec->hadException()))3096 if (UNLIKELY(throwScope.exception())) 3088 3097 return false; 3089 3098 return validateAndApplyPropertyDescriptor(exec, this, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException); … … 3185 3194 { 3186 3195 VM& vm = exec->vm(); 3196 auto scope = DECLARE_THROW_SCOPE(vm); 3187 3197 object->methodTable(vm)->getOwnPropertyNames(object, exec, propertyNames, EnumerationMode(mode, JSObjectPropertiesMode::Exclude)); 3188 if (UNLIKELY( vm.exception()))3198 if (UNLIKELY(scope.exception())) 3189 3199 return; 3190 3200 3191 3201 JSValue nextProto = object->getPrototype(vm, exec); 3192 if (UNLIKELY( vm.exception()))3202 if (UNLIKELY(scope.exception())) 3193 3203 return; 3194 3204 if (nextProto.isNull()) … … 3202 3212 } 3203 3213 prototype->methodTable(vm)->getOwnPropertyNames(prototype, exec, propertyNames, mode); 3204 if (UNLIKELY( exec->hadException()))3214 if (UNLIKELY(scope.exception())) 3205 3215 return; 3206 3216 nextProto = prototype->getPrototype(vm, exec); 3207 if (UNLIKELY( vm.exception()))3217 if (UNLIKELY(scope.exception())) 3208 3218 return; 3209 3219 if (nextProto.isNull()) … … 3221 3231 3222 3232 JSValue method = get(exec, ident); 3223 if ( exec->hadException())3233 if (UNLIKELY(scope.exception())) 3224 3234 return jsUndefined(); 3225 3235 -
trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h
r205462 r205569 41 41 Vector<JSValue> result; 42 42 JSValue lengthProperty = arrayLikeValue.get(exec, vm.propertyNames->length); 43 if ( vm.exception())43 if (UNLIKELY(scope.exception())) 44 44 return; 45 45 double lengthAsDouble = lengthProperty.toLength(exec); 46 if ( vm.exception())46 if (UNLIKELY(scope.exception())) 47 47 return; 48 48 RELEASE_ASSERT(lengthAsDouble >= 0.0 && lengthAsDouble == std::trunc(lengthAsDouble)); … … 50 50 for (uint64_t index = 0; index < length; index++) { 51 51 JSValue next = arrayLikeValue.get(exec, index); 52 if ( vm.exception())52 if (UNLIKELY(scope.exception())) 53 53 return; 54 54 … … 97 97 ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot&)>::type JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot, CallbackWhenNoException callback) const 98 98 { 99 VM& vm = exec->vm(); 100 auto scope = DECLARE_THROW_SCOPE(vm); 99 101 bool found = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); 100 if (UNLIKELY( exec->hadException()))102 if (UNLIKELY(scope.exception())) 101 103 return { }; 102 104 return callback(found, slot); … … 106 108 { 107 109 VM& vm = exec->vm(); 110 auto scope = DECLARE_THROW_SCOPE(vm); 108 111 auto& structureIDTable = vm.heap.structureIDTable(); 109 112 JSObject* object = this; … … 113 116 if (structure.classInfo()->methodTable.getOwnPropertySlotByIndex(object, exec, propertyName, slot)) 114 117 return true; 115 if (UNLIKELY( vm.exception()))118 if (UNLIKELY(scope.exception())) 116 119 return false; 117 120 JSValue prototype; … … 120 123 else { 121 124 prototype = object->getPrototype(vm, exec); 122 if ( vm.exception())125 if (UNLIKELY(scope.exception())) 123 126 return false; 124 127 } … … 135 138 136 139 VM& vm = exec->vm(); 140 auto scope = DECLARE_THROW_SCOPE(vm); 137 141 auto& structureIDTable = vm.heap.structureIDTable(); 138 142 JSObject* object = this; … … 146 150 if (structure.classInfo()->methodTable.getOwnPropertySlot(object, exec, propertyName, slot)) 147 151 return true; 148 if (UNLIKELY( vm.exception()))152 if (UNLIKELY(scope.exception())) 149 153 return false; 150 154 } … … 154 158 else { 155 159 prototype = object->getPrototype(vm, exec); 156 if ( vm.exception())160 if (UNLIKELY(scope.exception())) 157 161 return false; 158 162 } -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
r205462 r205569 104 104 105 105 Structure* promiseStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->promiseStructure()); 106 if ( exec->hadException())106 if (UNLIKELY(scope.exception())) 107 107 return JSValue::encode(JSValue()); 108 108 JSPromise* promise = JSPromise::create(vm, promiseStructure); -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.h
r197539 r205569 103 103 { 104 104 VM& vm = exec->vm(); 105 auto scope = DECLARE_THROW_SCOPE(vm); 105 106 106 107 uint32_t indexedLength = base->methodTable(vm)->getEnumerableLength(exec, base); … … 120 121 if (structure->canAccessPropertiesQuicklyForEnumeration() && indexedLength == base->getArrayLength()) { 121 122 base->methodTable(vm)->getStructurePropertyNames(base, exec, propertyNames, EnumerationMode()); 122 ASSERT(! exec->hadException());123 ASSERT(!scope.exception()); 123 124 124 125 numberStructureProperties = propertyNames.size(); 125 126 126 127 base->methodTable(vm)->getGenericPropertyNames(base, exec, propertyNames, EnumerationMode()); 127 ASSERT(! exec->hadException());128 ASSERT(!scope.exception()); 128 129 } else { 129 130 // Generic property names vector contains all indexed property names. … … 131 132 indexedLength = 0; 132 133 base->methodTable(vm)->getPropertyNames(base, exec, propertyNames, EnumerationMode()); 133 if (UNLIKELY( exec->hadException()))134 if (UNLIKELY(scope.exception())) 134 135 return nullptr; 135 136 } -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
r205462 r205569 56 56 JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, Structure* structure, JSObject* iteratedObject) 57 57 { 58 VM& vm = exec->vm(); 59 auto scope = DECLARE_THROW_SCOPE(vm); 58 60 JSPropertyNameEnumerator* enumerator = propertyNameEnumerator(exec, iteratedObject); 59 if (UNLIKELY( exec->hadException()))61 if (UNLIKELY(scope.exception())) 60 62 return nullptr; 61 63 return JSPropertyNameIterator::create(exec, structure, iteratedObject, enumerator); -
trunk/Source/JavaScriptCore/runtime/JSScope.cpp
r205462 r205569 201 201 static inline bool isUnscopable(ExecState* exec, JSScope* scope, JSObject* object, const Identifier& ident) 202 202 { 203 VM& vm = exec->vm(); 204 auto throwScope = DECLARE_THROW_SCOPE(vm); 203 205 if (scope->type() != WithScopeType) 204 206 return false; 205 207 206 208 JSValue unscopables = object->get(exec, exec->propertyNames().unscopablesSymbol); 207 if ( exec->hadException())209 if (UNLIKELY(throwScope.exception())) 208 210 return false; 209 211 if (!unscopables.isObject()) 210 212 return false; 211 213 JSValue blocked = jsCast<JSObject*>(unscopables)->get(exec, ident); 212 if ( exec->hadException())214 if (UNLIKELY(throwScope.exception())) 213 215 return false; 214 216 … … 219 221 { 220 222 VM& vm = exec->vm(); 223 auto throwScope = DECLARE_THROW_SCOPE(vm); 221 224 ScopeChainIterator end = scope->end(); 222 225 ScopeChainIterator it = scope->begin(); … … 241 244 if (!isUnscopable(exec, scope, object, ident)) 242 245 return object; 243 ASSERT_WITH_MESSAGE (!exec->hadException(), "When an exception occurs, the result of isUnscopable becomes false");246 ASSERT_WITH_MESSAGE_UNUSED(throwScope, !throwScope.exception(), "When an exception occurs, the result of isUnscopable becomes false"); 244 247 } 245 248 } -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r205198 r205569 75 75 bool JSString::equalSlowCase(ExecState* exec, JSString* other) const 76 76 { 77 VM& vm = exec->vm(); 78 auto scope = DECLARE_THROW_SCOPE(vm); 77 79 String str1 = value(exec); 78 80 String str2 = other->value(exec); 79 if ( exec->hadException())81 if (UNLIKELY(scope.exception())) 80 82 return false; 81 83 return WTF::equal(*str1.impl(), *str2.impl()); -
trunk/Source/JavaScriptCore/runtime/JSStringJoiner.cpp
r205198 r205569 109 109 110 110 unsigned length = joinedLength(state); 111 if ( state.hadException())111 if (UNLIKELY(scope.exception())) 112 112 return jsUndefined(); 113 113 -
trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp
r201787 r205569 573 573 JSValue LiteralParser<CharType>::parse(ParserState initialState) 574 574 { 575 VM& vm = m_exec->vm(); 576 auto scope = DECLARE_THROW_SCOPE(vm); 575 577 ParserState state = initialState; 576 578 MarkedArgumentBuffer objectStack; … … 584 586 case StartParseArray: { 585 587 JSArray* array = constructEmptyArray(m_exec, 0); 586 if (UNLIKELY( m_exec->hadException()))588 if (UNLIKELY(scope.exception())) 587 589 return JSValue(); 588 590 objectStack.append(array); … … 682 684 JSObject* object = asObject(objectStack.last()); 683 685 PropertyName ident = identifierStack.last(); 684 if (m_mode != StrictJSON && ident == m_exec->vm().propertyNames->underscoreProto) {686 if (m_mode != StrictJSON && ident == vm.propertyNames->underscoreProto) { 685 687 if (!visitedUnderscoreProto.add(object).isNewEntry) { 686 688 m_parseErrorMessage = ASCIILiteral("Attempted to redefine __proto__ property"); … … 694 696 object->putDirectIndex(m_exec, index.value(), lastValue); 695 697 else 696 object->putDirect( m_exec->vm(), ident, lastValue);698 object->putDirect(vm, ident, lastValue); 697 699 } 698 700 identifierStack.removeLast(); -
trunk/Source/JavaScriptCore/runtime/MapConstructor.cpp
r205520 r205569 72 72 73 73 JSValue adderFunction = map->JSObject::get(exec, exec->propertyNames().set); 74 if ( exec->hadException())74 if (UNLIKELY(scope.exception())) 75 75 return JSValue::encode(jsUndefined()); 76 76 … … 81 81 82 82 forEachInIterable(exec, iterable, [&](VM& vm, ExecState* exec, JSValue nextItem) { 83 auto scope = DECLARE_THROW_SCOPE(vm); 83 84 if (!nextItem.isObject()) { 84 85 throwTypeError(exec, scope); … … 87 88 88 89 JSValue key = nextItem.get(exec, static_cast<unsigned>(0)); 89 if ( vm.exception())90 if (UNLIKELY(scope.exception())) 90 91 return; 91 92 92 93 JSValue value = nextItem.get(exec, static_cast<unsigned>(1)); 93 if ( vm.exception())94 if (UNLIKELY(scope.exception())) 94 95 return; 95 96 -
trunk/Source/JavaScriptCore/runtime/MathObject.cpp
r204466 r205569 163 163 EncodedJSValue JSC_HOST_CALL mathProtoFuncClz32(ExecState* exec) 164 164 { 165 VM& vm = exec->vm(); 166 auto scope = DECLARE_THROW_SCOPE(vm); 165 167 uint32_t value = exec->argument(0).toUInt32(exec); 166 if ( exec->hadException())168 if (UNLIKELY(scope.exception())) 167 169 return JSValue::encode(jsNull()); 168 170 return JSValue::encode(JSValue(clz32(value))); … … 186 188 EncodedJSValue JSC_HOST_CALL mathProtoFuncHypot(ExecState* exec) 187 189 { 190 VM& vm = exec->vm(); 191 auto scope = DECLARE_THROW_SCOPE(vm); 188 192 unsigned argsCount = exec->argumentCount(); 189 193 double max = 0; … … 192 196 for (unsigned i = 0; i < argsCount; ++i) { 193 197 args.uncheckedAppend(exec->uncheckedArgument(i).toNumber(exec)); 194 if ( exec->hadException())198 if (UNLIKELY(scope.exception())) 195 199 return JSValue::encode(jsNull()); 196 200 if (std::isinf(args[i])) … … 293 297 EncodedJSValue JSC_HOST_CALL mathProtoFuncIMul(ExecState* exec) 294 298 { 299 VM& vm = exec->vm(); 300 auto scope = DECLARE_THROW_SCOPE(vm); 295 301 int32_t left = exec->argument(0).toInt32(exec); 296 if ( exec->hadException())302 if (UNLIKELY(scope.exception())) 297 303 return JSValue::encode(jsNull()); 298 304 int32_t right = exec->argument(1).toInt32(exec); -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp
r205278 r205569 113 113 114 114 const Identifier moduleKey = exec->argument(0).toPropertyKey(exec); 115 if ( exec->hadException())115 if (UNLIKELY(scope.exception())) 116 116 return JSValue::encode(jsUndefined()); 117 117 118 118 String source = exec->argument(1).toString(exec)->value(exec); 119 if ( exec->hadException())119 if (UNLIKELY(scope.exception())) 120 120 return JSValue::encode(jsUndefined()); 121 121 … … 143 143 EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeRequestedModules(ExecState* exec) 144 144 { 145 VM& vm = exec->vm(); 146 auto scope = DECLARE_THROW_SCOPE(vm); 145 147 JSModuleRecord* moduleRecord = jsDynamicCast<JSModuleRecord*>(exec->argument(0)); 146 148 if (!moduleRecord) … … 148 150 149 151 JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size()); 150 if (UNLIKELY( exec->hadException()))152 if (UNLIKELY(scope.exception())) 151 153 JSValue::encode(jsUndefined()); 152 154 size_t i = 0; … … 159 161 EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeModuleDeclarationInstantiation(ExecState* exec) 160 162 { 163 VM& vm = exec->vm(); 164 auto scope = DECLARE_THROW_SCOPE(vm); 161 165 JSModuleRecord* moduleRecord = jsDynamicCast<JSModuleRecord*>(exec->argument(0)); 162 166 if (!moduleRecord) … … 167 171 168 172 moduleRecord->link(exec); 169 if ( exec->hadException())173 if (UNLIKELY(scope.exception())) 170 174 return JSValue::encode(jsUndefined()); 171 175 -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
r205462 r205569 64 64 EncodedJSValue JSC_HOST_CALL Interpreter::constructWithNativeErrorConstructor(ExecState* exec) 65 65 { 66 VM& vm = exec->vm(); 67 auto scope = DECLARE_THROW_SCOPE(vm); 66 68 JSValue message = exec->argument(0); 67 69 Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), jsCast<NativeErrorConstructor*>(exec->callee())->errorStructure()); 68 if ( exec->hadException())70 if (UNLIKELY(scope.exception())) 69 71 return JSValue::encode(JSValue()); 70 72 ASSERT(errorStructure); -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp
r202680 r205569 86 86 static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec) 87 87 { 88 VM& vm = exec->vm(); 89 auto scope = DECLARE_THROW_SCOPE(vm); 88 90 double n = exec->argumentCount() ? exec->uncheckedArgument(0).toNumber(exec) : 0; 89 91 Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), exec->lexicalGlobalObject()->numberObjectStructure()); 90 if ( exec->hadException())92 if (UNLIKELY(scope.exception())) 91 93 return JSValue::encode(JSValue()); 92 94 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r205372 r205569 122 122 ObjectConstructor* objectConstructor = jsCast<ObjectConstructor*>(exec->callee()); 123 123 JSGlobalObject* globalObject = objectConstructor->globalObject(); 124 VM& vm = globalObject->vm(); 125 auto scope = DECLARE_THROW_SCOPE(vm); 124 126 125 127 // We need to check newTarget condition in this caller side instead of InternalFunction::createSubclassStructure side. … … 130 132 // a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%"). 131 133 Structure* objectStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject->objectStructureForObjectConstructor()); 132 if ( exec->hadException())134 if (UNLIKELY(scope.exception())) 133 135 return nullptr; 134 136 return constructEmptyObject(exec, objectStructure); … … 212 214 EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec) 213 215 { 216 VM& vm = exec->vm(); 217 auto scope = DECLARE_THROW_SCOPE(vm); 214 218 JSObject* object = exec->argument(0).toObject(exec); 215 if ( exec->hadException())219 if (UNLIKELY(scope.exception())) 216 220 return JSValue::encode(jsUndefined()); 217 221 return JSValue::encode(objectConstructorGetPrototypeOf(exec, object)); … … 232 236 233 237 JSObject* object = objectValue.toObject(exec); 234 if ( exec->hadException())238 if (UNLIKELY(scope.exception())) 235 239 return JSValue::encode(objectValue); 236 240 … … 242 246 bool shouldThrowIfCantSet = true; 243 247 bool didSetPrototype = object->setPrototype(vm, exec, protoValue, shouldThrowIfCantSet); 244 ASSERT_UNUSED(didSetPrototype, vm.exception() || didSetPrototype);248 ASSERT_UNUSED(didSetPrototype, scope.exception() || didSetPrototype); 245 249 return JSValue::encode(objectValue); 246 250 } … … 248 252 JSValue objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject* object, const Identifier& propertyName) 249 253 { 254 VM& vm = exec->vm(); 255 auto scope = DECLARE_THROW_SCOPE(vm); 250 256 PropertyDescriptor descriptor; 251 257 if (!object->getOwnPropertyDescriptor(exec, propertyName, descriptor)) 252 258 return jsUndefined(); 253 if ( exec->hadException())259 if (UNLIKELY(scope.exception())) 254 260 return jsUndefined(); 255 261 … … 262 268 JSValue objectConstructorGetOwnPropertyDescriptors(ExecState* exec, JSObject* object) 263 269 { 270 VM& vm = exec->vm(); 271 auto scope = DECLARE_THROW_SCOPE(vm); 264 272 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 265 object->methodTable( exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));266 if ( exec->hadException())273 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 274 if (UNLIKELY(scope.exception())) 267 275 return jsUndefined(); 268 276 269 277 JSObject* descriptors = constructEmptyObject(exec); 270 if ( exec->hadException())278 if (UNLIKELY(scope.exception())) 271 279 return jsUndefined(); 272 280 … … 274 282 PropertyDescriptor descriptor; 275 283 bool didGetDescriptor = object->getOwnPropertyDescriptor(exec, propertyName, descriptor); 276 if ( exec->hadException())284 if (UNLIKELY(scope.exception())) 277 285 return jsUndefined(); 278 286 … … 286 294 PutPropertySlot slot(descriptors); 287 295 descriptors->putOwnDataPropertyMayBeIndex(exec, propertyName, fromDescriptor, slot); 288 ASSERT(! exec->hadException());296 ASSERT(!scope.exception()); 289 297 } 290 298 … … 294 302 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec) 295 303 { 304 VM& vm = exec->vm(); 305 auto scope = DECLARE_THROW_SCOPE(vm); 296 306 JSObject* object = exec->argument(0).toObject(exec); 297 if ( exec->hadException())307 if (UNLIKELY(scope.exception())) 298 308 return JSValue::encode(jsUndefined()); 299 309 auto propertyName = exec->argument(1).toPropertyKey(exec); 300 if ( exec->hadException())310 if (UNLIKELY(scope.exception())) 301 311 return JSValue::encode(jsUndefined()); 302 312 return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName)); … … 305 315 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptors(ExecState* exec) 306 316 { 317 VM& vm = exec->vm(); 318 auto scope = DECLARE_THROW_SCOPE(vm); 307 319 JSObject* object = exec->argument(0).toObject(exec); 308 if ( exec->hadException())320 if (UNLIKELY(scope.exception())) 309 321 return JSValue::encode(jsUndefined()); 310 322 return JSValue::encode(objectConstructorGetOwnPropertyDescriptors(exec, object)); … … 314 326 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec) 315 327 { 328 VM& vm = exec->vm(); 329 auto scope = DECLARE_THROW_SCOPE(vm); 316 330 JSObject* object = exec->argument(0).toObject(exec); 317 if ( exec->hadException())331 if (UNLIKELY(scope.exception())) 318 332 return JSValue::encode(jsNull()); 319 333 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include)); … … 323 337 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState* exec) 324 338 { 339 VM& vm = exec->vm(); 340 auto scope = DECLARE_THROW_SCOPE(vm); 325 341 JSObject* object = exec->argument(0).toObject(exec); 326 if ( exec->hadException())342 if (UNLIKELY(scope.exception())) 327 343 return JSValue::encode(jsNull()); 328 344 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include)); … … 332 348 EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec) 333 349 { 350 VM& vm = exec->vm(); 351 auto scope = DECLARE_THROW_SCOPE(vm); 334 352 JSObject* object = exec->argument(0).toObject(exec); 335 if ( exec->hadException())353 if (UNLIKELY(scope.exception())) 336 354 return JSValue::encode(jsNull()); 337 355 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude)); … … 340 358 EncodedJSValue JSC_HOST_CALL ownEnumerablePropertyKeys(ExecState* exec) 341 359 { 360 VM& vm = exec->vm(); 361 auto scope = DECLARE_THROW_SCOPE(vm); 342 362 JSObject* object = exec->argument(0).toObject(exec); 343 if ( exec->hadException())363 if (UNLIKELY(scope.exception())) 344 364 return JSValue::encode(jsNull()); 345 365 return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Exclude)); … … 361 381 if (description->hasProperty(exec, exec->propertyNames().enumerable)) { 362 382 JSValue value = description->get(exec, exec->propertyNames().enumerable); 363 if ( vm.exception())383 if (UNLIKELY(scope.exception())) 364 384 return false; 365 385 desc.setEnumerable(value.toBoolean(exec)); 366 } else if ( vm.exception())386 } else if (UNLIKELY(scope.exception())) 367 387 return false; 368 388 369 389 if (description->hasProperty(exec, exec->propertyNames().configurable)) { 370 390 JSValue value = description->get(exec, exec->propertyNames().configurable); 371 if ( vm.exception())391 if (UNLIKELY(scope.exception())) 372 392 return false; 373 393 desc.setConfigurable(value.toBoolean(exec)); 374 } else if ( vm.exception())394 } else if (UNLIKELY(scope.exception())) 375 395 return false; 376 396 … … 378 398 if (description->hasProperty(exec, exec->propertyNames().value)) { 379 399 JSValue value = description->get(exec, exec->propertyNames().value); 380 if ( vm.exception())400 if (UNLIKELY(scope.exception())) 381 401 return false; 382 402 desc.setValue(value); 383 } else if ( vm.exception())403 } else if (UNLIKELY(scope.exception())) 384 404 return false; 385 405 386 406 if (description->hasProperty(exec, exec->propertyNames().writable)) { 387 407 JSValue value = description->get(exec, exec->propertyNames().writable); 388 if ( vm.exception())408 if (UNLIKELY(scope.exception())) 389 409 return false; 390 410 desc.setWritable(value.toBoolean(exec)); 391 } else if ( vm.exception())411 } else if (UNLIKELY(scope.exception())) 392 412 return false; 393 413 394 414 if (description->hasProperty(exec, exec->propertyNames().get)) { 395 415 JSValue get = description->get(exec, exec->propertyNames().get); 396 if ( vm.exception())416 if (UNLIKELY(scope.exception())) 397 417 return false; 398 418 if (!get.isUndefined()) { … … 404 424 } 405 425 desc.setGetter(get); 406 } else if ( vm.exception())426 } else if (UNLIKELY(scope.exception())) 407 427 return false; 408 428 409 429 if (description->hasProperty(exec, exec->propertyNames().set)) { 410 430 JSValue set = description->get(exec, exec->propertyNames().set); 411 if ( vm.exception())431 if (UNLIKELY(scope.exception())) 412 432 return false; 413 433 if (!set.isUndefined()) { … … 419 439 } 420 440 desc.setSetter(set); 421 } else if ( vm.exception())441 } else if (UNLIKELY(scope.exception())) 422 442 return false; 423 443 … … 446 466 JSObject* obj = asObject(exec->argument(0)); 447 467 auto propertyName = exec->argument(1).toPropertyKey(exec); 448 if ( exec->hadException())468 if (UNLIKELY(scope.exception())) 449 469 return JSValue::encode(jsNull()); 450 470 PropertyDescriptor descriptor; … … 454 474 return JSValue::encode(jsNull()); 455 475 ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor())); 456 ASSERT(! exec->hadException());476 ASSERT(!scope.exception()); 457 477 obj->methodTable(vm)->defineOwnProperty(obj, exec, propertyName, descriptor, true); 458 478 scope.release(); … … 462 482 static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties) 463 483 { 484 VM& vm = exec->vm(); 485 auto scope = DECLARE_THROW_SCOPE(vm); 486 464 487 PropertyNameArray propertyNames(exec, PropertyNameMode::StringsAndSymbols); 465 asObject(properties)->methodTable( exec->vm())->getOwnPropertyNames(asObject(properties), exec, propertyNames, EnumerationMode(DontEnumPropertiesMode::Exclude));466 if (UNLIKELY( exec->hadException()))488 asObject(properties)->methodTable(vm)->getOwnPropertyNames(asObject(properties), exec, propertyNames, EnumerationMode(DontEnumPropertiesMode::Exclude)); 489 if (UNLIKELY(scope.exception())) 467 490 return jsNull(); 468 491 size_t numProperties = propertyNames.size(); … … 471 494 for (size_t i = 0; i < numProperties; i++) { 472 495 JSValue prop = properties->get(exec, propertyNames[i]); 473 if ( exec->hadException())496 if (UNLIKELY(scope.exception())) 474 497 return jsNull(); 475 498 PropertyDescriptor descriptor; … … 491 514 if (exec->propertyNames().isPrivateName(propertyName)) 492 515 continue; 493 object->methodTable( exec->vm())->defineOwnProperty(object, exec, propertyName, descriptors[i], true);494 if ( exec->hadException())516 object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, descriptors[i], true); 517 if (UNLIKELY(scope.exception())) 495 518 return jsNull(); 496 519 } … … 532 555 EncodedJSValue JSC_HOST_CALL objectConstructorSeal(ExecState* exec) 533 556 { 557 VM& vm = exec->vm(); 558 auto scope = DECLARE_THROW_SCOPE(vm); 559 534 560 // 1. If Type(O) is not Object, return O. 535 561 JSValue obj = exec->argument(0); … … 539 565 540 566 if (isJSFinalObject(object)) { 541 object->seal( exec->vm());567 object->seal(vm); 542 568 return JSValue::encode(obj); 543 569 } … … 545 571 // 2. For each named own property name P of O, 546 572 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 547 object->methodTable( exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));548 if (UNLIKELY( exec->hadException()))573 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 574 if (UNLIKELY(scope.exception())) 549 575 return JSValue::encode(obj); 550 576 PropertyNameArray::const_iterator end = properties.end(); … … 560 586 desc.setConfigurable(false); 561 587 // c. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments. 562 object->methodTable( exec->vm())->defineOwnProperty(object, exec, propertyName, desc, true);563 if ( exec->hadException())588 object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, desc, true); 589 if (UNLIKELY(scope.exception())) 564 590 return JSValue::encode(obj); 565 591 } 566 592 567 593 // 3. Set the [[Extensible]] internal property of O to false. 568 object->methodTable( exec->vm())->preventExtensions(object, exec);569 if ( exec->hadException())594 object->methodTable(vm)->preventExtensions(object, exec); 595 if (UNLIKELY(scope.exception())) 570 596 return JSValue::encode(JSValue()); 571 597 … … 576 602 JSObject* objectConstructorFreeze(ExecState* exec, JSObject* object) 577 603 { 604 VM& vm = exec->vm(); 605 auto scope = DECLARE_THROW_SCOPE(vm); 606 578 607 if (isJSFinalObject(object) && !hasIndexedProperties(object->indexingType())) { 579 object->freeze( exec->vm());608 object->freeze(vm); 580 609 return object; 581 610 } … … 583 612 // 2. For each named own property name P of O, 584 613 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 585 object->methodTable( exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));586 if (UNLIKELY( exec->hadException()))614 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 615 if (UNLIKELY(scope.exception())) 587 616 return object; 588 617 PropertyNameArray::const_iterator end = properties.end(); … … 602 631 desc.setConfigurable(false); 603 632 // d. Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments. 604 object->methodTable( exec->vm())->defineOwnProperty(object, exec, propertyName, desc, true);605 if ( exec->hadException())633 object->methodTable(vm)->defineOwnProperty(object, exec, propertyName, desc, true); 634 if (UNLIKELY(scope.exception())) 606 635 return object; 607 636 } 608 637 609 638 // 3. Set the [[Extensible]] internal property of O to false. 610 object->methodTable( exec->vm())->preventExtensions(object, exec);611 if ( exec->hadException())639 object->methodTable(vm)->preventExtensions(object, exec); 640 if (UNLIKELY(scope.exception())) 612 641 return nullptr; 613 642 … … 618 647 EncodedJSValue JSC_HOST_CALL objectConstructorFreeze(ExecState* exec) 619 648 { 649 VM& vm = exec->vm(); 650 auto scope = DECLARE_THROW_SCOPE(vm); 620 651 // 1. If Type(O) is not Object, return O. 621 652 JSValue obj = exec->argument(0); … … 623 654 return JSValue::encode(obj); 624 655 JSObject* result = objectConstructorFreeze(exec, asObject(obj)); 625 if ( exec->hadException())656 if (UNLIKELY(scope.exception())) 626 657 return JSValue::encode(JSValue()); 627 658 return JSValue::encode(result); … … 640 671 EncodedJSValue JSC_HOST_CALL objectConstructorIsSealed(ExecState* exec) 641 672 { 673 VM& vm = exec->vm(); 674 auto scope = DECLARE_THROW_SCOPE(vm); 675 642 676 // 1. If Type(O) is not Object, return true. 643 677 JSValue obj = exec->argument(0); … … 647 681 648 682 if (isJSFinalObject(object)) 649 return JSValue::encode(jsBoolean(object->isSealed( exec->vm())));683 return JSValue::encode(jsBoolean(object->isSealed(vm))); 650 684 651 685 // 2. For each named own property name P of O, 652 686 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 653 object->methodTable( exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));654 if (UNLIKELY( exec->hadException()))687 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 688 if (UNLIKELY(scope.exception())) 655 689 return JSValue::encode(JSValue()); 656 690 PropertyNameArray::const_iterator end = properties.end(); … … 671 705 // 4. Otherwise, return false. 672 706 bool isExtensible = object->isExtensible(exec); 673 if ( exec->hadException())707 if (UNLIKELY(scope.exception())) 674 708 return JSValue::encode(JSValue()); 675 709 return JSValue::encode(jsBoolean(!isExtensible)); … … 678 712 EncodedJSValue JSC_HOST_CALL objectConstructorIsFrozen(ExecState* exec) 679 713 { 714 VM& vm = exec->vm(); 715 auto scope = DECLARE_THROW_SCOPE(vm); 716 680 717 // 1. If Type(O) is not Object, return true. 681 718 JSValue obj = exec->argument(0); … … 685 722 686 723 if (isJSFinalObject(object)) 687 return JSValue::encode(jsBoolean(object->isFrozen( exec->vm())));724 return JSValue::encode(jsBoolean(object->isFrozen(vm))); 688 725 689 726 // 2. For each named own property name P of O, 690 727 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 691 object->methodTable( exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include));692 if (UNLIKELY( exec->hadException()))728 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 729 if (UNLIKELY(scope.exception())) 693 730 return JSValue::encode(JSValue()); 694 731 PropertyNameArray::const_iterator end = properties.end(); … … 710 747 // 4. Otherwise, return false. 711 748 bool isExtensible = object->isExtensible(exec); 712 if ( exec->hadException())749 if (UNLIKELY(scope.exception())) 713 750 return JSValue::encode(JSValue()); 714 751 return JSValue::encode(jsBoolean(!isExtensible)); … … 717 754 EncodedJSValue JSC_HOST_CALL objectConstructorIsExtensible(ExecState* exec) 718 755 { 756 VM& vm = exec->vm(); 757 auto scope = DECLARE_THROW_SCOPE(vm); 719 758 JSValue obj = exec->argument(0); 720 759 if (!obj.isObject()) … … 722 761 JSObject* object = asObject(obj); 723 762 bool isExtensible = object->isExtensible(exec); 724 if ( exec->hadException())763 if (UNLIKELY(scope.exception())) 725 764 return JSValue::encode(JSValue()); 726 765 return JSValue::encode(jsBoolean(isExtensible)); … … 736 775 { 737 776 VM& vm = exec->vm(); 777 auto scope = DECLARE_THROW_SCOPE(vm); 738 778 PropertyNameArray properties(exec, propertyNameMode); 739 779 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(dontEnumPropertiesMode)); 740 if (UNLIKELY( vm.exception()))780 if (UNLIKELY(scope.exception())) 741 781 return nullptr; 742 782 743 783 JSArray* keys = constructEmptyArray(exec, 0); 744 if (UNLIKELY( vm.exception()))784 if (UNLIKELY(scope.exception())) 745 785 return nullptr; 746 786 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h
r205372 r205569 102 102 { 103 103 VM& vm = exec->vm(); 104 auto scope = DECLARE_THROW_SCOPE(vm); 104 105 JSObject* description = constructEmptyObject(exec); 105 if ( vm.exception())106 if (UNLIKELY(scope.exception())) 106 107 return nullptr; 107 108 -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r205198 r205569 90 90 EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec) 91 91 { 92 VM& vm = exec->vm(); 93 auto scope = DECLARE_THROW_SCOPE(vm); 94 92 95 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 93 96 auto propertyName = exec->argument(0).toPropertyKey(exec); 94 if ( exec->hadException())97 if (UNLIKELY(scope.exception())) 95 98 return JSValue::encode(jsUndefined()); 96 99 JSObject* thisObject = thisValue.toObject(exec); … … 102 105 EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec) 103 106 { 107 VM& vm = exec->vm(); 108 auto scope = DECLARE_THROW_SCOPE(vm); 109 104 110 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 105 111 JSObject* thisObj = thisValue.toObject(exec); … … 110 116 return JSValue::encode(jsBoolean(false)); 111 117 112 VM& vm = exec->vm();113 118 JSValue v = asObject(exec->argument(0))->getPrototype(vm, exec); 114 if (UNLIKELY( vm.exception()))119 if (UNLIKELY(scope.exception())) 115 120 return JSValue::encode(JSValue()); 116 121 … … 121 126 return JSValue::encode(jsBoolean(true)); 122 127 v = asObject(v)->getPrototype(vm, exec); 123 if (UNLIKELY( vm.exception()))128 if (UNLIKELY(scope.exception())) 124 129 return JSValue::encode(JSValue()); 125 130 } … … 132 137 133 138 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 134 if ( exec->hadException())139 if (UNLIKELY(scope.exception())) 135 140 return JSValue::encode(jsUndefined()); 136 141 … … 141 146 142 147 auto propertyName = exec->argument(0).toPropertyKey(exec); 143 if ( exec->hadException())148 if (UNLIKELY(scope.exception())) 144 149 return JSValue::encode(jsUndefined()); 145 150 … … 161 166 162 167 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 163 if ( exec->hadException())168 if (UNLIKELY(scope.exception())) 164 169 return JSValue::encode(jsUndefined()); 165 170 … … 170 175 171 176 auto propertyName = exec->argument(0).toPropertyKey(exec); 172 if ( exec->hadException())177 if (UNLIKELY(scope.exception())) 173 178 return JSValue::encode(jsUndefined()); 174 179 … … 186 191 EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec) 187 192 { 188 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 189 if (exec->hadException()) 190 return JSValue::encode(jsUndefined()); 191 192 auto propertyName = exec->argument(0).toPropertyKey(exec); 193 if (exec->hadException()) 193 VM& vm = exec->vm(); 194 auto scope = DECLARE_THROW_SCOPE(vm); 195 196 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 197 if (UNLIKELY(scope.exception())) 198 return JSValue::encode(jsUndefined()); 199 200 auto propertyName = exec->argument(0).toPropertyKey(exec); 201 if (UNLIKELY(scope.exception())) 194 202 return JSValue::encode(jsUndefined()); 195 203 … … 213 221 EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) 214 222 { 215 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 216 if (exec->hadException()) 217 return JSValue::encode(jsUndefined()); 218 219 auto propertyName = exec->argument(0).toPropertyKey(exec); 220 if (exec->hadException()) 223 VM& vm = exec->vm(); 224 auto scope = DECLARE_THROW_SCOPE(vm); 225 226 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 227 if (UNLIKELY(scope.exception())) 228 return JSValue::encode(jsUndefined()); 229 230 auto propertyName = exec->argument(0).toPropertyKey(exec); 231 if (UNLIKELY(scope.exception())) 221 232 return JSValue::encode(jsUndefined()); 222 233 … … 240 251 EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec) 241 252 { 242 auto propertyName = exec->argument(0).toPropertyKey(exec); 243 if (exec->hadException()) 244 return JSValue::encode(jsUndefined()); 245 246 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 247 if (exec->hadException()) 253 VM& vm = exec->vm(); 254 auto scope = DECLARE_THROW_SCOPE(vm); 255 256 auto propertyName = exec->argument(0).toPropertyKey(exec); 257 if (UNLIKELY(scope.exception())) 258 return JSValue::encode(jsUndefined()); 259 260 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 261 if (UNLIKELY(scope.exception())) 248 262 return JSValue::encode(jsUndefined()); 249 263 PropertyDescriptor descriptor; … … 255 269 EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec) 256 270 { 271 VM& vm = exec->vm(); 272 auto scope = DECLARE_THROW_SCOPE(vm); 273 257 274 // 1. Let O be the result of calling ToObject passing the this value as the argument. 258 275 JSObject* object = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 259 if ( exec->hadException())276 if (UNLIKELY(scope.exception())) 260 277 return JSValue::encode(jsUndefined()); 261 278 … … 293 310 if (found) { 294 311 JSValue stringTag = toStringTagSlot.getValue(exec, toStringTagSymbol); 295 if (UNLIKELY( vm.exception()))312 if (UNLIKELY(scope.exception())) 296 313 return jsUndefined(); 297 314 if (stringTag.isString()) { … … 308 325 309 326 String tag = thisObject->methodTable(exec->vm())->toStringName(thisObject, exec); 310 if ( vm.exception())327 if (UNLIKELY(scope.exception())) 311 328 return JSValue(); 312 329 String newString = WTF::tryMakeString("[object ", WTFMove(tag), "]"); -
trunk/Source/JavaScriptCore/runtime/Operations.cpp
r204206 r205569 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 … … 45 45 // exception for the Date exception in defaultValue() 46 46 VM& vm = callFrame->vm(); 47 auto scope = DECLARE_THROW_SCOPE(vm); 47 48 JSValue p1 = v1.toPrimitive(callFrame); 48 if (UNLIKELY( vm.exception()))49 if (UNLIKELY(scope.exception())) 49 50 return JSValue(); 50 51 JSValue p2 = v2.toPrimitive(callFrame); 51 if (UNLIKELY( vm.exception()))52 if (UNLIKELY(scope.exception())) 52 53 return JSValue(); 53 54 -
trunk/Source/JavaScriptCore/runtime/Options.h
r205462 r205569 347 347 v(unsigned, fireExceptionFuzzAt, 0, Normal, nullptr) \ 348 348 v(bool, validateDFGExceptionHandling, false, Normal, "Causes the DFG to emit code validating exception handling for each node that can exit") /* This is true by default on Debug builds */\ 349 v(bool, dumpSimulatedThrows, false, Normal, "Dumps the call stack at each simulated throw for exception scope verification") \ 349 350 \ 350 351 v(bool, useExecutableAllocationFuzz, false, Normal, nullptr) \ -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
r205520 r205569 76 76 { 77 77 VM& vm = exec->vm(); 78 auto scope = DECLARE_THROW_SCOPE(vm); 79 78 80 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 79 81 GetterSetter* getterSetter = GetterSetter::create(vm, globalObject); 80 if ( exec->hadException())82 if (UNLIKELY(scope.exception())) 81 83 return nullptr; 82 84 if (m_getter && !m_getter.isUndefined()) -
trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp
r205462 r205569 56 56 static EncodedJSValue JSC_HOST_CALL makeRevocableProxy(ExecState* exec) 57 57 { 58 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 58 VM& vm = exec->vm(); 59 auto scope = DECLARE_THROW_SCOPE(vm); 59 60 if (exec->argumentCount() < 2) 60 61 return throwVMTypeError(exec, scope, ASCIILiteral("Proxy.revocable needs to be called with two arguments: the target and the handler")); 61 62 62 VM& vm = exec->vm();63 63 ArgList args(exec); 64 64 JSValue target = args.at(0); 65 65 JSValue handler = args.at(1); 66 66 ProxyObject* proxy = ProxyObject::create(exec, exec->lexicalGlobalObject(), target, handler); 67 if ( vm.exception())67 if (UNLIKELY(scope.exception())) 68 68 return JSValue::encode(JSValue()); 69 69 ProxyRevoke* revoke = ProxyRevoke::create(vm, exec->lexicalGlobalObject()->proxyRevokeStructure(), proxy); 70 if ( vm.exception())70 if (UNLIKELY(scope.exception())) 71 71 return JSValue::encode(JSValue()); 72 72 73 73 JSObject* result = constructEmptyObject(exec); 74 if ( vm.exception())74 if (UNLIKELY(scope.exception())) 75 75 return JSValue::encode(JSValue()); 76 76 result->putDirect(vm, makeIdentifier(vm, "proxy"), proxy, None); -
trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp
r205535 r205569 54 54 { 55 55 VM& vm = exec->vm(); 56 auto scope = DECLARE_THROW_SCOPE(vm); 56 57 const ProxyObject* proxy = jsCast<const ProxyObject*>(object); 57 58 while (proxy) { … … 59 60 if (isArray(exec, target)) 60 61 return target->classInfo()->methodTable.toStringName(target, exec); 61 if ( vm.exception())62 if (UNLIKELY(scope.exception())) 62 63 break; 63 64 … … 141 142 CallType callType; 142 143 JSValue getHandler = handler->getMethod(exec, callData, callType, vm.propertyNames->get, ASCIILiteral("'get' property of a Proxy's handler object should be callable")); 143 if ( exec->hadException())144 if (UNLIKELY(scope.exception())) 144 145 return jsUndefined(); 145 146 … … 152 153 arguments.append(receiver); 153 154 JSValue trapResult = call(exec, getHandler, callType, callData, handler, arguments); 154 if ( exec->hadException())155 if (UNLIKELY(scope.exception())) 155 156 return jsUndefined(); 156 157 … … 166 167 } 167 168 168 if ( exec->hadException())169 if (UNLIKELY(scope.exception())) 169 170 return jsUndefined(); 170 171 … … 174 175 bool ProxyObject::performGet(ExecState* exec, PropertyName propertyName, PropertySlot& slot) 175 176 { 177 VM& vm = exec->vm(); 178 auto scope = DECLARE_THROW_SCOPE(vm); 176 179 JSValue result = performProxyGet(exec, this, slot.thisValue(), propertyName); 177 if ( exec->hadException())180 if (UNLIKELY(scope.exception())) 178 181 return false; 179 182 unsigned ignoredAttributes = 0; … … 209 212 CallType callType; 210 213 JSValue getOwnPropertyDescriptorMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "getOwnPropertyDescriptor"), ASCIILiteral("'getOwnPropertyDescriptor' property of a Proxy's handler should be callable")); 211 if ( exec->hadException())214 if (UNLIKELY(scope.exception())) 212 215 return false; 213 216 if (getOwnPropertyDescriptorMethod.isUndefined()) … … 218 221 arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid()))); 219 222 JSValue trapResult = call(exec, getOwnPropertyDescriptorMethod, callType, callData, handler, arguments); 220 if ( exec->hadException())223 if (UNLIKELY(scope.exception())) 221 224 return false; 222 225 … … 228 231 PropertyDescriptor targetPropertyDescriptor; 229 232 bool isTargetPropertyDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, targetPropertyDescriptor); 230 if ( exec->hadException())233 if (UNLIKELY(scope.exception())) 231 234 return false; 232 235 … … 241 244 // https://bugs.webkit.org/show_bug.cgi?id=154375 242 245 bool isExtensible = target->isExtensible(exec); 243 if ( exec->hadException())246 if (UNLIKELY(scope.exception())) 244 247 return false; 245 248 if (!isExtensible) { … … 255 258 256 259 bool isExtensible = target->isExtensible(exec); 257 if ( exec->hadException())260 if (UNLIKELY(scope.exception())) 258 261 return false; 259 262 PropertyDescriptor trapResultAsDescriptor; 260 263 toPropertyDescriptor(exec, trapResult, trapResultAsDescriptor); 261 if ( exec->hadException())264 if (UNLIKELY(scope.exception())) 262 265 return false; 263 266 bool throwException = false; … … 278 281 if (trapResultAsDescriptor.isAccessorDescriptor()) { 279 282 GetterSetter* getterSetter = trapResultAsDescriptor.slowGetterSetter(exec); 280 if ( exec->hadException())283 if (UNLIKELY(scope.exception())) 281 284 return false; 282 285 slot.setGetterSlot(this, trapResultAsDescriptor.attributes(), getterSetter); … … 317 320 CallType callType; 318 321 JSValue hasMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->has, ASCIILiteral("'has' property of a Proxy's handler should be callable")); 319 if ( exec->hadException())322 if (UNLIKELY(scope.exception())) 320 323 return false; 321 324 if (hasMethod.isUndefined()) … … 326 329 arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid()))); 327 330 JSValue trapResult = call(exec, hasMethod, callType, callData, handler, arguments); 328 if ( exec->hadException())331 if (UNLIKELY(scope.exception())) 329 332 return false; 330 333 331 334 bool trapResultAsBool = trapResult.toBoolean(exec); 332 if ( exec->hadException())335 if (UNLIKELY(scope.exception())) 333 336 return false; 334 337 … … 336 339 PropertyDescriptor descriptor; 337 340 bool isPropertyDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, descriptor); 338 if ( exec->hadException())341 if (UNLIKELY(scope.exception())) 339 342 return false; 340 343 if (isPropertyDescriptorDefined) { … … 344 347 } 345 348 bool isExtensible = target->isExtensible(exec); 346 if ( exec->hadException())349 if (UNLIKELY(scope.exception())) 347 350 return false; 348 351 if (!isExtensible) { … … 417 420 CallType callType; 418 421 JSValue setMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->set, ASCIILiteral("'set' property of a Proxy's handler should be callable")); 419 if ( exec->hadException())422 if (UNLIKELY(scope.exception())) 420 423 return false; 421 424 JSObject* target = this->target(); … … 429 432 arguments.append(thisValue); 430 433 JSValue trapResult = call(exec, setMethod, callType, callData, handler, arguments); 431 if ( exec->hadException())434 if (UNLIKELY(scope.exception())) 432 435 return false; 433 436 bool trapResultAsBool = trapResult.toBoolean(exec); 434 if ( exec->hadException())437 if (UNLIKELY(scope.exception())) 435 438 return false; 436 439 if (!trapResultAsBool) … … 468 471 { 469 472 VM& vm = exec->vm(); 470 Identifier ident = Identifier::from(exec, propertyName); 471 if (exec->hadException()) 473 auto scope = DECLARE_THROW_SCOPE(vm); 474 Identifier ident = Identifier::from(exec, propertyName); 475 if (UNLIKELY(scope.exception())) 472 476 return false; 473 477 auto performDefaultPut = [&] () { … … 503 507 CallType callType; 504 508 JSValue applyMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "apply"), ASCIILiteral("'apply' property of a Proxy's handler should be callable")); 505 if ( exec->hadException())509 if (UNLIKELY(scope.exception())) 506 510 return JSValue::encode(jsUndefined()); 507 511 JSObject* target = proxy->target(); … … 514 518 515 519 JSArray* argArray = constructArray(exec, static_cast<ArrayAllocationProfile*>(nullptr), ArgList(exec)); 516 if ( exec->hadException())520 if (UNLIKELY(scope.exception())) 517 521 return JSValue::encode(jsUndefined()); 518 522 MarkedArgumentBuffer arguments; … … 553 557 CallType callType; 554 558 JSValue constructMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "construct"), ASCIILiteral("'construct' property of a Proxy's handler should be constructible")); 555 if ( exec->hadException())559 if (UNLIKELY(scope.exception())) 556 560 return JSValue::encode(jsUndefined()); 557 561 JSObject* target = proxy->target(); … … 564 568 565 569 JSArray* argArray = constructArray(exec, static_cast<ArrayAllocationProfile*>(nullptr), ArgList(exec)); 566 if ( exec->hadException())570 if (UNLIKELY(scope.exception())) 567 571 return JSValue::encode(jsUndefined()); 568 572 MarkedArgumentBuffer arguments; … … 571 575 arguments.append(exec->newTarget()); 572 576 JSValue result = call(exec, constructMethod, callType, callData, handler, arguments); 573 if ( exec->hadException())577 if (UNLIKELY(scope.exception())) 574 578 return JSValue::encode(jsUndefined()); 575 579 if (!result.isObject()) … … 614 618 CallType callType; 615 619 JSValue deletePropertyMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "deleteProperty"), ASCIILiteral("'deleteProperty' property of a Proxy's handler should be callable")); 616 if ( exec->hadException())620 if (UNLIKELY(scope.exception())) 617 621 return false; 618 622 JSObject* target = this->target(); … … 624 628 arguments.append(identifierToSafePublicJSValue(vm, Identifier::fromUid(&vm, propertyName.uid()))); 625 629 JSValue trapResult = call(exec, deletePropertyMethod, callType, callData, handler, arguments); 626 if ( exec->hadException())630 if (UNLIKELY(scope.exception())) 627 631 return false; 628 632 629 633 bool trapResultAsBool = trapResult.toBoolean(exec); 630 if ( exec->hadException())634 if (UNLIKELY(scope.exception())) 631 635 return false; 632 636 … … 642 646 } 643 647 644 if ( exec->hadException())648 if (UNLIKELY(scope.exception())) 645 649 return false; 646 650 … … 688 692 CallType callType; 689 693 JSValue preventExtensionsMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "preventExtensions"), ASCIILiteral("'preventExtensions' property of a Proxy's handler should be callable")); 690 if ( exec->hadException())694 if (UNLIKELY(scope.exception())) 691 695 return false; 692 696 JSObject* target = this->target(); … … 697 701 arguments.append(target); 698 702 JSValue trapResult = call(exec, preventExtensionsMethod, callType, callData, handler, arguments); 699 if ( exec->hadException())703 if (UNLIKELY(scope.exception())) 700 704 return false; 701 705 702 706 bool trapResultAsBool = trapResult.toBoolean(exec); 703 if ( exec->hadException())707 if (UNLIKELY(scope.exception())) 704 708 return false; 705 709 706 710 if (trapResultAsBool) { 707 711 bool targetIsExtensible = target->isExtensible(exec); 708 if ( exec->hadException())712 if (UNLIKELY(scope.exception())) 709 713 return false; 710 714 if (targetIsExtensible) { … … 741 745 CallType callType; 742 746 JSValue isExtensibleMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "isExtensible"), ASCIILiteral("'isExtensible' property of a Proxy's handler should be callable")); 743 if ( exec->hadException())747 if (UNLIKELY(scope.exception())) 744 748 return false; 745 749 … … 751 755 arguments.append(target); 752 756 JSValue trapResult = call(exec, isExtensibleMethod, callType, callData, handler, arguments); 753 if ( exec->hadException())757 if (UNLIKELY(scope.exception())) 754 758 return false; 755 759 756 760 bool trapResultAsBool = trapResult.toBoolean(exec); 757 if ( exec->hadException())761 if (UNLIKELY(scope.exception())) 758 762 return false; 759 763 760 764 bool isTargetExtensible = target->isExtensible(exec); 761 if ( exec->hadException())765 if (UNLIKELY(scope.exception())) 762 766 return false; 763 767 … … 808 812 CallType callType; 809 813 JSValue definePropertyMethod = handler->getMethod(exec, callData, callType, vm.propertyNames->defineProperty, ASCIILiteral("'defineProperty' property of a Proxy's handler should be callable")); 810 if ( vm.exception())814 if (UNLIKELY(scope.exception())) 811 815 return false; 812 816 … … 815 819 816 820 JSObject* descriptorObject = constructObjectFromPropertyDescriptor(exec, descriptor); 817 if ( vm.exception())821 if (UNLIKELY(scope.exception())) 818 822 return false; 819 823 … … 823 827 arguments.append(descriptorObject); 824 828 JSValue trapResult = call(exec, definePropertyMethod, callType, callData, handler, arguments); 825 if ( vm.exception())829 if (UNLIKELY(scope.exception())) 826 830 return false; 827 831 828 832 bool trapResultAsBool = trapResult.toBoolean(exec); 829 if ( vm.exception())833 if (UNLIKELY(scope.exception())) 830 834 return false; 831 835 … … 835 839 PropertyDescriptor targetDescriptor; 836 840 bool isTargetDescriptorDefined = target->getOwnPropertyDescriptor(exec, propertyName, targetDescriptor); 837 if ( vm.exception())841 if (UNLIKELY(scope.exception())) 838 842 return false; 839 843 840 844 bool targetIsExtensible = target->isExtensible(exec); 841 if ( vm.exception())845 if (UNLIKELY(scope.exception())) 842 846 return false; 843 847 bool settingConfigurableToFalse = descriptor.configurablePresent() && !descriptor.configurable(); … … 897 901 CallType callType; 898 902 JSValue ownKeysMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "ownKeys"), ASCIILiteral("'ownKeys' property of a Proxy's handler should be callable")); 899 if ( vm.exception())903 if (UNLIKELY(scope.exception())) 900 904 return; 901 905 JSObject* target = this->target(); … … 908 912 arguments.append(target); 909 913 JSValue arrayLikeObject = call(exec, ownKeysMethod, callType, callData, handler, arguments); 910 if ( vm.exception())914 if (UNLIKELY(scope.exception())) 911 915 return; 912 916 … … 936 940 937 941 Identifier ident = value.toPropertyKey(exec); 938 if ( vm.exception())942 if (UNLIKELY(scope.exception())) 939 943 return doExitEarly; 940 944 … … 945 949 946 950 createListFromArrayLike(exec, arrayLikeObject, dontThrowAnExceptionTypeFilter, ASCIILiteral("Proxy handler's 'ownKeys' method must return an array-like object containing only Strings and Symbols"), addPropName); 947 if ( vm.exception())951 if (UNLIKELY(scope.exception())) 948 952 return; 949 953 … … 952 956 PropertyNameArray targetKeys(&vm, propertyNameMode); 953 957 target->methodTable(vm)->getOwnPropertyNames(target, exec, targetKeys, enumerationMode); 954 if ( vm.exception())958 if (UNLIKELY(scope.exception())) 955 959 return; 956 960 Vector<UniquedStringImpl*> targetConfigurableKeys; … … 959 963 PropertyDescriptor descriptor; 960 964 bool isPropertyDefined = target->getOwnPropertyDescriptor(exec, ident.impl(), descriptor); 961 if ( vm.exception())965 if (UNLIKELY(scope.exception())) 962 966 return; 963 967 if (isPropertyDefined && !descriptor.configurable()) … … 1048 1052 CallType callType; 1049 1053 JSValue setPrototypeOfMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "setPrototypeOf"), ASCIILiteral("'setPrototypeOf' property of a Proxy's handler should be callable")); 1050 if ( vm.exception())1054 if (UNLIKELY(scope.exception())) 1051 1055 return false; 1052 1056 … … 1059 1063 arguments.append(prototype); 1060 1064 JSValue trapResult = call(exec, setPrototypeOfMethod, callType, callData, handler, arguments); 1061 if ( vm.exception())1065 if (UNLIKELY(scope.exception())) 1062 1066 return false; 1063 1067 1064 1068 bool trapResultAsBool = trapResult.toBoolean(exec); 1065 if ( vm.exception())1069 if (UNLIKELY(scope.exception())) 1066 1070 return false; 1067 1071 … … 1073 1077 1074 1078 bool targetIsExtensible = target->isExtensible(exec); 1075 if ( vm.exception())1079 if (UNLIKELY(scope.exception())) 1076 1080 return false; 1077 1081 if (targetIsExtensible) … … 1079 1083 1080 1084 JSValue targetPrototype = target->getPrototype(vm, exec); 1081 if ( vm.exception())1085 if (UNLIKELY(scope.exception())) 1082 1086 return false; 1083 1087 if (!sameValue(exec, prototype, targetPrototype)) { … … 1113 1117 CallType callType; 1114 1118 JSValue getPrototypeOfMethod = handler->getMethod(exec, callData, callType, makeIdentifier(vm, "getPrototypeOf"), ASCIILiteral("'getPrototypeOf' property of a Proxy's handler should be callable")); 1115 if ( vm.exception())1119 if (UNLIKELY(scope.exception())) 1116 1120 return JSValue(); 1117 1121 … … 1123 1127 arguments.append(target); 1124 1128 JSValue trapResult = call(exec, getPrototypeOfMethod, callType, callData, handler, arguments); 1125 if ( vm.exception())1129 if (UNLIKELY(scope.exception())) 1126 1130 return JSValue(); 1127 1131 … … 1132 1136 1133 1137 bool targetIsExtensible = target->isExtensible(exec); 1134 if ( vm.exception())1138 if (UNLIKELY(scope.exception())) 1135 1139 return JSValue(); 1136 1140 if (targetIsExtensible) … … 1138 1142 1139 1143 JSValue targetPrototype = target->getPrototype(vm, exec); 1140 if ( vm.exception())1144 if (UNLIKELY(scope.exception())) 1141 1145 return JSValue(); 1142 1146 if (!sameValue(exec, targetPrototype, trapResult)) { -
trunk/Source/JavaScriptCore/runtime/ReflectObject.cpp
r205372 r205569 124 124 return false; 125 125 }); 126 if ( exec->hadException())126 if (UNLIKELY(scope.exception())) 127 127 return JSValue::encode(jsUndefined()); 128 128 … … 140 140 return JSValue::encode(throwTypeError(exec, scope, ASCIILiteral("Reflect.defineProperty requires the first argument be an object"))); 141 141 auto propertyName = exec->argument(1).toPropertyKey(exec); 142 if ( exec->hadException())142 if (UNLIKELY(scope.exception())) 143 143 return JSValue::encode(jsUndefined()); 144 144 … … 147 147 return JSValue::encode(jsUndefined()); 148 148 ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor())); 149 ASSERT(! exec->hadException());149 ASSERT(!scope.exception()); 150 150 151 151 // Reflect.defineProperty should not throw an error when the defineOwnProperty operation fails. … … 179 179 180 180 const Identifier propertyName = exec->argument(1).toPropertyKey(exec); 181 if ( exec->hadException())181 if (UNLIKELY(scope.exception())) 182 182 return JSValue::encode(jsNull()); 183 183 … … 201 201 202 202 auto key = exec->argument(1).toPropertyKey(exec); 203 if ( exec->hadException())203 if (UNLIKELY(scope.exception())) 204 204 return JSValue::encode(jsUndefined()); 205 205 … … 230 230 231 231 bool isExtensible = asObject(target)->isExtensible(exec); 232 if ( exec->hadException())232 if (UNLIKELY(scope.exception())) 233 233 return JSValue::encode(JSValue()); 234 234 return JSValue::encode(jsBoolean(isExtensible)); … … 258 258 JSObject* object = asObject(target); 259 259 bool result = object->methodTable(vm)->preventExtensions(object, exec); 260 if ( exec->hadException())260 if (UNLIKELY(scope.exception())) 261 261 return JSValue::encode(JSValue()); 262 262 return JSValue::encode(jsBoolean(result)); … … 275 275 276 276 auto propertyName = exec->argument(1).toPropertyKey(exec); 277 if ( exec->hadException())277 if (UNLIKELY(scope.exception())) 278 278 return JSValue::encode(jsUndefined()); 279 279 … … 308 308 bool shouldThrowIfCantSet = false; 309 309 bool didSetPrototype = object->setPrototype(vm, exec, proto, shouldThrowIfCantSet); 310 if ( vm.exception())310 if (UNLIKELY(scope.exception())) 311 311 return JSValue::encode(JSValue()); 312 312 return JSValue::encode(jsBoolean(didSetPrototype)); -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r205198 r205569 217 217 return NoFlags; 218 218 JSString* flagsString = flags.toString(exec); 219 ASSERT(scope.exception() || flagsString); 219 220 if (!flagsString) { 220 ASSERT(exec->hadException());221 221 return InvalidFlags; 222 222 } 223 223 224 224 RegExpFlags result = regExpFlags(flagsString->value(exec)); 225 if ( exec->hadException())225 if (UNLIKELY(scope.exception())) 226 226 return InvalidFlags; 227 227 if (result == InvalidFlags) … … 236 236 237 237 String pattern = patternArg.isUndefined() ? emptyString() : patternArg.toString(exec)->value(exec); 238 if ( exec->hadException())238 if (UNLIKELY(scope.exception())) 239 239 return nullptr; 240 240 … … 248 248 249 249 Structure* structure = getRegExpStructure(exec, globalObject, newTarget); 250 if ( vm.exception())250 if (UNLIKELY(scope.exception())) 251 251 return nullptr; 252 252 return RegExpObject::create(vm, structure, regExp); … … 256 256 { 257 257 VM& vm = exec->vm(); 258 auto scope = DECLARE_THROW_SCOPE(vm); 258 259 JSValue patternArg = args.at(0); 259 260 JSValue flagsArg = args.at(1); … … 264 265 if (newTarget.isUndefined() && constructAsRegexp && flagsArg.isUndefined()) { 265 266 JSValue constructor = patternArg.get(exec, vm.propertyNames->constructor); 266 if ( vm.exception())267 if (UNLIKELY(scope.exception())) 267 268 return nullptr; 268 269 if (callee == constructor) { … … 275 276 RegExp* regExp = jsCast<RegExpObject*>(patternArg)->regExp(); 276 277 Structure* structure = getRegExpStructure(exec, globalObject, newTarget); 277 if ( exec->hadException())278 if (UNLIKELY(scope.exception())) 278 279 return nullptr; 279 280 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h
r205462 r205569 134 134 ALWAYS_INLINE bool isRegExp(VM& vm, ExecState* exec, JSValue value) 135 135 { 136 auto scope = DECLARE_THROW_SCOPE(vm); 136 137 if (!value.isObject()) 137 138 return false; … … 139 140 JSObject* object = asObject(value); 140 141 JSValue matchValue = object->get(exec, vm.propertyNames->matchSymbol); 141 if ( vm.exception())142 if (UNLIKELY(scope.exception())) 142 143 return false; 143 144 if (!matchValue.isUndefined()) -
trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp
r205198 r205569 181 181 182 182 JSArray* array = constructEmptyArray(exec, nullptr); 183 if (UNLIKELY( vm.exception()))183 if (UNLIKELY(scope.exception())) 184 184 return jsUndefined(); 185 185 … … 234 234 JSValue RegExpObject::matchGlobal(ExecState* exec, JSGlobalObject* globalObject, JSString* string) 235 235 { 236 VM& vm = globalObject->vm(); 237 auto scope = DECLARE_THROW_SCOPE(vm); 236 238 RegExp* regExp = this->regExp(); 237 239 238 240 ASSERT(regExp->global()); 239 241 240 VM* vm = &globalObject->vm();241 242 242 setLastIndex(exec, 0); 243 if ( exec->hadException())243 if (UNLIKELY(scope.exception())) 244 244 return jsUndefined(); 245 245 … … 250 250 unsigned stringLength = s.length(); 251 251 return collectMatches( 252 *vm, exec, string, s, regExpConstructor, regExp,252 vm, exec, string, s, regExpConstructor, regExp, 253 253 [&] (size_t end) -> size_t { 254 254 return advanceStringUnicode(s, stringLength, end); … … 257 257 258 258 return collectMatches( 259 *vm, exec, string, s, regExpConstructor, regExp,259 vm, exec, string, s, regExpConstructor, regExp, 260 260 [&] (size_t end) -> size_t { 261 261 return end + 1; -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
r205462 r205569 160 160 } else { 161 161 String pattern = !exec->argumentCount() ? emptyString() : arg0.toString(exec)->value(exec); 162 if ( exec->hadException())162 if (UNLIKELY(scope.exception())) 163 163 return JSValue::encode(jsUndefined()); 164 164 … … 166 166 if (!arg1.isUndefined()) { 167 167 flags = regExpFlags(arg1.toString(exec)->value(exec)); 168 if ( exec->hadException())168 if (UNLIKELY(scope.exception())) 169 169 return JSValue::encode(jsUndefined()); 170 170 if (flags == InvalidFlags) … … 190 190 191 191 VM& vm = exec->vm(); 192 auto scope = DECLARE_THROW_SCOPE(vm); 192 193 193 194 JSValue globalValue = regexp->get(exec, exec->propertyNames().global); 194 if ( vm.exception())195 if (UNLIKELY(scope.exception())) 195 196 return string; 196 197 JSValue ignoreCaseValue = regexp->get(exec, exec->propertyNames().ignoreCase); 197 if ( vm.exception())198 if (UNLIKELY(scope.exception())) 198 199 return string; 199 200 JSValue multilineValue = regexp->get(exec, exec->propertyNames().multiline); 200 if ( vm.exception())201 if (UNLIKELY(scope.exception())) 201 202 return string; 202 203 JSValue unicodeValue = regexp->get(exec, exec->propertyNames().unicode); 203 if ( vm.exception())204 if (UNLIKELY(scope.exception())) 204 205 return string; 205 206 JSValue stickyValue = regexp->get(exec, exec->propertyNames().sticky); 206 if ( vm.exception())207 if (UNLIKELY(scope.exception())) 207 208 return string; 208 209 … … 239 240 240 241 JSValue sourceValue = thisObject->get(exec, vm.propertyNames->source); 241 if ( vm.exception())242 if (UNLIKELY(scope.exception())) 242 243 return JSValue::encode(jsUndefined()); 243 244 String source = sourceValue.toString(exec)->value(exec); 244 if ( vm.exception())245 if (UNLIKELY(scope.exception())) 245 246 return JSValue::encode(jsUndefined()); 246 247 247 248 JSValue flagsValue = thisObject->get(exec, vm.propertyNames->flags); 248 if ( vm.exception())249 if (UNLIKELY(scope.exception())) 249 250 return JSValue::encode(jsUndefined()); 250 251 String flags = flagsValue.toString(exec)->value(exec); 251 if ( vm.exception())252 if (UNLIKELY(scope.exception())) 252 253 return JSValue::encode(jsUndefined()); 253 254 … … 340 341 341 342 auto flags = flagsString(exec, asObject(thisValue)); 342 if ( exec->hadException())343 if (UNLIKELY(scope.exception())) 343 344 return JSValue::encode(jsUndefined()); 344 345 … … 473 474 { 474 475 VM& vm = exec->vm(); 476 auto scope = DECLARE_THROW_SCOPE(vm); 475 477 JSValue thisValue = exec->thisValue(); 476 478 RegExp* regExp = asRegExpObject(thisValue)->regExp(); … … 478 480 JSString* string = exec->uncheckedArgument(0).toString(exec); 479 481 String s = string->value(exec); 480 if ( vm.exception())482 if (UNLIKELY(scope.exception())) 481 483 return JSValue::encode(jsUndefined()); 482 484 … … 587 589 JSString* inputString = exec->argument(0).toString(exec); 588 590 String input = inputString->value(exec); 589 if ( vm.exception())591 if (UNLIKELY(scope.exception())) 590 592 return JSValue::encode(jsUndefined()); 591 593 ASSERT(!input.isNull()); … … 602 604 // 12. Let lengthA be 0. 603 605 JSArray* result = constructEmptyArray(exec, 0); 604 if (UNLIKELY( vm.exception()))606 if (UNLIKELY(scope.exception())) 605 607 return JSValue::encode(jsUndefined()); 606 608 unsigned resultLength = 0; -
trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp
r205520 r205569 73 73 74 74 JSValue adderFunction = set->get(exec, exec->propertyNames().add); 75 if ( exec->hadException())75 if (UNLIKELY(scope.exception())) 76 76 return JSValue::encode(jsUndefined()); 77 77 -
trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp
r205462 r205569 101 101 for (unsigned i = 0; i < length; ++i) { 102 102 double codePointAsDouble = exec->uncheckedArgument(i).toNumber(exec); 103 if ( exec->hadException())103 if (UNLIKELY(scope.exception())) 104 104 return JSValue::encode(jsUndefined()); 105 105 … … 123 123 { 124 124 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 125 VM& vm = exec->vm(); 125 VM& vm = globalObject->vm(); 126 auto scope = DECLARE_THROW_SCOPE(vm); 126 127 127 128 Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->stringObjectStructure()); 128 if ( exec->hadException())129 if (UNLIKELY(scope.exception())) 129 130 return JSValue::encode(JSValue()); 130 131 -
trunk/Source/JavaScriptCore/runtime/StringObject.cpp
r205198 r205569 109 109 bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool throwException) 110 110 { 111 VM& vm = exec->vm(); 112 auto scope = DECLARE_THROW_SCOPE(vm); 111 113 StringObject* thisObject = jsCast<StringObject*>(object); 112 114 … … 121 123 ASSERT(isCurrentDefined); 122 124 bool isExtensible = thisObject->isExtensible(exec); 123 if ( exec->hadException())125 if (UNLIKELY(scope.exception())) 124 126 return false; 125 127 return validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible, descriptor, isCurrentDefined, current, throwException); -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r205198 r205569 478 478 CallType callType, String& replacementString, JSValue replaceValue) 479 479 { 480 auto scope = DECLARE_THROW_SCOPE(vm); 481 480 482 const String& source = string->value(exec); 481 483 unsigned sourceLen = source.length(); 482 if ( exec->hadException())484 if (UNLIKELY(scope.exception())) 483 485 return JSValue::encode(jsUndefined()); 484 486 RegExpObject* regExpObject = asRegExpObject(searchValue); … … 489 491 // ES5.1 15.5.4.10 step 8.a. 490 492 regExpObject->setLastIndex(exec, 0); 491 if ( exec->hadException())493 if (UNLIKELY(scope.exception())) 492 494 return JSValue::encode(jsUndefined()); 493 495 … … 512 514 JSFunction* func = jsCast<JSFunction*>(replaceValue); 513 515 CachedCall cachedCall(exec, func, argCount); 514 if ( exec->hadException())516 if (UNLIKELY(scope.exception())) 515 517 return JSValue::encode(jsUndefined()); 516 518 if (source.is8Bit()) { … … 540 542 JSValue jsResult = cachedCall.call(); 541 543 replacements.append(jsResult.toString(exec)->value(exec)); 542 if ( exec->hadException())544 if (UNLIKELY(scope.exception())) 543 545 return JSValue::encode(jsUndefined()); 544 546 … … 579 581 JSValue jsResult = cachedCall.call(); 580 582 replacements.append(jsResult.toString(exec)->value(exec)); 581 if ( exec->hadException())583 if (UNLIKELY(scope.exception())) 582 584 return JSValue::encode(jsUndefined()); 583 585 … … 619 621 620 622 replacements.append(call(exec, replaceValue, callType, callData, jsUndefined(), args).toString(exec)->value(exec)); 621 if ( exec->hadException())623 if (UNLIKELY(scope.exception())) 622 624 return JSValue::encode(jsUndefined()); 623 625 } else { … … 659 661 VM& vm = exec->vm(); 660 662 NativeCallFrameTracer tracer(&vm, exec); 661 663 auto scope = DECLARE_THROW_SCOPE(vm); 664 662 665 RegExp* regExp = searchValue->regExp(); 663 666 if (regExp->global()) { 664 667 // ES5.1 15.5.4.10 step 8.a. 665 668 searchValue->setLastIndex(exec, 0); 666 if ( exec->hadException())669 if (UNLIKELY(scope.exception())) 667 670 return JSValue::encode(jsUndefined()); 668 671 return removeUsingRegExpSearch(vm, exec, thisValue, thisValue->value(exec), regExp); … … 689 692 static ALWAYS_INLINE EncodedJSValue replaceUsingRegExpSearch(VM& vm, ExecState* exec, JSString* string, JSValue searchValue, JSValue replaceValue) 690 693 { 694 auto scope = DECLARE_THROW_SCOPE(vm); 695 691 696 String replacementString; 692 697 CallData callData; … … 694 699 if (callType == CallType::None) { 695 700 replacementString = replaceValue.toString(exec)->value(exec); 696 if ( exec->hadException())701 if (UNLIKELY(scope.exception())) 697 702 return JSValue::encode(jsUndefined()); 698 703 } … … 702 707 } 703 708 704 static ALWAYS_INLINE EncodedJSValue replaceUsingStringSearch(VM&, ExecState* exec, JSString* jsString, JSValue searchValue, JSValue replaceValue) 705 { 709 static ALWAYS_INLINE EncodedJSValue replaceUsingStringSearch(VM& vm, ExecState* exec, JSString* jsString, JSValue searchValue, JSValue replaceValue) 710 { 711 auto scope = DECLARE_THROW_SCOPE(vm); 712 706 713 const String& string = jsString->value(exec); 707 714 String searchString = searchValue.toString(exec)->value(exec); 708 if ( exec->hadException())715 if (UNLIKELY(scope.exception())) 709 716 return JSValue::encode(jsUndefined()); 710 717 … … 722 729 args.append(jsString); 723 730 replaceValue = call(exec, replaceValue, callType, callData, jsUndefined(), args); 724 if ( exec->hadException())731 if (UNLIKELY(scope.exception())) 725 732 return JSValue::encode(jsUndefined()); 726 733 } 727 734 728 735 String replaceString = replaceValue.toString(exec)->value(exec); 729 if ( exec->hadException())736 if (UNLIKELY(scope.exception())) 730 737 return JSValue::encode(jsUndefined()); 731 738 … … 812 819 return throwVMTypeError(exec, scope); 813 820 JSString* string = thisValue.toString(exec); 814 if ( exec->hadException())821 if (UNLIKELY(scope.exception())) 815 822 return JSValue::encode(jsUndefined()); 816 823 return replace(vm, exec, string, searchValue, replaceValue); … … 819 826 EncodedJSValue JSC_HOST_CALL stringProtoFuncReplaceUsingRegExp(ExecState* exec) 820 827 { 828 VM& vm = exec->vm(); 829 auto scope = DECLARE_THROW_SCOPE(vm); 830 821 831 JSString* string = exec->thisValue().toString(exec); 822 if ( exec->hadException())832 if (UNLIKELY(scope.exception())) 823 833 return JSValue::encode(jsUndefined()); 824 834 … … 832 842 EncodedJSValue JSC_HOST_CALL stringProtoFuncReplaceUsingStringSearch(ExecState* exec) 833 843 { 844 VM& vm = exec->vm(); 845 auto scope = DECLARE_THROW_SCOPE(vm); 846 834 847 JSString* string = exec->thisValue().toString(exec); 835 if ( exec->hadException())848 if (UNLIKELY(scope.exception())) 836 849 return JSValue::encode(jsUndefined()); 837 850 … … 942 955 } 943 956 944 if (UNLIKELY( exec->hadException()))957 if (UNLIKELY(scope.exception())) 945 958 return JSValue::encode(jsUndefined()); 946 959 … … 1054 1067 return throwVMTypeError(exec, scope); 1055 1068 String s = thisValue.toString(exec)->value(exec); 1056 if ( exec->hadException())1069 if (UNLIKELY(scope.exception())) 1057 1070 return JSValue::encode(jsUndefined()); 1058 1071 … … 1112 1125 { 1113 1126 VM& vm = exec->vm(); 1127 auto scope = DECLARE_THROW_SCOPE(vm); 1114 1128 JSValue thisValue = exec->thisValue(); 1115 1129 ASSERT(checkObjectCoercible(thisValue)); … … 1118 1132 // 7. Let s be the number of characters in S. 1119 1133 String input = thisValue.toString(exec)->value(exec); 1120 if (UNLIKELY( vm.exception()))1134 if (UNLIKELY(scope.exception())) 1121 1135 return JSValue::encode(jsUndefined()); 1122 1136 ASSERT(!input.isNull()); … … 1125 1139 // where Array is the standard built-in constructor with that name. 1126 1140 JSArray* result = constructEmptyArray(exec, 0); 1127 if (UNLIKELY( vm.exception()))1141 if (UNLIKELY(scope.exception())) 1128 1142 return JSValue::encode(jsUndefined()); 1129 1143 … … 1142 1156 JSValue separatorValue = exec->uncheckedArgument(0); 1143 1157 String separator = separatorValue.toString(exec)->value(exec); 1144 if (UNLIKELY( vm.exception()))1158 if (UNLIKELY(scope.exception())) 1145 1159 return JSValue::encode(jsUndefined()); 1146 1160 … … 1251 1265 } else { 1252 1266 uString = thisValue.toString(exec)->value(exec); 1253 if ( exec->hadException())1267 if (UNLIKELY(scope.exception())) 1254 1268 return JSValue::encode(jsUndefined()); 1255 1269 len = uString.length(); … … 1304 1318 1305 1319 JSString* jsString = thisValue.toString(exec); 1306 if ( exec->hadException())1320 if (UNLIKELY(scope.exception())) 1307 1321 return JSValue::encode(jsUndefined()); 1308 1322 … … 1378 1392 return throwVMTypeError(exec, scope); 1379 1393 String s = thisValue.toString(exec)->value(exec); 1380 if ( exec->hadException())1394 if (UNLIKELY(scope.exception())) 1381 1395 return JSValue::encode(jsUndefined()); 1382 1396 1383 1397 JSValue a0 = exec->argument(0); 1384 1398 String str = a0.toString(exec)->value(exec); 1385 if ( exec->hadException())1399 if (UNLIKELY(scope.exception())) 1386 1400 return JSValue::encode(jsUndefined()); 1387 1401 return JSValue::encode(jsNumber(Collator().collate(s, str))); … … 1404 1418 1405 1419 // 3. ReturnIfAbrupt(S). 1406 if ( state->hadException())1420 if (UNLIKELY(scope.exception())) 1407 1421 return JSValue::encode(jsUndefined()); 1408 1422 … … 1415 1429 1416 1430 // 5. ReturnIfAbrupt(requestedLocales). 1417 if ( state->hadException())1431 if (UNLIKELY(scope.exception())) 1418 1432 return JSValue::encode(jsUndefined()); 1419 1433 … … 1499 1513 return throwVMTypeError(exec, scope); 1500 1514 String s = thisValue.toString(exec)->value(exec); 1501 if ( exec->hadException())1515 if (UNLIKELY(scope.exception())) 1502 1516 return JSValue::encode(jsUndefined()); 1503 1517 return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>")); … … 1513 1527 return throwVMTypeError(exec, scope); 1514 1528 String s = thisValue.toString(exec)->value(exec); 1515 if ( exec->hadException())1529 if (UNLIKELY(scope.exception())) 1516 1530 return JSValue::encode(jsUndefined()); 1517 1531 return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>")); … … 1527 1541 return throwVMTypeError(exec, scope); 1528 1542 String s = thisValue.toString(exec)->value(exec); 1529 if ( exec->hadException())1543 if (UNLIKELY(scope.exception())) 1530 1544 return JSValue::encode(jsUndefined()); 1531 1545 return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>")); … … 1541 1555 return throwVMTypeError(exec, scope); 1542 1556 String s = thisValue.toString(exec)->value(exec); 1543 if ( exec->hadException())1557 if (UNLIKELY(scope.exception())) 1544 1558 return JSValue::encode(jsUndefined()); 1545 1559 return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>")); … … 1555 1569 return throwVMTypeError(exec, scope); 1556 1570 String s = thisValue.toString(exec)->value(exec); 1557 if ( exec->hadException())1571 if (UNLIKELY(scope.exception())) 1558 1572 return JSValue::encode(jsUndefined()); 1559 1573 return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>")); … … 1569 1583 return throwVMTypeError(exec, scope); 1570 1584 String s = thisValue.toString(exec)->value(exec); 1571 if ( exec->hadException())1585 if (UNLIKELY(scope.exception())) 1572 1586 return JSValue::encode(jsUndefined()); 1573 1587 return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>")); … … 1583 1597 return throwVMTypeError(exec, scope); 1584 1598 String s = thisValue.toString(exec)->value(exec); 1585 if ( exec->hadException())1599 if (UNLIKELY(scope.exception())) 1586 1600 return JSValue::encode(jsUndefined()); 1587 1601 return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>")); … … 1597 1611 return throwVMTypeError(exec, scope); 1598 1612 String s = thisValue.toString(exec)->value(exec); 1599 if ( exec->hadException())1613 if (UNLIKELY(scope.exception())) 1600 1614 return JSValue::encode(jsUndefined()); 1601 1615 return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>")); … … 1611 1625 return throwVMTypeError(exec, scope); 1612 1626 String s = thisValue.toString(exec)->value(exec); 1613 if ( exec->hadException())1627 if (UNLIKELY(scope.exception())) 1614 1628 return JSValue::encode(jsUndefined()); 1615 1629 return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>")); … … 1625 1639 return throwVMTypeError(exec, scope); 1626 1640 String s = thisValue.toString(exec)->value(exec); 1627 if ( exec->hadException())1641 if (UNLIKELY(scope.exception())) 1628 1642 return JSValue::encode(jsUndefined()); 1629 1643 … … 1644 1658 return throwVMTypeError(exec, scope); 1645 1659 String s = thisValue.toString(exec)->value(exec); 1646 if ( exec->hadException())1660 if (UNLIKELY(scope.exception())) 1647 1661 return JSValue::encode(jsUndefined()); 1648 1662 … … 1699 1713 return throwVMTypeError(exec, scope); 1700 1714 String s = thisValue.toString(exec)->value(exec); 1701 if ( exec->hadException())1715 if (UNLIKELY(scope.exception())) 1702 1716 return JSValue::encode(jsUndefined()); 1703 1717 … … 1718 1732 return throwVMTypeError(exec, scope); 1719 1733 String s = thisValue.toString(exec)->value(exec); 1720 if ( exec->hadException())1734 if (UNLIKELY(scope.exception())) 1721 1735 return JSValue::encode(jsUndefined()); 1722 1736 … … 1766 1780 return throwTypeError(exec, scope); 1767 1781 String str = thisValue.toString(exec)->value(exec); 1768 if ( exec->hadException())1782 if (UNLIKELY(scope.exception())) 1769 1783 return jsUndefined(); 1770 1784 … … 1824 1838 1825 1839 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1826 if ( exec->hadException())1840 if (UNLIKELY(scope.exception())) 1827 1841 return JSValue::encode(jsUndefined()); 1828 1842 1829 1843 JSValue a0 = exec->argument(0); 1830 1844 bool isRegularExpression = isRegExp(vm, exec, a0); 1831 if ( vm.exception())1845 if (UNLIKELY(scope.exception())) 1832 1846 return JSValue::encode(JSValue()); 1833 1847 if (isRegularExpression) … … 1835 1849 1836 1850 String searchString = a0.toString(exec)->value(exec); 1837 if ( exec->hadException())1851 if (UNLIKELY(scope.exception())) 1838 1852 return JSValue::encode(jsUndefined()); 1839 1853 … … 1845 1859 unsigned length = stringToSearchIn.length(); 1846 1860 start = clampAndTruncateToUnsigned(positionArg.toInteger(exec), 0, length); 1847 if ( exec->hadException())1861 if (UNLIKELY(scope.exception())) 1848 1862 return JSValue::encode(jsUndefined()); 1849 1863 } … … 1862 1876 1863 1877 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1864 if ( exec->hadException())1878 if (UNLIKELY(scope.exception())) 1865 1879 return JSValue::encode(jsUndefined()); 1866 1880 1867 1881 JSValue a0 = exec->argument(0); 1868 1882 bool isRegularExpression = isRegExp(vm, exec, a0); 1869 if ( vm.exception())1883 if (UNLIKELY(scope.exception())) 1870 1884 return JSValue::encode(JSValue()); 1871 1885 if (isRegularExpression) … … 1873 1887 1874 1888 String searchString = a0.toString(exec)->value(exec); 1875 if ( exec->hadException())1889 if (UNLIKELY(scope.exception())) 1876 1890 return JSValue::encode(jsUndefined()); 1877 1891 … … 1884 1898 else if (!endPositionArg.isUndefined()) { 1885 1899 end = clampAndTruncateToUnsigned(endPositionArg.toInteger(exec), 0, length); 1886 if ( exec->hadException())1900 if (UNLIKELY(scope.exception())) 1887 1901 return JSValue::encode(jsUndefined()); 1888 1902 } … … 1893 1907 static EncodedJSValue JSC_HOST_CALL stringIncludesImpl(VM& vm, ExecState* exec, String stringToSearchIn, String searchString, JSValue positionArg) 1894 1908 { 1909 auto scope = DECLARE_THROW_SCOPE(vm); 1895 1910 unsigned start = 0; 1896 1911 if (positionArg.isInt32()) … … 1899 1914 unsigned length = stringToSearchIn.length(); 1900 1915 start = clampAndTruncateToUnsigned(positionArg.toInteger(exec), 0, length); 1901 if ( vm.exception())1916 if (UNLIKELY(scope.exception())) 1902 1917 return JSValue::encode(jsUndefined()); 1903 1918 } … … 1916 1931 1917 1932 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1918 if ( exec->hadException())1933 if (UNLIKELY(scope.exception())) 1919 1934 return JSValue::encode(jsUndefined()); 1920 1935 1921 1936 JSValue a0 = exec->argument(0); 1922 1937 bool isRegularExpression = isRegExp(vm, exec, a0); 1923 if ( vm.exception())1938 if (UNLIKELY(scope.exception())) 1924 1939 return JSValue::encode(JSValue()); 1925 1940 if (isRegularExpression) … … 1927 1942 1928 1943 String searchString = a0.toString(exec)->value(exec); 1929 if ( exec->hadException())1944 if (UNLIKELY(scope.exception())) 1930 1945 return JSValue::encode(jsUndefined()); 1931 1946 … … 1937 1952 EncodedJSValue JSC_HOST_CALL builtinStringIncludesInternal(ExecState* exec) 1938 1953 { 1954 VM& vm = exec->vm(); 1955 auto scope = DECLARE_THROW_SCOPE(vm); 1956 1939 1957 JSValue thisValue = exec->thisValue(); 1940 1958 ASSERT(checkObjectCoercible(thisValue)); 1941 1959 1942 1960 String stringToSearchIn = thisValue.toString(exec)->value(exec); 1943 if ( exec->hadException())1961 if (UNLIKELY(scope.exception())) 1944 1962 return JSValue::encode(jsUndefined()); 1945 1963 1946 1964 JSValue a0 = exec->uncheckedArgument(0); 1947 VM& vm = exec->vm();1948 1965 String searchString = a0.toString(exec)->value(exec); 1949 if ( exec->hadException())1966 if (UNLIKELY(scope.exception())) 1950 1967 return JSValue::encode(jsUndefined()); 1951 1968 … … 2003 2020 return throwVMTypeError(exec, scope); 2004 2021 JSString::SafeView source = thisValue.toString(exec)->view(exec); 2005 if ( exec->hadException())2022 if (UNLIKELY(scope.exception())) 2006 2023 return JSValue::encode(jsUndefined()); 2007 2024 … … 2010 2027 if (!exec->argument(0).isUndefined()) { 2011 2028 String formString = exec->uncheckedArgument(0).toString(exec)->value(exec); 2012 if ( exec->hadException())2029 if (UNLIKELY(scope.exception())) 2013 2030 return JSValue::encode(jsUndefined()); 2014 2031 -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp
r205335 r205569 97 97 EncodedJSValue JSC_HOST_CALL symbolConstructorFor(ExecState* exec) 98 98 { 99 VM& vm = exec->vm(); 100 auto scope = DECLARE_THROW_SCOPE(vm); 101 99 102 JSString* stringKey = exec->argument(0).toString(exec); 100 if ( exec->hadException())103 if (UNLIKELY(scope.exception())) 101 104 return JSValue::encode(jsUndefined()); 102 105 String string = stringKey->value(exec); 103 if ( exec->hadException())106 if (UNLIKELY(scope.exception())) 104 107 return JSValue::encode(jsUndefined()); 105 108 -
trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp
r205462 r205569 46 46 47 47 VM& vm = exec->vm(); 48 auto scope = DECLARE_THROW_SCOPE(vm); 48 49 unsigned count = templateKey.cookedStrings().size(); 49 50 JSArray* templateObject = constructEmptyArray(exec, nullptr, count); 50 if (UNLIKELY( vm.exception()))51 if (UNLIKELY(scope.exception())) 51 52 return nullptr; 52 53 JSArray* rawObject = constructEmptyArray(exec, nullptr, count); 53 if (UNLIKELY( vm.exception()))54 if (UNLIKELY(scope.exception())) 54 55 return nullptr; 55 56 … … 60 61 61 62 objectConstructorFreeze(exec, rawObject); 62 ASSERT(! exec->hadException());63 ASSERT(!scope.exception()); 63 64 64 65 templateObject->putDirect(vm, exec->propertyNames().raw, rawObject, ReadOnly | DontEnum | DontDelete); 65 66 66 67 objectConstructorFreeze(exec, templateObject); 67 ASSERT(! exec->hadException());68 ASSERT(!scope.exception()); 68 69 69 70 m_templateMap.set(templateKey, templateObject); -
trunk/Source/JavaScriptCore/runtime/ThrowScope.cpp
r205462 r205569 27 27 #include "ThrowScope.h" 28 28 29 #include "Exception.h" 29 30 #include "JSCInlines.h" 30 31 #include "VM.h" … … 32 33 namespace JSC { 33 34 34 #if ENABLE( THROW_SCOPE_VERIFICATION)35 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 35 36 36 namespace { 37 38 // Logs all ThrowScope activity to help debug the source of a verification failure. 39 bool traceOn = false; 40 41 // A more verbose logging option to dump the C++ stack trace at strategic points to aid debugging. 42 bool traceWithStackTraces = false; 43 44 // Disabled temporarily until all known verification failures are fixed. 45 bool verificationOn = false; 46 47 unsigned traceCount = 0; 48 }; 49 50 /* 51 ThrowScope verification works to simulate exception throws and catch cases where 52 exception checks are missing. This is how it works: 53 54 1. The VM has a m_needExceptionCheck bit that indicates where an exception check is 55 needed. You can think of the m_needExceptionCheck bit being set as a simulated 56 throw. 57 58 2. Every throw site must declare a ThrowScope instance using DECLARE_THROW_SCOPE at 59 the top of its function (as early as possible) e.g. 60 61 void foo(...) 62 { 63 auto scope = DECLARE_THROW_SCOPE(vm); 64 throwException(exec, scope, ...); 65 } 66 67 Note: VM::throwException() methods are private, and only calleableby the ThrowScope 68 friend class. All throws must go through a ThrowScope. Hence, we are guaranteed that 69 any function that can throw will have a ThrowScope. 70 71 Note: by convention, every throw helper function must take a ThrowScope argument 72 instead of instantiating its own ThrowScope. This allows the throw to be attributed 73 to the client code rather than the throw helper itself. 74 75 3. Verification of needed exception checks 76 77 a. On construction, each ThrowScope will verify that VM::m_needExceptionCheck is 78 not set. 79 80 This ensures that the caller of the current function has checked for exceptions 81 where needed before doing more work which led to calling the current function. 82 83 b. On destruction, each ThrowScope will verify that VM::m_needExceptionCheck is 84 not set. This verification will be skipped if the ThrowScope has been released 85 (see (5) below). 86 87 This ensures that the function that owns this ThrowScope is not missing any 88 exception checks before returning. 89 90 c. When throwing an exception, the ThrowScope will verify that VM::m_needExceptionCheck 91 is not set, unless it's been ask to rethrow the same Exception object. 92 93 4. Simulated throws 94 95 Throws are simulated by setting the m_needExceptionCheck bit. 96 97 The bit will only be set in the ThrowScope destructor except when the ThrowScope 98 detects the caller is a LLInt or JIT function. LLInt or JIT functions will always 99 check for exceptions after a host C++ function returns to it. However, they will 100 not clear the m_needExceptionCheck bit. 101 102 Hence, if the ThrowScope destructor detects the caller is a LLInt or JIT function, 103 it will just skip the setting of the bit. 104 105 Note: there is no need, and it is incorrect to set the m_needExceptionCheck bit 106 in the throwException methods. This is because, in practice, we always return 107 immediately after throwing an exception. It doesn't make sense to set the bit in 108 the throw just to have to clear it immediately after before we do verification in 109 the ThrowScope destructor. 110 111 5. Using ThrowScope::release() 112 113 ThrowScope::release() should only be used at the bottom of a function if: 114 115 a. This function is going to let its caller check and handle the exception. 116 117 void foo(...) 118 { 119 auto scope = DECLARE_THROW_SCOPE(vm); 120 auto result = goo(); // may throw. 121 122 ... // Cleanup code that will are not affected by a pending exceptions. 123 124 scope.release(); // tell the ThrowScope that the caller will handle the exception. 125 return result; 126 } 127 128 b. This function is going to do a tail call that may throw. 129 130 void foo(...) 131 { 132 auto scope = DECLARE_THROW_SCOPE(vm); 133 ... 134 scope.release(); // tell the ThrowScope that the caller will handle the exception. 135 return goo(); // may throw. 136 } 137 138 ThrowScope::release() should not be used in the code paths that branch. For example: 139 140 void foo(...) 141 { 142 auto scope = DECLARE_THROW_SCOPE(vm); 143 144 auto result = goo1(); // may throw. 145 scope.release(); // <=================== the WRONG way !!! 146 if (result) 147 return; 148 149 result = goo2(); // may throw. 150 ... 151 return result; 152 } 153 154 The above will result in a verification failure in goo2()'s ThrowScope. The proper way 155 to fix this verification is to do wither (6) or (7) below. 156 157 6. Checking exceptions with ThrowScope::exception() 158 159 ThrowScope::exception() returns the thrown Exception object if there is one pending. 160 Else it returns nullptr. 161 162 It also clears the m_needExceptionCheck bit thereby indicating that we've satisifed 163 the needed exception check. 164 165 This is how we do it: 166 167 void foo(...) 168 { 169 auto scope = DECLARE_THROW_SCOPE(vm); 170 171 auto result = goo1(); // may throw. 172 if (scope.exception()) 173 return; 174 175 result = goo2(); // may throw. 176 ... 177 return result; 178 } 179 180 But sometimes, for optimization reasons, we may choose to test the result of the callee 181 function instead doing a load of the VM exception value. See (7) below. 182 183 7. Checking exception by checking callee result 184 185 This approach should only be applied when it makes a difference to performance. 186 If we need to do this, we should add an ASSERT() that invokes ThrowScope::exception() 187 and verify the result. Since ThrowScope verification is only done on DEBUG builds, 188 this ASSERT will satisfy the verification requirements while not impacting performance. 189 190 This is how we do it: 191 192 void foo(...) 193 { 194 auto scope = DECLARE_THROW_SCOPE(vm); 195 196 bool failed = goo1(); // may throw. 197 ASSERT(!!scope.exception() == failed) 198 if (failed) 199 return; 200 201 result = goo2(); // may throw. 202 ... 203 return result; 204 } 205 206 8. Debugging verification failures. 207 208 a. When verification fails, you will see a helpful message followed by an assertion failure. 209 For example: 210 211 FAILED exception check verification: 212 Exception thrown from ThrowScope [2] Exit: setUpCall @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1245 213 is unchecked in ThrowScope [1]: varargsSetup @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1398 214 215 The message tells you that failure was detected at in varargsSetup() @ LLIntSlowPaths.cpp 216 line 1398, and that the missing exception check should have happened somewhere between 217 the call to setUpCall() @ LLIntSlowPaths.cpp line 1245 and it. 218 219 If that is insufficient information, you can ... 220 221 b. Turn on ThrowScope tracing 222 223 Just set traceOn=true at the top of ThrowScope.cpp, and rebuild. Thereafter, you should 224 see a trace of ThrowScopes being entered and exited as well as their depth e.g. 225 226 ThrowScope [1] Enter: llint_slow_path_jfalse @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1032 227 ThrowScope [1] Exit: llint_slow_path_jfalse @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1032 228 229 You will also see traces of simulated throws e.g. 230 231 ThrowScope [2] Throw from: setUpCall @ /Volumes/Data/ws6/OpenSource/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:1245 232 233 If that is insufficient information, you can ... 234 235 c. Turn on ThrowScope stack dumps 236 237 Just set traceWithStackTraces=true at the top of ThrowScope.cpp, and rebuild. 238 Thereafter, you should see a stack traces at various relevant ThrowScope events. 239 240 d. Using throwScopePrintIfNeedCheck() 241 242 If you have isolated the missing exception check to a function that is large but 243 is unsure which statement can throw and is missing the check, you can sprinkle 244 the function with calls to throwScopePrintIfNeedCheck(). 245 246 throwScopePrintIfNeedCheck() will log a line "Need exception check at ..." that 247 inlcudes the file and line number only when it see the m_needExceptionCheck set. 248 This will tell you which statement simulated the throw that is not being checked 249 i.e. the one that preceded the throwScopePrintIfNeedCheck() that printed a line. 250 */ 251 252 ThrowScope::ThrowScope(VM& vm, ThrowScopeLocation location) 253 : m_vm(vm) 254 , m_previousScope(vm.m_topThrowScope) 255 , m_location(location) 256 , m_depth(m_previousScope ? m_previousScope->m_depth + 1 : 0) 37 ThrowScope::ThrowScope(VM& vm, ExceptionEventLocation location) 38 : ExceptionScope(vm, location) 257 39 { 258 m_vm.m_topThrowScope = this; 259 260 if (traceOn) { 261 dataLog("<", traceCount++, "> ThrowScope [", m_depth, "] Enter: ", location.functionName, " @ ", location.file, ":", location.line); 262 if (m_vm.m_needExceptionCheck) 263 dataLog(", needs check"); 264 dataLog("\n"); 265 266 if (traceWithStackTraces) 267 WTFReportBacktrace(); 268 } 269 270 verifyExceptionCheckNeedIsSatisfied(Site::ScopeEntry); 40 m_vm.verifyExceptionCheckNeedIsSatisfied(m_recursionDepth, m_location); 271 41 } 272 42 273 43 ThrowScope::~ThrowScope() 274 44 { 275 RELEASE_ASSERT(m_vm.m_top ThrowScope);45 RELEASE_ASSERT(m_vm.m_topExceptionScope); 276 46 277 47 if (!m_isReleased) 278 verifyExceptionCheckNeedIsSatisfied(Site::ScopeExit);48 m_vm.verifyExceptionCheckNeedIsSatisfied(m_recursionDepth, m_location); 279 49 else { 280 50 // If we released the scope, that means we're letting our callers do the … … 299 69 if (!willBeHandleByLLIntOrJIT) 300 70 simulateThrow(); 301 302 if (traceOn) {303 dataLog("<", traceCount++, "> ThrowScope [", m_depth, "] Exit: ", m_location.functionName, " @ ", m_location.file, ":", m_location.line);304 if (!willBeHandleByLLIntOrJIT)305 dataLog(", with rethrow");306 if (m_vm.m_needExceptionCheck)307 dataLog(", needs check");308 dataLog("\n");309 310 if (traceWithStackTraces)311 WTFReportBacktrace();312 }313 314 m_vm.m_topThrowScope = m_previousScope;315 71 } 316 72 … … 318 74 { 319 75 if (m_vm.exception() && m_vm.exception() != exception) 320 verifyExceptionCheckNeedIsSatisfied(Site::Throw);76 m_vm.verifyExceptionCheckNeedIsSatisfied(m_recursionDepth, m_location); 321 77 322 78 m_vm.throwException(exec, exception); … … 326 82 { 327 83 if (!error.isCell() || !jsDynamicCast<Exception*>(error.asCell())) 328 verifyExceptionCheckNeedIsSatisfied(Site::Throw);84 m_vm.verifyExceptionCheckNeedIsSatisfied(m_recursionDepth, m_location); 329 85 330 86 return m_vm.throwException(exec, error); … … 334 90 { 335 91 if (!jsDynamicCast<Exception*>(obj)) 336 verifyExceptionCheckNeedIsSatisfied(Site::Throw);92 m_vm.verifyExceptionCheckNeedIsSatisfied(m_recursionDepth, m_location); 337 93 338 94 return m_vm.throwException(exec, obj); 339 95 } 340 96 341 void ThrowScope::printIfNeedCheck(const char* functionName, const char* file, unsigned line)342 {343 if (m_vm.m_needExceptionCheck)344 dataLog("<", traceCount++, "> Need exception check at ", functionName, " @ ", file, ":", line, "\n");345 }346 347 97 void ThrowScope::simulateThrow() 348 98 { 349 RELEASE_ASSERT(m_vm.m_top ThrowScope);99 RELEASE_ASSERT(m_vm.m_topExceptionScope); 350 100 m_vm.m_simulatedThrowPointLocation = m_location; 351 m_vm.m_simulatedThrowPoint Depth = m_depth;101 m_vm.m_simulatedThrowPointRecursionDepth = m_recursionDepth; 352 102 m_vm.m_needExceptionCheck = true; 353 103 354 if ( traceOn) {355 dataLog(" <", traceCount++, "> ThrowScope [", m_depth, "] Throw from: ", m_location.functionName, " @ ", m_location.file, ":", m_location.line, "\n");356 if (traceWithStackTraces)357 104 if (Options::dumpSimulatedThrows()) { 105 dataLog("Simulated throw from this scope: ", m_location, "\n"); 106 dataLog(" (ExceptionScope::m_recursionDepth was ", m_recursionDepth, ")\n"); 107 WTFReportBacktrace(); 358 108 } 359 109 } 360 110 361 void ThrowScope::verifyExceptionCheckNeedIsSatisfied(ThrowScope::Site site) 362 { 363 if (!verificationOn) 364 return; 365 366 if (UNLIKELY(m_vm.m_needExceptionCheck)) { 367 auto failDepth = m_vm.m_simulatedThrowPointDepth; 368 auto& failLocation = m_vm.m_simulatedThrowPointLocation; 369 370 auto siteName = [] (Site site) -> const char* { 371 switch (site) { 372 case Site::ScopeEntry: 373 return "Entry"; 374 case Site::ScopeExit: 375 return "Exit"; 376 case Site::Throw: 377 return "Throw"; 378 } 379 RELEASE_ASSERT_NOT_REACHED(); 380 return nullptr; 381 }; 382 383 dataLog( 384 "FAILED exception check verification:\n" 385 " Exception thrown from ThrowScope [", failDepth, "] ", siteName(site), ": ", failLocation.functionName, " @ ", failLocation.file, ":", failLocation.line, "\n" 386 " is unchecked in ThrowScope [", m_depth, "]: ", m_location.functionName, " @ ", m_location.file, ":", m_location.line, "\n" 387 "\n"); 388 389 RELEASE_ASSERT(!m_vm.m_needExceptionCheck); 390 } 391 } 392 393 #endif // ENABLE(THROW_SCOPE_VERIFICATION) 111 #endif // ENABLE(EXCEPTION_SCOPE_VERIFICATION) 394 112 395 113 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/ThrowScope.h
r205198 r205569 27 27 #define ThrowScope_h 28 28 29 #include "Exception.h" 30 #include "VM.h" 29 #include "ExceptionScope.h" 31 30 32 31 namespace JSC { … … 35 34 class JSObject; 36 35 37 #if ENABLE( THROW_SCOPE_VERIFICATION)36 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 38 37 39 class ThrowScope { 38 // If a function can throw a JS exception, it should declare a ThrowScope at the 39 // top of the function (as early as possible) using the DECLARE_THROW_SCOPE macro. 40 // Declaring a ThrowScope in a function means that the function may throw an 41 // exception that its caller will have to handle. 42 43 class ThrowScope : public ExceptionScope { 40 44 public: 41 JS_EXPORT_PRIVATE ThrowScope(VM&, ThrowScopeLocation);45 JS_EXPORT_PRIVATE ThrowScope(VM&, ExceptionEventLocation); 42 46 JS_EXPORT_PRIVATE ~ThrowScope(); 43 47 … … 45 49 ThrowScope(ThrowScope&&) = default; 46 50 47 VM& vm() const { return m_vm; }48 49 51 JS_EXPORT_PRIVATE void throwException(ExecState*, Exception*); 50 52 JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue); 51 53 JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*); 52 54 53 inline Exception* exception() 54 { 55 m_vm.m_needExceptionCheck = false; 56 return m_vm.exception(); 57 } 58 59 inline void release() { m_isReleased = true; } 55 void release() { m_isReleased = true; } 60 56 61 57 JS_EXPORT_PRIVATE void printIfNeedCheck(const char* functionName, const char* file, unsigned line); … … 64 60 void simulateThrow(); 65 61 66 enum class Site {67 ScopeEntry,68 ScopeExit,69 Throw70 };71 void verifyExceptionCheckNeedIsSatisfied(Site);72 73 VM& m_vm;74 ThrowScope* m_previousScope;75 ThrowScopeLocation m_location;76 unsigned m_depth;77 62 bool m_isReleased { false }; 78 63 }; 79 64 80 65 #define DECLARE_THROW_SCOPE(vm__) \ 81 JSC::ThrowScope((vm__), JSC:: ThrowScopeLocation(__FUNCTION__, __FILE__, __LINE__))66 JSC::ThrowScope((vm__), JSC::ExceptionEventLocation(__FUNCTION__, __FILE__, __LINE__)) 82 67 83 68 #define throwScopePrintIfNeedCheck(scope__) \ 84 69 scope__.printIfNeedCheck(__FUNCTION__, __FILE__, __LINE__) 85 70 86 #else // not ENABLE( THROW_SCOPE_VERIFICATION)71 #else // not ENABLE(EXCEPTION_SCOPE_VERIFICATION) 87 72 88 class ThrowScope {73 class ThrowScope : public ExceptionScope { 89 74 public: 90 ThrowScope(VM& vm)91 : m_vm(vm)75 ALWAYS_INLINE ThrowScope(VM& vm) 76 : ExceptionScope(vm) 92 77 { } 78 ThrowScope(const ThrowScope&) = delete; 79 ThrowScope(ThrowScope&&) = default; 93 80 94 VM& vm() const { return m_vm; } 95 96 void throwException(ExecState* exec, Exception* exception) { m_vm.throwException(exec, exception); } 97 JSValue throwException(ExecState* exec, JSValue value) { return m_vm.throwException(exec, value); } 98 JSObject* throwException(ExecState* exec, JSObject* obj) { return m_vm.throwException(exec, obj); } 99 100 Exception* exception() { return m_vm.exception(); } 101 void release() { } 102 103 private: 104 VM& m_vm; 81 ALWAYS_INLINE void throwException(ExecState* exec, Exception* exception) { m_vm.throwException(exec, exception); } 82 ALWAYS_INLINE JSValue throwException(ExecState* exec, JSValue value) { return m_vm.throwException(exec, value); } 83 ALWAYS_INLINE JSObject* throwException(ExecState* exec, JSObject* obj) { return m_vm.throwException(exec, obj); } 84 85 ALWAYS_INLINE void release() { } 105 86 }; 106 87 … … 108 89 JSC::ThrowScope((vm__)) 109 90 110 #endif // ENABLE( THROW_SCOPE_VERIFICATION)91 #endif // ENABLE(EXCEPTION_SCOPE_VERIFICATION) 111 92 112 93 ALWAYS_INLINE void throwException(ExecState* exec, ThrowScope& scope, Exception* exception) -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r205520 r205569 895 895 #endif // !ENABLE(JIT) 896 896 897 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 898 void VM::verifyExceptionCheckNeedIsSatisfied(unsigned recursionDepth, ExceptionEventLocation& location) 899 { 900 if (!m_verifyExceptionEvents) 901 return; 902 903 if (UNLIKELY(m_needExceptionCheck)) { 904 auto throwDepth = m_simulatedThrowPointRecursionDepth; 905 auto& throwLocation = m_simulatedThrowPointLocation; 906 907 dataLog( 908 "ERROR: Unchecked JS exception:\n" 909 " This scope can throw a JS exception: ", throwLocation, "\n" 910 " (ExceptionScope::m_recursionDepth was ", throwDepth, ")\n" 911 " But the exception was unchecked as of this scope: ", location, "\n" 912 " (ExceptionScope::m_recursionDepth was ", recursionDepth, ")\n" 913 "\n"); 914 WTFReportBacktrace(); 915 916 RELEASE_ASSERT(!m_needExceptionCheck); 917 } 918 } 919 #endif 920 897 921 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/VM.h
r205520 r205569 33 33 #include "ControlFlowProfiler.h" 34 34 #include "DateInstanceCache.h" 35 #include "ExceptionEventLocation.h" 35 36 #include "ExecutableAllocator.h" 36 37 #include "FunctionHasExecutedCache.h" … … 48 49 #include "SourceCode.h" 49 50 #include "Strong.h" 50 #include "ThrowScopeLocation.h"51 51 #include "ThunkGenerators.h" 52 52 #include "TypedArrayController.h" … … 86 86 class ExecState; 87 87 class Exception; 88 class ExceptionScope; 88 89 class HandleStack; 89 90 class TypeProfiler; … … 113 114 #endif 114 115 class Symbol; 115 class ThrowScope;116 116 class UnlinkedCodeBlock; 117 117 class UnlinkedEvalCodeBlock; … … 448 448 void restorePreviousException(Exception* exception) { setException(exception); } 449 449 450 void clearException() { m_exception = nullptr; }451 450 void clearLastException() { m_lastException = nullptr; } 452 451 453 452 ExecState** addressOfCallFrameForCatch() { return &callFrameForCatch; } 454 453 455 Exception* exception() const { return m_exception; }456 454 JSCell** addressOfException() { return reinterpret_cast<JSCell**>(&m_exception); } 457 455 … … 649 647 m_lastException = exception; 650 648 } 649 Exception* exception() const 650 { 651 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 652 m_needExceptionCheck = false; 653 #endif 654 return m_exception; 655 } 656 void clearException() 657 { 658 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 659 m_needExceptionCheck = false; 660 #endif 661 m_exception = nullptr; 662 } 651 663 652 664 #if !ENABLE(JIT) … … 658 670 JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue); 659 671 JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*); 672 673 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 674 void verifyExceptionCheckNeedIsSatisfied(unsigned depth, ExceptionEventLocation&); 675 #endif 660 676 661 677 #if ENABLE(ASSEMBLER) … … 683 699 Exception* m_exception { nullptr }; 684 700 Exception* m_lastException { nullptr }; 685 #if ENABLE( THROW_SCOPE_VERIFICATION)686 ThrowScope* m_topThrowScope { nullptr };687 ThrowScopeLocation m_simulatedThrowPointLocation;688 unsigned m_simulatedThrowPoint Depth { 0 };701 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION) 702 ExceptionScope* m_topExceptionScope { nullptr }; 703 ExceptionEventLocation m_simulatedThrowPointLocation; 704 unsigned m_simulatedThrowPointRecursionDepth { 0 }; 689 705 mutable bool m_needExceptionCheck { false }; 706 707 // Disabled temporarily until all known verification failures are fixed. 708 bool m_verifyExceptionEvents { false }; 690 709 #endif 691 710 … … 713 732 std::unique_ptr<BytecodeIntrinsicRegistry> m_bytecodeIntrinsicRegistry; 714 733 734 // Friends for exception checking purpose only. 735 friend class Heap; 736 friend class CatchScope; 737 friend class ExceptionScope; 715 738 friend class ThrowScope; 716 739 }; -
trunk/Source/JavaScriptCore/runtime/WeakMapConstructor.cpp
r205462 r205569 60 60 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 61 61 Structure* weakMapStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->weakMapStructure()); 62 if ( exec->hadException())62 if (UNLIKELY(scope.exception())) 63 63 return JSValue::encode(JSValue()); 64 64 JSWeakMap* weakMap = JSWeakMap::create(exec, weakMapStructure); … … 68 68 69 69 JSValue adderFunction = weakMap->JSObject::get(exec, exec->propertyNames().set); 70 if ( exec->hadException())70 if (UNLIKELY(scope.exception())) 71 71 return JSValue::encode(jsUndefined()); 72 72 … … 77 77 78 78 forEachInIterable(exec, iterable, [&](VM& vm, ExecState* exec, JSValue nextItem) { 79 auto scope = DECLARE_THROW_SCOPE(vm); 79 80 if (!nextItem.isObject()) { 80 81 throwTypeError(exec, scope); … … 83 84 84 85 JSValue key = nextItem.get(exec, static_cast<unsigned>(0)); 85 if ( vm.exception())86 if (UNLIKELY(scope.exception())) 86 87 return; 87 88 88 89 JSValue value = nextItem.get(exec, static_cast<unsigned>(1)); 89 if ( vm.exception())90 if (UNLIKELY(scope.exception())) 90 91 return; 91 92 -
trunk/Source/JavaScriptCore/runtime/WeakSetConstructor.cpp
r205462 r205569 60 60 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 61 61 Structure* weakSetStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->weakSetStructure()); 62 if ( exec->hadException())62 if (UNLIKELY(scope.exception())) 63 63 return JSValue::encode(JSValue()); 64 64 JSWeakSet* weakSet = JSWeakSet::create(exec, weakSetStructure); … … 68 68 69 69 JSValue adderFunction = weakSet->JSObject::get(exec, exec->propertyNames().add); 70 if ( exec->hadException())70 if (UNLIKELY(scope.exception())) 71 71 return JSValue::encode(jsUndefined()); 72 72 -
trunk/Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp
r205462 r205569 308 308 static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec) 309 309 { 310 auto scope = DECLARE_THROW_SCOPE(exec->vm()); 310 311 for (unsigned i = 0; i < exec->argumentCount(); ++i) { 311 312 String argStr = exec->uncheckedArgument(i).toString(exec)->value(exec); 312 if ( exec->hadException())313 if (UNLIKELY(scope.exception())) 313 314 return JSValue::encode(jsUndefined()); 314 315 dataLog(argStr); -
trunk/Source/WTF/ChangeLog
r205549 r205569 1 2016-09-07 Mark Lam <mark.lam@apple.com> 2 3 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. 4 https://bugs.webkit.org/show_bug.cgi?id=161498 5 6 Reviewed by Geoffrey Garen. 7 8 * wtf/Platform.h: 9 1 10 2016-09-07 Youenn Fablet <youenn@apple.com> 2 11 -
trunk/Source/WTF/wtf/Platform.h
r205497 r205569 919 919 #endif 920 920 921 #ifndef ENABLE_ THROW_SCOPE_VERIFICATION922 #define ENABLE_ THROW_SCOPE_VERIFICATION (!defined(NDEBUG))921 #ifndef ENABLE_EXCEPTION_SCOPE_VERIFICATION 922 #define ENABLE_EXCEPTION_SCOPE_VERIFICATION (!defined(NDEBUG)) 923 923 #endif 924 924 -
trunk/Source/WebCore/ChangeLog
r205565 r205569 1 2016-09-07 Mark Lam <mark.lam@apple.com> 2 3 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. 4 https://bugs.webkit.org/show_bug.cgi?id=161498 5 6 Reviewed by Geoffrey Garen. 7 8 No new test because there is no behavior change in general except for 1 bug fix. 9 That bug is already caught by existing tests with the introduction of the CatchScope. 10 11 Fixes a bug in JSEventListener::handleEvent() where the exception thrown from 12 a failed attempt to get the handleEvent callback is not handled. 13 14 * ForwardingHeaders/runtime/CatchScope.h: Added. 15 * Modules/encryptedmedia/CDMSessionClearKey.cpp: 16 (WebCore::CDMSessionClearKey::update): 17 * Modules/indexeddb/IDBObjectStore.cpp: 18 (WebCore::IDBObjectStore::putOrAdd): 19 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 20 (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): 21 * Modules/mediastream/SDPProcessor.cpp: 22 (WebCore::SDPProcessor::callScript): 23 * Modules/plugins/QuickTimePluginReplacement.mm: 24 (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected): 25 (WebCore::QuickTimePluginReplacement::installReplacement): 26 * bindings/js/ArrayValue.cpp: 27 (WebCore::ArrayValue::get): 28 * bindings/js/Dictionary.cpp: 29 (WebCore::Dictionary::getOwnPropertiesAsStringHashMap): 30 * bindings/js/IDBBindingUtilities.cpp: 31 (WebCore::toJS): 32 * bindings/js/JSApplePaySessionCustom.cpp: 33 (WebCore::JSApplePaySession::completeShippingMethodSelection): 34 (WebCore::JSApplePaySession::completeShippingContactSelection): 35 (WebCore::JSApplePaySession::completePaymentMethodSelection): 36 * bindings/js/JSAudioTrackCustom.cpp: 37 (WebCore::JSAudioTrack::setKind): 38 (WebCore::JSAudioTrack::setLanguage): 39 * bindings/js/JSBlobCustom.cpp: 40 (WebCore::constructJSBlob): 41 * bindings/js/JSCSSStyleDeclarationCustom.cpp: 42 (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): 43 * bindings/js/JSCommandLineAPIHostCustom.cpp: 44 (WebCore::getJSListenerFunctions): 45 * bindings/js/JSCryptoAlgorithmDictionary.cpp: 46 (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): 47 (WebCore::getHashAlgorithm): 48 (WebCore::createAesCbcParams): 49 (WebCore::createAesKeyGenParams): 50 (WebCore::createHmacParams): 51 (WebCore::createHmacKeyParams): 52 (WebCore::createRsaKeyGenParams): 53 (WebCore::createRsaOaepParams): 54 (WebCore::createRsaSsaParams): 55 * bindings/js/JSCryptoKeySerializationJWK.cpp: 56 (WebCore::getJSArrayFromJSON): 57 (WebCore::getStringFromJSON): 58 (WebCore::getBooleanFromJSON): 59 (WebCore::JSCryptoKeySerializationJWK::JSCryptoKeySerializationJWK): 60 (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): 61 (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): 62 (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): 63 (WebCore::JSCryptoKeySerializationJWK::keyData): 64 (WebCore::buildJSONForRSAComponents): 65 (WebCore::addUsagesToJSON): 66 (WebCore::JSCryptoKeySerializationJWK::serialize): 67 * bindings/js/JSCustomElementInterface.cpp: 68 (WebCore::JSCustomElementInterface::constructElement): 69 (WebCore::constructCustomElementSynchronously): 70 (WebCore::JSCustomElementInterface::upgradeElement): 71 * bindings/js/JSCustomElementRegistryCustom.cpp: 72 (WebCore::getCustomElementCallback): 73 (WebCore::JSCustomElementRegistry::define): 74 (WebCore::whenDefinedPromise): 75 (WebCore::JSCustomElementRegistry::whenDefined): 76 * bindings/js/JSDOMBinding.cpp: 77 (WebCore::valueToUSVString): 78 (WebCore::reportException): 79 (WebCore::reportCurrentException): 80 (WebCore::setDOMException): 81 (WebCore::hasIteratorMethod): 82 (WebCore::toSmallerInt): 83 (WebCore::toSmallerUInt): 84 (WebCore::toInt32EnforceRange): 85 (WebCore::toUInt32EnforceRange): 86 (WebCore::toInt64EnforceRange): 87 (WebCore::toUInt64EnforceRange): 88 (WebCore::throwNotSupportedError): 89 (WebCore::throwInvalidStateError): 90 (WebCore::throwSecurityError): 91 * bindings/js/JSDOMBinding.h: 92 (WebCore::toJSSequence): 93 (WebCore::toJS): 94 (WebCore::jsFrozenArray): 95 (WebCore::NativeValueTraits<String>::nativeValue): 96 (WebCore::NativeValueTraits<unsigned>::nativeValue): 97 (WebCore::NativeValueTraits<float>::nativeValue): 98 (WebCore::NativeValueTraits<double>::nativeValue): 99 (WebCore::toNativeArray): 100 * bindings/js/JSDOMGlobalObject.cpp: 101 (WebCore::makeThisTypeErrorForBuiltins): 102 (WebCore::makeGetterTypeErrorForBuiltins): 103 * bindings/js/JSDOMGlobalObjectTask.cpp: 104 * bindings/js/JSDOMIterator.h: 105 (WebCore::iteratorForEach): 106 * bindings/js/JSDOMPromise.cpp: 107 (WebCore::rejectPromiseWithExceptionIfAny): 108 * bindings/js/JSDOMPromise.h: 109 (WebCore::callPromiseFunction): 110 * bindings/js/JSDOMStringMapCustom.cpp: 111 (WebCore::JSDOMStringMap::putDelegate): 112 * bindings/js/JSDOMWindowBase.cpp: 113 (WebCore::JSDOMWindowMicrotaskCallback::call): 114 * bindings/js/JSDOMWindowCustom.cpp: 115 (WebCore::JSDOMWindow::setLocation): 116 (WebCore::JSDOMWindow::open): 117 (WebCore::JSDOMWindow::showModalDialog): 118 (WebCore::handlePostMessage): 119 (WebCore::JSDOMWindow::setTimeout): 120 (WebCore::JSDOMWindow::setInterval): 121 * bindings/js/JSDataCueCustom.cpp: 122 (WebCore::constructJSDataCue): 123 * bindings/js/JSDeviceMotionEventCustom.cpp: 124 (WebCore::readAccelerationArgument): 125 (WebCore::readRotationRateArgument): 126 (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): 127 * bindings/js/JSDictionary.cpp: 128 (WebCore::JSDictionary::tryGetProperty): 129 (WebCore::JSDictionary::convertValue): 130 * bindings/js/JSDictionary.h: 131 (WebCore::JSDictionary::tryGetPropertyAndResult): 132 * bindings/js/JSDocumentCustom.cpp: 133 (WebCore::JSDocument::getCSSCanvasContext): 134 * bindings/js/JSEventListener.cpp: 135 (WebCore::JSEventListener::handleEvent): 136 * bindings/js/JSFileCustom.cpp: 137 (WebCore::constructJSFile): 138 * bindings/js/JSGeolocationCustom.cpp: 139 (WebCore::createPositionOptions): 140 (WebCore::JSGeolocation::getCurrentPosition): 141 (WebCore::JSGeolocation::watchPosition): 142 * bindings/js/JSHTMLAllCollectionCustom.cpp: 143 (WebCore::callHTMLAllCollection): 144 * bindings/js/JSHTMLCanvasElementCustom.cpp: 145 (WebCore::get3DContextAttributes): 146 (WebCore::JSHTMLCanvasElement::getContext): 147 (WebCore::JSHTMLCanvasElement::probablySupportsContext): 148 * bindings/js/JSHTMLElementCustom.cpp: 149 (WebCore::constructJSHTMLElement): 150 * bindings/js/JSHistoryCustom.cpp: 151 (WebCore::JSHistory::pushState): 152 (WebCore::JSHistory::replaceState): 153 * bindings/js/JSIDBDatabaseCustom.cpp: 154 (WebCore::JSIDBDatabase::createObjectStore): 155 * bindings/js/JSLazyEventListener.cpp: 156 (WebCore::JSLazyEventListener::initializeJSFunction): 157 * bindings/js/JSMainThreadExecState.h: 158 (WebCore::JSMainThreadExecState::linkAndEvaluateModule): 159 (WebCore::JSMainThreadExecState::~JSMainThreadExecState): 160 * bindings/js/JSMessageEventCustom.cpp: 161 (WebCore::handleInitMessageEvent): 162 * bindings/js/JSMessagePortCustom.cpp: 163 (WebCore::fillMessagePortArray): 164 * bindings/js/JSMessagePortCustom.h: 165 (WebCore::handlePostMessage): 166 * bindings/js/JSMockContentFilterSettingsCustom.cpp: 167 (WebCore::JSMockContentFilterSettings::setDecisionPoint): 168 (WebCore::toDecision): 169 (WebCore::JSMockContentFilterSettings::setDecision): 170 (WebCore::JSMockContentFilterSettings::setUnblockRequestDecision): 171 * bindings/js/JSNodeFilterCustom.cpp: 172 (WebCore::JSNodeFilter::acceptNode): 173 * bindings/js/JSNodeOrString.cpp: 174 (WebCore::toNodeOrStringVector): 175 * bindings/js/JSSQLTransactionCustom.cpp: 176 (WebCore::JSSQLTransaction::executeSql): 177 * bindings/js/JSSVGLengthCustom.cpp: 178 (WebCore::JSSVGLength::convertToSpecifiedUnits): 179 * bindings/js/JSStorageCustom.cpp: 180 (WebCore::JSStorage::getOwnPropertyNames): 181 (WebCore::JSStorage::putDelegate): 182 * bindings/js/JSTextTrackCustom.cpp: 183 (WebCore::JSTextTrack::setLanguage): 184 * bindings/js/JSVideoTrackCustom.cpp: 185 (WebCore::JSVideoTrack::setKind): 186 (WebCore::JSVideoTrack::setLanguage): 187 * bindings/js/JSWebGL2RenderingContextCustom.cpp: 188 (WebCore::JSWebGL2RenderingContext::getIndexedParameter): 189 * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: 190 (WebCore::getObjectParameter): 191 (WebCore::JSWebGLRenderingContextBase::getExtension): 192 (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): 193 (WebCore::JSWebGLRenderingContextBase::getParameter): 194 (WebCore::JSWebGLRenderingContextBase::getProgramParameter): 195 (WebCore::JSWebGLRenderingContextBase::getShaderParameter): 196 (WebCore::toVector): 197 (WebCore::dataFunctionf): 198 (WebCore::dataFunctionMatrix): 199 * bindings/js/JSWebKitSubtleCryptoCustom.cpp: 200 (WebCore::createAlgorithmFromJSValue): 201 (WebCore::cryptoKeyFormatFromJSValue): 202 (WebCore::cryptoKeyUsagesFromJSValue): 203 (WebCore::JSWebKitSubtleCrypto::encrypt): 204 (WebCore::JSWebKitSubtleCrypto::decrypt): 205 (WebCore::JSWebKitSubtleCrypto::sign): 206 (WebCore::JSWebKitSubtleCrypto::verify): 207 (WebCore::JSWebKitSubtleCrypto::digest): 208 (WebCore::JSWebKitSubtleCrypto::generateKey): 209 (WebCore::importKey): 210 (WebCore::JSWebKitSubtleCrypto::importKey): 211 (WebCore::exportKey): 212 (WebCore::JSWebKitSubtleCrypto::exportKey): 213 (WebCore::JSWebKitSubtleCrypto::wrapKey): 214 (WebCore::JSWebKitSubtleCrypto::unwrapKey): 215 * bindings/js/JSWorkerCustom.cpp: 216 (WebCore::constructJSWorker): 217 * bindings/js/JSWorkerGlobalScopeCustom.cpp: 218 (WebCore::JSWorkerGlobalScope::importScripts): 219 (WebCore::JSWorkerGlobalScope::setTimeout): 220 (WebCore::JSWorkerGlobalScope::setInterval): 221 * bindings/js/ReadableStreamDefaultController.cpp: 222 (WebCore::ReadableStreamDefaultController::invoke): 223 (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked): 224 * bindings/js/ReadableStreamDefaultController.h: 225 (WebCore::ReadableStreamDefaultController::enqueue): 226 * bindings/js/ScheduledAction.cpp: 227 (WebCore::ScheduledAction::create): 228 * bindings/js/ScriptGlobalObject.cpp: 229 (WebCore::ScriptGlobalObject::set): 230 * bindings/js/SerializedScriptValue.cpp: 231 (WebCore::CloneBase::shouldTerminate): 232 (WebCore::CloneDeserializer::deserialize): 233 (WebCore::SerializedScriptValue::create): 234 (WebCore::SerializedScriptValue::deserialize): 235 * bindings/js/WorkerScriptController.cpp: 236 (WebCore::WorkerScriptController::evaluate): 237 * bindings/scripts/CodeGeneratorJS.pm: 238 (GenerateDictionaryImplementationContent): 239 (GenerateImplementation): 240 (GenerateParametersCheck): 241 (GenerateImplementationFunctionCall): 242 (GenerateConstructorDefinition): 243 * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: 244 (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): 245 * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: 246 (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): 247 * bindings/scripts/test/JS/JSTestEventConstructor.cpp: 248 (WebCore::JSTestEventConstructorConstructor::construct): 249 * bindings/scripts/test/JS/JSTestEventTarget.cpp: 250 (WebCore::jsTestEventTargetPrototypeFunctionItem): 251 * bindings/scripts/test/JS/JSTestGlobalObject.cpp: 252 (WebCore::setJSTestGlobalObjectRegularAttribute): 253 (WebCore::setJSTestGlobalObjectPublicAndPrivateAttribute): 254 (WebCore::setJSTestGlobalObjectPublicAndPrivateConditionalAttribute): 255 (WebCore::setJSTestGlobalObjectEnabledAtRuntimeAttribute): 256 (WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation): 257 (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1): 258 (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2): 259 * bindings/scripts/test/JS/JSTestInterface.cpp: 260 (WebCore::JSTestInterfaceConstructor::construct): 261 (WebCore::setJSTestInterfaceConstructorImplementsStaticAttr): 262 (WebCore::setJSTestInterfaceImplementsStr2): 263 (WebCore::setJSTestInterfaceImplementsStr3): 264 (WebCore::setJSTestInterfaceImplementsNode): 265 (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr): 266 (WebCore::setJSTestInterfaceSupplementalStr2): 267 (WebCore::setJSTestInterfaceSupplementalStr3): 268 (WebCore::setJSTestInterfaceSupplementalNode): 269 (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2): 270 (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): 271 * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: 272 (WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom): 273 * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: 274 (WebCore::JSTestNamedConstructorNamedConstructor::construct): 275 * bindings/scripts/test/JS/JSTestNode.cpp: 276 (WebCore::setJSTestNodeName): 277 * bindings/scripts/test/JS/JSTestNondeterministic.cpp: 278 (WebCore::setJSTestNondeterministicNondeterministicWriteableAttr): 279 (WebCore::setJSTestNondeterministicNondeterministicExceptionAttr): 280 (WebCore::setJSTestNondeterministicNondeterministicGetterExceptionAttr): 281 (WebCore::setJSTestNondeterministicNondeterministicSetterExceptionAttr): 282 * bindings/scripts/test/JS/JSTestObj.cpp: 283 (WebCore::convertDictionary<TestObj::Dictionary>): 284 (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): 285 (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): 286 (WebCore::convertDictionary<AlternateDictionaryName>): 287 (WebCore::setJSTestObjConstructorStaticStringAttr): 288 (WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor): 289 (WebCore::setJSTestObjEnumAttr): 290 (WebCore::setJSTestObjByteAttr): 291 (WebCore::setJSTestObjOctetAttr): 292 (WebCore::setJSTestObjShortAttr): 293 (WebCore::setJSTestObjClampedShortAttr): 294 (WebCore::setJSTestObjEnforceRangeShortAttr): 295 (WebCore::setJSTestObjUnsignedShortAttr): 296 (WebCore::setJSTestObjLongAttr): 297 (WebCore::setJSTestObjLongLongAttr): 298 (WebCore::setJSTestObjUnsignedLongLongAttr): 299 (WebCore::setJSTestObjStringAttr): 300 (WebCore::setJSTestObjUsvstringAttr): 301 (WebCore::setJSTestObjTestObjAttr): 302 (WebCore::setJSTestObjTestNullableObjAttr): 303 (WebCore::setJSTestObjLenientTestObjAttr): 304 (WebCore::setJSTestObjStringAttrTreatingNullAsEmptyString): 305 (WebCore::setJSTestObjUsvstringAttrTreatingNullAsEmptyString): 306 (WebCore::setJSTestObjImplementationEnumAttr): 307 (WebCore::setJSTestObjXMLObjAttr): 308 (WebCore::setJSTestObjCreate): 309 (WebCore::setJSTestObjReflectedStringAttr): 310 (WebCore::setJSTestObjReflectedUSVStringAttr): 311 (WebCore::setJSTestObjReflectedIntegralAttr): 312 (WebCore::setJSTestObjReflectedUnsignedIntegralAttr): 313 (WebCore::setJSTestObjReflectedBooleanAttr): 314 (WebCore::setJSTestObjReflectedURLAttr): 315 (WebCore::setJSTestObjReflectedUSVURLAttr): 316 (WebCore::setJSTestObjReflectedCustomIntegralAttr): 317 (WebCore::setJSTestObjReflectedCustomBooleanAttr): 318 (WebCore::setJSTestObjReflectedCustomURLAttr): 319 (WebCore::setJSTestObjEnabledAtRuntimeAttribute): 320 (WebCore::setJSTestObjTypedArrayAttr): 321 (WebCore::setJSTestObjAttrWithGetterException): 322 (WebCore::setJSTestObjAttrWithGetterExceptionWithMessage): 323 (WebCore::setJSTestObjAttrWithSetterException): 324 (WebCore::setJSTestObjAttrWithSetterExceptionWithMessage): 325 (WebCore::setJSTestObjStringAttrWithGetterException): 326 (WebCore::setJSTestObjStringAttrWithSetterException): 327 (WebCore::setJSTestObjCustomAttr): 328 (WebCore::setJSTestObjOnfoo): 329 (WebCore::setJSTestObjOnwebkitfoo): 330 (WebCore::setJSTestObjWithScriptStateAttribute): 331 (WebCore::setJSTestObjWithCallWithAndSetterCallWithAttribute): 332 (WebCore::setJSTestObjWithScriptExecutionContextAttribute): 333 (WebCore::setJSTestObjWithScriptStateAttributeRaises): 334 (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises): 335 (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute): 336 (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises): 337 (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute): 338 (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute): 339 (WebCore::setJSTestObjConditionalAttr1): 340 (WebCore::setJSTestObjConditionalAttr2): 341 (WebCore::setJSTestObjConditionalAttr3): 342 (WebCore::setJSTestObjConditionalAttr4Constructor): 343 (WebCore::setJSTestObjConditionalAttr5Constructor): 344 (WebCore::setJSTestObjConditionalAttr6Constructor): 345 (WebCore::setJSTestObjAnyAttribute): 346 (WebCore::setJSTestObjMutablePoint): 347 (WebCore::setJSTestObjImmutablePoint): 348 (WebCore::setJSTestObjStrawberry): 349 (WebCore::setJSTestObjId): 350 (WebCore::setJSTestObjReplaceableAttribute): 351 (WebCore::setJSTestObjNullableLongSettableAttribute): 352 (WebCore::setJSTestObjNullableStringSettableAttribute): 353 (WebCore::setJSTestObjNullableUSVStringSettableAttribute): 354 (WebCore::setJSTestObjNullableStringValue): 355 (WebCore::setJSTestObjAttributeWithReservedEnumType): 356 (WebCore::setJSTestObjPutForwardsAttribute): 357 (WebCore::setJSTestObjPutForwardsNullableAttribute): 358 (WebCore::setJSTestObjStringifierAttribute): 359 (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1): 360 (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2): 361 (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): 362 (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs): 363 (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs): 364 (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs): 365 (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): 366 (WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString): 367 (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter): 368 (WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod): 369 (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg): 370 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArg): 371 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue): 372 (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): 373 (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg): 374 (WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg): 375 (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString): 376 (WebCore::jsTestObjPrototypeFunctionSerializedValue): 377 (WebCore::jsTestObjPrototypeFunctionPrivateMethod): 378 (WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod): 379 (WebCore::jsTestObjPrototypeFunctionAddEventListener): 380 (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): 381 (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj): 382 (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException): 383 (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException): 384 (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces): 385 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): 386 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue): 387 (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): 388 (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): 389 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString): 390 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVString): 391 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicString): 392 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue): 393 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue): 394 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull): 395 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined): 396 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull): 397 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString): 398 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringIsEmptyString): 399 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString): 400 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN): 401 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN): 402 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLong): 403 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero): 404 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong): 405 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero): 406 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequence): 407 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty): 408 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBoolean): 409 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse): 410 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver): 411 (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): 412 (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg): 413 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): 414 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): 415 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): 416 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): 417 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): 418 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9): 419 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10): 420 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11): 421 (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1): 422 (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2): 423 (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): 424 (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): 425 (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): 426 (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp): 427 (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange): 428 (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence): 429 (WebCore::jsTestObjPrototypeFunctionStringArrayFunction): 430 (WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence): 431 (WebCore::jsTestObjPrototypeFunctionGetElementById): 432 (WebCore::jsTestObjPrototypeFunctionConvert3): 433 (WebCore::jsTestObjPrototypeFunctionConvert4): 434 (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod): 435 (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod): 436 (WebCore::jsTestObjPrototypeFunctionAny): 437 (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise): 438 (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise): 439 (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise): 440 (WebCore::jsTestObjPrototypeFunctionConditionalOverload1): 441 (WebCore::jsTestObjPrototypeFunctionConditionalOverload2): 442 (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1): 443 (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2): 444 (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot): 445 * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: 446 (WebCore::constructJSTestOverloadedConstructors1): 447 (WebCore::constructJSTestOverloadedConstructors2): 448 (WebCore::constructJSTestOverloadedConstructors4): 449 (WebCore::constructJSTestOverloadedConstructors5): 450 * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: 451 (WebCore::constructJSTestOverloadedConstructorsWithSequence1): 452 (WebCore::constructJSTestOverloadedConstructorsWithSequence2): 453 * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: 454 (WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem): 455 * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: 456 (WebCore::setJSTestSerializedScriptValueInterfaceValue): 457 (WebCore::setJSTestSerializedScriptValueInterfaceCachedValue): 458 * bindings/scripts/test/JS/JSTestTypedefs.cpp: 459 (WebCore::JSTestTypedefsConstructor::construct): 460 (WebCore::setJSTestTypedefsUnsignedLongLongAttr): 461 (WebCore::setJSTestTypedefsImmutableSerializedScriptValue): 462 (WebCore::setJSTestTypedefsAttrWithGetterException): 463 (WebCore::setJSTestTypedefsAttrWithSetterException): 464 (WebCore::setJSTestTypedefsStringAttrWithGetterException): 465 (WebCore::setJSTestTypedefsStringAttrWithSetterException): 466 (WebCore::jsTestTypedefsPrototypeFunctionFunc): 467 (WebCore::jsTestTypedefsPrototypeFunctionSetShadow): 468 (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg): 469 (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg): 470 (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp): 471 (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction): 472 (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2): 473 (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude): 474 * bridge/NP_jsobject.cpp: 475 (_NPN_InvokeDefault): 476 (_NPN_Invoke): 477 (_NPN_Evaluate): 478 (_NPN_GetProperty): 479 (_NPN_SetProperty): 480 (_NPN_RemoveProperty): 481 (_NPN_HasProperty): 482 (_NPN_HasMethod): 483 (_NPN_Enumerate): 484 (_NPN_Construct): 485 * bridge/c/c_instance.cpp: 486 (JSC::Bindings::CInstance::moveGlobalExceptionToExecState): 487 * bridge/objc/WebScriptObject.mm: 488 (WebCore::addExceptionToConsole): 489 (-[WebScriptObject callWebScriptMethod:withArguments:]): 490 (-[WebScriptObject evaluateWebScript:]): 491 (-[WebScriptObject setValue:forKey:]): 492 (-[WebScriptObject valueForKey:]): 493 (-[WebScriptObject removeWebScriptKey:]): 494 (-[WebScriptObject hasWebScriptKey:]): 495 (-[WebScriptObject webScriptValueAtIndex:]): 496 (-[WebScriptObject setWebScriptValueAtIndex:value:]): 497 * contentextensions/ContentExtensionParser.cpp: 498 (WebCore::ContentExtensions::getDomainList): 499 (WebCore::ContentExtensions::getTypeFlags): 500 (WebCore::ContentExtensions::loadTrigger): 501 (WebCore::ContentExtensions::loadAction): 502 (WebCore::ContentExtensions::loadEncodedRules): 503 * html/HTMLMediaElement.cpp: 504 (WebCore::controllerJSValue): 505 (WebCore::HTMLMediaElement::updateCaptionContainer): 506 (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): 507 (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot): 508 (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange): 509 (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): 510 * html/HTMLPlugInImageElement.cpp: 511 (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): 512 1 513 2016-09-07 Chris Dumez <cdumez@apple.com> 2 514 -
trunk/Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp
r195452 r205569 112 112 VM& vm = clearKeyVM(); 113 113 JSLockHolder lock(vm); 114 auto scope = DECLARE_THROW_SCOPE(vm); 114 115 JSGlobalObject* globalObject = JSGlobalObject::create(vm, JSGlobalObject::createStructure(vm, jsNull())); 115 116 ExecState* exec = globalObject->globalExec(); … … 117 118 JSLockHolder locker(clearKeyVM()); 118 119 JSValue keysDataObject = JSONParse(exec, rawKeysString); 119 if ( exec->hadException() || !keysDataObject) {120 if (scope.exception() || !keysDataObject) { 120 121 LOG(Media, "CDMSessionClearKey::update(%p) - failed: invalid JSON", this); 121 122 break; -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
r204018 r205569 237 237 RefPtr<IDBRequest> IDBObjectStore::putOrAdd(ExecState& state, JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck, ExceptionCodeWithMessage& ec) 238 238 { 239 VM& vm = state.vm(); 240 auto scope = DECLARE_CATCH_SCOPE(vm); 241 239 242 LOG(IndexedDB, "IDBObjectStore::putOrAdd"); 240 243 ASSERT(currentThread() == m_transaction->database().originThreadID()); … … 271 274 272 275 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr); 273 if ( state.hadException()) {276 if (UNLIKELY(scope.exception())) { 274 277 // Clear the DOM exception from the serializer so we can give a more targeted exception. 275 s tate.clearException();278 scope.clearException(); 276 279 277 280 ec.code = IDBDatabaseException::DataCloneError; -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r205462 r205569 860 860 ThreadSafeDataBuffer injectedRecordValue; 861 861 if (usedKeyIsGenerated && !objectStoreInfo->keyPath().isNull()) { 862 JSLockHolder locker(databaseThreadVM()); 862 VM& vm = databaseThreadVM(); 863 JSLockHolder locker(vm); 864 auto scope = DECLARE_THROW_SCOPE(vm); 863 865 864 866 auto value = deserializeIDBValueToJSValue(databaseThreadExecState(), originalRecordValue.data()); … … 874 876 875 877 auto serializedValue = SerializedScriptValue::create(&databaseThreadExecState(), value, nullptr, nullptr); 876 if ( databaseThreadExecState().hadException()) {878 if (UNLIKELY(scope.exception())) { 877 879 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to serialize record value after injecting record key")), usedKey)); 878 880 return; -
trunk/Source/WebCore/Modules/mediastream/SDPProcessor.cpp
r201728 r205569 1 1 /* 2 2 * Copyright (C) 2015, 2016 Ericsson AB. 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 … … 501 502 ScriptController& scriptController = document->frame()->script(); 502 503 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(*m_isolatedWorld)); 504 JSC::VM& vm = globalObject->vm(); 505 JSC::JSLockHolder lock(vm); 506 auto scope = DECLARE_CATCH_SCOPE(vm); 503 507 JSC::ExecState* exec = globalObject->globalExec(); 504 JSC::JSLockHolder lock(exec);505 508 506 509 JSC::JSValue probeFunctionValue = globalObject->get(exec, JSC::Identifier::fromString(exec, "generate")); … … 508 511 URL scriptURL; 509 512 scriptController.evaluateInWorld(ScriptSourceCode(SDPProcessorScriptResource::scriptString(), scriptURL), *m_isolatedWorld); 510 if ( exec->hadException()) {511 exec->clearException();513 if (UNLIKELY(scope.exception())) { 514 scope.clearException(); 512 515 return false; 513 516 } … … 528 531 529 532 JSC::JSValue result = JSC::call(exec, function, callType, callData, globalObject, argList); 530 if ( exec->hadException()) {533 if (UNLIKELY(scope.exception())) { 531 534 LOG_ERROR("SDPProcessor script threw in function %s", functionName.ascii().data()); 532 exec->clearException();535 scope.clearException(); 533 536 return false; 534 537 } -
trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm
r205271 r205569 161 161 ScriptController& scriptController = m_parentElement->document().frame()->script(); 162 162 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 163 JSC::VM& vm = globalObject->vm(); 164 JSC::JSLockHolder lock(vm); 165 auto scope = DECLARE_CATCH_SCOPE(vm); 163 166 JSC::ExecState* exec = globalObject->globalExec(); 164 JSC::JSLockHolder lock(exec);165 167 166 168 JSC::JSValue replacementFunction = globalObject->get(exec, JSC::Identifier::fromString(exec, "createPluginReplacement")); … … 169 171 170 172 scriptController.evaluateInWorld(ScriptSourceCode(quickTimePluginReplacementScript()), world); 171 if ( exec->hadException()) {173 if (UNLIKELY(scope.exception())) { 172 174 LOG(Plugins, "%p - Exception when evaluating QuickTime plugin replacement script", this); 173 exec->clearException();175 scope.clearException(); 174 176 return false; 175 177 } … … 189 191 ScriptController& scriptController = m_parentElement->document().frame()->script(); 190 192 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 193 JSC::VM& vm = globalObject->vm(); 194 JSC::JSLockHolder lock(vm); 195 auto scope = DECLARE_CATCH_SCOPE(vm); 191 196 JSC::ExecState* exec = globalObject->globalExec(); 192 JSC::JSLockHolder lock(exec); 193 197 194 198 // Lookup the "createPluginReplacement" function. 195 199 JSC::JSValue replacementFunction = globalObject->get(exec, JSC::Identifier::fromString(exec, "createPluginReplacement")); … … 197 201 return false; 198 202 JSC::JSObject* replacementObject = replacementFunction.toObject(exec); 199 ASSERT(! exec->hadException());203 ASSERT(!scope.exception()); 200 204 JSC::CallData callData; 201 205 JSC::CallType callType = replacementObject->methodTable()->getCallData(replacementObject, callData); … … 210 214 argList.append(toJS<String>(exec, globalObject, m_values)); 211 215 JSC::JSValue replacement = call(exec, replacementObject, callType, callData, globalObject, argList); 212 if ( exec->hadException()) {213 exec->clearException();216 if (UNLIKELY(scope.exception())) { 217 scope.clearException(); 214 218 return false; 215 219 } … … 217 221 // Get the <video> created to replace the plug-in. 218 222 JSC::JSValue value = replacement.get(exec, JSC::Identifier::fromString(exec, "video")); 219 if (! exec->hadException() && !value.isUndefinedOrNull())223 if (!scope.exception() && !value.isUndefinedOrNull()) 220 224 m_mediaElement = JSHTMLVideoElement::toWrapped(value); 221 225 222 226 if (!m_mediaElement) { 223 227 LOG(Plugins, "%p - Failed to find <video> element created by QuickTime plugin replacement script.", this); 224 exec->clearException();228 scope.clearException(); 225 229 return false; 226 230 } … … 228 232 // Get the scripting interface. 229 233 value = replacement.get(exec, JSC::Identifier::fromString(exec, "scriptObject")); 230 if (! exec->hadException() && !value.isUndefinedOrNull()) {234 if (!scope.exception() && !value.isUndefinedOrNull()) { 231 235 m_scriptObject = value.toObject(exec); 232 ASSERT(! exec->hadException());236 ASSERT(!scope.exception()); 233 237 } 234 238 235 239 if (!m_scriptObject) { 236 240 LOG(Plugins, "%p - Failed to find script object created by QuickTime plugin replacement.", this); 237 exec->clearException();241 scope.clearException(); 238 242 return false; 239 243 } -
trunk/Source/WebCore/bindings/js/ArrayValue.cpp
r195781 r205569 83 83 bool ArrayValue::get(size_t index, String& value) const 84 84 { 85 VM& vm = m_exec->vm(); 86 auto scope = DECLARE_THROW_SCOPE(vm); 87 85 88 if (isUndefinedOrNull()) 86 89 return false; … … 91 94 92 95 value = indexedValue.toWTFString(m_exec); 93 if ( m_exec->hadException())96 if (UNLIKELY(scope.exception())) 94 97 return false; 95 98 -
trunk/Source/WebCore/bindings/js/Dictionary.cpp
r187355 r205569 62 62 JSObject* object = m_dictionary.initializerObject(); 63 63 ExecState* exec = m_dictionary.execState(); 64 VM& vm = exec->vm(); 65 auto scope = DECLARE_THROW_SCOPE(vm); 64 66 65 67 PropertyNameArray propertyNames(exec, PropertyNameMode::Strings); … … 70 72 continue; 71 73 JSValue value = object->get(exec, *it); 72 if ( exec->hadException())74 if (UNLIKELY(scope.exception())) 73 75 continue; 74 76 String stringValue = value.toString(exec)->value(exec); 75 if ( !exec->hadException())77 if (LIKELY(!scope.exception())) 76 78 map.set(stringKey, stringValue); 77 79 } -
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp
r203065 r205569 91 91 VM& vm = state.vm(); 92 92 Locker<JSLock> locker(vm.apiLock()); 93 auto scope = DECLARE_THROW_SCOPE(vm); 93 94 94 95 switch (key->type()) { … … 97 98 unsigned size = inArray.size(); 98 99 auto outArray = constructEmptyArray(&state, 0, &globalObject, size); 99 if (UNLIKELY( vm.exception()))100 if (UNLIKELY(scope.exception())) 100 101 return jsUndefined(); 101 102 for (size_t i = 0; i < size; ++i) -
trunk/Source/WebCore/bindings/js/JSApplePaySessionCustom.cpp
r205198 r205569 56 56 ExceptionCode ec = 0; 57 57 uint16_t status = convert<uint16_t>(state, state.argument(0), NormalConversion); 58 if (UNLIKELY(s tate.hadException()))58 if (UNLIKELY(scope.exception())) 59 59 return jsUndefined(); 60 60 61 61 Dictionary newTotal = { &state, state.argument(1) }; 62 if (UNLIKELY(s tate.hadException()))62 if (UNLIKELY(scope.exception())) 63 63 return jsUndefined(); 64 64 65 65 ArrayValue newLineItems { &state, state.argument(2) }; 66 if (UNLIKELY(s tate.hadException()))66 if (UNLIKELY(scope.exception())) 67 67 return jsUndefined(); 68 68 impl.completeShippingMethodSelection(status, newTotal, newLineItems, ec); … … 89 89 ExceptionCode ec = 0; 90 90 uint16_t status = convert<uint16_t>(state, state.argument(0), NormalConversion); 91 if (UNLIKELY(s tate.hadException()))91 if (UNLIKELY(scope.exception())) 92 92 return jsUndefined(); 93 93 94 94 ArrayValue newShippingMethods { &state, state.argument(1) }; 95 if (UNLIKELY(s tate.hadException()))95 if (UNLIKELY(scope.exception())) 96 96 return jsUndefined(); 97 97 98 98 Dictionary newTotal = { &state, state.argument(2) }; 99 if (UNLIKELY(s tate.hadException()))99 if (UNLIKELY(scope.exception())) 100 100 return jsUndefined(); 101 101 102 102 ArrayValue newLineItems { &state, state.argument(3) }; 103 if (UNLIKELY(s tate.hadException()))103 if (UNLIKELY(scope.exception())) 104 104 return jsUndefined(); 105 105 impl.completeShippingContactSelection(status, newShippingMethods, newTotal, newLineItems, ec); … … 126 126 ExceptionCode ec = 0; 127 127 Dictionary newTotal = { &state, state.argument(0) }; 128 if (UNLIKELY(s tate.hadException()))128 if (UNLIKELY(scope.exception())) 129 129 return jsUndefined(); 130 130 131 131 ArrayValue newLineItems { &state, state.argument(1) }; 132 if (UNLIKELY(s tate.hadException()))132 if (UNLIKELY(scope.exception())) 133 133 return jsUndefined(); 134 134 impl.completePaymentMethodSelection(newTotal, newLineItems, ec); -
trunk/Source/WebCore/bindings/js/JSAudioTrackCustom.cpp
r191887 r205569 44 44 { 45 45 #if ENABLE(MEDIA_SOURCE) 46 VM& vm = state.vm(); 47 auto scope = DECLARE_THROW_SCOPE(vm); 48 46 49 auto& string = value.toString(&state)->value(&state); 47 if ( state.hadException())50 if (UNLIKELY(scope.exception())) 48 51 return; 49 52 wrapped().setKind(string); … … 57 60 { 58 61 #if ENABLE(MEDIA_SOURCE) 62 VM& vm = state.vm(); 63 auto scope = DECLARE_THROW_SCOPE(vm); 64 59 65 auto& string = value.toString(&state)->value(&state); 60 if ( state.hadException())66 if (UNLIKELY(scope.exception())) 61 67 return; 62 68 wrapped().setLanguage(string); -
trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp
r205422 r205569 81 81 unsigned blobPartsLength = 0; 82 82 JSObject* blobParts = toJSSequence(exec, exec.uncheckedArgument(0), blobPartsLength); 83 if ( exec.hadException())83 if (UNLIKELY(scope.exception())) 84 84 return JSValue::encode(jsUndefined()); 85 85 ASSERT(blobParts); … … 102 102 // Attempt to get the endings property and validate it. 103 103 bool containsEndings = dictionary.get("endings", endings); 104 if ( exec.hadException())104 if (UNLIKELY(scope.exception())) 105 105 return JSValue::encode(jsUndefined()); 106 106 … … 112 112 // Attempt to get the type property. 113 113 dictionary.get("type", type); 114 if ( exec.hadException())114 if (UNLIKELY(scope.exception())) 115 115 return JSValue::encode(jsUndefined()); 116 116 } … … 122 122 for (unsigned i = 0; i < blobPartsLength; ++i) { 123 123 JSValue item = blobParts->get(&exec, i); 124 if ( exec.hadException())124 if (UNLIKELY(scope.exception())) 125 125 return JSValue::encode(jsUndefined()); 126 126 … … 133 133 else { 134 134 String string = item.toWTFString(&exec); 135 if ( exec.hadException())135 if (UNLIKELY(scope.exception())) 136 136 return JSValue::encode(jsUndefined()); 137 137 blobBuilder.append(string, endings); -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r205198 r205569 356 356 357 357 String propertyName = state.uncheckedArgument(0).toWTFString(&state); 358 if ( state.hadException())358 if (UNLIKELY(scope.exception())) 359 359 return jsUndefined(); 360 360 -
trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp
r204499 r205569 69 69 { 70 70 VM& vm = state.vm(); 71 auto scope = DECLARE_THROW_SCOPE(vm); 71 72 JSArray* result = constructEmptyArray(&state, nullptr); 72 if (UNLIKELY( vm.exception()))73 if (UNLIKELY(scope.exception())) 73 74 return nullptr; 74 75 size_t handlersCount = listenerInfo.eventListenerVector.size(); -
trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp
r205198 r205569 81 81 } 82 82 83 if ( exec->hadException())83 if (UNLIKELY(scope.exception())) 84 84 return false; 85 85 … … 107 107 108 108 ExecState* exec = dictionary.execState(); 109 VM& vm = exec->vm(); 110 auto scope = DECLARE_THROW_SCOPE(vm); 109 111 JSObject* object = dictionary.initializerObject(); 110 112 … … 112 114 113 115 JSValue hash = getProperty(exec, object, "hash"); 114 if ( exec->hadException())116 if (UNLIKELY(scope.exception())) 115 117 return false; 116 118 … … 135 137 136 138 JSValue iv = getProperty(exec, value.getObject(), "iv"); 137 if ( exec->hadException())139 if (UNLIKELY(scope.exception())) 138 140 return nullptr; 139 141 … … 141 143 142 144 CryptoOperationData ivData; 143 if (!cryptoOperationDataFromJSValue(exec, iv, ivData)) {144 ASSERT(exec->hadException());145 return nullptr;146 }145 auto success = cryptoOperationDataFromJSValue(exec, iv, ivData); 146 ASSERT(scope.exception() || success); 147 if (!success) 148 return nullptr; 147 149 148 150 if (ivData.second != 16) { … … 169 171 170 172 JSValue lengthValue = getProperty(&state, value.getObject(), "length"); 171 if ( state.hadException())173 if (UNLIKELY(scope.exception())) 172 174 return nullptr; 173 175 … … 190 192 auto result = adoptRef(*new CryptoAlgorithmHmacParams); 191 193 192 if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {193 ASSERT(state.hadException());194 return nullptr;195 }194 auto success = getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required); 195 ASSERT_UNUSED(scope, scope.exception() || success); 196 if (!success) 197 return nullptr; 196 198 197 199 return WTFMove(result); … … 211 213 auto result = adoptRef(*new CryptoAlgorithmHmacKeyParams); 212 214 213 if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {214 ASSERT(state.hadException());215 return nullptr;216 }215 auto success = getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required); 216 ASSERT(scope.exception() || success); 217 if (!success) 218 return nullptr; 217 219 218 220 result->hasLength = jsDictionary.get("length", result->length); 219 if ( state.hadException())221 if (UNLIKELY(scope.exception())) 220 222 return nullptr; 221 223 … … 237 239 238 240 JSValue modulusLengthValue = getProperty(&state, value.getObject(), "modulusLength"); 239 if ( state.hadException())241 if (UNLIKELY(scope.exception())) 240 242 return nullptr; 241 243 242 244 // FIXME: Why no EnforceRange? Filed as <https://www.w3.org/Bugs/Public/show_bug.cgi?id=23779>. 243 245 result->modulusLength = convert<uint32_t>(state, modulusLengthValue, NormalConversion); 244 if ( state.hadException())246 if (UNLIKELY(scope.exception())) 245 247 return nullptr; 246 248 247 249 JSValue publicExponentValue = getProperty(&state, value.getObject(), "publicExponent"); 248 if ( state.hadException())250 if (UNLIKELY(scope.exception())) 249 251 return nullptr; 250 252 … … 280 282 auto result = adoptRef(*new CryptoAlgorithmRsaOaepParams); 281 283 282 if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {283 ASSERT(exec->hadException());284 return nullptr;285 }284 auto success = getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required); 285 ASSERT(scope.exception() || success); 286 if (!success) 287 return nullptr; 286 288 287 289 JSValue labelValue = getProperty(exec, value.getObject(), "label"); 288 if ( exec->hadException())290 if (UNLIKELY(scope.exception())) 289 291 return nullptr; 290 292 … … 294 296 295 297 CryptoOperationData labelData; 296 if (!cryptoOperationDataFromJSValue(exec, labelValue, labelData)) {297 ASSERT(exec->hadException());298 return nullptr;299 }298 success = cryptoOperationDataFromJSValue(exec, labelValue, labelData); 299 ASSERT(scope.exception() || success); 300 if (!success) 301 return nullptr; 300 302 301 303 result->label.append(labelData.first, labelData.second); … … 317 319 auto result = adoptRef(*new CryptoAlgorithmRsaSsaParams); 318 320 319 if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {320 ASSERT(state.hadException());321 return nullptr;322 }321 auto success = getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required); 322 ASSERT(scope.exception() || success); 323 if (!success) 324 return nullptr; 323 325 324 326 return WTFMove(result); -
trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp
r205198 r205569 63 63 64 64 JSValue value = slot.getValue(exec, identifier); 65 ASSERT(! exec->hadException());65 ASSERT(!scope.exception()); 66 66 if (!isJSArray(value)) { 67 67 throwTypeError(exec, scope, String::format("Expected an array for \"%s\" JSON key", key)); … … 86 86 87 87 JSValue jsValue = slot.getValue(exec, identifier); 88 ASSERT(! exec->hadException());88 ASSERT(!scope.exception()); 89 89 if (!jsValue.getString(exec, result)) { 90 90 // Can get an out of memory exception. 91 if ( exec->hadException())91 if (UNLIKELY(scope.exception())) 92 92 return false; 93 93 throwTypeError(exec, scope, String::format("Expected a string value for \"%s\" JSON key", key)); … … 110 110 111 111 JSValue jsValue = slot.getValue(exec, identifier); 112 ASSERT(! exec->hadException());112 ASSERT(!scope.exception()); 113 113 if (!jsValue.isBoolean()) { 114 114 throwTypeError(exec, scope, String::format("Expected a boolean value for \"%s\" JSON key", key)); … … 149 149 150 150 JSValue jsonValue = JSONParse(exec, jsonString); 151 if ( exec->hadException())151 if (UNLIKELY(scope.exception())) 152 152 return; 153 153 … … 299 299 String operation; 300 300 if (!jsValue.getString(m_exec, operation)) { 301 if (! m_exec->hadException())301 if (!scope.exception()) 302 302 throwTypeError(m_exec, scope, ASCIILiteral("JWK key_ops attribute could not be processed")); 303 303 return; … … 321 321 } 322 322 } else { 323 if ( m_exec->hadException())323 if (UNLIKELY(scope.exception())) 324 324 return; 325 325 … … 392 392 String keyBase64URL; 393 393 if (!getStringFromJSON(m_exec, m_json.get(), "k", keyBase64URL)) { 394 if (! m_exec->hadException())394 if (!scope.exception()) 395 395 throwTypeError(m_exec, scope, ASCIILiteral("Secret key data is not present is JWK")); 396 396 return nullptr; … … 421 421 422 422 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "n", modulus)) { 423 if (! m_exec->hadException())423 if (!scope.exception()) 424 424 throwTypeError(m_exec, scope, ASCIILiteral("Required JWK \"n\" member is missing")); 425 425 return nullptr; … … 432 432 433 433 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "e", exponent)) { 434 if (! m_exec->hadException())434 if (!scope.exception()) 435 435 throwTypeError(m_exec, scope, ASCIILiteral("Required JWK \"e\" member is missing")); 436 436 return nullptr; … … 438 438 439 439 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "d", modulus)) { 440 if ( m_exec->hadException())440 if (scope.exception()) 441 441 return nullptr; 442 442 return CryptoKeyDataRSAComponents::createPublic(modulus, exponent); … … 447 447 Vector<CryptoKeyDataRSAComponents::PrimeInfo> otherPrimeInfos; 448 448 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "p", firstPrimeInfo.primeFactor)) { 449 if ( m_exec->hadException())449 if (scope.exception()) 450 450 return nullptr; 451 451 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); … … 453 453 454 454 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "dp", firstPrimeInfo.factorCRTExponent)) { 455 if ( m_exec->hadException())455 if (scope.exception()) 456 456 return nullptr; 457 457 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); … … 459 459 460 460 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "q", secondPrimeInfo.primeFactor)) { 461 if ( m_exec->hadException())461 if (scope.exception()) 462 462 return nullptr; 463 463 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); … … 465 465 466 466 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "dq", secondPrimeInfo.factorCRTExponent)) { 467 if ( m_exec->hadException())467 if (scope.exception()) 468 468 return nullptr; 469 469 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); … … 471 471 472 472 if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "qi", secondPrimeInfo.factorCRTCoefficient)) { 473 if ( m_exec->hadException())473 if (scope.exception()) 474 474 return nullptr; 475 475 return CryptoKeyDataRSAComponents::createPrivate(modulus, exponent, privateExponent); … … 478 478 JSArray* otherPrimeInfoJSArray; 479 479 if (!getJSArrayFromJSON(m_exec, m_json.get(), "oth", otherPrimeInfoJSArray)) { 480 if ( m_exec->hadException())480 if (scope.exception()) 481 481 return nullptr; 482 482 return CryptoKeyDataRSAComponents::createPrivateWithAdditionalData(modulus, exponent, privateExponent, firstPrimeInfo, secondPrimeInfo, otherPrimeInfos); … … 486 486 CryptoKeyDataRSAComponents::PrimeInfo info; 487 487 JSValue element = otherPrimeInfoJSArray->getIndex(m_exec, i); 488 if ( m_exec->hadException())488 if (UNLIKELY(scope.exception())) 489 489 return nullptr; 490 490 if (!element.isObject()) { … … 493 493 } 494 494 if (!getBigIntegerVectorFromJSON(m_exec, asObject(element), "r", info.primeFactor)) { 495 if (! m_exec->hadException())495 if (!scope.exception()) 496 496 throwTypeError(m_exec, scope, ASCIILiteral("Cannot get prime factor for a prime in \"oth\" dictionary")); 497 497 return nullptr; 498 498 } 499 499 if (!getBigIntegerVectorFromJSON(m_exec, asObject(element), "d", info.factorCRTExponent)) { 500 if (! m_exec->hadException())500 if (!scope.exception()) 501 501 throwTypeError(m_exec, scope, ASCIILiteral("Cannot get factor CRT exponent for a prime in \"oth\" dictionary")); 502 502 return nullptr; 503 503 } 504 504 if (!getBigIntegerVectorFromJSON(m_exec, asObject(element), "t", info.factorCRTCoefficient)) { 505 if (! m_exec->hadException())505 if (!scope.exception()) 506 506 throwTypeError(m_exec, scope, ASCIILiteral("Cannot get factor CRT coefficient for a prime in \"oth\" dictionary")); 507 507 return nullptr; … … 520 520 String jwkKeyType; 521 521 if (!getStringFromJSON(m_exec, m_json.get(), "kty", jwkKeyType)) { 522 if (! m_exec->hadException())522 if (!scope.exception()) 523 523 throwTypeError(m_exec, scope, ASCIILiteral("Required JWK \"kty\" member is missing")); 524 524 return nullptr; … … 550 550 static void buildJSONForRSAComponents(JSC::ExecState* exec, const CryptoKeyDataRSAComponents& data, JSC::JSObject* result) 551 551 { 552 VM& vm = exec->vm(); 553 auto scope = DECLARE_THROW_SCOPE(vm); 554 552 555 addToJSON(exec, result, "kty", "RSA"); 553 556 addToJSON(exec, result, "n", base64URLEncode(data.modulus())); … … 571 574 return; 572 575 573 VM& vm = exec->vm();574 576 JSArray* oth = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), data.otherPrimeInfos().size()); 575 if (UNLIKELY( vm.exception()))577 if (UNLIKELY(scope.exception())) 576 578 return; 577 579 for (size_t i = 0, size = data.otherPrimeInfos().size(); i < size; ++i) { … … 699 701 { 700 702 VM& vm = exec->vm(); 703 auto scope = DECLARE_THROW_SCOPE(vm); 701 704 JSArray* keyOps = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), 0); 702 if (UNLIKELY( vm.exception()))705 if (UNLIKELY(scope.exception())) 703 706 return; 704 707 … … 739 742 740 743 addJWKAlgorithmToJSON(exec, result, key); 741 if ( exec->hadException())744 if (UNLIKELY(scope.exception())) 742 745 return String(); 743 746 … … 745 748 746 749 addUsagesToJSON(exec, result, key.usagesBitmap()); 747 if ( exec->hadException())750 if (UNLIKELY(scope.exception())) 748 751 return String(); 749 752 … … 756 759 return String(); 757 760 } 758 if ( exec->hadException())761 if (UNLIKELY(scope.exception())) 759 762 return String(); 760 763 -
trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp
r205416 r205569 69 69 VM& vm = m_isolatedWorld->vm(); 70 70 JSLockHolder lock(vm); 71 auto scope = DECLARE_CATCH_SCOPE(vm); 71 72 72 73 if (!m_constructor) … … 80 81 auto& state = *context->execState(); 81 82 RefPtr<Element> element = constructCustomElementSynchronously(downcast<Document>(*context), vm, state, m_constructor.get(), localName); 83 ASSERT(!!scope.exception() == !element); 82 84 if (!element) { 83 auto* exception = vm.exception();84 ASSERT(exception);85 85 if (shouldClearException == ShouldClearException::Clear) { 86 state.clearException(); 86 auto* exception = scope.exception(); 87 scope.clearException(); 87 88 reportException(&state, exception); 88 89 } … … 111 112 JSValue newElement = construct(&state, constructor, constructType, constructData, args); 112 113 InspectorInstrumentation::didCallFunction(cookie, &document); 113 if ( vm.exception())114 if (UNLIKELY(scope.exception())) 114 115 return nullptr; 115 116 … … 167 168 JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, *m_isolatedWorld); 168 169 ExecState* state = globalObject->globalExec(); 169 if ( state->hadException())170 if (UNLIKELY(scope.exception())) 170 171 return; 171 172 … … 186 187 m_constructionStack.removeLast(); 187 188 188 if ( state->hadException()) {189 if (UNLIKELY(scope.exception())) { 189 190 element.setIsFailedCustomElement(*this); 190 191 return; -
trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
r205410 r205569 47 47 48 48 JSValue callback = prototype.get(&state, id); 49 if ( state.hadException())49 if (UNLIKELY(scope.exception())) 50 50 return nullptr; 51 51 if (callback.isUndefined()) … … 89 89 90 90 AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state)); 91 if (UNLIKELY(s tate.hadException()))91 if (UNLIKELY(scope.exception())) 92 92 return jsUndefined(); 93 93 … … 119 119 120 120 JSValue prototypeValue = constructor->get(&state, vm.propertyNames->prototype); 121 if ( state.hadException())121 if (UNLIKELY(scope.exception())) 122 122 return jsUndefined(); 123 123 if (!prototypeValue.isObject()) … … 130 130 if (auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"))) 131 131 elementInterface->setConnectedCallback(connectedCallback); 132 if ( state.hadException())132 if (UNLIKELY(scope.exception())) 133 133 return jsUndefined(); 134 134 135 135 if (auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"))) 136 136 elementInterface->setDisconnectedCallback(disconnectedCallback); 137 if ( state.hadException())137 if (UNLIKELY(scope.exception())) 138 138 return jsUndefined(); 139 139 140 140 if (auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"))) 141 141 elementInterface->setAdoptedCallback(adoptedCallback); 142 if ( state.hadException())142 if (UNLIKELY(scope.exception())) 143 143 return jsUndefined(); 144 144 145 145 auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback")); 146 if ( state.hadException())146 if (UNLIKELY(scope.exception())) 147 147 return jsUndefined(); 148 148 if (attributeChangedCallback) { 149 149 auto value = convertOptional<Vector<String>>(state, constructor->get(&state, Identifier::fromString(&state, "observedAttributes"))); 150 if ( state.hadException())150 if (UNLIKELY(scope.exception())) 151 151 return jsUndefined(); 152 152 if (value) … … 171 171 172 172 AtomicString localName(state.uncheckedArgument(0).toString(&state)->toAtomicString(&state)); 173 if (UNLIKELY(s tate.hadException()))173 if (UNLIKELY(scope.exception())) 174 174 return jsUndefined(); 175 175 … … 192 192 JSValue JSCustomElementRegistry::whenDefined(ExecState& state) 193 193 { 194 auto scope = DECLARE_CATCH_SCOPE(state.vm()); 195 194 196 JSDOMGlobalObject& globalObject = *jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject()); 195 197 auto& promiseDeferred = *JSPromiseDeferred::create(&state, &globalObject); 196 198 JSValue promise = whenDefinedPromise(state, globalObject, wrapped()); 197 199 198 if ( state.hadException()) {200 if (UNLIKELY(scope.exception())) { 199 201 rejectPromiseWithExceptionIfAny(state, globalObject, promiseDeferred); 200 ASSERT(!s tate.hadException());202 ASSERT(!scope.exception()); 201 203 return promiseDeferred.promise(); 202 204 } -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r205462 r205569 120 120 String valueToUSVString(ExecState* exec, JSValue value) 121 121 { 122 VM& vm = exec->vm(); 123 auto scope = DECLARE_THROW_SCOPE(vm); 124 122 125 String string = value.toWTFString(exec); 123 if ( exec->hadException())126 if (UNLIKELY(scope.exception())) 124 127 return { }; 125 128 StringView view { string }; … … 188 191 void reportException(ExecState* exec, JSValue exceptionValue, CachedScript* cachedScript) 189 192 { 190 RELEASE_ASSERT(exec->vm().currentThreadIsHoldingAPILock()); 193 VM& vm = exec->vm(); 194 RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock()); 191 195 Exception* exception = jsDynamicCast<Exception*>(exceptionValue); 192 196 if (!exception) { 193 exception = exec->lastException();197 exception = vm.lastException(); 194 198 if (!exception) 195 199 exception = Exception::create(exec->vm(), exceptionValue, Exception::DoNotCaptureStack); … … 201 205 void reportException(ExecState* exec, Exception* exception, CachedScript* cachedScript, ExceptionDetails* exceptionDetails) 202 206 { 203 RELEASE_ASSERT(exec->vm().currentThreadIsHoldingAPILock()); 207 VM& vm = exec->vm(); 208 auto scope = DECLARE_CATCH_SCOPE(vm); 209 210 RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock()); 204 211 if (isTerminatedExecutionException(exception)) 205 212 return; … … 208 215 209 216 RefPtr<ScriptCallStack> callStack(createScriptCallStackFromException(exec, exception, ScriptCallStack::maxCallStackSizeToCapture)); 210 exec->clearException();211 exec->clearLastException();217 scope.clearException(); 218 vm.clearLastException(); 212 219 213 220 JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); … … 240 247 // We need to clear any new exception that may be thrown in the toString() call above. 241 248 // reportException() is not supposed to be making new exceptions. 242 exec->clearException();243 exec->clearLastException();249 scope.clearException(); 250 vm.clearLastException(); 244 251 } 245 252 … … 257 264 void reportCurrentException(ExecState* exec) 258 265 { 259 Exception* exception = exec->exception(); 260 exec->clearException(); 266 VM& vm = exec->vm(); 267 auto scope = DECLARE_CATCH_SCOPE(vm); 268 Exception* exception = scope.exception(); 269 scope.clearException(); 261 270 reportException(exec, exception); 262 271 } … … 342 351 auto scope = DECLARE_THROW_SCOPE(vm); 343 352 344 if (!ec || exec->hadException())353 if (!ec || scope.exception()) 345 354 return; 346 355 … … 353 362 auto scope = DECLARE_THROW_SCOPE(vm); 354 363 355 if (!ec.code || exec->hadException())364 if (!ec.code || scope.exception()) 356 365 return; 357 366 … … 363 372 bool hasIteratorMethod(JSC::ExecState& state, JSC::JSValue value) 364 373 { 374 auto& vm = state.vm(); 375 auto scope = DECLARE_THROW_SCOPE(vm); 376 365 377 if (!value.isObject()) 366 378 return false; 367 379 368 auto& vm = state.vm();369 380 JSObject* object = JSC::asObject(value); 370 381 CallData callData; 371 382 CallType callType; 372 383 JSValue applyMethod = object->getMethod(&state, callData, callType, vm.propertyNames->iteratorSymbol, ASCIILiteral("Symbol.iterator property should be callable")); 373 if ( vm.exception())384 if (UNLIKELY(scope.exception())) 374 385 return false; 375 386 … … 510 521 511 522 double x = value.toNumber(&state); 512 if (UNLIKELY(s tate.hadException()))523 if (UNLIKELY(scope.exception())) 513 524 return 0; 514 525 … … 557 568 558 569 double x = value.toNumber(&state); 559 if (UNLIKELY(s tate.hadException()))570 if (UNLIKELY(scope.exception())) 560 571 return 0; 561 572 … … 643 654 int32_t toInt32EnforceRange(ExecState& state, JSValue value) 644 655 { 656 VM& vm = state.vm(); 657 auto scope = DECLARE_THROW_SCOPE(vm); 658 645 659 if (value.isInt32()) 646 660 return value.asInt32(); 647 661 648 662 double x = value.toNumber(&state); 649 if (UNLIKELY(s tate.hadException()))663 if (UNLIKELY(scope.exception())) 650 664 return 0; 651 665 return enforceRange(state, x, kMinInt32, kMaxInt32); … … 673 687 uint32_t toUInt32EnforceRange(ExecState& state, JSValue value) 674 688 { 689 VM& vm = state.vm(); 690 auto scope = DECLARE_THROW_SCOPE(vm); 691 675 692 if (value.isUInt32()) 676 693 return value.asUInt32(); 677 694 678 695 double x = value.toNumber(&state); 679 if (UNLIKELY(s tate.hadException()))696 if (UNLIKELY(scope.exception())) 680 697 return 0; 681 698 return enforceRange(state, x, 0, kMaxUInt32); … … 684 701 int64_t toInt64EnforceRange(ExecState& state, JSC::JSValue value) 685 702 { 686 double x = value.toNumber(&state); 687 if (UNLIKELY(state.hadException())) 703 VM& vm = state.vm(); 704 auto scope = DECLARE_THROW_SCOPE(vm); 705 706 double x = value.toNumber(&state); 707 if (UNLIKELY(scope.exception())) 688 708 return 0; 689 709 return enforceRange(state, x, -kJSMaxInteger, kJSMaxInteger); … … 692 712 uint64_t toUInt64EnforceRange(ExecState& state, JSC::JSValue value) 693 713 { 694 double x = value.toNumber(&state); 695 if (UNLIKELY(state.hadException())) 714 VM& vm = state.vm(); 715 auto scope = DECLARE_THROW_SCOPE(vm); 716 717 double x = value.toNumber(&state); 718 if (UNLIKELY(scope.exception())) 696 719 return 0; 697 720 return enforceRange(state, x, 0, kJSMaxInteger); … … 857 880 void throwNotSupportedError(JSC::ExecState& state, JSC::ThrowScope& scope, const char* message) 858 881 { 859 ASSERT(!s tate.hadException());882 ASSERT(!scope.exception()); 860 883 String messageString(message); 861 884 throwException(&state, scope, createDOMException(&state, NOT_SUPPORTED_ERR, &messageString)); … … 864 887 void throwInvalidStateError(JSC::ExecState& state, JSC::ThrowScope& scope, const char* message) 865 888 { 866 ASSERT(!s tate.hadException());889 ASSERT(!scope.exception()); 867 890 String messageString(message); 868 891 throwException(&state, scope, createDOMException(&state, INVALID_STATE_ERR, &messageString)); … … 871 894 void throwSecurityError(JSC::ExecState& state, JSC::ThrowScope& scope, const String& message) 872 895 { 873 ASSERT(!s tate.hadException());896 ASSERT(!scope.exception()); 874 897 throwException(&state, scope, createDOMException(&state, SECURITY_ERR, message)); 875 898 } -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r205542 r205569 553 553 554 554 JSC::JSValue lengthValue = object->get(&exec, exec.propertyNames().length); 555 if ( exec.hadException())555 if (UNLIKELY(scope.exception())) 556 556 return nullptr; 557 557 … … 562 562 563 563 length = lengthValue.toUInt32(&exec); 564 if ( exec.hadException())564 if (UNLIKELY(scope.exception())) 565 565 return nullptr; 566 566 … … 605 605 template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T>& vector) 606 606 { 607 JSC::VM& vm = globalObject->vm(); 608 auto scope = DECLARE_THROW_SCOPE(vm); 609 607 610 JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size()); 608 if (UNLIKELY( exec->hadException()))611 if (UNLIKELY(scope.exception())) 609 612 return JSC::jsUndefined(); 610 613 for (size_t i = 0; i < vector.size(); ++i) … … 615 618 template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<RefPtr<T>>& vector) 616 619 { 620 JSC::VM& vm = globalObject->vm(); 621 auto scope = DECLARE_THROW_SCOPE(vm); 622 617 623 JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size()); 618 if (UNLIKELY( exec->hadException()))624 if (UNLIKELY(scope.exception())) 619 625 return JSC::jsUndefined(); 620 626 for (size_t i = 0; i < vector.size(); ++i) … … 700 706 template<typename T, size_t inlineCapacity> JSC::JSValue jsFrozenArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T, inlineCapacity>& vector) 701 707 { 708 JSC::VM& vm = globalObject->vm(); 709 auto scope = DECLARE_THROW_SCOPE(vm); 710 702 711 JSC::MarkedArgumentBuffer list; 703 712 for (auto& element : vector) { 704 713 list.append(JSValueTraits<T>::arrayJSValue(exec, globalObject, element)); 705 if (UNLIKELY( exec->hadException()))714 if (UNLIKELY(scope.exception())) 706 715 return JSC::jsUndefined(); 707 716 } 708 717 auto* array = JSC::constructArray(exec, nullptr, globalObject, list); 709 if (UNLIKELY( exec->hadException()))718 if (UNLIKELY(scope.exception())) 710 719 return JSC::jsUndefined(); 711 720 return JSC::objectConstructorFreeze(exec, array); … … 746 755 static inline bool nativeValue(JSC::ExecState& exec, JSC::JSValue jsValue, String& indexedValue) 747 756 { 757 JSC::VM& vm = exec.vm(); 758 auto scope = DECLARE_THROW_SCOPE(vm); 748 759 indexedValue = jsValue.toWTFString(&exec); 749 return ! exec.hadException();760 return !scope.exception(); 750 761 } 751 762 }; … … 754 765 static inline bool nativeValue(JSC::ExecState& exec, JSC::JSValue jsValue, unsigned& indexedValue) 755 766 { 767 JSC::VM& vm = exec.vm(); 768 auto scope = DECLARE_THROW_SCOPE(vm); 756 769 indexedValue = jsValue.toUInt32(&exec); 757 return ! exec.hadException();770 return !scope.exception(); 758 771 } 759 772 }; … … 762 775 static inline bool nativeValue(JSC::ExecState& exec, JSC::JSValue jsValue, float& indexedValue) 763 776 { 777 JSC::VM& vm = exec.vm(); 778 auto scope = DECLARE_THROW_SCOPE(vm); 764 779 indexedValue = jsValue.toFloat(&exec); 765 return ! exec.hadException();780 return !scope.exception(); 766 781 } 767 782 }; … … 770 785 static inline bool nativeValue(JSC::ExecState& exec, JSC::JSValue jsValue, double& indexedValue) 771 786 { 787 JSC::VM& vm = exec.vm(); 788 auto scope = DECLARE_THROW_SCOPE(vm); 772 789 indexedValue = jsValue.toNumber(&exec); 773 return ! exec.hadException();790 return !scope.exception(); 774 791 } 775 792 }; … … 808 825 809 826 Vector<T> result; 810 forEachInIterable(&exec, value, [&result](JSC::VM&, JSC::ExecState* state, JSC::JSValue jsValue) { 827 forEachInIterable(&exec, value, [&result](JSC::VM& vm, JSC::ExecState* state, JSC::JSValue jsValue) { 828 auto scope = DECLARE_THROW_SCOPE(vm); 811 829 T convertedValue; 812 if (!NativeValueTraits<T>::nativeValue(*state, jsValue, convertedValue)) 830 bool success = NativeValueTraits<T>::nativeValue(*state, jsValue, convertedValue); 831 ASSERT_UNUSED(scope, scope.exception() || success); 832 if (!success) 813 833 return; 814 ASSERT(!state->hadException());815 834 result.append(convertedValue); 816 835 }); -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
r205549 r205569 76 76 ASSERT(execState); 77 77 ASSERT(execState->argumentCount() == 2); 78 VM& vm = execState->vm(); 79 auto scope = DECLARE_CATCH_SCOPE(vm); 78 80 79 81 auto interfaceName = execState->uncheckedArgument(0).getString(execState); 80 ASSERT (!execState->hadException());82 ASSERT_UNUSED(scope, !scope.exception()); 81 83 auto functionName = execState->uncheckedArgument(1).getString(execState); 82 ASSERT(! execState->hadException());84 ASSERT(!scope.exception()); 83 85 return JSValue::encode(createTypeError(execState, makeThisTypeErrorMessage(interfaceName.utf8().data(), functionName.utf8().data()))); 84 86 } … … 88 90 ASSERT(execState); 89 91 ASSERT(execState->argumentCount() == 2); 92 VM& vm = execState->vm(); 93 auto scope = DECLARE_CATCH_SCOPE(vm); 90 94 91 95 auto interfaceName = execState->uncheckedArgument(0).getString(execState); 92 ASSERT (!execState->hadException());96 ASSERT_UNUSED(scope, !scope.exception()); 93 97 auto attributeName = execState->uncheckedArgument(1).getString(execState); 94 ASSERT(! execState->hadException());98 ASSERT(!scope.exception()); 95 99 return JSValue::encode(createTypeError(execState, makeGetterTypeErrorMessage(interfaceName.utf8().data(), attributeName.utf8().data()))); 96 100 } -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp
r201496 r205569 50 50 51 51 Ref<JSGlobalObjectCallback> protectedThis(*this); 52 JSLockHolder lock(m_globalObject->vm()); 52 VM& vm = m_globalObject->vm(); 53 JSLockHolder lock(vm); 54 auto scope = DECLARE_THROW_SCOPE(vm); 53 55 54 56 ExecState* exec = m_globalObject->globalExec(); … … 65 67 else 66 68 m_task->run(exec); 67 ASSERT (!exec->hadException());69 ASSERT_UNUSED(scope, !scope.exception()); 68 70 } 69 71 -
trunk/Source/WebCore/bindings/js/JSDOMIterator.h
r205198 r205569 206 206 arguments.append(wrapper); 207 207 JSC::call(&state, callback, callType, callData, thisValue, arguments); 208 if ( state.hadException())208 if (UNLIKELY(scope.exception())) 209 209 break; 210 210 } -
trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp
r205410 r205569 101 101 void rejectPromiseWithExceptionIfAny(JSC::ExecState& state, JSDOMGlobalObject& globalObject, JSPromiseDeferred& promiseDeferred) 102 102 { 103 if (!state.hadException()) 103 VM& vm = state.vm(); 104 auto scope = DECLARE_CATCH_SCOPE(vm); 105 106 if (!scope.exception()) 104 107 return; 105 108 106 JSValue error = s tate.exception()->value();107 s tate.clearException();109 JSValue error = scope.exception()->value(); 110 scope.clearException(); 108 111 109 112 DeferredWrapper::create(&state, &globalObject, &promiseDeferred)->reject(error); -
trunk/Source/WebCore/bindings/js/JSDOMPromise.h
r205257 r205569 159 159 inline JSC::JSValue callPromiseFunction(JSC::ExecState& state, JSC::EncodedJSValue promiseFunction(JSC::ExecState*, JSC::JSPromiseDeferred*)) 160 160 { 161 JSC::VM& vm = state.vm(); 162 auto scope = DECLARE_CATCH_SCOPE(vm); 163 161 164 JSDOMGlobalObject& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject()); 162 165 JSC::JSPromiseDeferred& promiseDeferred = *JSC::JSPromiseDeferred::create(&state, &globalObject); … … 164 167 165 168 rejectPromiseWithExceptionIfAny(state, globalObject, promiseDeferred); 166 ASSERT (!state.hadException());169 ASSERT_UNUSED(scope, !scope.exception()); 167 170 return promiseDeferred.promise(); 168 171 } -
trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
r198023 r205569 76 76 bool JSDOMStringMap::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult) 77 77 { 78 VM& vm = exec->vm(); 79 auto scope = DECLARE_THROW_SCOPE(vm); 80 78 81 if (propertyName.isSymbol()) 79 82 return false; 80 83 81 84 String stringValue = value.toString(exec)->value(exec); 82 if ( exec->hadException())85 if (UNLIKELY(scope.exception())) 83 86 return false; 84 87 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r205372 r205569 198 198 { 199 199 Ref<JSDOMWindowMicrotaskCallback> protectedThis(*this); 200 JSLockHolder lock(m_globalObject->vm()); 200 VM& vm = m_globalObject->vm(); 201 JSLockHolder lock(vm); 202 auto scope = DECLARE_THROW_SCOPE(vm); 201 203 202 204 ExecState* exec = m_globalObject->globalExec(); … … 204 206 JSMainThreadExecState::runTask(exec, m_task); 205 207 206 ASSERT (!exec->hadException());208 ASSERT_UNUSED(scope, !scope.exception()); 207 209 } 208 210 -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r205468 r205569 370 370 void JSDOMWindow::setLocation(ExecState& state, JSValue value) 371 371 { 372 VM& vm = state.vm(); 373 auto scope = DECLARE_THROW_SCOPE(vm); 374 372 375 #if ENABLE(DASHBOARD_SUPPORT) 373 376 // To avoid breaking old widgets, make "var location =" in a top-level frame create … … 383 386 384 387 String locationString = value.toString(&state)->value(&state); 385 if ( state.hadException())388 if (UNLIKELY(scope.exception())) 386 389 return; 387 390 … … 407 410 JSValue JSDOMWindow::open(ExecState& state) 408 411 { 412 VM& vm = state.vm(); 413 auto scope = DECLARE_THROW_SCOPE(vm); 414 409 415 String urlString = valueToUSVStringWithUndefinedOrNullCheck(&state, state.argument(0)); 410 if ( state.hadException())416 if (UNLIKELY(scope.exception())) 411 417 return jsUndefined(); 412 418 JSValue targetValue = state.argument(1); 413 419 AtomicString target = targetValue.isUndefinedOrNull() ? AtomicString("_blank", AtomicString::ConstructFromLiteral) : targetValue.toString(&state)->toAtomicString(&state); 414 if ( state.hadException())420 if (UNLIKELY(scope.exception())) 415 421 return jsUndefined(); 416 422 String windowFeaturesString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(2)); 417 if ( state.hadException())423 if (UNLIKELY(scope.exception())) 418 424 return jsUndefined(); 419 425 … … 471 477 472 478 String urlString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(0)); 473 if ( state.hadException())479 if (UNLIKELY(scope.exception())) 474 480 return jsUndefined(); 475 481 String dialogFeaturesString = valueToStringWithUndefinedOrNullCheck(&state, state.argument(2)); 476 if ( state.hadException())482 if (UNLIKELY(scope.exception())) 477 483 return jsUndefined(); 478 484 … … 512 518 fillMessagePortArray(state, state.argument(transferablesArgIndex), messagePorts, arrayBuffers); 513 519 } 514 if ( state.hadException())520 if (UNLIKELY(scope.exception())) 515 521 return jsUndefined(); 516 522 517 523 auto message = SerializedScriptValue::create(&state, state.uncheckedArgument(0), &messagePorts, &arrayBuffers); 518 524 519 if ( state.hadException())525 if (UNLIKELY(scope.exception())) 520 526 return jsUndefined(); 521 527 522 528 String targetOrigin = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(targetOriginArgIndex)); 523 if ( state.hadException())529 if (UNLIKELY(scope.exception())) 524 530 return jsUndefined(); 525 531 … … 546 552 ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr; 547 553 std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), contentSecurityPolicy); 548 if ( state.hadException())554 if (UNLIKELY(scope.exception())) 549 555 return jsUndefined(); 550 556 … … 571 577 ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr; 572 578 std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), contentSecurityPolicy); 573 if ( state.hadException())579 if (UNLIKELY(scope.exception())) 574 580 return jsUndefined(); 575 581 int delay = state.argument(1).toInt32(&state); -
trunk/Source/WebCore/bindings/js/JSDataCueCustom.cpp
r205422 r205569 59 59 60 60 double startTime(exec.uncheckedArgument(0).toNumber(&exec)); 61 if (UNLIKELY( exec.hadException()))61 if (UNLIKELY(scope.exception())) 62 62 return JSValue::encode(jsUndefined()); 63 63 64 64 double endTime(exec.uncheckedArgument(1).toNumber(&exec)); 65 if (UNLIKELY( exec.hadException()))65 if (UNLIKELY(scope.exception())) 66 66 return JSValue::encode(jsUndefined()); 67 67 … … 88 88 89 89 ArrayBuffer* data = toArrayBuffer(valueArgument); 90 if (UNLIKELY( exec.hadException()))90 if (UNLIKELY(scope.exception())) 91 91 return JSValue::encode(jsUndefined()); 92 92 -
trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
r205462 r205569 48 48 return nullptr; 49 49 50 VM& vm = state.vm(); 51 auto scope = DECLARE_THROW_SCOPE(vm); 52 50 53 // Given the above test, this will always yield an object. 51 54 JSObject* object = value.toObject(&state); 52 ASSERT(!s tate.hadException());55 ASSERT(!scope.exception()); 53 56 54 57 JSValue xValue = object->get(&state, Identifier::fromString(&state, "x")); 55 if ( state.hadException())58 if (UNLIKELY(scope.exception())) 56 59 return nullptr; 57 60 bool canProvideX = !xValue.isUndefinedOrNull(); 58 61 double x = xValue.toNumber(&state); 59 if ( state.hadException())62 if (UNLIKELY(scope.exception())) 60 63 return nullptr; 61 64 62 65 JSValue yValue = object->get(&state, Identifier::fromString(&state, "y")); 63 if ( state.hadException())66 if (UNLIKELY(scope.exception())) 64 67 return nullptr; 65 68 bool canProvideY = !yValue.isUndefinedOrNull(); 66 69 double y = yValue.toNumber(&state); 67 if ( state.hadException())70 if (UNLIKELY(scope.exception())) 68 71 return nullptr; 69 72 70 73 JSValue zValue = object->get(&state, Identifier::fromString(&state, "z")); 71 if ( state.hadException())74 if (UNLIKELY(scope.exception())) 72 75 return nullptr; 73 76 bool canProvideZ = !zValue.isUndefinedOrNull(); 74 77 double z = zValue.toNumber(&state); 75 if ( state.hadException())78 if (UNLIKELY(scope.exception())) 76 79 return nullptr; 77 80 … … 86 89 if (value.isUndefinedOrNull()) 87 90 return nullptr; 91 92 VM& vm = state.vm(); 93 auto scope = DECLARE_THROW_SCOPE(vm); 88 94 89 95 // Given the above test, this will always yield an object. 90 96 JSObject* object = value.toObject(&state); 91 ASSERT(!s tate.hadException());97 ASSERT(!scope.exception()); 92 98 93 99 JSValue alphaValue = object->get(&state, Identifier::fromString(&state, "alpha")); 94 if ( state.hadException())100 if (UNLIKELY(scope.exception())) 95 101 return nullptr; 96 102 bool canProvideAlpha = !alphaValue.isUndefinedOrNull(); 97 103 double alpha = alphaValue.toNumber(&state); 98 if ( state.hadException())104 if (UNLIKELY(scope.exception())) 99 105 return nullptr; 100 106 101 107 JSValue betaValue = object->get(&state, Identifier::fromString(&state, "beta")); 102 if ( state.hadException())108 if (UNLIKELY(scope.exception())) 103 109 return nullptr; 104 110 bool canProvideBeta = !betaValue.isUndefinedOrNull(); 105 111 double beta = betaValue.toNumber(&state); 106 if ( state.hadException())112 if (UNLIKELY(scope.exception())) 107 113 return nullptr; 108 114 109 115 JSValue gammaValue = object->get(&state, Identifier::fromString(&state, "gamma")); 110 if ( state.hadException())116 if (UNLIKELY(scope.exception())) 111 117 return nullptr; 112 118 bool canProvideGamma = !gammaValue.isUndefinedOrNull(); 113 119 double gamma = gammaValue.toNumber(&state); 114 if ( state.hadException())120 if (UNLIKELY(scope.exception())) 115 121 return nullptr; 116 122 … … 173 179 JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState& state) 174 180 { 181 VM& vm = state.vm(); 182 auto scope = DECLARE_THROW_SCOPE(vm); 183 175 184 const String type = state.argument(0).toString(&state)->value(&state); 176 185 bool bubbles = state.argument(1).toBoolean(&state); … … 180 189 // Otherwise, use the standard JavaScript conversion. 181 190 RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(state.argument(3), state); 182 if ( state.hadException())191 if (UNLIKELY(scope.exception())) 183 192 return jsUndefined(); 184 193 185 194 RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(state.argument(4), state); 186 if ( state.hadException())195 if (UNLIKELY(scope.exception())) 187 196 return jsUndefined(); 188 197 189 198 RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(state.argument(5), state); 190 if ( state.hadException())199 if (UNLIKELY(scope.exception())) 191 200 return jsUndefined(); 192 201 -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r205198 r205569 79 79 JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult) const 80 80 { 81 VM& vm = m_exec->vm(); 82 auto scope = DECLARE_THROW_SCOPE(vm); 81 83 ASSERT(isValid()); 82 84 Identifier identifier = Identifier::fromString(m_exec, propertyName); … … 87 89 return true; 88 90 }); 89 if ( m_exec->hadException())91 if (UNLIKELY(scope.exception())) 90 92 return ExceptionThrown; 91 93 return propertyFound ? PropertyFound : NoPropertyFound; … … 152 154 { 153 155 ASSERT(exec); 156 VM& vm = exec->vm(); 157 auto scope = DECLARE_THROW_SCOPE(vm); 158 154 159 if (value.isUndefinedOrNull()) 155 160 return; … … 157 162 unsigned length = 0; 158 163 JSObject* object = toJSSequence(*exec, value, length); 159 if ( exec->hadException())164 if (UNLIKELY(scope.exception())) 160 165 return; 161 166 162 167 for (unsigned i = 0 ; i < length; ++i) { 163 168 JSValue itemValue = object->get(exec, i); 164 if ( exec->hadException())169 if (UNLIKELY(scope.exception())) 165 170 return; 166 171 result.append(itemValue.toString(exec)->value(exec)); … … 222 227 { 223 228 ASSERT(exec); 229 VM& vm = exec->vm(); 230 auto scope = DECLARE_THROW_SCOPE(vm); 231 224 232 result.clear(); 225 233 … … 229 237 unsigned length = 0; 230 238 JSObject* object = toJSSequence(*exec, value, length); 231 if ( exec->hadException())239 if (UNLIKELY(scope.exception())) 232 240 return; 233 241 234 242 for (unsigned i = 0 ; i < length; ++i) { 235 243 JSValue itemValue = object->get(exec, i); 236 if ( exec->hadException())244 if (UNLIKELY(scope.exception())) 237 245 return; 238 246 result.add(itemValue.toString(exec)->value(exec)); … … 298 306 { 299 307 ASSERT(exec); 308 VM& vm = exec->vm(); 309 auto scope = DECLARE_THROW_SCOPE(vm); 310 300 311 if (value.isUndefinedOrNull()) 301 312 return; … … 303 314 unsigned length = 0; 304 315 JSObject* object = toJSSequence(*exec, value, length); 305 if ( exec->hadException())316 if (UNLIKELY(scope.exception())) 306 317 return; 307 318 308 319 for (unsigned i = 0 ; i < length; ++i) { 309 320 JSValue itemValue = object->get(exec, i); 310 if ( exec->hadException())321 if (UNLIKELY(scope.exception())) 311 322 return; 312 323 -
trunk/Source/WebCore/bindings/js/JSDictionary.h
r205024 r205569 204 204 JSDictionary::GetPropertyResult JSDictionary::tryGetPropertyAndResult(const char* propertyName, T* context, void (*setter)(T* context, const Result&)) const 205 205 { 206 JSC::VM& vm = m_exec->vm(); 207 auto scope = DECLARE_THROW_SCOPE(vm); 208 206 209 JSC::JSValue value; 207 210 GetPropertyResult getPropertyResult = tryGetProperty(propertyName, value); … … 213 216 convertValue(m_exec, value, result); 214 217 215 if ( m_exec->hadException())218 if (UNLIKELY(scope.exception())) 216 219 return ExceptionThrown; 217 220 -
trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp
r205422 r205569 154 154 return throwException(&state, scope, createNotEnoughArgumentsError(&state)); 155 155 auto contextId = state.uncheckedArgument(0).toWTFString(&state); 156 if (UNLIKELY(s tate.hadException()))156 if (UNLIKELY(scope.exception())) 157 157 return jsUndefined(); 158 158 auto name = state.uncheckedArgument(1).toWTFString(&state); 159 if (UNLIKELY(s tate.hadException()))159 if (UNLIKELY(scope.exception())) 160 160 return jsUndefined(); 161 161 auto width = convert<int32_t>(state, state.uncheckedArgument(2), NormalConversion); 162 if (UNLIKELY(s tate.hadException()))162 if (UNLIKELY(scope.exception())) 163 163 return jsUndefined(); 164 164 auto height = convert<int32_t>(state, state.uncheckedArgument(3), NormalConversion); 165 if (UNLIKELY(s tate.hadException()))165 if (UNLIKELY(scope.exception())) 166 166 return jsUndefined(); 167 167 -
trunk/Source/WebCore/bindings/js/JSEventListener.cpp
r204424 r205569 80 80 return; 81 81 82 JSLockHolder lock(scriptExecutionContext->vm()); 82 VM& vm = scriptExecutionContext->vm(); 83 JSLockHolder lock(vm); 84 auto scope = DECLARE_CATCH_SCOPE(vm); 85 // See https://dom.spec.whatwg.org/#dispatching-events spec on calling handleEvent. 86 // "If this throws an exception, report the exception." It should not propagate the 87 // exception. 83 88 84 89 JSObject* jsFunction = this->jsFunction(scriptExecutionContext); … … 110 115 if (callType == CallType::None) { 111 116 handleEventFunction = jsFunction->get(exec, Identifier::fromString(exec, "handleEvent")); 117 if (UNLIKELY(scope.exception())) { 118 Exception* exception = scope.exception(); 119 scope.clearException(); 120 121 event->target()->uncaughtExceptionInEventHandler(); 122 reportException(exec, exception); 123 return; 124 } 112 125 callType = getCallData(handleEventFunction, callData); 113 126 } … … 122 135 globalObject->setCurrentEvent(event); 123 136 124 VM& vm = globalObject->vm();125 137 VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject); 126 138 … … 139 151 if (is<WorkerGlobalScope>(*scriptExecutionContext)) { 140 152 auto scriptController = downcast<WorkerGlobalScope>(*scriptExecutionContext).script(); 141 bool terminatorCausedException = ( exec->hadException() && isTerminatedExecutionException(exec->exception()));153 bool terminatorCausedException = (scope.exception() && isTerminatedExecutionException(scope.exception())); 142 154 if (terminatorCausedException || scriptController->isTerminatingExecution()) 143 155 scriptController->forbidExecution(); -
trunk/Source/WebCore/bindings/js/JSFileCustom.cpp
r205422 r205569 61 61 unsigned blobPartsLength = 0; 62 62 JSObject* blobParts = toJSSequence(exec, arg, blobPartsLength); 63 if ( exec.hadException())63 if (UNLIKELY(scope.exception())) 64 64 return JSValue::encode(jsUndefined()); 65 65 ASSERT(blobParts); … … 70 70 71 71 String filename = arg.toWTFString(&exec).replace('/', ':'); 72 if ( exec.hadException())72 if (UNLIKELY(scope.exception())) 73 73 return JSValue::encode(jsUndefined()); 74 74 … … 88 88 String type; 89 89 dictionary.get("type", type); 90 if ( exec.hadException())90 if (UNLIKELY(scope.exception())) 91 91 return JSValue::encode(jsUndefined()); 92 92 … … 96 96 if (type.isEmpty() || !normalizedType.isEmpty()) { 97 97 dictionary.get("lastModified", lastModified); 98 if ( exec.hadException())98 if (UNLIKELY(scope.exception())) 99 99 return JSValue::encode(jsUndefined()); 100 100 } … … 108 108 for (unsigned i = 0; i < blobPartsLength; ++i) { 109 109 JSValue item = blobParts->get(&exec, i); 110 if ( exec.hadException())110 if (UNLIKELY(scope.exception())) 111 111 return JSValue::encode(jsUndefined()); 112 112 … … 119 119 else { 120 120 String string = item.toWTFString(&exec); 121 if ( exec.hadException())121 if (UNLIKELY(scope.exception())) 122 122 return JSValue::encode(jsUndefined()); 123 123 blobBuilder.append(string, ASCIILiteral("transparent")); -
trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp
r200626 r205569 72 72 static RefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValue value) 73 73 { 74 VM& vm = exec->vm(); 75 auto scope = DECLARE_THROW_SCOPE(vm); 76 74 77 // Create default options. 75 78 auto options = PositionOptions::create(); … … 83 86 // Given the above test, this will always yield an object. 84 87 JSObject* object = value.toObject(exec); 85 ASSERT (!exec->hadException());88 ASSERT_UNUSED(scope, !scope.exception()); 86 89 87 90 // Create the dictionary wrapper from the initializer object. … … 100 103 JSValue JSGeolocation::getCurrentPosition(ExecState& state) 101 104 { 105 VM& vm = state.vm(); 106 auto scope = DECLARE_THROW_SCOPE(vm); 107 102 108 // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions 103 109 104 110 auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0)); 105 if ( state.hadException())111 if (UNLIKELY(scope.exception())) 106 112 return jsUndefined(); 107 113 ASSERT(positionCallback); 108 114 109 115 auto positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(&state, globalObject(), state.argument(1), CallbackAllowUndefined | CallbackAllowNull); 110 if ( state.hadException())116 if (UNLIKELY(scope.exception())) 111 117 return jsUndefined(); 112 118 113 119 auto positionOptions = createPositionOptions(&state, state.argument(2)); 114 if ( state.hadException())120 if (UNLIKELY(scope.exception())) 115 121 return jsUndefined(); 116 122 ASSERT(positionOptions); … … 122 128 JSValue JSGeolocation::watchPosition(ExecState& state) 123 129 { 130 VM& vm = state.vm(); 131 auto scope = DECLARE_THROW_SCOPE(vm); 132 124 133 // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions 125 134 126 135 auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0)); 127 if ( state.hadException())136 if (UNLIKELY(scope.exception())) 128 137 return jsUndefined(); 129 138 ASSERT(positionCallback); 130 139 131 140 auto positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(&state, globalObject(), state.argument(1), CallbackAllowUndefined | CallbackAllowNull); 132 if ( state.hadException())141 if (UNLIKELY(scope.exception())) 133 142 return jsUndefined(); 134 143 135 144 auto positionOptions = createPositionOptions(&state, state.argument(2)); 136 if ( state.hadException())145 if (UNLIKELY(scope.exception())) 137 146 return jsUndefined(); 138 147 ASSERT(positionOptions); -
trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
r205198 r205569 54 54 static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) 55 55 { 56 VM& vm = exec->vm(); 57 auto scope = DECLARE_THROW_SCOPE(vm); 58 56 59 if (exec->argumentCount() < 1) 57 60 return JSValue::encode(jsUndefined()); … … 66 69 // Support for document.all(<index>) etc. 67 70 String string = exec->argument(0).toString(exec)->value(exec); 68 if ( exec->hadException())71 if (UNLIKELY(scope.exception())) 69 72 return JSValue::encode(jsUndefined()); 70 73 if (Optional<uint32_t> index = parseIndex(*string.impl())) … … 77 80 // The second arg, if set, is the index of the item we want 78 81 String string = exec->argument(0).toString(exec)->value(exec); 79 if ( exec->hadException())82 if (UNLIKELY(scope.exception())) 80 83 return JSValue::encode(jsUndefined()); 81 84 if (Optional<uint32_t> index = parseIndex(*exec->argument(1).toWTFString(exec).impl())) { -
trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
r205554 r205569 47 47 static void get3DContextAttributes(ExecState& state, RefPtr<CanvasContextAttributes>& attrs) 48 48 { 49 VM& vm = state.vm(); 50 auto scope = DECLARE_THROW_SCOPE(vm); 51 49 52 JSValue initializerValue = state.argument(1); 50 53 if (initializerValue.isUndefinedOrNull()) … … 52 55 53 56 JSObject* initializerObject = initializerValue.toObject(&state); 54 ASSERT (!state.hadException());57 ASSERT_UNUSED(scope, !scope.exception()); 55 58 JSDictionary dictionary(&state, initializerObject); 56 59 … … 84 87 if (HTMLCanvasElement::is3dType(contextId)) { 85 88 get3DContextAttributes(state, attrs); 86 if ( state.hadException())89 if (UNLIKELY(scope.exception())) 87 90 return jsUndefined(); 88 91 } -
trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
r205416 r205569 79 79 Structure* baseStructure = getDOMStructure<JSHTMLElement>(vm, *globalObject); 80 80 auto* newElementStructure = InternalFunction::createSubclassStructure(&exec, newTargetValue, baseStructure); 81 if (UNLIKELY( exec.hadException()))81 if (UNLIKELY(scope.exception())) 82 82 return JSValue::encode(jsUndefined()); 83 83 … … 99 99 100 100 JSValue newPrototype = newTarget->get(&exec, vm.propertyNames->prototype); 101 if ( exec.hadException())101 if (UNLIKELY(scope.exception())) 102 102 return JSValue::encode(jsUndefined()); 103 103 104 104 JSObject* elementWrapperObject = asObject(elementWrapperValue); 105 105 JSObject::setPrototype(elementWrapperObject, &exec, newPrototype, true /* shouldThrowIfCantSet */); 106 if ( exec.hadException())106 if (UNLIKELY(scope.exception())) 107 107 return JSValue::encode(jsUndefined()); 108 108 -
trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp
r205198 r205569 64 64 65 65 auto historyState = SerializedScriptValue::create(&state, state.uncheckedArgument(0), 0, 0); 66 if ( state.hadException())66 if (UNLIKELY(scope.exception())) 67 67 return jsUndefined(); 68 68 69 69 // FIXME: title should not be nullable. 70 70 String title = valueToStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(1)); 71 if ( state.hadException())71 if (UNLIKELY(scope.exception())) 72 72 return jsUndefined(); 73 73 … … 75 75 if (argCount > 2) { 76 76 url = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(2)); 77 if ( state.hadException())77 if (UNLIKELY(scope.exception())) 78 78 return jsUndefined(); 79 79 } … … 98 98 99 99 auto historyState = SerializedScriptValue::create(&state, state.uncheckedArgument(0), 0, 0); 100 if ( state.hadException())100 if (UNLIKELY(scope.exception())) 101 101 return jsUndefined(); 102 102 103 103 // FIXME: title should not be nullable. 104 104 String title = valueToStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(1)); 105 if ( state.hadException())105 if (UNLIKELY(scope.exception())) 106 106 return jsUndefined(); 107 107 … … 109 109 if (argCount > 2) { 110 110 url = valueToUSVStringWithUndefinedOrNullCheck(&state, state.uncheckedArgument(2)); 111 if ( state.hadException())111 if (UNLIKELY(scope.exception())) 112 112 return jsUndefined(); 113 113 } -
trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp
r205198 r205569 56 56 57 57 String name = state.argument(0).toString(&state)->value(&state); 58 if ( state.hadException())58 if (UNLIKELY(scope.exception())) 59 59 return jsUndefined(); 60 60 … … 67 67 if (!optionsValue.isUndefinedOrNull()) { 68 68 JSValue keyPathValue = optionsValue.get(&state, Identifier::fromString(&state, "keyPath")); 69 if ( state.hadException())69 if (UNLIKELY(scope.exception())) 70 70 return jsUndefined(); 71 71 72 72 if (!keyPathValue.isUndefinedOrNull()) { 73 73 keyPath = idbKeyPathFromValue(state, keyPathValue); 74 if ( state.hadException())74 if (UNLIKELY(scope.exception())) 75 75 return jsUndefined(); 76 76 } 77 77 78 78 autoIncrement = optionsValue.get(&state, Identifier::fromString(&state, "autoIncrement")).toBoolean(&state); 79 if ( state.hadException())79 if (UNLIKELY(scope.exception())) 80 80 return jsUndefined(); 81 81 } -
trunk/Source/WebCore/bindings/js/JSLazyEventListener.cpp
r200775 r205569 99 99 return nullptr; 100 100 101 VM& vm = globalObject->vm(); 102 JSLockHolder lock(vm); 103 auto scope = DECLARE_CATCH_SCOPE(vm); 101 104 ExecState* exec = globalObject->globalExec(); 102 105 … … 113 116 m_sourceURL, m_sourcePosition, overrideLineNumber); 114 117 115 if ( exec->hadException()) {118 if (UNLIKELY(scope.exception())) { 116 119 reportCurrentException(exec); 117 exec->clearException();120 scope.clearException(); 118 121 return nullptr; 119 122 } … … 124 127 if (!wrapper()) { 125 128 // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating. 126 JSLockHolder lock(exec);127 129 // FIXME: Should pass the global object associated with the node 128 setWrapper( exec->vm(), asObject(toJS(exec, globalObject, *m_originalNode)));130 setWrapper(vm, asObject(toJS(exec, globalObject, *m_originalNode))); 129 131 } 130 132 131 133 // Add the event's home element to the scope 132 134 // (and the document, and the form - see JSHTMLElement::eventHandlerScope) 133 listenerAsFunction->setScope( exec->vm(), jsCast<JSNode*>(wrapper())->pushEventHandlerScope(exec, listenerAsFunction->scope()));135 listenerAsFunction->setScope(vm, jsCast<JSNode*>(wrapper())->pushEventHandlerScope(exec, listenerAsFunction->scope())); 134 136 } 135 137 return jsFunction; -
trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h
r205278 r205569 108 108 static JSC::JSValue linkAndEvaluateModule(JSC::ExecState* exec, const JSC::Identifier& moduleKey, JSC::JSValue initiator, NakedPtr<JSC::Exception>& returnedException) 109 109 { 110 JSC::VM& vm = exec->vm(); 111 auto scope = DECLARE_CATCH_SCOPE(vm); 112 110 113 JSMainThreadExecState currentState(exec); 111 114 JSC::JSValue returnValue = JSC::linkAndEvaluateModule(exec, moduleKey, initiator); 112 if ( exec->hadException()) {113 returnedException = exec->vm().exception();114 exec->clearException();115 if (UNLIKELY(scope.exception())) { 116 returnedException = scope.exception(); 117 scope.clearException(); 115 118 return JSC::jsUndefined(); 116 119 } … … 132 135 ~JSMainThreadExecState() 133 136 { 137 JSC::VM& vm = s_mainThreadState->vm(); 138 auto scope = DECLARE_CATCH_SCOPE(vm); 134 139 ASSERT(isMainThread()); 135 ASSERT (!s_mainThreadState->hadException());140 ASSERT_UNUSED(scope, !scope.exception()); 136 141 137 142 bool didExitJavaScript = s_mainThreadState && !m_previousState; -
trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp
r204215 r205569 105 105 static JSC::JSValue handleInitMessageEvent(JSMessageEvent* jsEvent, JSC::ExecState& state) 106 106 { 107 VM& vm = state.vm(); 108 auto scope = DECLARE_THROW_SCOPE(vm); 109 107 110 const String& typeArg = state.argument(0).toString(&state)->value(&state); 108 111 bool canBubbleArg = state.argument(1).toBoolean(&state); … … 117 120 arrayBuffers = std::make_unique<ArrayBufferArray>(); 118 121 fillMessagePortArray(state, state.argument(7), *messagePorts, *arrayBuffers); 119 if ( state.hadException())122 if (UNLIKELY(scope.exception())) 120 123 return jsUndefined(); 121 124 } 122 Deprecated::ScriptValue dataArg( state.vm(), state.argument(3));123 if ( state.hadException())125 Deprecated::ScriptValue dataArg(vm, state.argument(3)); 126 if (UNLIKELY(scope.exception())) 124 127 return jsUndefined(); 125 128 126 129 MessageEvent& event = jsEvent->wrapped(); 127 130 event.initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, sourceArg, WTFMove(messagePorts)); 128 jsEvent->m_data.set( state.vm(), jsEvent, dataArg.jsValue());131 jsEvent->m_data.set(vm, jsEvent, dataArg.jsValue()); 129 132 return jsUndefined(); 130 133 } -
trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp
r205198 r205569 74 74 unsigned length = 0; 75 75 JSObject* object = toJSSequence(state, value, length); 76 if ( state.hadException())76 if (UNLIKELY(scope.exception())) 77 77 return; 78 78 79 79 for (unsigned i = 0 ; i < length; ++i) { 80 80 JSValue value = object->get(&state, i); 81 if ( state.hadException())81 if (UNLIKELY(scope.exception())) 82 82 return; 83 83 // Validation of non-null objects, per HTML5 spec 10.3.3. -
trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h
r205198 r205569 62 62 fillMessagePortArray(state, state.argument(1), portArray, arrayBufferArray); 63 63 auto message = SerializedScriptValue::create(&state, state.uncheckedArgument(0), &portArray, &arrayBufferArray); 64 if ( state.hadException())64 if (UNLIKELY(scope.exception())) 65 65 return JSC::jsUndefined(); 66 66 -
trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp
r205198 r205569 63 63 64 64 uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) }; 65 if ( state.hadException())65 if (UNLIKELY(scope.exception())) 66 66 return; 67 67 … … 99 99 100 100 uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) }; 101 if ( state.hadException())101 if (UNLIKELY(scope.exception())) 102 102 return Decision::Allow; 103 103 … … 120 120 void JSMockContentFilterSettings::setDecision(ExecState& state, JSValue value) 121 121 { 122 VM& vm = state.vm(); 123 auto scope = DECLARE_THROW_SCOPE(vm); 124 122 125 Decision decision { toDecision(state, value) }; 123 if ( state.hadException())126 if (UNLIKELY(scope.exception())) 124 127 return; 125 128 … … 134 137 void JSMockContentFilterSettings::setUnblockRequestDecision(ExecState& state, JSValue value) 135 138 { 139 VM& vm = state.vm(); 140 auto scope = DECLARE_THROW_SCOPE(vm); 141 136 142 Decision unblockRequestDecision { toDecision(state, value) }; 137 if ( state.hadException())143 if (UNLIKELY(scope.exception())) 138 144 return; 139 145 -
trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
r205198 r205569 50 50 MarkedArgumentBuffer args; 51 51 args.append(toJS(state, m_data->globalObject(), node)); 52 if ( state->hadException())52 if (UNLIKELY(scope.exception())) 53 53 return NodeFilter::FILTER_REJECT; 54 54 55 55 NakedPtr<Exception> returnedException; 56 56 JSValue value = m_data->invokeCallback(args, JSCallbackData::CallbackType::FunctionOrObject, Identifier::fromString(state, "acceptNode"), returnedException); 57 ASSERT(!scope.exception() || returnedException); 57 58 if (returnedException) { 58 59 // Rethrow exception. … … 63 64 64 65 uint16_t result = convert<uint16_t>(*state, value, NormalConversion); 65 if ( state->hadException())66 if (UNLIKELY(scope.exception())) 66 67 return NodeFilter::FILTER_REJECT; 67 68 -
trunk/Source/WebCore/bindings/js/JSNodeOrString.cpp
r204493 r205569 29 29 #include "JSNode.h" 30 30 #include <JavaScriptCore/JSString.h> 31 #include <JavaScriptCore/ThrowScope.h> 31 32 32 33 using namespace JSC; … … 36 37 Vector<std::experimental::variant<Ref<Node>, String>> toNodeOrStringVector(ExecState& state) 37 38 { 39 VM& vm = state.vm(); 40 auto scope = DECLARE_THROW_SCOPE(vm); 41 38 42 size_t argumentCount = state.argumentCount(); 39 43 … … 47 51 else { 48 52 String string = value.toWTFString(&state); 49 if ( state.hadException())53 if (UNLIKELY(scope.exception())) 50 54 return { }; 51 55 result.uncheckedAppend(string); -
trunk/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp
r205324 r205569 45 45 JSValue JSSQLTransaction::executeSql(ExecState& state) 46 46 { 47 VM& vm = state.vm(); 48 auto scope = DECLARE_THROW_SCOPE(vm); 49 47 50 if (!state.argumentCount()) { 48 51 setDOMException(&state, SYNTAX_ERR); … … 51 54 52 55 String sqlStatement = state.argument(0).toString(&state)->value(&state); 53 if ( state.hadException())56 if (UNLIKELY(scope.exception())) 54 57 return jsUndefined(); 55 58 … … 64 67 65 68 JSValue lengthValue = object->get(&state, state.propertyNames().length); 66 if ( state.hadException())69 if (UNLIKELY(scope.exception())) 67 70 return jsUndefined(); 68 71 unsigned length = lengthValue.toUInt32(&state); 69 if ( state.hadException())72 if (UNLIKELY(scope.exception())) 70 73 return jsUndefined(); 71 74 72 75 for (unsigned i = 0 ; i < length; ++i) { 73 76 JSValue value = object->get(&state, i); 74 if ( state.hadException())77 if (UNLIKELY(scope.exception())) 75 78 return jsUndefined(); 76 79 … … 82 85 // Convert the argument to a string and append it 83 86 sqlValues.append(value.toString(&state)->value(&state)); 84 if ( state.hadException())87 if (UNLIKELY(scope.exception())) 85 88 return jsUndefined(); 86 89 } -
trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp
r205198 r205569 91 91 92 92 unsigned short unitType = state.uncheckedArgument(0).toUInt32(&state); 93 if ( state.hadException())93 if (UNLIKELY(scope.exception())) 94 94 return jsUndefined(); 95 95 -
trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp
r202031 r205569 80 80 void JSStorage::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) 81 81 { 82 VM& vm = exec->vm(); 83 auto scope = DECLARE_THROW_SCOPE(vm); 84 82 85 JSStorage* thisObject = jsCast<JSStorage*>(object); 83 86 ExceptionCode ec = 0; 84 87 unsigned length = thisObject->wrapped().length(ec); 85 88 setDOMException(exec, ec); 86 if ( exec->hadException())89 if (UNLIKELY(scope.exception())) 87 90 return; 88 91 for (unsigned i = 0; i < length; ++i) { 89 92 propertyNames.add(Identifier::fromString(exec, thisObject->wrapped().key(i, ec))); 90 93 setDOMException(exec, ec); 91 if ( exec->hadException())94 if (UNLIKELY(scope.exception())) 92 95 return; 93 96 } … … 98 101 bool JSStorage::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult) 99 102 { 103 VM& vm = exec->vm(); 104 auto scope = DECLARE_THROW_SCOPE(vm); 105 100 106 // Only perform the custom put if the object doesn't have a native property by this name. 101 107 // Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check … … 111 117 112 118 String stringValue = value.toString(exec)->value(exec); 113 if ( exec->hadException()) {119 if (UNLIKELY(scope.exception())) { 114 120 // The return value indicates whether putDelegate() should handle the put operation (which 115 121 // if true, tells the caller not to execute the generic put). It does not indicate whether -
trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp
r200317 r205569 45 45 { 46 46 #if ENABLE(MEDIA_SOURCE) 47 VM& vm = state.vm(); 48 auto scope = DECLARE_THROW_SCOPE(vm); 49 47 50 auto& string = value.toString(&state)->value(&state); 48 if ( state.hadException())51 if (UNLIKELY(scope.exception())) 49 52 return; 50 53 wrapped().setLanguage(string); -
trunk/Source/WebCore/bindings/js/JSVideoTrackCustom.cpp
r191887 r205569 44 44 { 45 45 #if ENABLE(MEDIA_SOURCE) 46 VM& vm = state.vm(); 47 auto scope = DECLARE_THROW_SCOPE(vm); 48 46 49 auto& string = value.toString(&state)->value(&state); 47 if ( state.hadException())50 if (UNLIKELY(scope.exception())) 48 51 return; 49 52 wrapped().setKind(string); … … 57 60 { 58 61 #if ENABLE(MEDIA_SOURCE) 62 VM& vm = state.vm(); 63 auto scope = DECLARE_THROW_SCOPE(vm); 64 59 65 auto& string = value.toString(&state)->value(&state); 60 if ( state.hadException())66 if (UNLIKELY(scope.exception())) 61 67 return; 62 68 wrapped().setLanguage(string); -
trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp
r205462 r205569 107 107 WebGL2RenderingContext& context = wrapped(); 108 108 unsigned pname = exec.uncheckedArgument(0).toInt32(&exec); 109 if ( exec.hadException())109 if (UNLIKELY(scope.exception())) 110 110 return jsUndefined(); 111 111 unsigned index = exec.uncheckedArgument(1).toInt32(&exec); 112 if ( exec.hadException())112 if (UNLIKELY(scope.exception())) 113 113 return jsUndefined(); 114 114 WebGLGetInfo info = context.getIndexedParameter(pname, index); -
trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp
r205422 r205569 200 200 WebGLRenderingContextBase& context = obj->wrapped(); 201 201 unsigned target = state.uncheckedArgument(0).toInt32(&state); 202 if ( state.hadException())202 if (UNLIKELY(scope.exception())) 203 203 return jsUndefined(); 204 204 unsigned pname = state.uncheckedArgument(1).toInt32(&state); 205 if ( state.hadException())205 if (UNLIKELY(scope.exception())) 206 206 return jsUndefined(); 207 207 WebGLGetInfo info; … … 336 336 WebGLRenderingContextBase& context = wrapped(); 337 337 const String name = state.uncheckedArgument(0).toString(&state)->value(&state); 338 if ( state.hadException())338 if (UNLIKELY(scope.exception())) 339 339 return jsUndefined(); 340 340 WebGLExtension* extension = context.getExtension(name); … … 358 358 WebGLRenderingContextBase& context = wrapped(); 359 359 unsigned target = state.uncheckedArgument(0).toInt32(&state); 360 if ( state.hadException())360 if (UNLIKELY(scope.exception())) 361 361 return jsUndefined(); 362 362 unsigned attachment = state.uncheckedArgument(1).toInt32(&state); 363 if ( state.hadException())363 if (UNLIKELY(scope.exception())) 364 364 return jsUndefined(); 365 365 unsigned pname = state.uncheckedArgument(2).toInt32(&state); 366 if ( state.hadException())366 if (UNLIKELY(scope.exception())) 367 367 return jsUndefined(); 368 368 WebGLGetInfo info = context.getFramebufferAttachmentParameter(target, attachment, pname, ec); … … 385 385 WebGLRenderingContextBase& context = wrapped(); 386 386 unsigned pname = state.uncheckedArgument(0).toInt32(&state); 387 if ( state.hadException())387 if (UNLIKELY(scope.exception())) 388 388 return jsUndefined(); 389 389 WebGLGetInfo info = context.getParameter(pname, ec); … … 409 409 return throwTypeError(&state, scope); 410 410 unsigned pname = state.uncheckedArgument(1).toInt32(&state); 411 if ( state.hadException())411 if (UNLIKELY(scope.exception())) 412 412 return jsUndefined(); 413 413 WebGLGetInfo info = context.getProgramParameter(program, pname, ec); … … 438 438 WebGLShader* shader = JSWebGLShader::toWrapped(state.uncheckedArgument(0)); 439 439 unsigned pname = state.uncheckedArgument(1).toInt32(&state); 440 if ( state.hadException())440 if (UNLIKELY(scope.exception())) 441 441 return jsUndefined(); 442 442 WebGLGetInfo info = context.getShaderParameter(shader, pname, ec); … … 497 497 bool toVector(JSC::ExecState& state, JSC::JSValue value, Vector<T, inlineCapacity>& vector) 498 498 { 499 VM& vm = state.vm(); 500 auto scope = DECLARE_THROW_SCOPE(vm); 501 499 502 if (!value.isObject()) 500 503 return false; … … 509 512 for (int32_t i = 0; i < length; ++i) { 510 513 JSC::JSValue v = object->get(&state, i); 511 if ( state.hadException())514 if (UNLIKELY(scope.exception())) 512 515 return false; 513 516 vector[i] = static_cast<T>(v.toNumber(&state)); … … 557 560 index = state.uncheckedArgument(0).toInt32(&state); 558 561 559 if ( state.hadException())562 if (UNLIKELY(scope.exception())) 560 563 return jsUndefined(); 561 564 562 565 RefPtr<Float32Array> webGLArray = toFloat32Array(state.uncheckedArgument(1)); 563 if ( state.hadException())566 if (UNLIKELY(scope.exception())) 564 567 return jsUndefined(); 565 568 … … 708 711 709 712 bool transpose = state.uncheckedArgument(1).toBoolean(&state); 710 if ( state.hadException())713 if (UNLIKELY(scope.exception())) 711 714 return jsUndefined(); 712 715 -
trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp
r205257 r205569 64 64 static RefPtr<CryptoAlgorithm> createAlgorithmFromJSValue(ExecState& state, JSValue value) 65 65 { 66 VM& vm = state.vm(); 67 auto scope = DECLARE_THROW_SCOPE(vm); 68 66 69 CryptoAlgorithmIdentifier algorithmIdentifier; 67 if (!JSCryptoAlgorithmDictionary::getAlgorithmIdentifier(&state, value, algorithmIdentifier)) { 68 ASSERT(state.hadException()); 70 auto success = JSCryptoAlgorithmDictionary::getAlgorithmIdentifier(&state, value, algorithmIdentifier); 71 ASSERT_UNUSED(scope, scope.exception() || success); 72 if (!success) 69 73 return nullptr; 70 }71 74 72 75 auto result = CryptoAlgorithmRegistry::singleton().create(algorithmIdentifier); … … 82 85 83 86 String keyFormatString = value.toString(&state)->value(&state); 84 if ( state.hadException())87 if (UNLIKELY(scope.exception())) 85 88 return false; 86 89 if (keyFormatString == "raw") … … 115 118 JSValue element = array->getIndex(&state, i); 116 119 String usageString = element.toString(&state)->value(&state); 117 if ( state.hadException())120 if (UNLIKELY(scope.exception())) 118 121 return false; 119 122 if (usageString == "encrypt") … … 146 149 147 150 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0)); 148 if (!algorithm) { 149 ASSERT(state.hadException()); 150 return jsUndefined(); 151 } 151 ASSERT(scope.exception() || algorithm); 152 if (!algorithm) 153 return jsUndefined(); 152 154 153 155 auto parameters = JSCryptoAlgorithmDictionary::createParametersForEncrypt(&state, algorithm->identifier(), state.uncheckedArgument(0)); 154 if (!parameters) { 155 ASSERT(state.hadException()); 156 return jsUndefined(); 157 } 156 ASSERT(scope.exception() || parameters); 157 if (!parameters) 158 return jsUndefined(); 158 159 159 160 RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(state.uncheckedArgument(1)); … … 168 169 169 170 CryptoOperationData data; 170 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), data)) {171 ASSERT(state.hadException());172 return jsUndefined();173 }171 auto success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), data); 172 ASSERT(scope.exception() || success); 173 if (!success) 174 return jsUndefined(); 174 175 175 176 … … 202 203 203 204 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0)); 204 if (!algorithm) { 205 ASSERT(state.hadException()); 206 return jsUndefined(); 207 } 205 ASSERT(scope.exception() || algorithm); 206 if (!algorithm) 207 return jsUndefined(); 208 208 209 209 auto parameters = JSCryptoAlgorithmDictionary::createParametersForDecrypt(&state, algorithm->identifier(), state.uncheckedArgument(0)); 210 if (!parameters) { 211 ASSERT(state.hadException()); 212 return jsUndefined(); 213 } 210 ASSERT(scope.exception() || parameters); 211 if (!parameters) 212 return jsUndefined(); 214 213 215 214 RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(state.uncheckedArgument(1)); … … 224 223 225 224 CryptoOperationData data; 226 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), data)) {227 ASSERT(state.hadException());228 return jsUndefined();229 }225 auto success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), data); 226 ASSERT(scope.exception() || success); 227 if (!success) 228 return jsUndefined(); 230 229 231 230 JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(&state, globalObject()); … … 257 256 258 257 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0)); 259 if (!algorithm) { 260 ASSERT(state.hadException()); 261 return jsUndefined(); 262 } 258 ASSERT(scope.exception() || algorithm); 259 if (!algorithm) 260 return jsUndefined(); 263 261 264 262 auto parameters = JSCryptoAlgorithmDictionary::createParametersForSign(&state, algorithm->identifier(), state.uncheckedArgument(0)); 265 if (!parameters) { 266 ASSERT(state.hadException()); 267 return jsUndefined(); 268 } 263 ASSERT(scope.exception() || parameters); 264 if (!parameters) 265 return jsUndefined(); 269 266 270 267 RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(state.uncheckedArgument(1)); … … 279 276 280 277 CryptoOperationData data; 281 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), data)) {282 ASSERT(state.hadException());283 return jsUndefined();284 }278 auto success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), data); 279 ASSERT(scope.exception() || success); 280 if (!success) 281 return jsUndefined(); 285 282 286 283 JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(&state, globalObject()); … … 312 309 313 310 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0)); 314 if (!algorithm) { 315 ASSERT(state.hadException()); 316 return jsUndefined(); 317 } 311 ASSERT(scope.exception() || algorithm); 312 if (!algorithm) 313 return jsUndefined(); 318 314 319 315 auto parameters = JSCryptoAlgorithmDictionary::createParametersForVerify(&state, algorithm->identifier(), state.uncheckedArgument(0)); 320 if (!parameters) { 321 ASSERT(state.hadException()); 322 return jsUndefined(); 323 } 316 ASSERT(scope.exception() || parameters); 317 if (!parameters) 318 return jsUndefined(); 324 319 325 320 RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(state.uncheckedArgument(1)); … … 334 329 335 330 CryptoOperationData signature; 336 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), signature)) {337 ASSERT(state.hadException());338 return jsUndefined();339 }331 auto success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(2), signature); 332 ASSERT(scope.exception() || success); 333 if (!success) 334 return jsUndefined(); 340 335 341 336 CryptoOperationData data; 342 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(3), data)) {343 ASSERT(state.hadException());344 return jsUndefined();345 }337 success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(3), data); 338 ASSERT(scope.exception() || success); 339 if (!success) 340 return jsUndefined(); 346 341 347 342 JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(&state, globalObject()); … … 373 368 374 369 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0)); 375 if (!algorithm) { 376 ASSERT(state.hadException()); 377 return jsUndefined(); 378 } 370 ASSERT(scope.exception() || algorithm); 371 if (!algorithm) 372 return jsUndefined(); 379 373 380 374 auto parameters = JSCryptoAlgorithmDictionary::createParametersForDigest(&state, algorithm->identifier(), state.uncheckedArgument(0)); 381 if (!parameters) { 382 ASSERT(state.hadException()); 383 return jsUndefined(); 384 } 375 ASSERT(scope.exception() || parameters); 376 if (!parameters) 377 return jsUndefined(); 385 378 386 379 CryptoOperationData data; 387 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), data)) {388 ASSERT(state.hadException());389 return jsUndefined();390 }380 auto success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), data); 381 ASSERT(scope.exception() || success); 382 if (!success) 383 return jsUndefined(); 391 384 392 385 JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(&state, globalObject()); … … 418 411 419 412 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0)); 420 if (!algorithm) { 421 ASSERT(state.hadException()); 422 return jsUndefined(); 423 } 413 ASSERT(scope.exception() || algorithm); 414 if (!algorithm) 415 return jsUndefined(); 424 416 425 417 auto parameters = JSCryptoAlgorithmDictionary::createParametersForGenerateKey(&state, algorithm->identifier(), state.uncheckedArgument(0)); 426 if (!parameters) { 427 ASSERT(state.hadException()); 428 return jsUndefined(); 429 } 418 ASSERT(scope.exception() || parameters); 419 if (!parameters) 420 return jsUndefined(); 430 421 431 422 bool extractable = false; 432 423 if (state.argumentCount() >= 2) { 433 424 extractable = state.uncheckedArgument(1).toBoolean(&state); 434 if ( state.hadException())425 if (UNLIKELY(scope.exception())) 435 426 return jsUndefined(); 436 427 } … … 438 429 CryptoKeyUsage keyUsages = 0; 439 430 if (state.argumentCount() >= 3) { 440 if (!cryptoKeyUsagesFromJSValue(state, state.argument(2), keyUsages)) {441 ASSERT(state.hadException());442 return jsUndefined();443 }431 auto success = cryptoKeyUsagesFromJSValue(state, state.argument(2), keyUsages); 432 ASSERT(scope.exception() || success); 433 if (!success) 434 return jsUndefined(); 444 435 } 445 436 … … 485 476 } 486 477 keySerialization = std::make_unique<JSCryptoKeySerializationJWK>(&state, jwkString); 487 if ( state.hadException())478 if (UNLIKELY(scope.exception())) 488 479 return; 489 480 break; … … 498 489 Optional<CryptoAlgorithmPair> reconciledResult = keySerialization->reconcileAlgorithm(algorithm.get(), parameters.get()); 499 490 if (!reconciledResult) { 500 if (!s tate.hadException())491 if (!scope.exception()) 501 492 throwTypeError(&state, scope, ASCIILiteral("Algorithm specified in key is not compatible with one passed to importKey as argument")); 502 493 return; 503 494 } 504 if ( state.hadException())495 if (UNLIKELY(scope.exception())) 505 496 return; 506 497 … … 514 505 515 506 keySerialization->reconcileExtractable(extractable); 516 if ( state.hadException())507 if (UNLIKELY(scope.exception())) 517 508 return; 518 509 519 510 keySerialization->reconcileUsages(keyUsages); 520 if ( state.hadException())511 if (UNLIKELY(scope.exception())) 521 512 return; 522 513 523 514 auto keyData = keySerialization->keyData(); 524 if ( state.hadException())515 if (UNLIKELY(scope.exception())) 525 516 return; 526 517 … … 540 531 541 532 CryptoKeyFormat keyFormat; 542 if (!cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat)) {543 ASSERT(state.hadException());544 return jsUndefined();545 }533 auto success = cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat); 534 ASSERT(scope.exception() || success); 535 if (!success) 536 return jsUndefined(); 546 537 547 538 CryptoOperationData data; 548 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), data)) {549 ASSERT(state.hadException());550 return jsUndefined();551 }539 success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), data); 540 ASSERT(scope.exception() || success); 541 if (!success) 542 return jsUndefined(); 552 543 553 544 RefPtr<CryptoAlgorithm> algorithm; … … 555 546 if (!state.uncheckedArgument(2).isNull()) { 556 547 algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(2)); 557 if (!algorithm) {558 ASSERT(state.hadException());559 return jsUndefined(); 560 } 548 ASSERT(scope.exception() || algorithm); 549 if (!algorithm) 550 return jsUndefined(); 551 561 552 parameters = JSCryptoAlgorithmDictionary::createParametersForImportKey(&state, algorithm->identifier(), state.uncheckedArgument(2)); 562 if (!parameters) { 563 ASSERT(state.hadException()); 564 return jsUndefined(); 565 } 553 ASSERT(scope.exception() || parameters); 554 if (!parameters) 555 return jsUndefined(); 566 556 } 567 557 … … 569 559 if (state.argumentCount() >= 4) { 570 560 extractable = state.uncheckedArgument(3).toBoolean(&state); 571 if ( state.hadException())561 if (UNLIKELY(scope.exception())) 572 562 return jsUndefined(); 573 563 } … … 575 565 CryptoKeyUsage keyUsages = 0; 576 566 if (state.argumentCount() >= 5) { 577 if (!cryptoKeyUsagesFromJSValue(state, state.argument(4), keyUsages)) {578 ASSERT(state.hadException());579 return jsUndefined();580 }567 auto success = cryptoKeyUsagesFromJSValue(state, state.argument(4), keyUsages); 568 ASSERT(scope.exception() || success); 569 if (!success) 570 return jsUndefined(); 581 571 } 582 572 … … 591 581 592 582 WebCore::importKey(state, keyFormat, data, WTFMove(algorithm), WTFMove(parameters), extractable, keyUsages, WTFMove(successCallback), WTFMove(failureCallback)); 593 if ( state.hadException())583 if (UNLIKELY(scope.exception())) 594 584 return jsUndefined(); 595 585 … … 618 608 case CryptoKeyFormat::JWK: { 619 609 String result = JSCryptoKeySerializationJWK::serialize(&state, key); 620 if ( state.hadException())610 if (UNLIKELY(scope.exception())) 621 611 return; 622 612 CString utf8String = result.utf8(StrictConversion); … … 641 631 642 632 CryptoKeyFormat keyFormat; 643 if (!cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat)) {644 ASSERT(state.hadException());645 return jsUndefined();646 }633 auto success = cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat); 634 ASSERT(scope.exception() || success); 635 if (!success) 636 return jsUndefined(); 647 637 648 638 RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(state.uncheckedArgument(1)); … … 660 650 661 651 WebCore::exportKey(state, keyFormat, *key, WTFMove(successCallback), WTFMove(failureCallback)); 662 if ( state.hadException())652 if (UNLIKELY(scope.exception())) 663 653 return jsUndefined(); 664 654 … … 675 665 676 666 CryptoKeyFormat keyFormat; 677 if (!cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat)) {678 ASSERT(state.hadException());679 return jsUndefined();680 }667 auto success = cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat); 668 ASSERT(scope.exception() || success); 669 if (!success) 670 return jsUndefined(); 681 671 682 672 RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(state.uncheckedArgument(1)); … … 695 685 696 686 auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(3)); 697 if (!algorithm) { 698 ASSERT(state.hadException()); 699 return jsUndefined(); 700 } 687 ASSERT(scope.exception() || algorithm); 688 if (!algorithm) 689 return jsUndefined(); 701 690 702 691 auto parameters = JSCryptoAlgorithmDictionary::createParametersForEncrypt(&state, algorithm->identifier(), state.uncheckedArgument(3)); 703 if (!parameters) { 704 ASSERT(state.hadException()); 705 return jsUndefined(); 706 } 692 ASSERT(scope.exception() || parameters); 693 if (!parameters) 694 return jsUndefined(); 707 695 708 696 JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(&state, globalObject()); … … 747 735 748 736 CryptoKeyFormat keyFormat; 749 if (!cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat)) {750 ASSERT(state.hadException());751 return jsUndefined();752 }737 auto success = cryptoKeyFormatFromJSValue(state, state.argument(0), keyFormat); 738 ASSERT(scope.exception() || success); 739 if (!success) 740 return jsUndefined(); 753 741 754 742 CryptoOperationData wrappedKeyData; 755 if (!cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), wrappedKeyData)) {756 ASSERT(state.hadException());757 return jsUndefined();758 }743 success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), wrappedKeyData); 744 ASSERT(scope.exception() || success); 745 if (!success) 746 return jsUndefined(); 759 747 760 748 RefPtr<CryptoKey> unwrappingKey = JSCryptoKey::toWrapped(state.uncheckedArgument(2)); … … 769 757 770 758 auto unwrapAlgorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(3)); 771 if (!unwrapAlgorithm) { 772 ASSERT(state.hadException()); 773 return jsUndefined(); 774 } 759 ASSERT(scope.exception() || unwrapAlgorithm); 760 if (!unwrapAlgorithm) 761 return jsUndefined(); 775 762 auto unwrapAlgorithmParameters = JSCryptoAlgorithmDictionary::createParametersForDecrypt(&state, unwrapAlgorithm->identifier(), state.uncheckedArgument(3)); 776 if (!unwrapAlgorithmParameters) { 777 ASSERT(state.hadException()); 778 return jsUndefined(); 779 } 763 ASSERT(scope.exception() || unwrapAlgorithmParameters); 764 if (!unwrapAlgorithmParameters) 765 return jsUndefined(); 780 766 781 767 RefPtr<CryptoAlgorithm> unwrappedKeyAlgorithm; … … 783 769 if (!state.uncheckedArgument(4).isNull()) { 784 770 unwrappedKeyAlgorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(4)); 785 if (!unwrappedKeyAlgorithm) {786 ASSERT(state.hadException());787 return jsUndefined(); 788 } 771 ASSERT(scope.exception() || unwrappedKeyAlgorithm); 772 if (!unwrappedKeyAlgorithm) 773 return jsUndefined(); 774 789 775 unwrappedKeyAlgorithmParameters = JSCryptoAlgorithmDictionary::createParametersForImportKey(&state, unwrappedKeyAlgorithm->identifier(), state.uncheckedArgument(4)); 790 if (!unwrappedKeyAlgorithmParameters) { 791 ASSERT(state.hadException()); 792 return jsUndefined(); 793 } 776 ASSERT(scope.exception() || unwrappedKeyAlgorithmParameters); 777 if (!unwrappedKeyAlgorithmParameters) 778 return jsUndefined(); 794 779 } 795 780 … … 797 782 if (state.argumentCount() >= 6) { 798 783 extractable = state.uncheckedArgument(5).toBoolean(&state); 799 if ( state.hadException())784 if (UNLIKELY(scope.exception())) 800 785 return jsUndefined(); 801 786 } … … 803 788 CryptoKeyUsage keyUsages = 0; 804 789 if (state.argumentCount() >= 7) { 805 if (!cryptoKeyUsagesFromJSValue(state, state.argument(6), keyUsages)) {806 ASSERT(state.hadException());807 return jsUndefined();808 }790 auto success = cryptoKeyUsagesFromJSValue(state, state.argument(6), keyUsages); 791 ASSERT(scope.exception() || success); 792 if (!success) 793 return jsUndefined(); 809 794 } 810 795 … … 820 805 wrapper->reject(nullptr); 821 806 }; 807 808 VM& vm = domGlobalObject->vm(); 809 auto scope = DECLARE_CATCH_SCOPE(vm); 810 822 811 ExecState& state = *domGlobalObject->globalExec(); 823 812 WebCore::importKey(state, keyFormat, std::make_pair(result.data(), result.size()), unwrappedKeyAlgorithm, unwrappedKeyAlgorithmParameters, extractable, keyUsages, WTFMove(importSuccessCallback), WTFMove(importFailureCallback)); 824 if ( state.hadException()) {813 if (UNLIKELY(scope.exception())) { 825 814 // FIXME: Report exception details to console, and possibly to calling script once there is a standardized way to pass errors to WebCrypto promise reject functions. 826 s tate.clearException();815 scope.clearException(); 827 816 wrapper->reject(nullptr); 828 817 } -
trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp
r205198 r205569 57 57 58 58 String scriptURL = exec.uncheckedArgument(0).toWTFString(&exec); 59 if ( exec.hadException())59 if (UNLIKELY(scope.exception())) 60 60 return JSValue::encode(JSValue()); 61 61 -
trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp
r205462 r205569 62 62 JSValue JSWorkerGlobalScope::importScripts(ExecState& state) 63 63 { 64 VM& vm = state.vm(); 65 auto scope = DECLARE_THROW_SCOPE(vm); 66 64 67 if (!state.argumentCount()) 65 68 return jsUndefined(); … … 68 71 for (unsigned i = 0; i < state.argumentCount(); ++i) { 69 72 urls.append(valueToUSVString(&state, state.uncheckedArgument(i))); 70 if ( state.hadException())73 if (UNLIKELY(scope.exception())) 71 74 return jsUndefined(); 72 75 } … … 87 90 88 91 std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), wrapped().contentSecurityPolicy()); 89 if ( state.hadException())92 if (UNLIKELY(scope.exception())) 90 93 return jsUndefined(); 91 94 if (!action) … … 104 107 105 108 std::unique_ptr<ScheduledAction> action = ScheduledAction::create(&state, globalObject()->world(), wrapped().contentSecurityPolicy()); 106 if ( state.hadException())109 if (UNLIKELY(scope.exception())) 107 110 return jsUndefined(); 108 111 if (!action) -
trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp
r205549 r205569 54 54 55 55 auto function = object.get(&state, JSC::Identifier::fromString(&state, propertyName)); 56 if ( state.hadException())56 if (UNLIKELY(scope.exception())) 57 57 return JSC::jsUndefined(); 58 58 … … 71 71 bool ReadableStreamDefaultController::isControlledReadableStreamLocked() const 72 72 { 73 auto& state = *globalObject()->globalExec(); 74 JSC::JSLockHolder lock(&state); 73 auto globalObject = this->globalObject(); 74 JSC::VM& vm = globalObject->vm(); 75 JSC::JSLockHolder lock(vm); 76 auto scope = DECLARE_CATCH_SCOPE(vm); 77 auto& state = *globalObject->globalExec(); 75 78 76 auto& clientData = *static_cast<JSVMClientData*>( state.vm().clientData);79 auto& clientData = *static_cast<JSVMClientData*>(vm.clientData); 77 80 auto readableStream = m_jsController->get(&state, clientData.builtinNames().controlledReadableStreamPrivateName()); 78 ASSERT (!state.hadException());81 ASSERT_UNUSED(scope, !scope.exception()); 79 82 80 auto isLocked = globalObject ()->builtinInternalFunctions().readableStreamInternals().m_isReadableStreamLockedFunction.get();83 auto isLocked = globalObject->builtinInternalFunctions().readableStreamInternals().m_isReadableStreamLockedFunction.get(); 81 84 82 85 JSC::MarkedArgumentBuffer arguments; 83 86 arguments.append(readableStream); 84 87 auto result = callFunction(state, isLocked, JSC::jsUndefined(), arguments); 85 ASSERT(!s tate.hadException());88 ASSERT(!scope.exception()); 86 89 87 90 return result.isTrue(); -
trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.h
r205549 r205569 75 75 inline bool ReadableStreamDefaultController::enqueue(RefPtr<JSC::ArrayBuffer>&& buffer) 76 76 { 77 JSC::ExecState& state = *globalObject()->globalExec(); 78 JSC::JSLockHolder locker(&state); 77 auto globalObject = this->globalObject(); 78 JSC::VM& vm = globalObject->vm(); 79 JSC::JSLockHolder locker(vm); 80 auto scope = DECLARE_THROW_SCOPE(vm); 81 JSC::ExecState& state = *globalObject->globalExec(); 79 82 80 83 if (!buffer) { … … 85 88 auto chunk = JSC::Uint8Array::create(WTFMove(buffer), 0, length); 86 89 ASSERT(chunk); 87 enqueue(state, toJS(&state, globalObject (), chunk.get()));88 ASSERT (!state.hadException());90 enqueue(state, toJS(&state, globalObject, chunk.get())); 91 ASSERT_UNUSED(scope, !scope.exception()); 89 92 return true; 90 93 } -
trunk/Source/WebCore/bindings/js/ScheduledAction.cpp
r197614 r205569 49 49 std::unique_ptr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperWorld& isolatedWorld, ContentSecurityPolicy* policy) 50 50 { 51 VM& vm = exec->vm(); 52 auto scope = DECLARE_THROW_SCOPE(vm); 53 51 54 JSValue v = exec->argument(0); 52 55 CallData callData; … … 55 58 return nullptr; 56 59 String string = v.toString(exec)->value(exec); 57 if ( exec->hadException())60 if (UNLIKELY(scope.exception())) 58 61 return nullptr; 59 62 return std::unique_ptr<ScheduledAction>(new ScheduledAction(string, isolatedWorld)); -
trunk/Source/WebCore/bindings/js/ScriptGlobalObject.cpp
r199619 r205569 44 44 auto& vm = scriptState.vm(); 45 45 JSLockHolder lock(vm); 46 auto scope = DECLARE_CATCH_SCOPE(vm); 46 47 auto& globalObject = *jsCast<JSDOMGlobalObject*>(scriptState.lexicalGlobalObject()); 47 48 globalObject.putDirect(vm, Identifier::fromString(&vm, name), toJS(&scriptState, &globalObject, value)); 48 if ( scriptState.hadException()) {49 reportException(&scriptState, sc riptState.exception());49 if (UNLIKELY(scope.exception())) { 50 reportException(&scriptState, scope.exception()); 50 51 return false; 51 52 } -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r205520 r205569 390 390 bool shouldTerminate() 391 391 { 392 return m_exec->hadException(); 392 VM& vm = m_exec->vm(); 393 auto scope = DECLARE_THROW_SCOPE(vm); 394 return scope.exception(); 393 395 } 394 396 … … 2449 2451 DeserializationResult CloneDeserializer::deserialize() 2450 2452 { 2453 VM& vm = m_exec->vm(); 2454 auto scope = DECLARE_THROW_SCOPE(vm); 2455 2451 2456 Vector<uint32_t, 16> indexStack; 2452 2457 Vector<Identifier, 16> propertyNameStack; … … 2469 2474 } 2470 2475 JSArray* outArray = constructEmptyArray(m_exec, 0, m_globalObject, length); 2471 if (UNLIKELY( m_exec->hadException()))2476 if (UNLIKELY(scope.exception())) 2472 2477 goto error; 2473 2478 m_gcBuffer.append(outArray); … … 2547 2552 return std::make_pair(JSValue(), StackOverflowError); 2548 2553 JSMap* map = JSMap::create(m_exec, m_exec->vm(), m_globalObject->mapStructure()); 2549 if (UNLIKELY( m_exec->hadException()))2554 if (UNLIKELY(scope.exception())) 2550 2555 goto error; 2551 2556 m_gcBuffer.append(map); … … 2578 2583 return std::make_pair(JSValue(), StackOverflowError); 2579 2584 JSSet* set = JSSet::create(m_exec, m_exec->vm(), m_globalObject->setStructure()); 2580 if (UNLIKELY( m_exec->hadException()))2585 if (UNLIKELY(scope.exception())) 2581 2586 goto error; 2582 2587 m_gcBuffer.append(set); … … 2711 2716 { 2712 2717 ExecState* exec = toJS(originContext); 2713 JSLockHolder locker(exec); 2718 VM& vm = exec->vm(); 2719 JSLockHolder locker(vm); 2720 auto scope = DECLARE_CATCH_SCOPE(vm); 2721 2714 2722 JSValue value = toJS(exec, apiValue); 2715 2723 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(exec, value, nullptr, nullptr); 2716 if ( exec->hadException()) {2724 if (UNLIKELY(scope.exception())) { 2717 2725 if (exception) 2718 *exception = toRef(exec, exec->exception()->value());2719 exec->clearException();2726 *exception = toRef(exec, scope.exception()->value()); 2727 scope.clearException(); 2720 2728 return nullptr; 2721 2729 } … … 2746 2754 { 2747 2755 ExecState* exec = toJS(destinationContext); 2748 JSLockHolder locker(exec); 2756 VM& vm = exec->vm(); 2757 JSLockHolder locker(vm); 2758 auto scope = DECLARE_CATCH_SCOPE(vm); 2759 2749 2760 JSValue value = deserialize(exec, exec->lexicalGlobalObject(), nullptr); 2750 if ( exec->hadException()) {2761 if (UNLIKELY(scope.exception())) { 2751 2762 if (exception) 2752 *exception = toRef(exec, exec->exception()->value());2753 exec->clearException();2763 *exception = toRef(exec, scope.exception()->value()); 2764 scope.clearException(); 2754 2765 return nullptr; 2755 2766 } -
trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp
r205462 r205569 128 128 VM& vm = exec->vm(); 129 129 JSLockHolder lock(vm); 130 auto scope = DECLARE_THROW_SCOPE(vm);131 130 132 131 JSC::evaluate(exec, sourceCode.jsSourceCode(), m_workerGlobalScopeWrapper->globalThis(), returnedException); … … 143 142 String sourceURL = sourceCode.url().string(); 144 143 Deprecated::ScriptValue error; 145 if (m_workerGlobalScope->sanitizeScriptError(errorMessage, lineNumber, columnNumber, sourceURL, error, sourceCode.cachedScript())) { 146 throwException(exec, scope, createError(exec, errorMessage.impl())); 147 returnedException = vm.exception(); 148 vm.clearException(); 149 } 144 if (m_workerGlobalScope->sanitizeScriptError(errorMessage, lineNumber, columnNumber, sourceURL, error, sourceCode.cachedScript())) 145 returnedException = Exception::create(vm, createError(exec, errorMessage.impl())); 150 146 } 151 147 } -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r205542 r205569 1025 1025 foreach my $member (@{$dictionary->members}) { 1026 1026 if ($needExceptionCheck) { 1027 $result .= " if (UNLIKELY( state.hadException()))\n";1027 $result .= " if (UNLIKELY(throwScope.exception()))\n"; 1028 1028 $result .= " return Nullopt;\n"; 1029 1029 } … … 3134 3134 push(@implContent, " VM& vm = state->vm();\n"); 3135 3135 push(@implContent, " auto throwScope = DECLARE_THROW_SCOPE(vm);\n"); 3136 push(@implContent, " UNUSED_PARAM(throwScope); ");3136 push(@implContent, " UNUSED_PARAM(throwScope);\n"); 3137 3137 push(@implContent, " JSValue value = JSValue::decode(encodedValue);\n"); 3138 3138 push(@implContent, " UNUSED_PARAM(thisValue);\n") if !$attribute->isStatic; … … 3232 3232 push(@implContent, " nativeValue = $nativeValue;\n"); 3233 3233 if ($mayThrowException) { 3234 push(@implContent, " if (UNLIKELY( state->hadException()))\n");3234 push(@implContent, " if (UNLIKELY(throwScope.exception()))\n"); 3235 3235 push(@implContent, " return false;\n"); 3236 3236 } … … 3243 3243 push(@implContent, " auto nativeValue = $nativeValue;\n"); 3244 3244 if ($mayThrowException) { 3245 push(@implContent, " if (UNLIKELY( state->hadException()))\n");3245 push(@implContent, " if (UNLIKELY(throwScope.exception()))\n"); 3246 3246 push(@implContent, " return false;\n"); 3247 3247 } … … 3980 3980 3981 3981 if (IsNativeType($type)) { 3982 push(@$outputArray, " if (UNLIKELY( state->hadException()))\n");3982 push(@$outputArray, " if (UNLIKELY(throwScope.exception()))\n"); 3983 3983 push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); 3984 3984 } … … 4020 4020 4021 4021 push(@$outputArray, "$indent $defineOptionalValue = parse<$className>(*state, ${name}Value);\n"); 4022 push(@$outputArray, "$indent if (UNLIKELY( state->hadException()))\n");4022 push(@$outputArray, "$indent if (UNLIKELY(throwScope.exception()))\n"); 4023 4023 push(@$outputArray, "$indent return JSValue::encode(jsUndefined());\n"); 4024 4024 push(@$outputArray, "$indent if (UNLIKELY(!$optionalValue))\n"); … … 4043 4043 push(@$outputArray, " $name = $nativeValue;\n"); 4044 4044 if ($mayThrowException) { 4045 push(@$outputArray, " if (UNLIKELY( state->hadException()))\n");4045 push(@$outputArray, " if (UNLIKELY(throwScope.exception()))\n"); 4046 4046 push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); 4047 4047 } … … 4086 4086 $value = "WTFMove($name)"; 4087 4087 if ($mayThrowException) { 4088 push(@$outputArray, " if (UNLIKELY( state->hadException()))\n");4088 push(@$outputArray, " if (UNLIKELY(throwScope.exception()))\n"); 4089 4089 push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); 4090 4090 } … … 4467 4467 4468 4468 if ($codeGenerator->ExtendedAttributeContains($function->signature->extendedAttributes->{"CallWith"}, "ScriptState")) { 4469 push(@implContent, $indent . "if (UNLIKELY( state->hadException()))\n");4469 push(@implContent, $indent . "if (UNLIKELY(throwScope.exception()))\n"); 4470 4470 push(@implContent, $indent . " return JSValue::encode(jsUndefined());\n"); 4471 4471 } … … 5291 5291 5292 5292 AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state); 5293 if (UNLIKELY( state->hadException()))5293 if (UNLIKELY(throwScope.exception())) 5294 5294 return JSValue::encode(jsUndefined()); 5295 5295 … … 5300 5300 // Given the above test, this will always yield an object. 5301 5301 JSObject* initializerObject = initializerValue.toObject(state); 5302 ASSERT(! state->hadException());5302 ASSERT(!throwScope.exception()); 5303 5303 5304 5304 // Create the dictionary wrapper from the initializer object. … … 5443 5443 5444 5444 if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"ConstructorCallWith"}, "ScriptState")) { 5445 push(@$outputArray, " if (UNLIKELY( state->hadException()))\n");5445 push(@$outputArray, " if (UNLIKELY(throwScope.exception()))\n"); 5446 5446 push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); 5447 5447 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
r205458 r205569 225 225 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 226 226 auto message = state->argument(0).toWTFString(state); 227 if (UNLIKELY( state->hadException()))227 if (UNLIKELY(throwScope.exception())) 228 228 return JSValue::encode(jsUndefined()); 229 229 impl.postMessage(WTFMove(message)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp
r205458 r205569 202 202 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 203 203 auto str = state->argument(0).toWTFString(state); 204 if (UNLIKELY( state->hadException()))204 if (UNLIKELY(throwScope.exception())) 205 205 return JSValue::encode(jsUndefined()); 206 206 impl.anotherFunction(WTFMove(str)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
r205458 r205569 86 86 87 87 AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state); 88 if (UNLIKELY( state->hadException()))88 if (UNLIKELY(throwScope.exception())) 89 89 return JSValue::encode(jsUndefined()); 90 90 … … 95 95 // Given the above test, this will always yield an object. 96 96 JSObject* initializerObject = initializerValue.toObject(state); 97 ASSERT(! state->hadException());97 ASSERT(!throwScope.exception()); 98 98 99 99 // Create the dictionary wrapper from the initializer object. -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
r205458 r205569 215 215 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 216 216 auto index = convert<uint32_t>(*state, state->argument(0), NormalConversion); 217 if (UNLIKELY( state->hadException()))217 if (UNLIKELY(throwScope.exception())) 218 218 return JSValue::encode(jsUndefined()); 219 219 JSValue result = toJS(state, castedThis->globalObject(), impl.item(WTFMove(index))); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
r205458 r205569 278 278 VM& vm = state->vm(); 279 279 auto throwScope = DECLARE_THROW_SCOPE(vm); 280 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 280 UNUSED_PARAM(throwScope); 281 JSValue value = JSValue::decode(encodedValue); 281 282 UNUSED_PARAM(thisValue); 282 283 JSTestGlobalObject* castedThis = jsDynamicCast<JSTestGlobalObject*>(JSValue::decode(thisValue)); … … 286 287 auto& impl = castedThis->wrapped(); 287 288 auto nativeValue = value.toWTFString(state); 288 if (UNLIKELY( state->hadException()))289 if (UNLIKELY(throwScope.exception())) 289 290 return false; 290 291 impl.setRegularAttribute(WTFMove(nativeValue)); … … 297 298 VM& vm = state->vm(); 298 299 auto throwScope = DECLARE_THROW_SCOPE(vm); 299 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 300 UNUSED_PARAM(throwScope); 301 JSValue value = JSValue::decode(encodedValue); 300 302 UNUSED_PARAM(thisValue); 301 303 JSTestGlobalObject* castedThis = jsDynamicCast<JSTestGlobalObject*>(JSValue::decode(thisValue)); … … 305 307 auto& impl = castedThis->wrapped(); 306 308 auto nativeValue = value.toWTFString(state); 307 if (UNLIKELY( state->hadException()))309 if (UNLIKELY(throwScope.exception())) 308 310 return false; 309 311 impl.setPublicAndPrivateAttribute(WTFMove(nativeValue)); … … 317 319 VM& vm = state->vm(); 318 320 auto throwScope = DECLARE_THROW_SCOPE(vm); 319 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 321 UNUSED_PARAM(throwScope); 322 JSValue value = JSValue::decode(encodedValue); 320 323 UNUSED_PARAM(thisValue); 321 324 JSTestGlobalObject* castedThis = jsDynamicCast<JSTestGlobalObject*>(JSValue::decode(thisValue)); … … 325 328 auto& impl = castedThis->wrapped(); 326 329 auto nativeValue = value.toWTFString(state); 327 if (UNLIKELY( state->hadException()))330 if (UNLIKELY(throwScope.exception())) 328 331 return false; 329 332 impl.setPublicAndPrivateConditionalAttribute(WTFMove(nativeValue)); … … 338 341 VM& vm = state->vm(); 339 342 auto throwScope = DECLARE_THROW_SCOPE(vm); 340 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 343 UNUSED_PARAM(throwScope); 344 JSValue value = JSValue::decode(encodedValue); 341 345 UNUSED_PARAM(thisValue); 342 346 JSTestGlobalObject* castedThis = jsDynamicCast<JSTestGlobalObject*>(JSValue::decode(thisValue)); … … 346 350 auto& impl = castedThis->wrapped(); 347 351 auto nativeValue = value.toWTFString(state); 348 if (UNLIKELY( state->hadException()))352 if (UNLIKELY(throwScope.exception())) 349 353 return false; 350 354 impl.setEnabledAtRuntimeAttribute(WTFMove(nativeValue)); … … 373 377 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 374 378 auto testParam = state->argument(0).toWTFString(state); 375 if (UNLIKELY( state->hadException()))379 if (UNLIKELY(throwScope.exception())) 376 380 return JSValue::encode(jsUndefined()); 377 381 impl.regularOperation(WTFMove(testParam)); … … 394 398 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 395 399 auto testParam = state->argument(0).toWTFString(state); 396 if (UNLIKELY( state->hadException()))400 if (UNLIKELY(throwScope.exception())) 397 401 return JSValue::encode(jsUndefined()); 398 402 impl.enabledAtRuntimeOperation(WTFMove(testParam)); … … 417 421 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 418 422 auto testParam = convert<int32_t>(*state, state->argument(0), NormalConversion); 419 if (UNLIKELY( state->hadException()))423 if (UNLIKELY(throwScope.exception())) 420 424 return JSValue::encode(jsUndefined()); 421 425 impl.enabledAtRuntimeOperation(WTFMove(testParam)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r205458 r205569 232 232 ExceptionCode ec = 0; 233 233 auto str1 = state->argument(0).toWTFString(state); 234 if (UNLIKELY( state->hadException()))234 if (UNLIKELY(throwScope.exception())) 235 235 return JSValue::encode(jsUndefined()); 236 236 auto str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toWTFString(state); 237 if (UNLIKELY( state->hadException()))237 if (UNLIKELY(throwScope.exception())) 238 238 return JSValue::encode(jsUndefined()); 239 239 ScriptExecutionContext* context = castedThis->scriptExecutionContext(); … … 664 664 VM& vm = state->vm(); 665 665 auto throwScope = DECLARE_THROW_SCOPE(vm); 666 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 666 UNUSED_PARAM(throwScope); 667 JSValue value = JSValue::decode(encodedValue); 667 668 auto nativeValue = value.toWTFString(state); 668 if (UNLIKELY( state->hadException()))669 if (UNLIKELY(throwScope.exception())) 669 670 return false; 670 671 TestInterface::setImplementsStaticAttr(WTFMove(nativeValue)); … … 679 680 VM& vm = state->vm(); 680 681 auto throwScope = DECLARE_THROW_SCOPE(vm); 681 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 682 UNUSED_PARAM(throwScope); 683 JSValue value = JSValue::decode(encodedValue); 682 684 UNUSED_PARAM(thisValue); 683 685 JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); … … 687 689 auto& impl = castedThis->wrapped(); 688 690 auto nativeValue = value.toWTFString(state); 689 if (UNLIKELY( state->hadException()))691 if (UNLIKELY(throwScope.exception())) 690 692 return false; 691 693 impl.setImplementsStr2(WTFMove(nativeValue)); … … 700 702 VM& vm = state->vm(); 701 703 auto throwScope = DECLARE_THROW_SCOPE(vm); 702 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 704 UNUSED_PARAM(throwScope); 705 JSValue value = JSValue::decode(encodedValue); 703 706 UNUSED_PARAM(thisValue); 704 707 JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); … … 717 720 VM& vm = state->vm(); 718 721 auto throwScope = DECLARE_THROW_SCOPE(vm); 719 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 722 UNUSED_PARAM(throwScope); 723 JSValue value = JSValue::decode(encodedValue); 720 724 UNUSED_PARAM(thisValue); 721 725 JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); … … 740 744 VM& vm = state->vm(); 741 745 auto throwScope = DECLARE_THROW_SCOPE(vm); 742 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 746 UNUSED_PARAM(throwScope); 747 JSValue value = JSValue::decode(encodedValue); 743 748 auto nativeValue = value.toWTFString(state); 744 if (UNLIKELY( state->hadException()))749 if (UNLIKELY(throwScope.exception())) 745 750 return false; 746 751 WebCore::TestSupplemental::setSupplementalStaticAttr(WTFMove(nativeValue)); … … 755 760 VM& vm = state->vm(); 756 761 auto throwScope = DECLARE_THROW_SCOPE(vm); 757 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 762 UNUSED_PARAM(throwScope); 763 JSValue value = JSValue::decode(encodedValue); 758 764 UNUSED_PARAM(thisValue); 759 765 JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); … … 763 769 auto& impl = castedThis->wrapped(); 764 770 auto nativeValue = value.toWTFString(state); 765 if (UNLIKELY( state->hadException()))771 if (UNLIKELY(throwScope.exception())) 766 772 return false; 767 773 WebCore::TestSupplemental::setSupplementalStr2(impl, WTFMove(nativeValue)); … … 776 782 VM& vm = state->vm(); 777 783 auto throwScope = DECLARE_THROW_SCOPE(vm); 778 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 784 UNUSED_PARAM(throwScope); 785 JSValue value = JSValue::decode(encodedValue); 779 786 UNUSED_PARAM(thisValue); 780 787 JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); … … 793 800 VM& vm = state->vm(); 794 801 auto throwScope = DECLARE_THROW_SCOPE(vm); 795 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 802 UNUSED_PARAM(throwScope); 803 JSValue value = JSValue::decode(encodedValue); 796 804 UNUSED_PARAM(thisValue); 797 805 JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); … … 853 861 return JSValue::encode(jsUndefined()); 854 862 auto strArg = state->argument(0).toWTFString(state); 855 if (UNLIKELY( state->hadException()))863 if (UNLIKELY(throwScope.exception())) 856 864 return JSValue::encode(jsUndefined()); 857 865 auto objArg = JSTestObj::toWrapped(state->argument(1)); … … 931 939 return JSValue::encode(jsUndefined()); 932 940 auto strArg = state->argument(0).toWTFString(state); 933 if (UNLIKELY( state->hadException()))941 if (UNLIKELY(throwScope.exception())) 934 942 return JSValue::encode(jsUndefined()); 935 943 auto objArg = JSTestObj::toWrapped(state->argument(1)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp
r205198 r205569 191 191 VM& vm = state->vm(); 192 192 auto throwScope = DECLARE_THROW_SCOPE(vm); 193 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 193 UNUSED_PARAM(throwScope); 194 JSValue value = JSValue::decode(encodedValue); 194 195 UNUSED_PARAM(thisValue); 195 196 JSTestJSBuiltinConstructor* castedThis = jsDynamicCast<JSTestJSBuiltinConstructor*>(JSValue::decode(thisValue)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp
r205458 r205569 92 92 ExceptionCode ec = 0; 93 93 auto str1 = state->argument(0).toWTFString(state); 94 if (UNLIKELY( state->hadException()))94 if (UNLIKELY(throwScope.exception())) 95 95 return JSValue::encode(jsUndefined()); 96 96 auto str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toWTFString(state); 97 if (UNLIKELY( state->hadException()))97 if (UNLIKELY(throwScope.exception())) 98 98 return JSValue::encode(jsUndefined()); 99 99 auto str3 = state->argument(2).isUndefined() ? String() : state->uncheckedArgument(2).toWTFString(state); 100 if (UNLIKELY( state->hadException()))100 if (UNLIKELY(throwScope.exception())) 101 101 return JSValue::encode(jsUndefined()); 102 102 auto object = TestNamedConstructor::createForJSConstructor(*castedThis->document(), WTFMove(str1), WTFMove(str2), WTFMove(str3), ec); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
r205458 r205569 208 208 VM& vm = state->vm(); 209 209 auto throwScope = DECLARE_THROW_SCOPE(vm); 210 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 210 UNUSED_PARAM(throwScope); 211 JSValue value = JSValue::decode(encodedValue); 211 212 UNUSED_PARAM(thisValue); 212 213 JSTestNode* castedThis = jsDynamicCast<JSTestNode*>(JSValue::decode(thisValue)); … … 216 217 auto& impl = castedThis->wrapped(); 217 218 auto nativeValue = value.toWTFString(state); 218 if (UNLIKELY( state->hadException()))219 if (UNLIKELY(throwScope.exception())) 219 220 return false; 220 221 impl.setName(WTFMove(nativeValue)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp
r205458 r205569 362 362 VM& vm = state->vm(); 363 363 auto throwScope = DECLARE_THROW_SCOPE(vm); 364 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 364 UNUSED_PARAM(throwScope); 365 JSValue value = JSValue::decode(encodedValue); 365 366 UNUSED_PARAM(thisValue); 366 367 JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue)); … … 370 371 auto& impl = castedThis->wrapped(); 371 372 auto nativeValue = value.toWTFString(state); 372 if (UNLIKELY( state->hadException()))373 if (UNLIKELY(throwScope.exception())) 373 374 return false; 374 375 impl.setNondeterministicWriteableAttr(WTFMove(nativeValue)); … … 381 382 VM& vm = state->vm(); 382 383 auto throwScope = DECLARE_THROW_SCOPE(vm); 383 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 384 UNUSED_PARAM(throwScope); 385 JSValue value = JSValue::decode(encodedValue); 384 386 UNUSED_PARAM(thisValue); 385 387 JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue)); … … 389 391 auto& impl = castedThis->wrapped(); 390 392 auto nativeValue = value.toWTFString(state); 391 if (UNLIKELY( state->hadException()))393 if (UNLIKELY(throwScope.exception())) 392 394 return false; 393 395 impl.setNondeterministicExceptionAttr(WTFMove(nativeValue)); … … 400 402 VM& vm = state->vm(); 401 403 auto throwScope = DECLARE_THROW_SCOPE(vm); 402 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 404 UNUSED_PARAM(throwScope); 405 JSValue value = JSValue::decode(encodedValue); 403 406 UNUSED_PARAM(thisValue); 404 407 JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue)); … … 408 411 auto& impl = castedThis->wrapped(); 409 412 auto nativeValue = value.toWTFString(state); 410 if (UNLIKELY( state->hadException()))413 if (UNLIKELY(throwScope.exception())) 411 414 return false; 412 415 impl.setNondeterministicGetterExceptionAttr(WTFMove(nativeValue)); … … 419 422 VM& vm = state->vm(); 420 423 auto throwScope = DECLARE_THROW_SCOPE(vm); 421 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 424 UNUSED_PARAM(throwScope); 425 JSValue value = JSValue::decode(encodedValue); 422 426 UNUSED_PARAM(thisValue); 423 427 JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue)); … … 428 432 ExceptionCode ec = 0; 429 433 auto nativeValue = value.toWTFString(state); 430 if (UNLIKELY( state->hadException()))434 if (UNLIKELY(throwScope.exception())) 431 435 return false; 432 436 impl.setNondeterministicSetterExceptionAttr(WTFMove(nativeValue), ec); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r205542 r205569 526 526 } 527 527 auto enumerationValueWithoutDefault = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValueWithoutDefault"))); 528 if (UNLIKELY( state.hadException()))528 if (UNLIKELY(throwScope.exception())) 529 529 return Nullopt; 530 530 auto enumerationValueWithDefault = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValueWithDefault")), TestObj::EnumType::EnumValue1); 531 if (UNLIKELY( state.hadException()))531 if (UNLIKELY(throwScope.exception())) 532 532 return Nullopt; 533 533 auto enumerationValueWithEmptyStringDefault = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValueWithEmptyStringDefault")), TestObj::EnumType::EmptyString); 534 if (UNLIKELY( state.hadException()))534 if (UNLIKELY(throwScope.exception())) 535 535 return Nullopt; 536 536 auto stringWithDefault = convertOptional<String>(state, object->get(&state, Identifier::fromString(&state, "stringWithDefault")), "defaultString"); 537 if (UNLIKELY( state.hadException()))537 if (UNLIKELY(throwScope.exception())) 538 538 return Nullopt; 539 539 auto stringWithoutDefault = convertOptional<String>(state, object->get(&state, Identifier::fromString(&state, "stringWithoutDefault"))); 540 if (UNLIKELY( state.hadException()))540 if (UNLIKELY(throwScope.exception())) 541 541 return Nullopt; 542 542 auto booleanWithDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithDefault")), false); 543 if (UNLIKELY( state.hadException()))543 if (UNLIKELY(throwScope.exception())) 544 544 return Nullopt; 545 545 auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"))); 546 if (UNLIKELY( state.hadException()))546 if (UNLIKELY(throwScope.exception())) 547 547 return Nullopt; 548 548 auto sequenceOfStrings = convertOptional<Vector<String>>(state, object->get(&state, Identifier::fromString(&state, "sequenceOfStrings"))); 549 if (UNLIKELY( state.hadException()))549 if (UNLIKELY(throwScope.exception())) 550 550 return Nullopt; 551 551 auto restrictedDouble = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "restrictedDouble")), ShouldAllowNonFinite::No); 552 if (UNLIKELY( state.hadException()))552 if (UNLIKELY(throwScope.exception())) 553 553 return Nullopt; 554 554 auto unrestrictedDouble = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedDouble")), ShouldAllowNonFinite::Yes); 555 if (UNLIKELY( state.hadException()))555 if (UNLIKELY(throwScope.exception())) 556 556 return Nullopt; 557 557 auto restrictedDoubleWithDefault = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "restrictedDoubleWithDefault")), ShouldAllowNonFinite::No, 0); 558 if (UNLIKELY( state.hadException()))558 if (UNLIKELY(throwScope.exception())) 559 559 return Nullopt; 560 560 auto unrestrictedDoubleWithDefault = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault")), ShouldAllowNonFinite::Yes, 0); 561 if (UNLIKELY( state.hadException()))561 if (UNLIKELY(throwScope.exception())) 562 562 return Nullopt; 563 563 auto restrictedFloat = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "restrictedFloat")), ShouldAllowNonFinite::No); 564 if (UNLIKELY( state.hadException()))564 if (UNLIKELY(throwScope.exception())) 565 565 return Nullopt; 566 566 auto unrestrictedFloat = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedFloat")), ShouldAllowNonFinite::Yes); 567 if (UNLIKELY( state.hadException()))567 if (UNLIKELY(throwScope.exception())) 568 568 return Nullopt; 569 569 auto restrictedFloatWithDefault = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "restrictedFloatWithDefault")), ShouldAllowNonFinite::No, 0); 570 if (UNLIKELY( state.hadException()))570 if (UNLIKELY(throwScope.exception())) 571 571 return Nullopt; 572 572 auto unrestrictedFloatWithDefault = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault")), ShouldAllowNonFinite::Yes, 0); 573 if (UNLIKELY( state.hadException()))573 if (UNLIKELY(throwScope.exception())) 574 574 return Nullopt; 575 575 auto smallIntegerClamped = convertOptional<int8_t>(state, object->get(&state, Identifier::fromString(&state, "smallIntegerClamped")), Clamp); 576 if (UNLIKELY( state.hadException()))576 if (UNLIKELY(throwScope.exception())) 577 577 return Nullopt; 578 578 auto smallIntegerWithDefault = convertOptional<int8_t>(state, object->get(&state, Identifier::fromString(&state, "smallIntegerWithDefault")), NormalConversion); 579 if (UNLIKELY( state.hadException()))579 if (UNLIKELY(throwScope.exception())) 580 580 return Nullopt; 581 581 auto smallUnsignedIntegerEnforcedRange = convertOptional<uint8_t>(state, object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerEnforcedRange")), EnforceRange); 582 if (UNLIKELY( state.hadException()))582 if (UNLIKELY(throwScope.exception())) 583 583 return Nullopt; 584 584 auto smallUnsignedIntegerWithDefault = convertOptional<uint8_t>(state, object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerWithDefault")), NormalConversion, 0); 585 if (UNLIKELY( state.hadException()))585 if (UNLIKELY(throwScope.exception())) 586 586 return Nullopt; 587 587 auto integer = convertOptional<int32_t>(state, object->get(&state, Identifier::fromString(&state, "integer")), NormalConversion); 588 if (UNLIKELY( state.hadException()))588 if (UNLIKELY(throwScope.exception())) 589 589 return Nullopt; 590 590 auto integerWithDefault = convertOptional<int32_t>(state, object->get(&state, Identifier::fromString(&state, "integerWithDefault")), NormalConversion, 0); 591 if (UNLIKELY( state.hadException()))591 if (UNLIKELY(throwScope.exception())) 592 592 return Nullopt; 593 593 auto unsignedInteger = convertOptional<uint32_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedInteger")), NormalConversion); 594 if (UNLIKELY( state.hadException()))594 if (UNLIKELY(throwScope.exception())) 595 595 return Nullopt; 596 596 auto unsignedIntegerWithDefault = convertOptional<uint32_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedIntegerWithDefault")), NormalConversion, 0); 597 if (UNLIKELY( state.hadException()))597 if (UNLIKELY(throwScope.exception())) 598 598 return Nullopt; 599 599 auto largeInteger = convertOptional<int64_t>(state, object->get(&state, Identifier::fromString(&state, "largeInteger")), NormalConversion); 600 if (UNLIKELY( state.hadException()))600 if (UNLIKELY(throwScope.exception())) 601 601 return Nullopt; 602 602 auto largeIntegerWithDefault = convertOptional<int64_t>(state, object->get(&state, Identifier::fromString(&state, "largeIntegerWithDefault")), NormalConversion, 0); 603 if (UNLIKELY( state.hadException()))603 if (UNLIKELY(throwScope.exception())) 604 604 return Nullopt; 605 605 auto unsignedLargeInteger = convertOptional<uint64_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedLargeInteger")), NormalConversion); 606 if (UNLIKELY( state.hadException()))606 if (UNLIKELY(throwScope.exception())) 607 607 return Nullopt; 608 608 auto unsignedLargeIntegerWithDefault = convertOptional<uint64_t>(state, object->get(&state, Identifier::fromString(&state, "unsignedLargeIntegerWithDefault")), NormalConversion, 0); 609 if (UNLIKELY( state.hadException()))609 if (UNLIKELY(throwScope.exception())) 610 610 return Nullopt; 611 611 auto* nullableNode = convertWrapperType<Node, JSNode>(state, object->get(&state, Identifier::fromString(&state, "nullableNode")), IsNullable::Yes); 612 if (UNLIKELY( state.hadException()))612 if (UNLIKELY(throwScope.exception())) 613 613 return Nullopt; 614 614 auto anyValue = convertOptional<JSC::JSValue>(state, object->get(&state, Identifier::fromString(&state, "anyValue")), jsUndefined()); 615 if (UNLIKELY( state.hadException()))615 if (UNLIKELY(throwScope.exception())) 616 616 return Nullopt; 617 617 auto anyTypedefValue = convertOptional<JSC::JSValue>(state, object->get(&state, Identifier::fromString(&state, "anyTypedefValue")), jsUndefined()); 618 if (UNLIKELY( state.hadException()))618 if (UNLIKELY(throwScope.exception())) 619 619 return Nullopt; 620 620 auto dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, object->get(&state, Identifier::fromString(&state, "dictionaryMember"))); … … 632 632 } 633 633 auto requiredEnumerationValue = convert<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "requiredEnumerationValue"))); 634 if (UNLIKELY( state.hadException()))634 if (UNLIKELY(throwScope.exception())) 635 635 return Nullopt; 636 636 auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"))); 637 if (UNLIKELY( state.hadException()))637 if (UNLIKELY(throwScope.exception())) 638 638 return Nullopt; 639 639 auto* nonNullableNode = convertWrapperType<Node, JSNode>(state, object->get(&state, Identifier::fromString(&state, "nonNullableNode")), IsNullable::No); 640 if (UNLIKELY( state.hadException()))640 if (UNLIKELY(throwScope.exception())) 641 641 return Nullopt; 642 642 auto requiredDictionaryMember = convertDictionary<TestObj::Dictionary>(state, object->get(&state, Identifier::fromString(&state, "requiredDictionaryMember"))); … … 656 656 } 657 657 auto enumerationValue = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValue"))); 658 if (UNLIKELY( state.hadException()))658 if (UNLIKELY(throwScope.exception())) 659 659 return Nullopt; 660 660 auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"))); … … 674 674 } 675 675 auto enumerationValue = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValue"))); 676 if (UNLIKELY( state.hadException()))676 if (UNLIKELY(throwScope.exception())) 677 677 return Nullopt; 678 678 auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"))); … … 3091 3091 VM& vm = state->vm(); 3092 3092 auto throwScope = DECLARE_THROW_SCOPE(vm); 3093 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3093 UNUSED_PARAM(throwScope); 3094 JSValue value = JSValue::decode(encodedValue); 3094 3095 auto nativeValue = value.toWTFString(state); 3095 if (UNLIKELY( state->hadException()))3096 if (UNLIKELY(throwScope.exception())) 3096 3097 return false; 3097 3098 TestObj::setStaticStringAttr(WTFMove(nativeValue)); … … 3104 3105 VM& vm = state->vm(); 3105 3106 auto throwScope = DECLARE_THROW_SCOPE(vm); 3106 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3107 UNUSED_PARAM(throwScope); 3108 JSValue value = JSValue::decode(encodedValue); 3107 3109 UNUSED_PARAM(thisValue); 3108 3110 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3119 3121 VM& vm = state->vm(); 3120 3122 auto throwScope = DECLARE_THROW_SCOPE(vm); 3121 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3123 UNUSED_PARAM(throwScope); 3124 JSValue value = JSValue::decode(encodedValue); 3122 3125 UNUSED_PARAM(thisValue); 3123 3126 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3127 3130 auto& impl = castedThis->wrapped(); 3128 3131 auto nativeValue = parse<TestObj::EnumType>(*state, value); 3129 if (UNLIKELY( state->hadException()))3132 if (UNLIKELY(throwScope.exception())) 3130 3133 return false; 3131 3134 if (UNLIKELY(!nativeValue)) … … 3140 3143 VM& vm = state->vm(); 3141 3144 auto throwScope = DECLARE_THROW_SCOPE(vm); 3142 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3145 UNUSED_PARAM(throwScope); 3146 JSValue value = JSValue::decode(encodedValue); 3143 3147 UNUSED_PARAM(thisValue); 3144 3148 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3148 3152 auto& impl = castedThis->wrapped(); 3149 3153 auto nativeValue = convert<int8_t>(*state, value, NormalConversion); 3150 if (UNLIKELY( state->hadException()))3154 if (UNLIKELY(throwScope.exception())) 3151 3155 return false; 3152 3156 impl.setByteAttr(WTFMove(nativeValue)); … … 3159 3163 VM& vm = state->vm(); 3160 3164 auto throwScope = DECLARE_THROW_SCOPE(vm); 3161 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3165 UNUSED_PARAM(throwScope); 3166 JSValue value = JSValue::decode(encodedValue); 3162 3167 UNUSED_PARAM(thisValue); 3163 3168 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3167 3172 auto& impl = castedThis->wrapped(); 3168 3173 auto nativeValue = convert<uint8_t>(*state, value, NormalConversion); 3169 if (UNLIKELY( state->hadException()))3174 if (UNLIKELY(throwScope.exception())) 3170 3175 return false; 3171 3176 impl.setOctetAttr(WTFMove(nativeValue)); … … 3178 3183 VM& vm = state->vm(); 3179 3184 auto throwScope = DECLARE_THROW_SCOPE(vm); 3180 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3185 UNUSED_PARAM(throwScope); 3186 JSValue value = JSValue::decode(encodedValue); 3181 3187 UNUSED_PARAM(thisValue); 3182 3188 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3186 3192 auto& impl = castedThis->wrapped(); 3187 3193 auto nativeValue = convert<int16_t>(*state, value, NormalConversion); 3188 if (UNLIKELY( state->hadException()))3194 if (UNLIKELY(throwScope.exception())) 3189 3195 return false; 3190 3196 impl.setShortAttr(WTFMove(nativeValue)); … … 3197 3203 VM& vm = state->vm(); 3198 3204 auto throwScope = DECLARE_THROW_SCOPE(vm); 3199 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3205 UNUSED_PARAM(throwScope); 3206 JSValue value = JSValue::decode(encodedValue); 3200 3207 UNUSED_PARAM(thisValue); 3201 3208 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3205 3212 auto& impl = castedThis->wrapped(); 3206 3213 auto nativeValue = convert<int16_t>(*state, value, Clamp); 3207 if (UNLIKELY( state->hadException()))3214 if (UNLIKELY(throwScope.exception())) 3208 3215 return false; 3209 3216 impl.setClampedShortAttr(WTFMove(nativeValue)); … … 3216 3223 VM& vm = state->vm(); 3217 3224 auto throwScope = DECLARE_THROW_SCOPE(vm); 3218 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3225 UNUSED_PARAM(throwScope); 3226 JSValue value = JSValue::decode(encodedValue); 3219 3227 UNUSED_PARAM(thisValue); 3220 3228 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3224 3232 auto& impl = castedThis->wrapped(); 3225 3233 auto nativeValue = convert<int16_t>(*state, value, EnforceRange); 3226 if (UNLIKELY( state->hadException()))3234 if (UNLIKELY(throwScope.exception())) 3227 3235 return false; 3228 3236 impl.setEnforceRangeShortAttr(WTFMove(nativeValue)); … … 3235 3243 VM& vm = state->vm(); 3236 3244 auto throwScope = DECLARE_THROW_SCOPE(vm); 3237 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3245 UNUSED_PARAM(throwScope); 3246 JSValue value = JSValue::decode(encodedValue); 3238 3247 UNUSED_PARAM(thisValue); 3239 3248 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3243 3252 auto& impl = castedThis->wrapped(); 3244 3253 auto nativeValue = convert<uint16_t>(*state, value, NormalConversion); 3245 if (UNLIKELY( state->hadException()))3254 if (UNLIKELY(throwScope.exception())) 3246 3255 return false; 3247 3256 impl.setUnsignedShortAttr(WTFMove(nativeValue)); … … 3254 3263 VM& vm = state->vm(); 3255 3264 auto throwScope = DECLARE_THROW_SCOPE(vm); 3256 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3265 UNUSED_PARAM(throwScope); 3266 JSValue value = JSValue::decode(encodedValue); 3257 3267 UNUSED_PARAM(thisValue); 3258 3268 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3262 3272 auto& impl = castedThis->wrapped(); 3263 3273 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3264 if (UNLIKELY( state->hadException()))3274 if (UNLIKELY(throwScope.exception())) 3265 3275 return false; 3266 3276 impl.setLongAttr(WTFMove(nativeValue)); … … 3273 3283 VM& vm = state->vm(); 3274 3284 auto throwScope = DECLARE_THROW_SCOPE(vm); 3275 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3285 UNUSED_PARAM(throwScope); 3286 JSValue value = JSValue::decode(encodedValue); 3276 3287 UNUSED_PARAM(thisValue); 3277 3288 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3281 3292 auto& impl = castedThis->wrapped(); 3282 3293 auto nativeValue = convert<int64_t>(*state, value, NormalConversion); 3283 if (UNLIKELY( state->hadException()))3294 if (UNLIKELY(throwScope.exception())) 3284 3295 return false; 3285 3296 impl.setLongLongAttr(WTFMove(nativeValue)); … … 3292 3303 VM& vm = state->vm(); 3293 3304 auto throwScope = DECLARE_THROW_SCOPE(vm); 3294 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3305 UNUSED_PARAM(throwScope); 3306 JSValue value = JSValue::decode(encodedValue); 3295 3307 UNUSED_PARAM(thisValue); 3296 3308 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3300 3312 auto& impl = castedThis->wrapped(); 3301 3313 auto nativeValue = convert<uint64_t>(*state, value, NormalConversion); 3302 if (UNLIKELY( state->hadException()))3314 if (UNLIKELY(throwScope.exception())) 3303 3315 return false; 3304 3316 impl.setUnsignedLongLongAttr(WTFMove(nativeValue)); … … 3311 3323 VM& vm = state->vm(); 3312 3324 auto throwScope = DECLARE_THROW_SCOPE(vm); 3313 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3325 UNUSED_PARAM(throwScope); 3326 JSValue value = JSValue::decode(encodedValue); 3314 3327 UNUSED_PARAM(thisValue); 3315 3328 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3319 3332 auto& impl = castedThis->wrapped(); 3320 3333 auto nativeValue = value.toWTFString(state); 3321 if (UNLIKELY( state->hadException()))3334 if (UNLIKELY(throwScope.exception())) 3322 3335 return false; 3323 3336 impl.setStringAttr(WTFMove(nativeValue)); … … 3330 3343 VM& vm = state->vm(); 3331 3344 auto throwScope = DECLARE_THROW_SCOPE(vm); 3332 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3345 UNUSED_PARAM(throwScope); 3346 JSValue value = JSValue::decode(encodedValue); 3333 3347 UNUSED_PARAM(thisValue); 3334 3348 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3338 3352 auto& impl = castedThis->wrapped(); 3339 3353 auto nativeValue = valueToUSVString(state, value); 3340 if (UNLIKELY( state->hadException()))3354 if (UNLIKELY(throwScope.exception())) 3341 3355 return false; 3342 3356 impl.setUsvstringAttr(WTFMove(nativeValue)); … … 3349 3363 VM& vm = state->vm(); 3350 3364 auto throwScope = DECLARE_THROW_SCOPE(vm); 3351 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3365 UNUSED_PARAM(throwScope); 3366 JSValue value = JSValue::decode(encodedValue); 3352 3367 UNUSED_PARAM(thisValue); 3353 3368 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3370 3385 VM& vm = state->vm(); 3371 3386 auto throwScope = DECLARE_THROW_SCOPE(vm); 3372 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3387 UNUSED_PARAM(throwScope); 3388 JSValue value = JSValue::decode(encodedValue); 3373 3389 UNUSED_PARAM(thisValue); 3374 3390 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3394 3410 VM& vm = state->vm(); 3395 3411 auto throwScope = DECLARE_THROW_SCOPE(vm); 3396 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3412 UNUSED_PARAM(throwScope); 3413 JSValue value = JSValue::decode(encodedValue); 3397 3414 UNUSED_PARAM(thisValue); 3398 3415 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3415 3432 VM& vm = state->vm(); 3416 3433 auto throwScope = DECLARE_THROW_SCOPE(vm); 3417 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3434 UNUSED_PARAM(throwScope); 3435 JSValue value = JSValue::decode(encodedValue); 3418 3436 UNUSED_PARAM(thisValue); 3419 3437 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3423 3441 auto& impl = castedThis->wrapped(); 3424 3442 auto nativeValue = valueToStringTreatingNullAsEmptyString(state, value); 3425 if (UNLIKELY( state->hadException()))3443 if (UNLIKELY(throwScope.exception())) 3426 3444 return false; 3427 3445 impl.setStringAttrTreatingNullAsEmptyString(WTFMove(nativeValue)); … … 3434 3452 VM& vm = state->vm(); 3435 3453 auto throwScope = DECLARE_THROW_SCOPE(vm); 3436 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3454 UNUSED_PARAM(throwScope); 3455 JSValue value = JSValue::decode(encodedValue); 3437 3456 UNUSED_PARAM(thisValue); 3438 3457 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3442 3461 auto& impl = castedThis->wrapped(); 3443 3462 auto nativeValue = valueToUSVStringTreatingNullAsEmptyString(state, value); 3444 if (UNLIKELY( state->hadException()))3463 if (UNLIKELY(throwScope.exception())) 3445 3464 return false; 3446 3465 impl.setUsvstringAttrTreatingNullAsEmptyString(WTFMove(nativeValue)); … … 3453 3472 VM& vm = state->vm(); 3454 3473 auto throwScope = DECLARE_THROW_SCOPE(vm); 3455 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3474 UNUSED_PARAM(throwScope); 3475 JSValue value = JSValue::decode(encodedValue); 3456 3476 UNUSED_PARAM(thisValue); 3457 3477 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3461 3481 auto& impl = castedThis->wrapped(); 3462 3482 auto nativeValue = parse<AlternateEnumName>(*state, value); 3463 if (UNLIKELY( state->hadException()))3483 if (UNLIKELY(throwScope.exception())) 3464 3484 return false; 3465 3485 if (UNLIKELY(!nativeValue)) … … 3474 3494 VM& vm = state->vm(); 3475 3495 auto throwScope = DECLARE_THROW_SCOPE(vm); 3476 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3496 UNUSED_PARAM(throwScope); 3497 JSValue value = JSValue::decode(encodedValue); 3477 3498 UNUSED_PARAM(thisValue); 3478 3499 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3495 3516 VM& vm = state->vm(); 3496 3517 auto throwScope = DECLARE_THROW_SCOPE(vm); 3497 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3518 UNUSED_PARAM(throwScope); 3519 JSValue value = JSValue::decode(encodedValue); 3498 3520 UNUSED_PARAM(thisValue); 3499 3521 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3503 3525 auto& impl = castedThis->wrapped(); 3504 3526 auto nativeValue = value.toBoolean(state); 3505 if (UNLIKELY( state->hadException()))3527 if (UNLIKELY(throwScope.exception())) 3506 3528 return false; 3507 3529 impl.setCreate(WTFMove(nativeValue)); … … 3514 3536 VM& vm = state->vm(); 3515 3537 auto throwScope = DECLARE_THROW_SCOPE(vm); 3516 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3538 UNUSED_PARAM(throwScope); 3539 JSValue value = JSValue::decode(encodedValue); 3517 3540 UNUSED_PARAM(thisValue); 3518 3541 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3522 3545 auto& impl = castedThis->wrapped(); 3523 3546 auto nativeValue = value.toWTFString(state); 3524 if (UNLIKELY( state->hadException()))3547 if (UNLIKELY(throwScope.exception())) 3525 3548 return false; 3526 3549 impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectedstringattrAttr, WTFMove(nativeValue)); … … 3533 3556 VM& vm = state->vm(); 3534 3557 auto throwScope = DECLARE_THROW_SCOPE(vm); 3535 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3558 UNUSED_PARAM(throwScope); 3559 JSValue value = JSValue::decode(encodedValue); 3536 3560 UNUSED_PARAM(thisValue); 3537 3561 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3541 3565 auto& impl = castedThis->wrapped(); 3542 3566 auto nativeValue = valueToUSVString(state, value); 3543 if (UNLIKELY( state->hadException()))3567 if (UNLIKELY(throwScope.exception())) 3544 3568 return false; 3545 3569 impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectedusvstringattrAttr, WTFMove(nativeValue)); … … 3552 3576 VM& vm = state->vm(); 3553 3577 auto throwScope = DECLARE_THROW_SCOPE(vm); 3554 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3578 UNUSED_PARAM(throwScope); 3579 JSValue value = JSValue::decode(encodedValue); 3555 3580 UNUSED_PARAM(thisValue); 3556 3581 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3560 3585 auto& impl = castedThis->wrapped(); 3561 3586 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3562 if (UNLIKELY( state->hadException()))3587 if (UNLIKELY(throwScope.exception())) 3563 3588 return false; 3564 3589 impl.setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, WTFMove(nativeValue)); … … 3571 3596 VM& vm = state->vm(); 3572 3597 auto throwScope = DECLARE_THROW_SCOPE(vm); 3573 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3598 UNUSED_PARAM(throwScope); 3599 JSValue value = JSValue::decode(encodedValue); 3574 3600 UNUSED_PARAM(thisValue); 3575 3601 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3579 3605 auto& impl = castedThis->wrapped(); 3580 3606 auto nativeValue = convert<uint32_t>(*state, value, NormalConversion); 3581 if (UNLIKELY( state->hadException()))3607 if (UNLIKELY(throwScope.exception())) 3582 3608 return false; 3583 3609 impl.setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, WTFMove(nativeValue)); … … 3590 3616 VM& vm = state->vm(); 3591 3617 auto throwScope = DECLARE_THROW_SCOPE(vm); 3592 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3618 UNUSED_PARAM(throwScope); 3619 JSValue value = JSValue::decode(encodedValue); 3593 3620 UNUSED_PARAM(thisValue); 3594 3621 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3598 3625 auto& impl = castedThis->wrapped(); 3599 3626 auto nativeValue = value.toBoolean(state); 3600 if (UNLIKELY( state->hadException()))3627 if (UNLIKELY(throwScope.exception())) 3601 3628 return false; 3602 3629 impl.setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, WTFMove(nativeValue)); … … 3609 3636 VM& vm = state->vm(); 3610 3637 auto throwScope = DECLARE_THROW_SCOPE(vm); 3611 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3638 UNUSED_PARAM(throwScope); 3639 JSValue value = JSValue::decode(encodedValue); 3612 3640 UNUSED_PARAM(thisValue); 3613 3641 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3617 3645 auto& impl = castedThis->wrapped(); 3618 3646 auto nativeValue = value.toWTFString(state); 3619 if (UNLIKELY( state->hadException()))3647 if (UNLIKELY(throwScope.exception())) 3620 3648 return false; 3621 3649 impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectedurlattrAttr, WTFMove(nativeValue)); … … 3628 3656 VM& vm = state->vm(); 3629 3657 auto throwScope = DECLARE_THROW_SCOPE(vm); 3630 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3658 UNUSED_PARAM(throwScope); 3659 JSValue value = JSValue::decode(encodedValue); 3631 3660 UNUSED_PARAM(thisValue); 3632 3661 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3636 3665 auto& impl = castedThis->wrapped(); 3637 3666 auto nativeValue = valueToUSVString(state, value); 3638 if (UNLIKELY( state->hadException()))3667 if (UNLIKELY(throwScope.exception())) 3639 3668 return false; 3640 3669 impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectedusvurlattrAttr, WTFMove(nativeValue)); … … 3647 3676 VM& vm = state->vm(); 3648 3677 auto throwScope = DECLARE_THROW_SCOPE(vm); 3649 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3678 UNUSED_PARAM(throwScope); 3679 JSValue value = JSValue::decode(encodedValue); 3650 3680 UNUSED_PARAM(thisValue); 3651 3681 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3655 3685 auto& impl = castedThis->wrapped(); 3656 3686 auto nativeValue = value.toWTFString(state); 3657 if (UNLIKELY( state->hadException()))3687 if (UNLIKELY(throwScope.exception())) 3658 3688 return false; 3659 3689 impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::customContentStringAttrAttr, WTFMove(nativeValue)); … … 3666 3696 VM& vm = state->vm(); 3667 3697 auto throwScope = DECLARE_THROW_SCOPE(vm); 3668 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3698 UNUSED_PARAM(throwScope); 3699 JSValue value = JSValue::decode(encodedValue); 3669 3700 UNUSED_PARAM(thisValue); 3670 3701 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3674 3705 auto& impl = castedThis->wrapped(); 3675 3706 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3676 if (UNLIKELY( state->hadException()))3707 if (UNLIKELY(throwScope.exception())) 3677 3708 return false; 3678 3709 impl.setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, WTFMove(nativeValue)); … … 3685 3716 VM& vm = state->vm(); 3686 3717 auto throwScope = DECLARE_THROW_SCOPE(vm); 3687 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3718 UNUSED_PARAM(throwScope); 3719 JSValue value = JSValue::decode(encodedValue); 3688 3720 UNUSED_PARAM(thisValue); 3689 3721 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3693 3725 auto& impl = castedThis->wrapped(); 3694 3726 auto nativeValue = value.toBoolean(state); 3695 if (UNLIKELY( state->hadException()))3727 if (UNLIKELY(throwScope.exception())) 3696 3728 return false; 3697 3729 impl.setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, WTFMove(nativeValue)); … … 3704 3736 VM& vm = state->vm(); 3705 3737 auto throwScope = DECLARE_THROW_SCOPE(vm); 3706 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3738 UNUSED_PARAM(throwScope); 3739 JSValue value = JSValue::decode(encodedValue); 3707 3740 UNUSED_PARAM(thisValue); 3708 3741 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3712 3745 auto& impl = castedThis->wrapped(); 3713 3746 auto nativeValue = value.toWTFString(state); 3714 if (UNLIKELY( state->hadException()))3747 if (UNLIKELY(throwScope.exception())) 3715 3748 return false; 3716 3749 impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::customContentURLAttrAttr, WTFMove(nativeValue)); … … 3724 3757 VM& vm = state->vm(); 3725 3758 auto throwScope = DECLARE_THROW_SCOPE(vm); 3726 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3759 UNUSED_PARAM(throwScope); 3760 JSValue value = JSValue::decode(encodedValue); 3727 3761 UNUSED_PARAM(thisValue); 3728 3762 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3732 3766 auto& impl = castedThis->wrapped(); 3733 3767 auto nativeValue = value.toWTFString(state); 3734 if (UNLIKELY( state->hadException()))3768 if (UNLIKELY(throwScope.exception())) 3735 3769 return false; 3736 3770 impl.setEnabledAtRuntimeAttribute(WTFMove(nativeValue)); … … 3744 3778 VM& vm = state->vm(); 3745 3779 auto throwScope = DECLARE_THROW_SCOPE(vm); 3746 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3780 UNUSED_PARAM(throwScope); 3781 JSValue value = JSValue::decode(encodedValue); 3747 3782 UNUSED_PARAM(thisValue); 3748 3783 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3752 3787 auto& impl = castedThis->wrapped(); 3753 3788 auto nativeValue = toFloat32Array(value); 3754 if (UNLIKELY( state->hadException()))3789 if (UNLIKELY(throwScope.exception())) 3755 3790 return false; 3756 3791 if (UNLIKELY(!nativeValue)) { … … 3767 3802 VM& vm = state->vm(); 3768 3803 auto throwScope = DECLARE_THROW_SCOPE(vm); 3769 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3804 UNUSED_PARAM(throwScope); 3805 JSValue value = JSValue::decode(encodedValue); 3770 3806 UNUSED_PARAM(thisValue); 3771 3807 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3775 3811 auto& impl = castedThis->wrapped(); 3776 3812 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3777 if (UNLIKELY( state->hadException()))3813 if (UNLIKELY(throwScope.exception())) 3778 3814 return false; 3779 3815 impl.setAttrWithGetterException(WTFMove(nativeValue)); … … 3786 3822 VM& vm = state->vm(); 3787 3823 auto throwScope = DECLARE_THROW_SCOPE(vm); 3788 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3824 UNUSED_PARAM(throwScope); 3825 JSValue value = JSValue::decode(encodedValue); 3789 3826 UNUSED_PARAM(thisValue); 3790 3827 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3794 3831 auto& impl = castedThis->wrapped(); 3795 3832 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3796 if (UNLIKELY( state->hadException()))3833 if (UNLIKELY(throwScope.exception())) 3797 3834 return false; 3798 3835 impl.setAttrWithGetterExceptionWithMessage(WTFMove(nativeValue)); … … 3805 3842 VM& vm = state->vm(); 3806 3843 auto throwScope = DECLARE_THROW_SCOPE(vm); 3807 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3844 UNUSED_PARAM(throwScope); 3845 JSValue value = JSValue::decode(encodedValue); 3808 3846 UNUSED_PARAM(thisValue); 3809 3847 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3814 3852 ExceptionCode ec = 0; 3815 3853 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3816 if (UNLIKELY( state->hadException()))3854 if (UNLIKELY(throwScope.exception())) 3817 3855 return false; 3818 3856 impl.setAttrWithSetterException(WTFMove(nativeValue), ec); … … 3826 3864 VM& vm = state->vm(); 3827 3865 auto throwScope = DECLARE_THROW_SCOPE(vm); 3828 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3866 UNUSED_PARAM(throwScope); 3867 JSValue value = JSValue::decode(encodedValue); 3829 3868 UNUSED_PARAM(thisValue); 3830 3869 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3835 3874 ExceptionCodeWithMessage ec; 3836 3875 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3837 if (UNLIKELY( state->hadException()))3876 if (UNLIKELY(throwScope.exception())) 3838 3877 return false; 3839 3878 impl.setAttrWithSetterExceptionWithMessage(WTFMove(nativeValue), ec); … … 3847 3886 VM& vm = state->vm(); 3848 3887 auto throwScope = DECLARE_THROW_SCOPE(vm); 3849 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3888 UNUSED_PARAM(throwScope); 3889 JSValue value = JSValue::decode(encodedValue); 3850 3890 UNUSED_PARAM(thisValue); 3851 3891 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3855 3895 auto& impl = castedThis->wrapped(); 3856 3896 auto nativeValue = value.toWTFString(state); 3857 if (UNLIKELY( state->hadException()))3897 if (UNLIKELY(throwScope.exception())) 3858 3898 return false; 3859 3899 impl.setStringAttrWithGetterException(WTFMove(nativeValue)); … … 3866 3906 VM& vm = state->vm(); 3867 3907 auto throwScope = DECLARE_THROW_SCOPE(vm); 3868 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3908 UNUSED_PARAM(throwScope); 3909 JSValue value = JSValue::decode(encodedValue); 3869 3910 UNUSED_PARAM(thisValue); 3870 3911 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3875 3916 ExceptionCode ec = 0; 3876 3917 auto nativeValue = value.toWTFString(state); 3877 if (UNLIKELY( state->hadException()))3918 if (UNLIKELY(throwScope.exception())) 3878 3919 return false; 3879 3920 impl.setStringAttrWithSetterException(WTFMove(nativeValue), ec); … … 3887 3928 VM& vm = state->vm(); 3888 3929 auto throwScope = DECLARE_THROW_SCOPE(vm); 3889 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3930 UNUSED_PARAM(throwScope); 3931 JSValue value = JSValue::decode(encodedValue); 3890 3932 UNUSED_PARAM(thisValue); 3891 3933 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3902 3944 VM& vm = state->vm(); 3903 3945 auto throwScope = DECLARE_THROW_SCOPE(vm); 3904 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3946 UNUSED_PARAM(throwScope); 3947 JSValue value = JSValue::decode(encodedValue); 3905 3948 UNUSED_PARAM(thisValue); 3906 3949 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3917 3960 VM& vm = state->vm(); 3918 3961 auto throwScope = DECLARE_THROW_SCOPE(vm); 3919 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3962 UNUSED_PARAM(throwScope); 3963 JSValue value = JSValue::decode(encodedValue); 3920 3964 UNUSED_PARAM(thisValue); 3921 3965 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3932 3976 VM& vm = state->vm(); 3933 3977 auto throwScope = DECLARE_THROW_SCOPE(vm); 3934 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3978 UNUSED_PARAM(throwScope); 3979 JSValue value = JSValue::decode(encodedValue); 3935 3980 UNUSED_PARAM(thisValue); 3936 3981 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3940 3985 auto& impl = castedThis->wrapped(); 3941 3986 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3942 if (UNLIKELY( state->hadException()))3987 if (UNLIKELY(throwScope.exception())) 3943 3988 return false; 3944 3989 impl.setWithScriptStateAttribute(*state, WTFMove(nativeValue)); … … 3951 3996 VM& vm = state->vm(); 3952 3997 auto throwScope = DECLARE_THROW_SCOPE(vm); 3953 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 3998 UNUSED_PARAM(throwScope); 3999 JSValue value = JSValue::decode(encodedValue); 3954 4000 UNUSED_PARAM(thisValue); 3955 4001 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3959 4005 auto& impl = castedThis->wrapped(); 3960 4006 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 3961 if (UNLIKELY( state->hadException()))4007 if (UNLIKELY(throwScope.exception())) 3962 4008 return false; 3963 4009 impl.setWithCallWithAndSetterCallWithAttribute(*state, activeDOMWindow(state), firstDOMWindow(state), WTFMove(nativeValue)); … … 3970 4016 VM& vm = state->vm(); 3971 4017 auto throwScope = DECLARE_THROW_SCOPE(vm); 3972 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4018 UNUSED_PARAM(throwScope); 4019 JSValue value = JSValue::decode(encodedValue); 3973 4020 UNUSED_PARAM(thisValue); 3974 4021 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 3994 4041 VM& vm = state->vm(); 3995 4042 auto throwScope = DECLARE_THROW_SCOPE(vm); 3996 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4043 UNUSED_PARAM(throwScope); 4044 JSValue value = JSValue::decode(encodedValue); 3997 4045 UNUSED_PARAM(thisValue); 3998 4046 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4015 4063 VM& vm = state->vm(); 4016 4064 auto throwScope = DECLARE_THROW_SCOPE(vm); 4017 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4065 UNUSED_PARAM(throwScope); 4066 JSValue value = JSValue::decode(encodedValue); 4018 4067 UNUSED_PARAM(thisValue); 4019 4068 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4039 4088 VM& vm = state->vm(); 4040 4089 auto throwScope = DECLARE_THROW_SCOPE(vm); 4041 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4090 UNUSED_PARAM(throwScope); 4091 JSValue value = JSValue::decode(encodedValue); 4042 4092 UNUSED_PARAM(thisValue); 4043 4093 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4063 4113 VM& vm = state->vm(); 4064 4114 auto throwScope = DECLARE_THROW_SCOPE(vm); 4065 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4115 UNUSED_PARAM(throwScope); 4116 JSValue value = JSValue::decode(encodedValue); 4066 4117 UNUSED_PARAM(thisValue); 4067 4118 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4087 4138 VM& vm = state->vm(); 4088 4139 auto throwScope = DECLARE_THROW_SCOPE(vm); 4089 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4140 UNUSED_PARAM(throwScope); 4141 JSValue value = JSValue::decode(encodedValue); 4090 4142 UNUSED_PARAM(thisValue); 4091 4143 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4111 4163 VM& vm = state->vm(); 4112 4164 auto throwScope = DECLARE_THROW_SCOPE(vm); 4113 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4165 UNUSED_PARAM(throwScope); 4166 JSValue value = JSValue::decode(encodedValue); 4114 4167 UNUSED_PARAM(thisValue); 4115 4168 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4133 4186 VM& vm = state->vm(); 4134 4187 auto throwScope = DECLARE_THROW_SCOPE(vm); 4135 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4188 UNUSED_PARAM(throwScope); 4189 JSValue value = JSValue::decode(encodedValue); 4136 4190 UNUSED_PARAM(thisValue); 4137 4191 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4141 4195 auto& impl = castedThis->wrapped(); 4142 4196 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4143 if (UNLIKELY( state->hadException()))4197 if (UNLIKELY(throwScope.exception())) 4144 4198 return false; 4145 4199 impl.setConditionalAttr1(WTFMove(nativeValue)); … … 4154 4208 VM& vm = state->vm(); 4155 4209 auto throwScope = DECLARE_THROW_SCOPE(vm); 4156 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4210 UNUSED_PARAM(throwScope); 4211 JSValue value = JSValue::decode(encodedValue); 4157 4212 UNUSED_PARAM(thisValue); 4158 4213 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4162 4217 auto& impl = castedThis->wrapped(); 4163 4218 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4164 if (UNLIKELY( state->hadException()))4219 if (UNLIKELY(throwScope.exception())) 4165 4220 return false; 4166 4221 impl.setConditionalAttr2(WTFMove(nativeValue)); … … 4175 4230 VM& vm = state->vm(); 4176 4231 auto throwScope = DECLARE_THROW_SCOPE(vm); 4177 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4232 UNUSED_PARAM(throwScope); 4233 JSValue value = JSValue::decode(encodedValue); 4178 4234 UNUSED_PARAM(thisValue); 4179 4235 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4183 4239 auto& impl = castedThis->wrapped(); 4184 4240 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4185 if (UNLIKELY( state->hadException()))4241 if (UNLIKELY(throwScope.exception())) 4186 4242 return false; 4187 4243 impl.setConditionalAttr3(WTFMove(nativeValue)); … … 4196 4252 VM& vm = state->vm(); 4197 4253 auto throwScope = DECLARE_THROW_SCOPE(vm); 4198 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4254 UNUSED_PARAM(throwScope); 4255 JSValue value = JSValue::decode(encodedValue); 4199 4256 UNUSED_PARAM(thisValue); 4200 4257 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4213 4270 VM& vm = state->vm(); 4214 4271 auto throwScope = DECLARE_THROW_SCOPE(vm); 4215 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4272 UNUSED_PARAM(throwScope); 4273 JSValue value = JSValue::decode(encodedValue); 4216 4274 UNUSED_PARAM(thisValue); 4217 4275 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4230 4288 VM& vm = state->vm(); 4231 4289 auto throwScope = DECLARE_THROW_SCOPE(vm); 4232 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4290 UNUSED_PARAM(throwScope); 4291 JSValue value = JSValue::decode(encodedValue); 4233 4292 UNUSED_PARAM(thisValue); 4234 4293 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4246 4305 VM& vm = state->vm(); 4247 4306 auto throwScope = DECLARE_THROW_SCOPE(vm); 4248 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4307 UNUSED_PARAM(throwScope); 4308 JSValue value = JSValue::decode(encodedValue); 4249 4309 UNUSED_PARAM(thisValue); 4250 4310 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4263 4323 VM& vm = state->vm(); 4264 4324 auto throwScope = DECLARE_THROW_SCOPE(vm); 4265 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4325 UNUSED_PARAM(throwScope); 4326 JSValue value = JSValue::decode(encodedValue); 4266 4327 UNUSED_PARAM(thisValue); 4267 4328 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4287 4348 VM& vm = state->vm(); 4288 4349 auto throwScope = DECLARE_THROW_SCOPE(vm); 4289 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4350 UNUSED_PARAM(throwScope); 4351 JSValue value = JSValue::decode(encodedValue); 4290 4352 UNUSED_PARAM(thisValue); 4291 4353 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4311 4373 VM& vm = state->vm(); 4312 4374 auto throwScope = DECLARE_THROW_SCOPE(vm); 4313 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4375 UNUSED_PARAM(throwScope); 4376 JSValue value = JSValue::decode(encodedValue); 4314 4377 UNUSED_PARAM(thisValue); 4315 4378 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4319 4382 auto& impl = castedThis->wrapped(); 4320 4383 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4321 if (UNLIKELY( state->hadException()))4384 if (UNLIKELY(throwScope.exception())) 4322 4385 return false; 4323 4386 impl.setBlueberry(WTFMove(nativeValue)); … … 4330 4393 VM& vm = state->vm(); 4331 4394 auto throwScope = DECLARE_THROW_SCOPE(vm); 4332 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4395 UNUSED_PARAM(throwScope); 4396 JSValue value = JSValue::decode(encodedValue); 4333 4397 UNUSED_PARAM(thisValue); 4334 4398 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4338 4402 auto& impl = castedThis->wrapped(); 4339 4403 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4340 if (UNLIKELY( state->hadException()))4404 if (UNLIKELY(throwScope.exception())) 4341 4405 return false; 4342 4406 impl.setId(WTFMove(nativeValue)); … … 4349 4413 VM& vm = state->vm(); 4350 4414 auto throwScope = DECLARE_THROW_SCOPE(vm); 4351 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4415 UNUSED_PARAM(throwScope); 4416 JSValue value = JSValue::decode(encodedValue); 4352 4417 UNUSED_PARAM(thisValue); 4353 4418 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4364 4429 VM& vm = state->vm(); 4365 4430 auto throwScope = DECLARE_THROW_SCOPE(vm); 4366 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4431 UNUSED_PARAM(throwScope); 4432 JSValue value = JSValue::decode(encodedValue); 4367 4433 UNUSED_PARAM(thisValue); 4368 4434 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4372 4438 auto& impl = castedThis->wrapped(); 4373 4439 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4374 if (UNLIKELY( state->hadException()))4440 if (UNLIKELY(throwScope.exception())) 4375 4441 return false; 4376 4442 impl.setNullableLongSettableAttribute(WTFMove(nativeValue)); … … 4383 4449 VM& vm = state->vm(); 4384 4450 auto throwScope = DECLARE_THROW_SCOPE(vm); 4385 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4451 UNUSED_PARAM(throwScope); 4452 JSValue value = JSValue::decode(encodedValue); 4386 4453 UNUSED_PARAM(thisValue); 4387 4454 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4391 4458 auto& impl = castedThis->wrapped(); 4392 4459 auto nativeValue = valueToStringWithUndefinedOrNullCheck(state, value); 4393 if (UNLIKELY( state->hadException()))4460 if (UNLIKELY(throwScope.exception())) 4394 4461 return false; 4395 4462 impl.setNullableStringSettableAttribute(WTFMove(nativeValue)); … … 4402 4469 VM& vm = state->vm(); 4403 4470 auto throwScope = DECLARE_THROW_SCOPE(vm); 4404 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4471 UNUSED_PARAM(throwScope); 4472 JSValue value = JSValue::decode(encodedValue); 4405 4473 UNUSED_PARAM(thisValue); 4406 4474 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4410 4478 auto& impl = castedThis->wrapped(); 4411 4479 auto nativeValue = valueToUSVStringWithUndefinedOrNullCheck(state, value); 4412 if (UNLIKELY( state->hadException()))4480 if (UNLIKELY(throwScope.exception())) 4413 4481 return false; 4414 4482 impl.setNullableUSVStringSettableAttribute(WTFMove(nativeValue)); … … 4421 4489 VM& vm = state->vm(); 4422 4490 auto throwScope = DECLARE_THROW_SCOPE(vm); 4423 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4491 UNUSED_PARAM(throwScope); 4492 JSValue value = JSValue::decode(encodedValue); 4424 4493 UNUSED_PARAM(thisValue); 4425 4494 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4429 4498 auto& impl = castedThis->wrapped(); 4430 4499 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 4431 if (UNLIKELY( state->hadException()))4500 if (UNLIKELY(throwScope.exception())) 4432 4501 return false; 4433 4502 impl.setNullableStringValue(WTFMove(nativeValue)); … … 4440 4509 VM& vm = state->vm(); 4441 4510 auto throwScope = DECLARE_THROW_SCOPE(vm); 4442 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4511 UNUSED_PARAM(throwScope); 4512 JSValue value = JSValue::decode(encodedValue); 4443 4513 UNUSED_PARAM(thisValue); 4444 4514 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4448 4518 auto& impl = castedThis->wrapped(); 4449 4519 auto nativeValue = parse<TestObj::Optional>(*state, value); 4450 if (UNLIKELY( state->hadException()))4520 if (UNLIKELY(throwScope.exception())) 4451 4521 return false; 4452 4522 if (UNLIKELY(!nativeValue)) … … 4461 4531 VM& vm = state->vm(); 4462 4532 auto throwScope = DECLARE_THROW_SCOPE(vm); 4463 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4533 UNUSED_PARAM(throwScope); 4534 JSValue value = JSValue::decode(encodedValue); 4464 4535 UNUSED_PARAM(thisValue); 4465 4536 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4470 4541 auto& impl = forwardedImpl.get(); 4471 4542 auto nativeValue = value.toWTFString(state); 4472 if (UNLIKELY( state->hadException()))4543 if (UNLIKELY(throwScope.exception())) 4473 4544 return false; 4474 4545 impl.setName(WTFMove(nativeValue)); … … 4481 4552 VM& vm = state->vm(); 4482 4553 auto throwScope = DECLARE_THROW_SCOPE(vm); 4483 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4554 UNUSED_PARAM(throwScope); 4555 JSValue value = JSValue::decode(encodedValue); 4484 4556 UNUSED_PARAM(thisValue); 4485 4557 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4492 4564 auto& impl = *forwardedImpl; 4493 4565 auto nativeValue = value.toWTFString(state); 4494 if (UNLIKELY( state->hadException()))4566 if (UNLIKELY(throwScope.exception())) 4495 4567 return false; 4496 4568 impl.setName(WTFMove(nativeValue)); … … 4503 4575 VM& vm = state->vm(); 4504 4576 auto throwScope = DECLARE_THROW_SCOPE(vm); 4505 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 4577 UNUSED_PARAM(throwScope); 4578 JSValue value = JSValue::decode(encodedValue); 4506 4579 UNUSED_PARAM(thisValue); 4507 4580 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); … … 4511 4584 auto& impl = castedThis->wrapped(); 4512 4585 auto nativeValue = valueToUSVString(state, value); 4513 if (UNLIKELY( state->hadException()))4586 if (UNLIKELY(throwScope.exception())) 4514 4587 return false; 4515 4588 impl.setStringifierAttribute(WTFMove(nativeValue)); … … 4547 4620 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4548 4621 auto testParam = state->argument(0).toWTFString(state); 4549 if (UNLIKELY( state->hadException()))4622 if (UNLIKELY(throwScope.exception())) 4550 4623 return JSValue::encode(jsUndefined()); 4551 4624 impl.enabledAtRuntimeOperation(WTFMove(testParam)); … … 4570 4643 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4571 4644 auto testParam = convert<int32_t>(*state, state->argument(0), NormalConversion); 4572 if (UNLIKELY( state->hadException()))4645 if (UNLIKELY(throwScope.exception())) 4573 4646 return JSValue::encode(jsUndefined()); 4574 4647 impl.enabledAtRuntimeOperation(WTFMove(testParam)); … … 4628 4701 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4629 4702 auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion); 4630 if (UNLIKELY( state->hadException()))4703 if (UNLIKELY(throwScope.exception())) 4631 4704 return JSValue::encode(jsUndefined()); 4632 4705 auto strArg = state->argument(1).toWTFString(state); 4633 if (UNLIKELY( state->hadException()))4706 if (UNLIKELY(throwScope.exception())) 4634 4707 return JSValue::encode(jsUndefined()); 4635 4708 auto objArg = JSTestObj::toWrapped(state->argument(2)); … … 4669 4742 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4670 4743 auto byteArg = convert<int8_t>(*state, state->argument(0), NormalConversion); 4671 if (UNLIKELY( state->hadException()))4744 if (UNLIKELY(throwScope.exception())) 4672 4745 return JSValue::encode(jsUndefined()); 4673 4746 auto strArg = state->argument(1).toWTFString(state); 4674 if (UNLIKELY( state->hadException()))4747 if (UNLIKELY(throwScope.exception())) 4675 4748 return JSValue::encode(jsUndefined()); 4676 4749 auto objArg = JSTestObj::toWrapped(state->argument(2)); … … 4710 4783 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4711 4784 auto octetArg = convert<uint8_t>(*state, state->argument(0), NormalConversion); 4712 if (UNLIKELY( state->hadException()))4785 if (UNLIKELY(throwScope.exception())) 4713 4786 return JSValue::encode(jsUndefined()); 4714 4787 auto strArg = state->argument(1).toWTFString(state); 4715 if (UNLIKELY( state->hadException()))4788 if (UNLIKELY(throwScope.exception())) 4716 4789 return JSValue::encode(jsUndefined()); 4717 4790 auto objArg = JSTestObj::toWrapped(state->argument(2)); … … 4751 4824 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4752 4825 auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion); 4753 if (UNLIKELY( state->hadException()))4826 if (UNLIKELY(throwScope.exception())) 4754 4827 return JSValue::encode(jsUndefined()); 4755 4828 auto strArg = state->argument(1).toWTFString(state); 4756 if (UNLIKELY( state->hadException()))4829 if (UNLIKELY(throwScope.exception())) 4757 4830 return JSValue::encode(jsUndefined()); 4758 4831 auto objArg = JSTestObj::toWrapped(state->argument(2)); … … 4792 4865 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4793 4866 auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion); 4794 if (UNLIKELY( state->hadException()))4867 if (UNLIKELY(throwScope.exception())) 4795 4868 return JSValue::encode(jsUndefined()); 4796 4869 auto strArg = state->argument(1).toWTFString(state); 4797 if (UNLIKELY( state->hadException()))4870 if (UNLIKELY(throwScope.exception())) 4798 4871 return JSValue::encode(jsUndefined()); 4799 4872 auto objArg = JSTestObj::toWrapped(state->argument(2)); … … 4833 4906 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4834 4907 auto arg = valueToStringTreatingNullAsEmptyString(state, state->argument(0)); 4835 if (UNLIKELY( state->hadException()))4908 if (UNLIKELY(throwScope.exception())) 4836 4909 return JSValue::encode(jsUndefined()); 4837 4910 impl.methodWithArgTreatingNullAsEmptyString(WTFMove(arg)); … … 4853 4926 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4854 4927 auto resolver = JSXPathNSResolver::toWrapped(*state, state->argument(0)); 4855 if (UNLIKELY( state->hadException()))4928 if (UNLIKELY(throwScope.exception())) 4856 4929 return JSValue::encode(jsUndefined()); 4857 4930 if (UNLIKELY(!resolver)) … … 4899 4972 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 4900 4973 auto index = convert<uint32_t>(*state, state->argument(0), NormalConversion); 4901 if (UNLIKELY( state->hadException()))4974 if (UNLIKELY(throwScope.exception())) 4902 4975 return JSValue::encode(jsUndefined()); 4903 4976 JSValue result = jsStringOrNull(state, impl.nullableStringSpecialMethod(WTFMove(index))); … … 4921 4994 TestObj::EnumType enumArg; 4922 4995 auto optionalValue = parse<TestObj::EnumType>(*state, enumArgValue); 4923 if (UNLIKELY( state->hadException()))4996 if (UNLIKELY(throwScope.exception())) 4924 4997 return JSValue::encode(jsUndefined()); 4925 4998 if (UNLIKELY(!optionalValue)) … … 4945 5018 if (!enumArgValue.isUndefined()) { 4946 5019 enumArg = parse<TestObj::EnumType>(*state, enumArgValue); 4947 if (UNLIKELY( state->hadException()))5020 if (UNLIKELY(throwScope.exception())) 4948 5021 return JSValue::encode(jsUndefined()); 4949 5022 if (UNLIKELY(!enumArg)) … … 4971 5044 } else { 4972 5045 auto optionalValue = parse<TestObj::EnumType>(*state, enumArgValue); 4973 if (UNLIKELY( state->hadException()))5046 if (UNLIKELY(throwScope.exception())) 4974 5047 return JSValue::encode(jsUndefined()); 4975 5048 if (UNLIKELY(!optionalValue)) … … 4996 5069 ExceptionCode ec = 0; 4997 5070 auto strArg = state->argument(0).toWTFString(state); 4998 if (UNLIKELY( state->hadException()))5071 if (UNLIKELY(throwScope.exception())) 4999 5072 return JSValue::encode(jsUndefined()); 5000 5073 auto objArg = JSTestObj::toWrapped(state->argument(1)); … … 5021 5094 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5022 5095 auto str = valueToUSVString(state, state->argument(0)); 5023 if (UNLIKELY( state->hadException()))5096 if (UNLIKELY(throwScope.exception())) 5024 5097 return JSValue::encode(jsUndefined()); 5025 5098 impl.methodWithUSVStringArg(WTFMove(str)); … … 5041 5114 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5042 5115 auto str = valueToUSVStringWithUndefinedOrNullCheck(state, state->argument(0)); 5043 if (UNLIKELY( state->hadException()))5116 if (UNLIKELY(throwScope.exception())) 5044 5117 return JSValue::encode(jsUndefined()); 5045 5118 impl.methodWithNullableUSVStringArg(WTFMove(str)); … … 5061 5134 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5062 5135 auto str = valueToUSVStringTreatingNullAsEmptyString(state, state->argument(0)); 5063 if (UNLIKELY( state->hadException()))5136 if (UNLIKELY(throwScope.exception())) 5064 5137 return JSValue::encode(jsUndefined()); 5065 5138 impl.methodWithUSVStringArgTreatingNullAsEmptyString(WTFMove(str)); … … 5081 5154 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5082 5155 auto serializedArg = SerializedScriptValue::create(state, state->argument(0), 0, 0); 5083 if (UNLIKELY( state->hadException()))5156 if (UNLIKELY(throwScope.exception())) 5084 5157 return JSValue::encode(jsUndefined()); 5085 5158 impl.serializedValue(WTFMove(serializedArg)); … … 5180 5253 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5181 5254 auto argument = state->argument(0).toWTFString(state); 5182 if (UNLIKELY( state->hadException()))5255 if (UNLIKELY(throwScope.exception())) 5183 5256 return JSValue::encode(jsUndefined()); 5184 5257 JSValue result = jsStringWithCache(state, impl.privateMethod(WTFMove(argument))); … … 5200 5273 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5201 5274 auto argument = state->argument(0).toWTFString(state); 5202 if (UNLIKELY( state->hadException()))5275 if (UNLIKELY(throwScope.exception())) 5203 5276 return JSValue::encode(jsUndefined()); 5204 5277 JSValue result = jsStringWithCache(state, impl.publicAndPrivateMethod(WTFMove(argument))); … … 5220 5293 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5221 5294 auto type = state->argument(0).toWTFString(state); 5222 if (UNLIKELY( state->hadException()))5295 if (UNLIKELY(throwScope.exception())) 5223 5296 return JSValue::encode(jsUndefined()); 5224 5297 auto listener = JSEventListener::create(state->argument(1), *castedThis, false, currentWorld(state)); … … 5226 5299 return throwArgumentTypeError(*state, throwScope, 1, "listener", "TestObject", "addEventListener", "EventListener"); 5227 5300 auto useCapture = state->argument(2).toBoolean(state); 5228 if (UNLIKELY( state->hadException()))5301 if (UNLIKELY(throwScope.exception())) 5229 5302 return JSValue::encode(jsUndefined()); 5230 5303 impl.addEventListener(WTFMove(type), *listener, WTFMove(useCapture)); … … 5246 5319 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5247 5320 auto type = state->argument(0).toWTFString(state); 5248 if (UNLIKELY( state->hadException()))5321 if (UNLIKELY(throwScope.exception())) 5249 5322 return JSValue::encode(jsUndefined()); 5250 5323 auto listener = JSEventListener::create(state->argument(1), *castedThis, false, currentWorld(state)); … … 5252 5325 return throwArgumentTypeError(*state, throwScope, 1, "listener", "TestObject", "removeEventListener", "EventListener"); 5253 5326 auto useCapture = state->argument(2).toBoolean(state); 5254 if (UNLIKELY( state->hadException()))5327 if (UNLIKELY(throwScope.exception())) 5255 5328 return JSValue::encode(jsUndefined()); 5256 5329 impl.removeEventListener(WTFMove(type), *listener, WTFMove(useCapture)); … … 5285 5358 auto& impl = castedThis->wrapped(); 5286 5359 JSValue result = toJS(state, castedThis->globalObject(), impl.withScriptStateObj(*state)); 5287 if (UNLIKELY( state->hadException()))5360 if (UNLIKELY(throwScope.exception())) 5288 5361 return JSValue::encode(jsUndefined()); 5289 5362 return JSValue::encode(result); … … 5322 5395 5323 5396 setDOMException(state, ec); 5324 if (UNLIKELY( state->hadException()))5397 if (UNLIKELY(throwScope.exception())) 5325 5398 return JSValue::encode(jsUndefined()); 5326 5399 return JSValue::encode(result); … … 5381 5454 5382 5455 setDOMException(state, ec); 5383 if (UNLIKELY( state->hadException()))5456 if (UNLIKELY(throwScope.exception())) 5384 5457 return JSValue::encode(jsUndefined()); 5385 5458 return JSValue::encode(result); … … 5401 5474 return JSValue::encode(jsUndefined()); 5402 5475 JSValue result = toJS(state, castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context)); 5403 if (UNLIKELY( state->hadException()))5476 if (UNLIKELY(throwScope.exception())) 5404 5477 return JSValue::encode(jsUndefined()); 5405 5478 return JSValue::encode(result); … … 5487 5560 auto& impl = castedThis->wrapped(); 5488 5561 auto opt = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion); 5489 if (UNLIKELY( state->hadException()))5562 if (UNLIKELY(throwScope.exception())) 5490 5563 return JSValue::encode(jsUndefined()); 5491 5564 impl.methodWithOptionalArg(WTFMove(opt)); … … 5505 5578 auto& impl = castedThis->wrapped(); 5506 5579 auto opt = state->argument(0).isUndefined() ? 666 : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion); 5507 if (UNLIKELY( state->hadException()))5580 if (UNLIKELY(throwScope.exception())) 5508 5581 return JSValue::encode(jsUndefined()); 5509 5582 impl.methodWithOptionalArgAndDefaultValue(WTFMove(opt)); … … 5525 5598 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5526 5599 auto nonOpt = convert<int32_t>(*state, state->argument(0), NormalConversion); 5527 if (UNLIKELY( state->hadException()))5600 if (UNLIKELY(throwScope.exception())) 5528 5601 return JSValue::encode(jsUndefined()); 5529 5602 auto opt = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion); 5530 if (UNLIKELY( state->hadException()))5603 if (UNLIKELY(throwScope.exception())) 5531 5604 return JSValue::encode(jsUndefined()); 5532 5605 impl.methodWithNonOptionalArgAndOptionalArg(WTFMove(nonOpt), WTFMove(opt)); … … 5548 5621 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5549 5622 auto nonOpt = convert<int32_t>(*state, state->argument(0), NormalConversion); 5550 if (UNLIKELY( state->hadException()))5623 if (UNLIKELY(throwScope.exception())) 5551 5624 return JSValue::encode(jsUndefined()); 5552 5625 auto opt1 = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion); 5553 if (UNLIKELY( state->hadException()))5626 if (UNLIKELY(throwScope.exception())) 5554 5627 return JSValue::encode(jsUndefined()); 5555 5628 auto opt2 = state->argument(2).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(2), NormalConversion); 5556 if (UNLIKELY( state->hadException()))5629 if (UNLIKELY(throwScope.exception())) 5557 5630 return JSValue::encode(jsUndefined()); 5558 5631 impl.methodWithNonOptionalArgAndTwoOptionalArgs(WTFMove(nonOpt), WTFMove(opt1), WTFMove(opt2)); … … 5572 5645 auto& impl = castedThis->wrapped(); 5573 5646 auto str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toWTFString(state); 5574 if (UNLIKELY( state->hadException()))5647 if (UNLIKELY(throwScope.exception())) 5575 5648 return JSValue::encode(jsUndefined()); 5576 5649 impl.methodWithOptionalString(WTFMove(str)); … … 5590 5663 auto& impl = castedThis->wrapped(); 5591 5664 auto str = state->argument(0).isUndefined() ? String() : valueToUSVString(state, state->uncheckedArgument(0)); 5592 if (UNLIKELY( state->hadException()))5665 if (UNLIKELY(throwScope.exception())) 5593 5666 return JSValue::encode(jsUndefined()); 5594 5667 impl.methodWithOptionalUSVString(WTFMove(str)); … … 5608 5681 auto& impl = castedThis->wrapped(); 5609 5682 auto str = state->argument(0).isUndefined() ? nullAtom : state->uncheckedArgument(0).toString(state)->toAtomicString(state); 5610 if (UNLIKELY( state->hadException()))5683 if (UNLIKELY(throwScope.exception())) 5611 5684 return JSValue::encode(jsUndefined()); 5612 5685 impl.methodWithOptionalAtomicString(WTFMove(str)); … … 5626 5699 auto& impl = castedThis->wrapped(); 5627 5700 auto str = state->argument(0).isUndefined() ? ASCIILiteral("foo") : state->uncheckedArgument(0).toWTFString(state); 5628 if (UNLIKELY( state->hadException()))5701 if (UNLIKELY(throwScope.exception())) 5629 5702 return JSValue::encode(jsUndefined()); 5630 5703 impl.methodWithOptionalStringAndDefaultValue(WTFMove(str)); … … 5644 5717 auto& impl = castedThis->wrapped(); 5645 5718 auto str = state->argument(0).isUndefined() ? AtomicString("foo", AtomicString::ConstructFromLiteral) : state->uncheckedArgument(0).toString(state)->toAtomicString(state); 5646 if (UNLIKELY( state->hadException()))5719 if (UNLIKELY(throwScope.exception())) 5647 5720 return JSValue::encode(jsUndefined()); 5648 5721 impl.methodWithOptionalAtomicStringAndDefaultValue(WTFMove(str)); … … 5662 5735 auto& impl = castedThis->wrapped(); 5663 5736 auto str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toWTFString(state); 5664 if (UNLIKELY( state->hadException()))5737 if (UNLIKELY(throwScope.exception())) 5665 5738 return JSValue::encode(jsUndefined()); 5666 5739 impl.methodWithOptionalStringIsNull(WTFMove(str)); … … 5680 5753 auto& impl = castedThis->wrapped(); 5681 5754 auto str = state->argument(0).toWTFString(state); 5682 if (UNLIKELY( state->hadException()))5755 if (UNLIKELY(throwScope.exception())) 5683 5756 return JSValue::encode(jsUndefined()); 5684 5757 impl.methodWithOptionalStringIsUndefined(WTFMove(str)); … … 5698 5771 auto& impl = castedThis->wrapped(); 5699 5772 auto str = state->argument(0).isUndefined() ? nullAtom : state->uncheckedArgument(0).toString(state)->toAtomicString(state); 5700 if (UNLIKELY( state->hadException()))5773 if (UNLIKELY(throwScope.exception())) 5701 5774 return JSValue::encode(jsUndefined()); 5702 5775 impl.methodWithOptionalAtomicStringIsNull(WTFMove(str)); … … 5716 5789 auto& impl = castedThis->wrapped(); 5717 5790 auto str = state->argument(0).isUndefined() ? emptyString() : state->uncheckedArgument(0).toWTFString(state); 5718 if (UNLIKELY( state->hadException()))5791 if (UNLIKELY(throwScope.exception())) 5719 5792 return JSValue::encode(jsUndefined()); 5720 5793 impl.methodWithOptionalStringIsEmptyString(WTFMove(str)); … … 5734 5807 auto& impl = castedThis->wrapped(); 5735 5808 auto str = state->argument(0).isUndefined() ? emptyString() : valueToUSVString(state, state->uncheckedArgument(0)); 5736 if (UNLIKELY( state->hadException()))5809 if (UNLIKELY(throwScope.exception())) 5737 5810 return JSValue::encode(jsUndefined()); 5738 5811 impl.methodWithOptionalUSVStringIsEmptyString(WTFMove(str)); … … 5752 5825 auto& impl = castedThis->wrapped(); 5753 5826 auto str = state->argument(0).isUndefined() ? emptyAtom : state->uncheckedArgument(0).toString(state)->toAtomicString(state); 5754 if (UNLIKELY( state->hadException()))5827 if (UNLIKELY(throwScope.exception())) 5755 5828 return JSValue::encode(jsUndefined()); 5756 5829 impl.methodWithOptionalAtomicStringIsEmptyString(WTFMove(str)); … … 5770 5843 auto& impl = castedThis->wrapped(); 5771 5844 auto number = convert<double>(*state, state->argument(0), ShouldAllowNonFinite::Yes); 5772 if (UNLIKELY( state->hadException()))5845 if (UNLIKELY(throwScope.exception())) 5773 5846 return JSValue::encode(jsUndefined()); 5774 5847 impl.methodWithOptionalDoubleIsNaN(WTFMove(number)); … … 5788 5861 auto& impl = castedThis->wrapped(); 5789 5862 auto number = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes); 5790 if (UNLIKELY( state->hadException()))5863 if (UNLIKELY(throwScope.exception())) 5791 5864 return JSValue::encode(jsUndefined()); 5792 5865 impl.methodWithOptionalFloatIsNaN(WTFMove(number)); … … 5806 5879 auto& impl = castedThis->wrapped(); 5807 5880 auto number = state->argument(0).isUndefined() ? Optional<int64_t>() : convert<int64_t>(*state, state->uncheckedArgument(0), NormalConversion); 5808 if (UNLIKELY( state->hadException()))5881 if (UNLIKELY(throwScope.exception())) 5809 5882 return JSValue::encode(jsUndefined()); 5810 5883 impl.methodWithOptionalLongLong(WTFMove(number)); … … 5824 5897 auto& impl = castedThis->wrapped(); 5825 5898 auto number = convert<int64_t>(*state, state->argument(0), NormalConversion); 5826 if (UNLIKELY( state->hadException()))5899 if (UNLIKELY(throwScope.exception())) 5827 5900 return JSValue::encode(jsUndefined()); 5828 5901 impl.methodWithOptionalLongLongIsZero(WTFMove(number)); … … 5842 5915 auto& impl = castedThis->wrapped(); 5843 5916 auto number = state->argument(0).isUndefined() ? Optional<uint64_t>() : convert<uint64_t>(*state, state->uncheckedArgument(0), NormalConversion); 5844 if (UNLIKELY( state->hadException()))5917 if (UNLIKELY(throwScope.exception())) 5845 5918 return JSValue::encode(jsUndefined()); 5846 5919 impl.methodWithOptionalUnsignedLongLong(WTFMove(number)); … … 5860 5933 auto& impl = castedThis->wrapped(); 5861 5934 auto number = convert<uint64_t>(*state, state->argument(0), NormalConversion); 5862 if (UNLIKELY( state->hadException()))5935 if (UNLIKELY(throwScope.exception())) 5863 5936 return JSValue::encode(jsUndefined()); 5864 5937 impl.methodWithOptionalUnsignedLongLongIsZero(WTFMove(number)); … … 5878 5951 auto& impl = castedThis->wrapped(); 5879 5952 auto array = state->argument(0).isUndefined() ? Optional<Vector<String>>() : toNativeArray<String>(*state, state->uncheckedArgument(0)); 5880 if (UNLIKELY( state->hadException()))5953 if (UNLIKELY(throwScope.exception())) 5881 5954 return JSValue::encode(jsUndefined()); 5882 5955 impl.methodWithOptionalSequence(WTFMove(array)); … … 5896 5969 auto& impl = castedThis->wrapped(); 5897 5970 auto array = state->argument(0).isUndefined() ? Vector<String>() : toNativeArray<String>(*state, state->uncheckedArgument(0)); 5898 if (UNLIKELY( state->hadException()))5971 if (UNLIKELY(throwScope.exception())) 5899 5972 return JSValue::encode(jsUndefined()); 5900 5973 impl.methodWithOptionalSequenceIsEmpty(WTFMove(array)); … … 5914 5987 auto& impl = castedThis->wrapped(); 5915 5988 auto b = state->argument(0).isUndefined() ? Optional<bool>() : state->uncheckedArgument(0).toBoolean(state); 5916 if (UNLIKELY( state->hadException()))5989 if (UNLIKELY(throwScope.exception())) 5917 5990 return JSValue::encode(jsUndefined()); 5918 5991 impl.methodWithOptionalBoolean(WTFMove(b)); … … 5932 6005 auto& impl = castedThis->wrapped(); 5933 6006 auto b = state->argument(0).toBoolean(state); 5934 if (UNLIKELY( state->hadException()))6007 if (UNLIKELY(throwScope.exception())) 5935 6008 return JSValue::encode(jsUndefined()); 5936 6009 impl.methodWithOptionalBooleanIsFalse(WTFMove(b)); … … 6010 6083 if (!state->argument(0).isUndefinedOrNull()) { 6011 6084 resolver = JSXPathNSResolver::toWrapped(*state, state->uncheckedArgument(0)); 6012 if (UNLIKELY( state->hadException()))6085 if (UNLIKELY(throwScope.exception())) 6013 6086 return JSValue::encode(jsUndefined()); 6014 6087 if (UNLIKELY(!resolver)) … … 6053 6126 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6054 6127 auto nonCallback = convert<int32_t>(*state, state->argument(0), NormalConversion); 6055 if (UNLIKELY( state->hadException()))6128 if (UNLIKELY(throwScope.exception())) 6056 6129 return JSValue::encode(jsUndefined()); 6057 6130 if (UNLIKELY(!state->argument(1).isObject())) … … 6117 6190 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6118 6191 auto nonCallback = convert<int32_t>(*state, state->argument(0), NormalConversion); 6119 if (UNLIKELY( state->hadException()))6192 if (UNLIKELY(throwScope.exception())) 6120 6193 return JSValue::encode(jsUndefined()); 6121 6194 if (UNLIKELY(!state->argument(1).isFunction())) … … 6250 6323 } 6251 6324 auto strArg = state->argument(1).toWTFString(state); 6252 if (UNLIKELY( state->hadException()))6325 if (UNLIKELY(throwScope.exception())) 6253 6326 return JSValue::encode(jsUndefined()); 6254 6327 impl.overloadedMethod(WTFMove(objArg), WTFMove(strArg)); … … 6276 6349 } 6277 6350 auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion); 6278 if (UNLIKELY( state->hadException()))6351 if (UNLIKELY(throwScope.exception())) 6279 6352 return JSValue::encode(jsUndefined()); 6280 6353 impl.overloadedMethod(WTFMove(objArg), WTFMove(longArg)); … … 6296 6369 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6297 6370 auto strArg = state->argument(0).toWTFString(state); 6298 if (UNLIKELY( state->hadException()))6371 if (UNLIKELY(throwScope.exception())) 6299 6372 return JSValue::encode(jsUndefined()); 6300 6373 impl.overloadedMethod(WTFMove(strArg)); … … 6316 6389 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6317 6390 auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion); 6318 if (UNLIKELY( state->hadException()))6391 if (UNLIKELY(throwScope.exception())) 6319 6392 return JSValue::encode(jsUndefined()); 6320 6393 impl.overloadedMethod(WTFMove(longArg)); … … 6379 6452 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6380 6453 auto arrayArg = toNativeArray<String>(*state, state->argument(0)); 6381 if (UNLIKELY( state->hadException()))6454 if (UNLIKELY(throwScope.exception())) 6382 6455 return JSValue::encode(jsUndefined()); 6383 6456 impl.overloadedMethod(WTFMove(arrayArg)); … … 6419 6492 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6420 6493 auto arrayArg = toNativeArray<String>(*state, state->argument(0)); 6421 if (UNLIKELY( state->hadException()))6494 if (UNLIKELY(throwScope.exception())) 6422 6495 return JSValue::encode(jsUndefined()); 6423 6496 impl.overloadedMethod(WTFMove(arrayArg)); … … 6439 6512 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6440 6513 auto arrayArg = toNativeArray<uint32_t>(*state, state->argument(0)); 6441 if (UNLIKELY( state->hadException()))6514 if (UNLIKELY(throwScope.exception())) 6442 6515 return JSValue::encode(jsUndefined()); 6443 6516 impl.overloadedMethod(WTFMove(arrayArg)); … … 6459 6532 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6460 6533 auto strArg = state->argument(0).toWTFString(state); 6461 if (UNLIKELY( state->hadException()))6534 if (UNLIKELY(throwScope.exception())) 6462 6535 return JSValue::encode(jsUndefined()); 6463 6536 impl.overloadedMethod(WTFMove(strArg)); … … 6541 6614 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6542 6615 auto strArg = state->argument(0).toWTFString(state); 6543 if (UNLIKELY( state->hadException()))6616 if (UNLIKELY(throwScope.exception())) 6544 6617 return JSValue::encode(jsUndefined()); 6545 6618 TestObj* objArg = nullptr; … … 6573 6646 } 6574 6647 auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion); 6575 if (UNLIKELY( state->hadException()))6648 if (UNLIKELY(throwScope.exception())) 6576 6649 return JSValue::encode(jsUndefined()); 6577 6650 impl.overloadedMethodWithOptionalParameter(WTFMove(objArg), WTFMove(longArg)); … … 6619 6692 UNUSED_PARAM(throwScope); 6620 6693 auto arg = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion); 6621 if (UNLIKELY( state->hadException()))6694 if (UNLIKELY(throwScope.exception())) 6622 6695 return JSValue::encode(jsUndefined()); 6623 6696 JSValue result = jsNumber(TestObj::classMethodWithOptional(WTFMove(arg))); … … 6644 6717 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6645 6718 auto arg = convert<int32_t>(*state, state->argument(0), NormalConversion); 6646 if (UNLIKELY( state->hadException()))6719 if (UNLIKELY(throwScope.exception())) 6647 6720 return JSValue::encode(jsUndefined()); 6648 6721 TestObj::overloadedMethod1(WTFMove(arg)); … … 6661 6734 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6662 6735 auto type = state->argument(0).toWTFString(state); 6663 if (UNLIKELY( state->hadException()))6736 if (UNLIKELY(throwScope.exception())) 6664 6737 return JSValue::encode(jsUndefined()); 6665 6738 TestObj::overloadedMethod1(WTFMove(type)); … … 6704 6777 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6705 6778 auto objArgsShort = convert<uint16_t>(*state, state->argument(0), Clamp); 6706 if (UNLIKELY( state->hadException()))6779 if (UNLIKELY(throwScope.exception())) 6707 6780 return JSValue::encode(jsUndefined()); 6708 6781 auto objArgsLong = convert<uint32_t>(*state, state->argument(1), Clamp); 6709 if (UNLIKELY( state->hadException()))6782 if (UNLIKELY(throwScope.exception())) 6710 6783 return JSValue::encode(jsUndefined()); 6711 6784 impl.classMethodWithClamp(WTFMove(objArgsShort), WTFMove(objArgsLong)); … … 6727 6800 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6728 6801 auto objArgsShort = convert<uint16_t>(*state, state->argument(0), EnforceRange); 6729 if (UNLIKELY( state->hadException()))6802 if (UNLIKELY(throwScope.exception())) 6730 6803 return JSValue::encode(jsUndefined()); 6731 6804 auto objArgsLong = convert<uint32_t>(*state, state->argument(1), EnforceRange); 6732 if (UNLIKELY( state->hadException()))6805 if (UNLIKELY(throwScope.exception())) 6733 6806 return JSValue::encode(jsUndefined()); 6734 6807 impl.classMethodWithEnforceRange(WTFMove(objArgsShort), WTFMove(objArgsLong)); … … 6750 6823 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6751 6824 auto unsignedLongSequence = toNativeArray<uint32_t>(*state, state->argument(0)); 6752 if (UNLIKELY( state->hadException()))6825 if (UNLIKELY(throwScope.exception())) 6753 6826 return JSValue::encode(jsUndefined()); 6754 6827 impl.methodWithUnsignedLongSequence(WTFMove(unsignedLongSequence)); … … 6771 6844 ExceptionCode ec = 0; 6772 6845 auto values = toNativeArray<String>(*state, state->argument(0)); 6773 if (UNLIKELY( state->hadException()))6846 if (UNLIKELY(throwScope.exception())) 6774 6847 return JSValue::encode(jsUndefined()); 6775 6848 JSValue result = jsArray(state, castedThis->globalObject(), impl.stringArrayFunction(WTFMove(values), ec)); … … 6816 6889 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6817 6890 auto arrayArg = toNativeArray<uint32_t>(*state, state->argument(0)); 6818 if (UNLIKELY( state->hadException()))6891 if (UNLIKELY(throwScope.exception())) 6819 6892 return JSValue::encode(jsUndefined()); 6820 6893 auto nullableArrayArg = toNativeArray<uint32_t>(*state, state->argument(1)); 6821 if (UNLIKELY( state->hadException()))6894 if (UNLIKELY(throwScope.exception())) 6822 6895 return JSValue::encode(jsUndefined()); 6823 6896 impl.methodWithAndWithoutNullableSequence(WTFMove(arrayArg), WTFMove(nullableArrayArg)); … … 6839 6912 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6840 6913 auto elementId = AtomicString(state->argument(0).toString(state)->toExistingAtomicString(state)); 6841 if (UNLIKELY( state->hadException()))6914 if (UNLIKELY(throwScope.exception())) 6842 6915 return JSValue::encode(jsUndefined()); 6843 6916 JSValue result = toJS(state, castedThis->globalObject(), impl.getElementById(WTFMove(elementId))); … … 6922 6995 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6923 6996 auto value = state->argument(0).toWTFString(state); 6924 if (UNLIKELY( state->hadException()))6997 if (UNLIKELY(throwScope.exception())) 6925 6998 return JSValue::encode(jsUndefined()); 6926 6999 impl.convert3(WTFMove(value)); … … 6942 7015 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 6943 7016 auto value = valueToStringWithUndefinedOrNullCheck(state, state->argument(0)); 6944 if (UNLIKELY( state->hadException()))7017 if (UNLIKELY(throwScope.exception())) 6945 7018 return JSValue::encode(jsUndefined()); 6946 7019 impl.convert4(WTFMove(value)); … … 7007 7080 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7008 7081 auto head = state->argument(0).toWTFString(state); 7009 if (UNLIKELY( state->hadException()))7082 if (UNLIKELY(throwScope.exception())) 7010 7083 return JSValue::encode(jsUndefined()); 7011 7084 auto tail = toArguments<VariadicHelper<JSC::JSValue, String>>(*state, 1); 7012 if (UNLIKELY( state->hadException()))7085 if (UNLIKELY(throwScope.exception())) 7013 7086 return JSValue::encode(jsUndefined()); 7014 7087 impl.variadicStringMethod(WTFMove(head), WTFMove(*tail.second)); … … 7030 7103 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7031 7104 auto head = convert<double>(*state, state->argument(0), ShouldAllowNonFinite::Yes); 7032 if (UNLIKELY( state->hadException()))7105 if (UNLIKELY(throwScope.exception())) 7033 7106 return JSValue::encode(jsUndefined()); 7034 7107 auto tail = toArguments<VariadicHelper<JSC::JSValue, double>>(*state, 1); 7035 if (UNLIKELY( state->hadException()))7108 if (UNLIKELY(throwScope.exception())) 7036 7109 return JSValue::encode(jsUndefined()); 7037 7110 impl.variadicDoubleMethod(WTFMove(head), WTFMove(*tail.second)); … … 7076 7149 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7077 7150 auto a = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes); 7078 if (UNLIKELY( state->hadException()))7151 if (UNLIKELY(throwScope.exception())) 7079 7152 return JSValue::encode(jsUndefined()); 7080 7153 auto b = convert<int32_t>(*state, state->argument(1), NormalConversion); 7081 if (UNLIKELY( state->hadException()))7154 if (UNLIKELY(throwScope.exception())) 7082 7155 return JSValue::encode(jsUndefined()); 7083 7156 impl.any(WTFMove(a), WTFMove(b)); … … 7126 7199 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7127 7200 auto a = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::No); 7128 if (UNLIKELY( state->hadException()))7201 if (UNLIKELY(throwScope.exception())) 7129 7202 return JSValue::encode(jsUndefined()); 7130 7203 impl.testPromiseFunctionWithFloatArgument(WTFMove(a), DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred)); … … 7173 7246 auto& impl = castedThis->wrapped(); 7174 7247 auto a = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion); 7175 if (UNLIKELY( state->hadException()))7248 if (UNLIKELY(throwScope.exception())) 7176 7249 return JSValue::encode(jsUndefined()); 7177 7250 impl.testPromiseFunctionWithOptionalIntArgument(WTFMove(a), DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred)); … … 7199 7272 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7200 7273 auto a = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::No); 7201 if (UNLIKELY( state->hadException()))7274 if (UNLIKELY(throwScope.exception())) 7202 7275 return JSValue::encode(jsUndefined()); 7203 7276 impl.testPromiseOverloadedFunction(WTFMove(a), DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred)); … … 7313 7386 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7314 7387 auto str = state->argument(0).toWTFString(state); 7315 if (UNLIKELY( state->hadException()))7388 if (UNLIKELY(throwScope.exception())) 7316 7389 return JSValue::encode(jsUndefined()); 7317 7390 impl.conditionalOverload(WTFMove(str)); … … 7336 7409 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7337 7410 auto a = convert<int32_t>(*state, state->argument(0), NormalConversion); 7338 if (UNLIKELY( state->hadException()))7411 if (UNLIKELY(throwScope.exception())) 7339 7412 return JSValue::encode(jsUndefined()); 7340 7413 impl.conditionalOverload(WTFMove(a)); … … 7379 7452 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7380 7453 auto str = state->argument(0).toWTFString(state); 7381 if (UNLIKELY( state->hadException()))7454 if (UNLIKELY(throwScope.exception())) 7382 7455 return JSValue::encode(jsUndefined()); 7383 7456 impl.singleConditionalOverload(WTFMove(str)); … … 7400 7473 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7401 7474 auto a = convert<int32_t>(*state, state->argument(0), NormalConversion); 7402 if (UNLIKELY( state->hadException()))7475 if (UNLIKELY(throwScope.exception())) 7403 7476 return JSValue::encode(jsUndefined()); 7404 7477 impl.singleConditionalOverload(WTFMove(a)); … … 7439 7512 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7440 7513 auto init = convertDictionary<TestObj::Dictionary>(*state, state->argument(0)); 7441 if (UNLIKELY( state->hadException()))7514 if (UNLIKELY(throwScope.exception())) 7442 7515 return JSValue::encode(jsUndefined()); 7443 7516 impl.attachShadowRoot(init.value()); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
r205542 r205569 76 76 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 77 77 auto arrayBuffer = toArrayBuffer(state->argument(0)); 78 if (UNLIKELY( state->hadException()))78 if (UNLIKELY(throwScope.exception())) 79 79 return JSValue::encode(jsUndefined()); 80 80 if (UNLIKELY(!arrayBuffer)) … … 94 94 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 95 95 auto arrayBufferView = toArrayBufferView(state->argument(0)); 96 if (UNLIKELY( state->hadException()))96 if (UNLIKELY(throwScope.exception())) 97 97 return JSValue::encode(jsUndefined()); 98 98 if (UNLIKELY(!arrayBufferView)) … … 128 128 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 129 129 auto string = state->argument(0).toWTFString(state); 130 if (UNLIKELY( state->hadException()))130 if (UNLIKELY(throwScope.exception())) 131 131 return JSValue::encode(jsUndefined()); 132 132 auto object = TestOverloadedConstructors::create(WTFMove(string)); … … 142 142 ASSERT(castedThis); 143 143 auto longArgs = toArguments<VariadicHelper<JSC::JSValue, int32_t>>(*state, 0); 144 if (UNLIKELY( state->hadException()))144 if (UNLIKELY(throwScope.exception())) 145 145 return JSValue::encode(jsUndefined()); 146 146 auto object = TestOverloadedConstructors::create(WTFMove(longArgs)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp
r205458 r205569 73 73 ASSERT(castedThis); 74 74 auto sequenceOfStrings = state->argument(0).isUndefined() ? Vector<String>() : toNativeArray<String>(*state, state->uncheckedArgument(0)); 75 if (UNLIKELY( state->hadException()))75 if (UNLIKELY(throwScope.exception())) 76 76 return JSValue::encode(jsUndefined()); 77 77 auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(sequenceOfStrings)); … … 89 89 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 90 90 auto string = state->argument(0).toWTFString(state); 91 if (UNLIKELY( state->hadException()))91 if (UNLIKELY(throwScope.exception())) 92 92 return JSValue::encode(jsUndefined()); 93 93 auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(string)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp
r205458 r205569 211 211 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 212 212 auto name = state->argument(0).toWTFString(state); 213 if (UNLIKELY( state->hadException()))213 if (UNLIKELY(throwScope.exception())) 214 214 return JSValue::encode(jsUndefined()); 215 215 JSValue result = toJS(state, castedThis->globalObject(), impl.namedItem(WTFMove(name))); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
r205458 r205569 252 252 VM& vm = state->vm(); 253 253 auto throwScope = DECLARE_THROW_SCOPE(vm); 254 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 254 UNUSED_PARAM(throwScope); 255 JSValue value = JSValue::decode(encodedValue); 255 256 UNUSED_PARAM(thisValue); 256 257 JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue)); … … 260 261 auto& impl = castedThis->wrapped(); 261 262 auto nativeValue = SerializedScriptValue::create(state, value, 0, 0); 262 if (UNLIKELY( state->hadException()))263 if (UNLIKELY(throwScope.exception())) 263 264 return false; 264 265 impl.setValue(WTFMove(nativeValue)); … … 271 272 VM& vm = state->vm(); 272 273 auto throwScope = DECLARE_THROW_SCOPE(vm); 273 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 274 UNUSED_PARAM(throwScope); 275 JSValue value = JSValue::decode(encodedValue); 274 276 UNUSED_PARAM(thisValue); 275 277 JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue)); … … 279 281 auto& impl = castedThis->wrapped(); 280 282 auto nativeValue = SerializedScriptValue::create(state, value, 0, 0); 281 if (UNLIKELY( state->hadException()))283 if (UNLIKELY(throwScope.exception())) 282 284 return false; 283 285 impl.setCachedValue(WTFMove(nativeValue)); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
r205458 r205569 133 133 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 134 134 auto hello = state->argument(0).toWTFString(state); 135 if (UNLIKELY( state->hadException()))135 if (UNLIKELY(throwScope.exception())) 136 136 return JSValue::encode(jsUndefined()); 137 137 if (UNLIKELY(!state->argument(1).isObject())) … … 361 361 VM& vm = state->vm(); 362 362 auto throwScope = DECLARE_THROW_SCOPE(vm); 363 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 363 UNUSED_PARAM(throwScope); 364 JSValue value = JSValue::decode(encodedValue); 364 365 UNUSED_PARAM(thisValue); 365 366 JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue)); … … 369 370 auto& impl = castedThis->wrapped(); 370 371 auto nativeValue = convert<uint64_t>(*state, value, NormalConversion); 371 if (UNLIKELY( state->hadException()))372 if (UNLIKELY(throwScope.exception())) 372 373 return false; 373 374 impl.setUnsignedLongLongAttr(WTFMove(nativeValue)); … … 380 381 VM& vm = state->vm(); 381 382 auto throwScope = DECLARE_THROW_SCOPE(vm); 382 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 383 UNUSED_PARAM(throwScope); 384 JSValue value = JSValue::decode(encodedValue); 383 385 UNUSED_PARAM(thisValue); 384 386 JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue)); … … 388 390 auto& impl = castedThis->wrapped(); 389 391 auto nativeValue = SerializedScriptValue::create(state, value, 0, 0); 390 if (UNLIKELY( state->hadException()))392 if (UNLIKELY(throwScope.exception())) 391 393 return false; 392 394 impl.setImmutableSerializedScriptValue(WTFMove(nativeValue)); … … 399 401 VM& vm = state->vm(); 400 402 auto throwScope = DECLARE_THROW_SCOPE(vm); 401 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 403 UNUSED_PARAM(throwScope); 404 JSValue value = JSValue::decode(encodedValue); 402 405 UNUSED_PARAM(thisValue); 403 406 JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue)); … … 407 410 auto& impl = castedThis->wrapped(); 408 411 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 409 if (UNLIKELY( state->hadException()))412 if (UNLIKELY(throwScope.exception())) 410 413 return false; 411 414 impl.setAttrWithGetterException(WTFMove(nativeValue)); … … 418 421 VM& vm = state->vm(); 419 422 auto throwScope = DECLARE_THROW_SCOPE(vm); 420 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 423 UNUSED_PARAM(throwScope); 424 JSValue value = JSValue::decode(encodedValue); 421 425 UNUSED_PARAM(thisValue); 422 426 JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue)); … … 427 431 ExceptionCode ec = 0; 428 432 auto nativeValue = convert<int32_t>(*state, value, NormalConversion); 429 if (UNLIKELY( state->hadException()))433 if (UNLIKELY(throwScope.exception())) 430 434 return false; 431 435 impl.setAttrWithSetterException(WTFMove(nativeValue), ec); … … 439 443 VM& vm = state->vm(); 440 444 auto throwScope = DECLARE_THROW_SCOPE(vm); 441 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 445 UNUSED_PARAM(throwScope); 446 JSValue value = JSValue::decode(encodedValue); 442 447 UNUSED_PARAM(thisValue); 443 448 JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue)); … … 447 452 auto& impl = castedThis->wrapped(); 448 453 auto nativeValue = value.toWTFString(state); 449 if (UNLIKELY( state->hadException()))454 if (UNLIKELY(throwScope.exception())) 450 455 return false; 451 456 impl.setStringAttrWithGetterException(WTFMove(nativeValue)); … … 458 463 VM& vm = state->vm(); 459 464 auto throwScope = DECLARE_THROW_SCOPE(vm); 460 UNUSED_PARAM(throwScope); JSValue value = JSValue::decode(encodedValue); 465 UNUSED_PARAM(throwScope); 466 JSValue value = JSValue::decode(encodedValue); 461 467 UNUSED_PARAM(thisValue); 462 468 JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue)); … … 467 473 ExceptionCode ec = 0; 468 474 auto nativeValue = value.toWTFString(state); 469 if (UNLIKELY( state->hadException()))475 if (UNLIKELY(throwScope.exception())) 470 476 return false; 471 477 impl.setStringAttrWithSetterException(WTFMove(nativeValue), ec); … … 492 498 auto& impl = castedThis->wrapped(); 493 499 auto x = state->argument(0).isUndefined() ? Vector<int32_t>() : toNativeArray<int32_t>(*state, state->uncheckedArgument(0)); 494 if (UNLIKELY( state->hadException()))500 if (UNLIKELY(throwScope.exception())) 495 501 return JSValue::encode(jsUndefined()); 496 502 impl.func(WTFMove(x)); … … 512 518 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 513 519 auto width = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes); 514 if (UNLIKELY( state->hadException()))520 if (UNLIKELY(throwScope.exception())) 515 521 return JSValue::encode(jsUndefined()); 516 522 auto height = convert<float>(*state, state->argument(1), ShouldAllowNonFinite::Yes); 517 if (UNLIKELY( state->hadException()))523 if (UNLIKELY(throwScope.exception())) 518 524 return JSValue::encode(jsUndefined()); 519 525 auto blur = convert<float>(*state, state->argument(2), ShouldAllowNonFinite::Yes); 520 if (UNLIKELY( state->hadException()))526 if (UNLIKELY(throwScope.exception())) 521 527 return JSValue::encode(jsUndefined()); 522 528 auto color = state->argument(3).isUndefined() ? String() : state->uncheckedArgument(3).toWTFString(state); 523 if (UNLIKELY( state->hadException()))529 if (UNLIKELY(throwScope.exception())) 524 530 return JSValue::encode(jsUndefined()); 525 531 auto alpha = state->argument(4).isUndefined() ? Optional<float>() : convert<float>(*state, state->uncheckedArgument(4), ShouldAllowNonFinite::Yes); 526 if (UNLIKELY( state->hadException()))532 if (UNLIKELY(throwScope.exception())) 527 533 return JSValue::encode(jsUndefined()); 528 534 impl.setShadow(WTFMove(width), WTFMove(height), WTFMove(blur), WTFMove(color), WTFMove(alpha)); … … 544 550 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 545 551 auto sequenceArg = toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(*state, state->argument(0)); 546 if (UNLIKELY( state->hadException()))552 if (UNLIKELY(throwScope.exception())) 547 553 return JSValue::encode(jsUndefined()); 548 554 JSValue result = jsNumber(impl.methodWithSequenceArg(WTFMove(sequenceArg))); … … 564 570 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 565 571 auto sequenceArg = toNativeArray<String>(*state, state->argument(0)); 566 if (UNLIKELY( state->hadException()))572 if (UNLIKELY(throwScope.exception())) 567 573 return JSValue::encode(jsUndefined()); 568 574 impl.nullableSequenceArg(WTFMove(sequenceArg)); … … 584 590 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 585 591 auto arg1 = convert<uint64_t>(*state, state->argument(0), Clamp); 586 if (UNLIKELY( state->hadException()))592 if (UNLIKELY(throwScope.exception())) 587 593 return JSValue::encode(jsUndefined()); 588 594 auto arg2 = state->argument(1).isUndefined() ? Optional<uint64_t>() : convert<uint64_t>(*state, state->uncheckedArgument(1), Clamp); 589 if (UNLIKELY( state->hadException()))595 if (UNLIKELY(throwScope.exception())) 590 596 return JSValue::encode(jsUndefined()); 591 597 impl.funcWithClamp(WTFMove(arg1), WTFMove(arg2)); … … 623 629 ExceptionCode ec = 0; 624 630 auto values = toNativeArray<String>(*state, state->argument(0)); 625 if (UNLIKELY( state->hadException()))631 if (UNLIKELY(throwScope.exception())) 626 632 return JSValue::encode(jsUndefined()); 627 633 JSValue result = jsArray(state, castedThis->globalObject(), impl.stringSequenceFunction(WTFMove(values), ec)); … … 646 652 ExceptionCode ec = 0; 647 653 auto values = toNativeArray<String>(*state, state->argument(0)); 648 if (UNLIKELY( state->hadException()))654 if (UNLIKELY(throwScope.exception())) 649 655 return JSValue::encode(jsUndefined()); 650 656 JSValue result = jsArray(state, castedThis->globalObject(), impl.stringSequenceFunction2(WTFMove(values), ec)); … … 668 674 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 669 675 auto sequenceArg = toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(*state, state->argument(0)); 670 if (UNLIKELY( state->hadException()))676 if (UNLIKELY(throwScope.exception())) 671 677 return JSValue::encode(jsUndefined()); 672 678 JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(WTFMove(sequenceArg))); -
trunk/Source/WebCore/bridge/NP_jsobject.cpp
r197614 r205569 178 178 return false; 179 179 180 ExecState* exec = rootObject->globalObject()->globalExec(); 181 JSLockHolder lock(exec); 180 auto globalObject = rootObject->globalObject(); 181 VM& vm = globalObject->vm(); 182 JSLockHolder lock(vm); 183 auto scope = DECLARE_CATCH_SCOPE(vm); 184 185 ExecState* exec = globalObject->globalExec(); 182 186 183 187 // Call the function object. … … 194 198 // Convert and return the result of the function call. 195 199 convertValueToNPVariant(exec, resultV, result); 196 exec->clearException();200 scope.clearException(); 197 201 return true; 198 202 } … … 226 230 if (!rootObject || !rootObject->isValid()) 227 231 return false; 228 ExecState* exec = rootObject->globalObject()->globalExec(); 229 JSLockHolder lock(exec); 232 233 auto globalObject = rootObject->globalObject(); 234 VM& vm = globalObject->vm(); 235 JSLockHolder lock(vm); 236 auto scope = DECLARE_CATCH_SCOPE(vm); 237 238 ExecState* exec = globalObject->globalExec(); 230 239 JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string())); 231 240 CallData callData; … … 241 250 // Convert and return the result of the function call. 242 251 convertValueToNPVariant(exec, resultV, result); 243 exec->clearException();252 scope.clearException(); 244 253 return true; 245 254 } … … 261 270 return false; 262 271 263 ExecState* exec = rootObject->globalObject()->globalExec(); 264 JSLockHolder lock(exec); 272 auto globalObject = rootObject->globalObject(); 273 VM& vm = globalObject->vm(); 274 JSLockHolder lock(vm); 275 auto scope = DECLARE_CATCH_SCOPE(vm); 276 277 ExecState* exec = globalObject->globalExec(); 265 278 String scriptString = convertNPStringToUTF16(s); 266 279 267 JSValue returnValue = JSC::evaluate( rootObject->globalObject()->globalExec(), makeSource(scriptString), JSC::JSValue());280 JSValue returnValue = JSC::evaluate(exec, makeSource(scriptString), JSC::JSValue()); 268 281 269 282 convertValueToNPVariant(exec, returnValue, variant); 270 exec->clearException();283 scope.clearException(); 271 284 return true; 272 285 } … … 285 298 return false; 286 299 287 ExecState* exec = rootObject->globalObject()->globalExec(); 300 auto globalObject = rootObject->globalObject(); 301 VM& vm = globalObject->vm(); 302 JSLockHolder lock(vm); 303 auto scope = DECLARE_CATCH_SCOPE(vm); 304 305 ExecState* exec = globalObject->globalExec(); 288 306 IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); 289 307 290 JSLockHolder lock(exec);291 308 JSValue result; 292 309 if (i->isString()) … … 296 313 297 314 convertValueToNPVariant(exec, result, variant); 298 exec->clearException();315 scope.clearException(); 299 316 return true; 300 317 } … … 319 336 return false; 320 337 321 ExecState* exec = rootObject->globalObject()->globalExec(); 322 JSLockHolder lock(exec); 338 auto globalObject = rootObject->globalObject(); 339 VM& vm = globalObject->vm(); 340 JSLockHolder lock(vm); 341 auto scope = DECLARE_CATCH_SCOPE(vm); 342 343 ExecState* exec = globalObject->globalExec(); 323 344 IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); 324 345 … … 328 349 } else 329 350 obj->imp->methodTable()->putByIndex(obj->imp, exec, i->number(), convertNPVariantToValue(exec, variant, rootObject), false); 330 exec->clearException();351 scope.clearException(); 331 352 return true; 332 353 } … … 347 368 return false; 348 369 349 ExecState* exec = rootObject->globalObject()->globalExec(); 370 auto globalObject = rootObject->globalObject(); 371 VM& vm = globalObject->vm(); 372 JSLockHolder lock(vm); 373 auto scope = DECLARE_CATCH_SCOPE(vm); 374 375 ExecState* exec = globalObject->globalExec(); 376 350 377 IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); 351 378 if (i->isString()) { 352 379 if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string()))) { 353 exec->clearException();380 scope.clearException(); 354 381 return false; 355 382 } 356 383 } else { 357 384 if (!obj->imp->hasProperty(exec, i->number())) { 358 exec->clearException();385 scope.clearException(); 359 386 return false; 360 387 } 361 388 } 362 389 363 JSLockHolder lock(exec);364 390 if (i->isString()) 365 391 obj->imp->methodTable()->deleteProperty(obj->imp, exec, identifierFromNPIdentifier(exec, i->string())); … … 367 393 obj->imp->methodTable()->deletePropertyByIndex(obj->imp, exec, i->number()); 368 394 369 exec->clearException();395 scope.clearException(); 370 396 return true; 371 397 } … … 382 408 return false; 383 409 384 ExecState* exec = rootObject->globalObject()->globalExec(); 410 auto globalObject = rootObject->globalObject(); 411 VM& vm = globalObject->vm(); 412 JSLockHolder lock(vm); 413 auto scope = DECLARE_CATCH_SCOPE(vm); 414 415 ExecState* exec = globalObject->globalExec(); 385 416 IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); 386 JSLockHolder lock(exec);387 417 if (i->isString()) { 388 418 bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string())); 389 exec->clearException();419 scope.clearException(); 390 420 return result; 391 421 } 392 422 393 423 bool result = obj->imp->hasProperty(exec, i->number()); 394 exec->clearException();424 scope.clearException(); 395 425 return result; 396 426 } … … 415 445 return false; 416 446 417 ExecState* exec = rootObject->globalObject()->globalExec(); 418 JSLockHolder lock(exec); 447 auto globalObject = rootObject->globalObject(); 448 VM& vm = globalObject->vm(); 449 JSLockHolder lock(vm); 450 auto scope = DECLARE_CATCH_SCOPE(vm); 451 452 ExecState* exec = globalObject->globalExec(); 419 453 JSValue func = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string())); 420 exec->clearException();454 scope.clearException(); 421 455 return !func.isUndefined(); 422 456 } … … 444 478 return false; 445 479 446 ExecState* exec = rootObject->globalObject()->globalExec(); 447 JSLockHolder lock(exec); 480 auto globalObject = rootObject->globalObject(); 481 VM& vm = globalObject->vm(); 482 JSLockHolder lock(vm); 483 auto scope = DECLARE_CATCH_SCOPE(vm); 484 485 ExecState* exec = globalObject->globalExec(); 448 486 PropertyNameArray propertyNames(exec, PropertyNameMode::Strings); 449 487 … … 459 497 *count = size; 460 498 461 exec->clearException();499 scope.clearException(); 462 500 return true; 463 501 } … … 480 518 if (!rootObject || !rootObject->isValid()) 481 519 return false; 482 483 ExecState* exec = rootObject->globalObject()->globalExec(); 484 JSLockHolder lock(exec); 520 521 auto globalObject = rootObject->globalObject(); 522 VM& vm = globalObject->vm(); 523 JSLockHolder lock(vm); 524 auto scope = DECLARE_CATCH_SCOPE(vm); 525 526 ExecState* exec = globalObject->globalExec(); 485 527 486 528 // Call the constructor object. … … 497 539 // Convert and return the result. 498 540 convertValueToNPVariant(exec, resultV, result); 499 exec->clearException();541 scope.clearException(); 500 542 return true; 501 543 } -
trunk/Source/WebCore/bridge/c/c_instance.cpp
r205198 r205569 69 69 void CInstance::moveGlobalExceptionToExecState(ExecState* exec) 70 70 { 71 VM& vm = exec->vm();72 auto scope = DECLARE_THROW_SCOPE(vm);73 74 71 if (globalExceptionString().isNull()) 75 72 return; 76 73 77 74 { 78 JSLockHolder lock(exec); 75 VM& vm = exec->vm(); 76 JSLockHolder lock(vm); 77 auto scope = DECLARE_THROW_SCOPE(vm); 79 78 throwException(exec, scope, createError(exec, globalExceptionString())); 80 79 } -
trunk/Source/WebCore/bridge/objc/WebScriptObject.mm
r204717 r205569 43 43 #import <JavaScriptCore/JSValueInternal.h> 44 44 #import <interpreter/CallFrame.h> 45 #import <runtime/CatchScope.h> 45 46 #import <runtime/Completion.h> 46 47 #import <runtime/InitializeThreading.h> … … 130 131 static void addExceptionToConsole(ExecState* exec) 131 132 { 132 JSC::Exception* exception = exec->exception(); 133 exec->clearException(); 133 JSC::VM& vm = exec->vm(); 134 auto scope = DECLARE_CATCH_SCOPE(vm); 135 JSC::Exception* exception = scope.exception(); 136 scope.clearException(); 134 137 addExceptionToConsole(exec, exception); 135 138 } … … 335 338 336 339 // Look up the function object. 337 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 338 JSLockHolder lock(exec); 339 ASSERT(!exec->hadException()); 340 auto globalObject = [self _rootObject]->globalObject(); 341 auto& vm = globalObject->vm(); 342 JSLockHolder lock(vm); 343 auto scope = DECLARE_CATCH_SCOPE(vm); 344 ExecState* exec = globalObject->globalExec(); 345 UNUSED_PARAM(scope); 340 346 341 347 JSC::JSValue function = [self _imp]->get(exec, Identifier::fromString(exec, String(name))); … … 370 376 return nil; 371 377 372 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 373 ASSERT(!exec->hadException()); 374 375 JSLockHolder lock(exec); 378 auto globalObject = [self _rootObject]->globalObject(); 379 auto& vm = globalObject->vm(); 380 JSLockHolder lock(vm); 381 auto scope = DECLARE_CATCH_SCOPE(vm); 382 ExecState* exec = globalObject->globalExec(); 383 UNUSED_PARAM(scope); 376 384 377 385 JSC::JSValue returnValue = JSMainThreadExecState::profiledEvaluate(exec, JSC::ProfilingReason::Other, makeSource(String(script)), JSC::JSValue()); … … 387 395 return; 388 396 389 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 390 ASSERT(!exec->hadException()); 391 392 JSLockHolder lock(exec); 397 auto globalObject = [self _rootObject]->globalObject(); 398 auto& vm = globalObject->vm(); 399 JSLockHolder lock(vm); 400 auto scope = DECLARE_CATCH_SCOPE(vm); 401 ExecState* exec = globalObject->globalExec(); 402 393 403 JSObject* object = JSC::jsDynamicCast<JSObject*>([self _imp]); 394 404 PutPropertySlot slot(object); 395 405 object->methodTable()->put(object, exec, Identifier::fromString(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot); 396 406 397 if ( exec->hadException()) {407 if (UNLIKELY(scope.exception())) { 398 408 addExceptionToConsole(exec); 399 exec->clearException();409 scope.clearException(); 400 410 } 401 411 } … … 405 415 if (![self _isSafeScript]) 406 416 return nil; 407 408 ExecState* exec = [self _rootObject]->globalObject()->globalExec();409 ASSERT(!exec->hadException());410 417 411 418 id resultObj; 412 419 { 420 auto globalObject = [self _rootObject]->globalObject(); 421 auto& vm = globalObject->vm(); 422 413 423 // Need to scope this lock to ensure that we release the lock before calling 414 424 // [super valueForKey:key] which might throw an exception and bypass the JSLock destructor, 415 425 // leaving the lock permanently held 416 JSLockHolder lock(exec); 417 426 JSLockHolder lock(vm); 427 428 auto scope = DECLARE_CATCH_SCOPE(vm); 429 ExecState* exec = globalObject->globalExec(); 430 418 431 JSC::JSValue result = [self _imp]->get(exec, Identifier::fromString(exec, String(key))); 419 432 420 if ( exec->hadException()) {433 if (UNLIKELY(scope.exception())) { 421 434 addExceptionToConsole(exec); 422 435 result = jsUndefined(); 423 exec->clearException();436 scope.clearException(); 424 437 } 425 438 … … 438 451 return; 439 452 440 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 441 ASSERT(!exec->hadException()); 442 443 JSLockHolder lock(exec); 453 auto globalObject = [self _rootObject]->globalObject(); 454 auto& vm = globalObject->vm(); 455 JSLockHolder lock(vm); 456 auto scope = DECLARE_CATCH_SCOPE(vm); 457 ExecState* exec = globalObject->globalExec(); 458 444 459 [self _imp]->methodTable()->deleteProperty([self _imp], exec, Identifier::fromString(exec, String(key))); 445 460 446 if ( exec->hadException()) {461 if (UNLIKELY(scope.exception())) { 447 462 addExceptionToConsole(exec); 448 exec->clearException();463 scope.clearException(); 449 464 } 450 465 } … … 455 470 return NO; 456 471 457 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 458 ASSERT(!exec->hadException()); 459 460 JSLockHolder lock(exec); 472 auto globalObject = [self _rootObject]->globalObject(); 473 auto& vm = globalObject->vm(); 474 JSLockHolder lock(vm); 475 auto scope = DECLARE_CATCH_SCOPE(vm); 476 ExecState* exec = globalObject->globalExec(); 477 461 478 BOOL result = [self _imp]->hasProperty(exec, Identifier::fromString(exec, String(key))); 462 479 463 if ( exec->hadException()) {480 if (UNLIKELY(scope.exception())) { 464 481 addExceptionToConsole(exec); 465 exec->clearException();482 scope.clearException(); 466 483 } 467 484 … … 491 508 return nil; 492 509 493 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 494 ASSERT(!exec->hadException()); 495 496 JSLockHolder lock(exec); 510 auto globalObject = [self _rootObject]->globalObject(); 511 auto& vm = globalObject->vm(); 512 JSLockHolder lock(vm); 513 auto scope = DECLARE_CATCH_SCOPE(vm); 514 ExecState* exec = globalObject->globalExec(); 515 497 516 JSC::JSValue result = [self _imp]->get(exec, index); 498 517 499 if ( exec->hadException()) {518 if (UNLIKELY(scope.exception())) { 500 519 addExceptionToConsole(exec); 501 520 result = jsUndefined(); 502 exec->clearException();521 scope.clearException(); 503 522 } 504 523 … … 513 532 return; 514 533 515 ExecState* exec = [self _rootObject]->globalObject()->globalExec(); 516 ASSERT(!exec->hadException()); 517 518 JSLockHolder lock(exec); 534 auto globalObject = [self _rootObject]->globalObject(); 535 auto& vm = globalObject->vm(); 536 JSLockHolder lock(vm); 537 auto scope = DECLARE_CATCH_SCOPE(vm); 538 ExecState* exec = globalObject->globalExec(); 539 519 540 [self _imp]->methodTable()->putByIndex([self _imp], exec, index, convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), false); 520 541 521 if ( exec->hadException()) {542 if (UNLIKELY(scope.exception())) { 522 543 addExceptionToConsole(exec); 523 exec->clearException();544 scope.clearException(); 524 545 } 525 546 } -
trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp
r205462 r205569 61 61 static std::error_code getDomainList(ExecState& exec, const JSObject* arrayObject, Vector<String>& vector) 62 62 { 63 VM& vm = exec.vm(); 64 auto scope = DECLARE_THROW_SCOPE(vm); 65 63 66 ASSERT(vector.isEmpty()); 64 67 if (!arrayObject || !isJSArray(arrayObject)) … … 69 72 for (unsigned i = 0; i < length; ++i) { 70 73 const JSValue value = array->getIndex(&exec, i); 71 if ( exec.hadException() || !value.isString())74 if (scope.exception() || !value.isString()) 72 75 return ContentExtensionError::JSONInvalidDomainList; 73 76 … … 85 88 static std::error_code getTypeFlags(ExecState& exec, const JSValue& typeValue, ResourceFlags& flags, uint16_t (*stringToType)(const String&)) 86 89 { 90 VM& vm = exec.vm(); 91 auto scope = DECLARE_THROW_SCOPE(vm); 92 87 93 if (!typeValue.isObject()) 88 94 return { }; 89 95 90 96 const JSObject* object = typeValue.toObject(&exec); 91 ASSERT(! exec.hadException());97 ASSERT(!scope.exception()); 92 98 if (!isJSArray(object)) 93 99 return ContentExtensionError::JSONInvalidTriggerFlagsArray; … … 98 104 for (unsigned i = 0; i < length; ++i) { 99 105 const JSValue value = array->getIndex(&exec, i); 100 if ( exec.hadException() || !value)106 if (scope.exception() || !value) 101 107 return ContentExtensionError::JSONInvalidObjectInTriggerFlagsArray; 102 108 … … 114 120 static std::error_code loadTrigger(ExecState& exec, const JSObject& ruleObject, Trigger& trigger) 115 121 { 122 VM& vm = exec.vm(); 123 auto scope = DECLARE_THROW_SCOPE(vm); 124 116 125 const JSValue triggerObject = ruleObject.get(&exec, Identifier::fromString(&exec, "trigger")); 117 if (!triggerObject || exec.hadException() || !triggerObject.isObject())126 if (!triggerObject || scope.exception() || !triggerObject.isObject()) 118 127 return ContentExtensionError::JSONInvalidTrigger; 119 128 120 129 const JSValue urlFilterObject = triggerObject.get(&exec, Identifier::fromString(&exec, "url-filter")); 121 if (!urlFilterObject || exec.hadException() || !urlFilterObject.isString())130 if (!urlFilterObject || scope.exception() || !urlFilterObject.isString()) 122 131 return ContentExtensionError::JSONInvalidURLFilterInTrigger; 123 132 … … 129 138 130 139 const JSValue urlFilterCaseValue = triggerObject.get(&exec, Identifier::fromString(&exec, "url-filter-is-case-sensitive")); 131 if (urlFilterCaseValue && ! exec.hadException() && urlFilterCaseValue.isBoolean())140 if (urlFilterCaseValue && !scope.exception() && urlFilterCaseValue.isBoolean()) 132 141 trigger.urlFilterIsCaseSensitive = urlFilterCaseValue.toBoolean(&exec); 133 142 134 143 const JSValue resourceTypeValue = triggerObject.get(&exec, Identifier::fromString(&exec, "resource-type")); 135 if (! exec.hadException() && resourceTypeValue.isObject()) {144 if (!scope.exception() && resourceTypeValue.isObject()) { 136 145 auto typeFlagsError = getTypeFlags(exec, resourceTypeValue, trigger.flags, readResourceType); 137 146 if (typeFlagsError) … … 141 150 142 151 const JSValue loadTypeValue = triggerObject.get(&exec, Identifier::fromString(&exec, "load-type")); 143 if (! exec.hadException() && loadTypeValue.isObject()) {152 if (!scope.exception() && loadTypeValue.isObject()) { 144 153 auto typeFlagsError = getTypeFlags(exec, loadTypeValue, trigger.flags, readLoadType); 145 154 if (typeFlagsError) … … 149 158 150 159 const JSValue ifDomain = triggerObject.get(&exec, Identifier::fromString(&exec, "if-domain")); 151 if (! exec.hadException() && ifDomain.isObject()) {160 if (!scope.exception() && ifDomain.isObject()) { 152 161 auto ifDomainError = getDomainList(exec, asObject(ifDomain), trigger.domains); 153 162 if (ifDomainError) … … 161 170 162 171 const JSValue unlessDomain = triggerObject.get(&exec, Identifier::fromString(&exec, "unless-domain")); 163 if (! exec.hadException() && unlessDomain.isObject()) {172 if (!scope.exception() && unlessDomain.isObject()) { 164 173 if (trigger.domainCondition != Trigger::DomainCondition::None) 165 174 return ContentExtensionError::JSONUnlessAndIfDomain; … … 187 196 static std::error_code loadAction(ExecState& exec, const JSObject& ruleObject, Action& action, bool& validSelector) 188 197 { 198 VM& vm = exec.vm(); 199 auto scope = DECLARE_THROW_SCOPE(vm); 200 189 201 validSelector = true; 190 202 const JSValue actionObject = ruleObject.get(&exec, Identifier::fromString(&exec, "action")); 191 if (!actionObject || exec.hadException() || !actionObject.isObject())203 if (!actionObject || scope.exception() || !actionObject.isObject()) 192 204 return ContentExtensionError::JSONInvalidAction; 193 205 194 206 const JSValue typeObject = actionObject.get(&exec, Identifier::fromString(&exec, "type")); 195 if (!typeObject || exec.hadException() || !typeObject.isString())207 if (!typeObject || scope.exception() || !typeObject.isString()) 196 208 return ContentExtensionError::JSONInvalidActionType; 197 209 … … 206 218 else if (actionType == "css-display-none") { 207 219 JSValue selector = actionObject.get(&exec, Identifier::fromString(&exec, "selector")); 208 if (!selector || exec.hadException() || !selector.isString())220 if (!selector || scope.exception() || !selector.isString()) 209 221 return ContentExtensionError::JSONInvalidCSSDisplayNoneActionType; 210 222 … … 244 256 static std::error_code loadEncodedRules(ExecState& exec, const String& rules, Vector<ContentExtensionRule>& ruleList) 245 257 { 258 VM& vm = exec.vm(); 259 auto scope = DECLARE_THROW_SCOPE(vm); 260 246 261 // FIXME: JSONParse should require callbacks instead of an ExecState. 247 262 const JSValue decodedRules = JSONParse(&exec, rules); 248 263 249 if ( exec.hadException() || !decodedRules)264 if (scope.exception() || !decodedRules) 250 265 return ContentExtensionError::JSONInvalid; 251 266 … … 254 269 255 270 const JSObject* topLevelObject = decodedRules.toObject(&exec); 256 if (!topLevelObject || exec.hadException())271 if (!topLevelObject || scope.exception()) 257 272 return ContentExtensionError::JSONTopLevelStructureNotAnObject; 258 273 … … 270 285 for (unsigned i = 0; i < length; ++i) { 271 286 const JSValue value = topLevelArray->getIndex(&exec, i); 272 if ( exec.hadException() || !value)287 if (scope.exception() || !value) 273 288 return ContentExtensionError::JSONInvalidObjectInTopLevelArray; 274 289 275 290 const JSObject* ruleObject = value.toObject(&exec); 276 if (!ruleObject || exec.hadException())291 if (!ruleObject || scope.exception()) 277 292 return ContentExtensionError::JSONInvalidRule; 278 293 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r205417 r205569 4003 4003 static JSC::JSValue controllerJSValue(JSC::ExecState& exec, JSDOMGlobalObject& globalObject, HTMLMediaElement& media) 4004 4004 { 4005 JSC::VM& vm = globalObject.vm(); 4006 auto scope = DECLARE_THROW_SCOPE(vm); 4005 4007 auto mediaJSWrapper = toJS(&exec, &globalObject, media); 4006 4008 … … 4010 4012 return JSC::jsNull(); 4011 4013 4012 JSC::Identifier controlsHost = JSC::Identifier::fromString(& exec.vm(), "controlsHost");4014 JSC::Identifier controlsHost = JSC::Identifier::fromString(&vm, "controlsHost"); 4013 4015 JSC::JSValue controlsHostJSWrapper = mediaJSWrapperObject->get(&exec, controlsHost); 4014 if ( exec.hadException())4016 if (UNLIKELY(scope.exception())) 4015 4017 return JSC::jsNull(); 4016 4018 … … 4019 4021 return JSC::jsNull(); 4020 4022 4021 JSC::Identifier controllerID = JSC::Identifier::fromString(& exec.vm(), "controller");4023 JSC::Identifier controllerID = JSC::Identifier::fromString(&vm, "controller"); 4022 4024 JSC::JSValue controllerJSWrapper = controlsHostJSWrapperObject->get(&exec, controllerID); 4023 if ( exec.hadException())4025 if (UNLIKELY(scope.exception())) 4024 4026 return JSC::jsNull(); 4025 4027 … … 4058 4060 ScriptController& scriptController = document().frame()->script(); 4059 4061 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 4062 JSC::VM& vm = globalObject->vm(); 4063 JSC::JSLockHolder lock(vm); 4064 auto scope = DECLARE_CATCH_SCOPE(vm); 4060 4065 JSC::ExecState* exec = globalObject->globalExec(); 4061 JSC::JSLockHolder lock(exec);4062 4066 4063 4067 JSC::JSValue controllerValue = controllerJSValue(*exec, *globalObject, *this); … … 4084 4088 JSC::MarkedArgumentBuffer noArguments; 4085 4089 JSC::call(exec, methodObject, callType, callData, controllerObject, noArguments); 4086 exec->clearException();4090 scope.clearException(); 4087 4091 4088 4092 m_haveSetUpCaptionContainer = true; … … 6604 6608 ScriptController& scriptController = document().frame()->script(); 6605 6609 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 6610 JSC::VM& vm = globalObject->vm(); 6611 JSC::JSLockHolder lock(vm); 6612 auto scope = DECLARE_CATCH_SCOPE(vm); 6606 6613 JSC::ExecState* exec = globalObject->globalExec(); 6607 JSC::JSLockHolder lock(exec);6608 6614 6609 6615 JSC::JSValue functionValue = globalObject->get(exec, JSC::Identifier::fromString(exec, "createControls")); … … 6618 6624 #endif 6619 6625 scriptController.evaluateInWorld(ScriptSourceCode(mediaControlsScript, scriptURL), world); 6620 if ( exec->hadException()) {6621 exec->clearException();6626 if (UNLIKELY(scope.exception())) { 6627 scope.clearException(); 6622 6628 return false; 6623 6629 } … … 6677 6683 ScriptController& scriptController = document().frame()->script(); 6678 6684 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 6685 JSC::VM& vm = globalObject->vm(); 6686 JSC::JSLockHolder lock(vm); 6687 auto scope = DECLARE_CATCH_SCOPE(vm); 6679 6688 JSC::ExecState* exec = globalObject->globalExec(); 6680 JSC::JSLockHolder lock(exec);6681 6689 6682 6690 // The media controls script must provide a method with the following details. … … 6705 6713 6706 6714 JSC::JSObject* function = functionValue.toObject(exec); 6707 ASSERT(! exec->hadException());6715 ASSERT(!scope.exception()); 6708 6716 JSC::CallData callData; 6709 6717 JSC::CallType callType = function->methodTable()->getCallData(function, callData); … … 6712 6720 6713 6721 JSC::JSValue controllerValue = JSC::call(exec, function, callType, callData, globalObject, argList); 6714 exec->clearException();6722 scope.clearException(); 6715 6723 JSC::JSObject* controllerObject = JSC::jsDynamicCast<JSC::JSObject*>(controllerValue); 6716 6724 if (!controllerObject) … … 6719 6727 // Connect the Media, MediaControllerHost, and Controller so the GC knows about their relationship 6720 6728 JSC::JSObject* mediaJSWrapperObject = mediaJSWrapper.toObject(exec); 6721 ASSERT(! exec->hadException());6729 ASSERT(!scope.exception()); 6722 6730 JSC::Identifier controlsHost = JSC::Identifier::fromString(&exec->vm(), "controlsHost"); 6723 6731 … … 6739 6747 updateUsesLTRUserInterfaceLayoutDirectionJSProperty(); 6740 6748 6741 if ( exec->hadException())6742 exec->clearException();6749 if (UNLIKELY(scope.exception())) 6750 scope.clearException(); 6743 6751 } 6744 6752 … … 6775 6783 ScriptController& scriptController = document().frame()->script(); 6776 6784 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 6785 JSC::VM& vm = globalObject->vm(); 6786 JSC::JSLockHolder lock(vm); 6787 auto scope = DECLARE_THROW_SCOPE(vm); 6777 6788 JSC::ExecState* exec = globalObject->globalExec(); 6778 JSC::JSLockHolder lock(exec);6779 6789 6780 6790 JSC::JSValue controllerValue = controllerJSValue(*exec, *globalObject, *this); 6781 6791 JSC::JSObject* controllerObject = controllerValue.toObject(exec); 6782 6792 6783 if ( exec->hadException())6793 if (UNLIKELY(scope.exception())) 6784 6794 return; 6785 6795 6786 6796 JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "handlePresentationModeChange")); 6787 if ( exec->hadException() || functionValue.isUndefinedOrNull())6797 if (UNLIKELY(scope.exception()) || functionValue.isUndefinedOrNull()) 6788 6798 return; 6789 6799 6790 6800 JSC::JSObject* function = functionValue.toObject(exec); 6791 ASSERT(! exec->hadException());6801 ASSERT(!scope.exception()); 6792 6802 JSC::CallData callData; 6793 6803 JSC::CallType callType = function->methodTable()->getCallData(function, callData); … … 6816 6826 ScriptController& scriptController = document().frame()->script(); 6817 6827 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world)); 6828 JSC::VM& vm = globalObject->vm(); 6829 JSC::JSLockHolder lock(vm); 6830 auto scope = DECLARE_THROW_SCOPE(vm); 6818 6831 JSC::ExecState* exec = globalObject->globalExec(); 6819 JSC::JSLockHolder lock(exec);6820 6832 6821 6833 JSC::JSValue controllerValue = controllerJSValue(*exec, *globalObject, *this); 6822 6834 JSC::JSObject* controllerObject = controllerValue.toObject(exec); 6823 6835 6824 if ( exec->hadException())6836 if (UNLIKELY(scope.exception())) 6825 6837 return emptyString(); 6826 6838 6827 6839 JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "getCurrentControlsStatus")); 6828 if ( exec->hadException() || functionValue.isUndefinedOrNull())6840 if (UNLIKELY(scope.exception()) || functionValue.isUndefinedOrNull()) 6829 6841 return emptyString(); 6830 6842 6831 6843 JSC::JSObject* function = functionValue.toObject(exec); 6832 ASSERT(! exec->hadException());6844 ASSERT(!scope.exception()); 6833 6845 JSC::CallData callData; 6834 6846 JSC::CallType callType = function->methodTable()->getCallData(function, callData); … … 6839 6851 JSC::JSValue outputValue = JSC::call(exec, function, callType, callData, controllerObject, argList); 6840 6852 6841 if ( exec->hadException())6853 if (UNLIKELY(scope.exception())) 6842 6854 return emptyString(); 6843 6855 -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r205249 r205569 393 393 ScriptController& scriptController = document().frame()->script(); 394 394 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(isolatedWorld)); 395 396 JSC::VM& vm = globalObject->vm(); 397 JSC::JSLockHolder lock(vm); 398 auto scope = DECLARE_CATCH_SCOPE(vm); 395 399 JSC::ExecState* exec = globalObject->globalExec(); 396 397 JSC::JSLockHolder lock(exec);398 400 399 401 JSC::MarkedArgumentBuffer argList; … … 409 411 JSC::JSObject* overlay = globalObject->get(exec, JSC::Identifier::fromString(exec, "createOverlay")).toObject(exec); 410 412 if (!overlay) { 411 ASSERT( exec->hadException());412 exec->clearException();413 ASSERT(scope.exception()); 414 scope.clearException(); 413 415 return; 414 416 } … … 419 421 420 422 JSC::call(exec, overlay, callType, callData, globalObject, argList); 421 exec->clearException();423 scope.clearException(); 422 424 } 423 425 -
trunk/Source/WebKit/mac/ChangeLog
r205549 r205569 1 2016-09-07 Mark Lam <mark.lam@apple.com> 2 3 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. 4 https://bugs.webkit.org/show_bug.cgi?id=161498 5 6 Reviewed by Geoffrey Garen. 7 8 * Plugins/Hosted/NetscapePluginInstanceProxy.mm: 9 (WebKit::NetscapePluginInstanceProxy::evaluate): 10 (WebKit::NetscapePluginInstanceProxy::invoke): 11 (WebKit::NetscapePluginInstanceProxy::invokeDefault): 12 (WebKit::NetscapePluginInstanceProxy::construct): 13 (WebKit::NetscapePluginInstanceProxy::getProperty): 14 (WebKit::NetscapePluginInstanceProxy::setProperty): 15 (WebKit::NetscapePluginInstanceProxy::removeProperty): 16 (WebKit::NetscapePluginInstanceProxy::hasProperty): 17 (WebKit::NetscapePluginInstanceProxy::hasMethod): 18 (WebKit::NetscapePluginInstanceProxy::enumerate): 19 * WebView/WebView.mm: 20 (aeDescFromJSValue): 21 1 22 2016-09-07 Youenn Fablet <youenn@apple.com> 2 23 -
trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
r205198 r205569 886 886 return false; 887 887 888 JSLockHolder lock(pluginWorld().vm()); 889 Strong<JSGlobalObject> globalObject(pluginWorld().vm(), frame->script().globalObject(pluginWorld())); 888 VM& vm = pluginWorld().vm(); 889 JSLockHolder lock(vm); 890 auto scope = DECLARE_CATCH_SCOPE(vm); 891 892 Strong<JSGlobalObject> globalObject(vm, frame->script().globalObject(pluginWorld())); 890 893 ExecState* exec = globalObject->globalExec(); 891 894 … … 895 898 896 899 marshalValue(exec, result, resultData, resultLength); 897 exec->clearException();900 scope.clearException(); 898 901 return true; 899 902 } … … 916 919 if (!frame) 917 920 return false; 918 921 922 VM& vm = pluginWorld().vm(); 923 JSLockHolder lock(vm); 924 auto scope = DECLARE_CATCH_SCOPE(vm); 925 919 926 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 920 JSLockHolder lock(exec);921 927 JSValue function = object->get(exec, methodName); 922 928 CallData callData; … … 931 937 932 938 marshalValue(exec, value, resultData, resultLength); 933 exec->clearException();939 scope.clearException(); 934 940 return true; 935 941 } … … 949 955 if (!frame) 950 956 return false; 951 957 958 VM& vm = pluginWorld().vm(); 959 JSLockHolder lock(vm); 960 auto scope = DECLARE_CATCH_SCOPE(vm); 961 952 962 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 953 JSLockHolder lock(exec);954 963 CallData callData; 955 964 CallType callType = object->methodTable()->getCallData(object, callData); … … 963 972 964 973 marshalValue(exec, value, resultData, resultLength); 965 exec->clearException();974 scope.clearException(); 966 975 return true; 967 976 } … … 981 990 if (!frame) 982 991 return false; 983 992 993 VM& vm = pluginWorld().vm(); 994 JSLockHolder lock(vm); 995 auto scope = DECLARE_CATCH_SCOPE(vm); 996 984 997 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 985 JSLockHolder lock(exec);986 998 987 999 ConstructData constructData; … … 996 1008 997 1009 marshalValue(exec, value, resultData, resultLength); 998 exec->clearException();1010 scope.clearException(); 999 1011 return true; 1000 1012 } … … 1014 1026 if (!frame) 1015 1027 return false; 1016 1028 1029 VM& vm = pluginWorld().vm(); 1030 JSLockHolder lock(vm); 1031 auto scope = DECLARE_CATCH_SCOPE(vm); 1032 1017 1033 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1018 JSLockHolder lock(exec);1019 1034 JSValue value = object->get(exec, propertyName); 1020 1035 1021 1036 marshalValue(exec, value, resultData, resultLength); 1022 exec->clearException();1037 scope.clearException(); 1023 1038 return true; 1024 1039 } … … 1035 1050 if (!frame) 1036 1051 return false; 1037 1052 1053 VM& vm = pluginWorld().vm(); 1054 JSLockHolder lock(vm); 1055 auto scope = DECLARE_CATCH_SCOPE(vm); 1056 1038 1057 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1039 JSLockHolder lock(exec);1040 1058 JSValue value = object->get(exec, propertyName); 1041 1059 1042 1060 marshalValue(exec, value, resultData, resultLength); 1043 exec->clearException();1061 scope.clearException(); 1044 1062 return true; 1045 1063 } … … 1059 1077 if (!frame) 1060 1078 return false; 1061 1079 1080 VM& vm = pluginWorld().vm(); 1081 JSLockHolder lock(vm); 1082 auto scope = DECLARE_CATCH_SCOPE(vm); 1083 1062 1084 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1063 JSLockHolder lock(exec);1064 1085 1065 1086 JSValue value = demarshalValue(exec, valueData, valueLength); … … 1067 1088 object->methodTable()->put(object, exec, propertyName, value, slot); 1068 1089 1069 exec->clearException();1090 scope.clearException(); 1070 1091 return true; 1071 1092 } … … 1085 1106 if (!frame) 1086 1107 return false; 1087 1108 1109 VM& vm = pluginWorld().vm(); 1110 JSLockHolder lock(vm); 1111 auto scope = DECLARE_CATCH_SCOPE(vm); 1112 1088 1113 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1089 JSLockHolder lock(exec);1090 1114 1091 1115 JSValue value = demarshalValue(exec, valueData, valueLength); 1092 1116 object->methodTable()->putByIndex(object, exec, propertyName, value, false); 1093 1117 1094 exec->clearException();1118 scope.clearException(); 1095 1119 return true; 1096 1120 } … … 1111 1135 return false; 1112 1136 1137 VM& vm = pluginWorld().vm(); 1138 JSLockHolder lock(vm); 1139 auto scope = DECLARE_CATCH_SCOPE(vm); 1140 1113 1141 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1114 JSLockHolder lock(exec);1115 1142 if (!object->hasProperty(exec, propertyName)) { 1116 exec->clearException();1143 scope.clearException(); 1117 1144 return false; 1118 1145 } 1119 1146 1120 1147 object->methodTable()->deleteProperty(object, exec, propertyName); 1121 exec->clearException();1148 scope.clearException(); 1122 1149 return true; 1123 1150 } … … 1137 1164 if (!frame) 1138 1165 return false; 1139 1166 1167 VM& vm = pluginWorld().vm(); 1168 JSLockHolder lock(vm); 1169 auto scope = DECLARE_CATCH_SCOPE(vm); 1170 1140 1171 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1141 JSLockHolder lock(exec);1142 1172 if (!object->hasProperty(exec, propertyName)) { 1143 exec->clearException();1173 scope.clearException(); 1144 1174 return false; 1145 1175 } 1146 1176 1147 1177 object->methodTable()->deletePropertyByIndex(object, exec, propertyName); 1148 exec->clearException();1178 scope.clearException(); 1149 1179 return true; 1150 1180 } … … 1164 1194 if (!frame) 1165 1195 return false; 1166 1196 1197 VM& vm = pluginWorld().vm(); 1198 JSLockHolder lock(vm); 1199 auto scope = DECLARE_CATCH_SCOPE(vm); 1200 1167 1201 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1168 1202 bool result = object->hasProperty(exec, propertyName); 1169 exec->clearException();1170 1203 scope.clearException(); 1204 1171 1205 return result; 1172 1206 } … … 1186 1220 if (!frame) 1187 1221 return false; 1188 1222 1223 VM& vm = pluginWorld().vm(); 1224 JSLockHolder lock(vm); 1225 auto scope = DECLARE_CATCH_SCOPE(vm); 1226 1189 1227 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1190 1228 bool result = object->hasProperty(exec, propertyName); 1191 exec->clearException();1192 1229 scope.clearException(); 1230 1193 1231 return result; 1194 1232 } … … 1208 1246 if (!frame) 1209 1247 return false; 1210 1248 1249 VM& vm = pluginWorld().vm(); 1250 JSLockHolder lock(vm); 1251 auto scope = DECLARE_CATCH_SCOPE(vm); 1252 1211 1253 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1212 JSLockHolder lock(exec);1213 1254 JSValue func = object->get(exec, methodName); 1214 exec->clearException();1255 scope.clearException(); 1215 1256 return !func.isUndefined(); 1216 1257 } … … 1230 1271 if (!frame) 1231 1272 return false; 1232 1273 1274 VM& vm = pluginWorld().vm(); 1275 JSLockHolder lock(vm); 1276 auto scope = DECLARE_CATCH_SCOPE(vm); 1277 1233 1278 ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec(); 1234 JSLockHolder lock(exec);1235 1279 1236 1280 PropertyNameArray propertyNames(exec, PropertyNameMode::Strings); … … 1252 1296 memcpy(resultData, [data bytes], resultLength); 1253 1297 1254 exec->clearException();1298 scope.clearException(); 1255 1299 1256 1300 return true; -
trunk/Source/WebKit/mac/WebView/WebView.mm
r205365 r205569 6937 6937 static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSC::JSValue jsValue) 6938 6938 { 6939 VM& vm = exec->vm(); 6940 auto scope = DECLARE_CATCH_SCOPE(vm); 6941 6939 6942 NSAppleEventDescriptor* aeDesc = 0; 6940 6943 if (jsValue.isBoolean()) … … 6977 6980 } 6978 6981 JSC::JSValue primitive = object->toPrimitive(exec); 6979 if ( exec->hadException()) {6980 exec->clearException();6982 if (UNLIKELY(scope.exception())) { 6983 scope.clearException(); 6981 6984 return [NSAppleEventDescriptor nullDescriptor]; 6982 6985 } -
trunk/Source/WebKit/win/ChangeLog
r205495 r205569 1 2016-09-07 Mark Lam <mark.lam@apple.com> 2 3 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. 4 https://bugs.webkit.org/show_bug.cgi?id=161498 5 6 Reviewed by Geoffrey Garen. 7 8 * Plugins/PluginPackage.cpp: 9 (WebCore::NPN_Evaluate): 10 (WebCore::NPN_Invoke): 11 1 12 2016-09-06 Per Arne Vollan <pvollan@apple.com> 2 13 -
trunk/Source/WebKit/win/Plugins/PluginPackage.cpp
r197614 r205569 211 211 PluginView::keepAlive(instance); 212 212 213 JSC::ExecState* exec = rootObject->globalObject()->globalExec(); 214 JSC::JSLockHolder lock(exec); 213 auto globalObject = rootObject->globalObject(); 214 auto& vm = globalObject->vm(); 215 JSC::JSLockHolder lock(vm); 216 auto scope = DECLARE_CATCH_SCOPE(vm); 217 218 JSC::ExecState* exec = globalObject->globalExec(); 215 219 String scriptString = JSC::Bindings::convertNPStringToUTF16(s); 216 220 217 JSC::JSValue returnValue = JSC::evaluate( rootObject->globalObject()->globalExec(), makeSource(scriptString), JSC::JSValue());221 JSC::JSValue returnValue = JSC::evaluate(exec, makeSource(scriptString), JSC::JSValue()); 218 222 219 223 JSC::Bindings::convertValueToNPVariant(exec, returnValue, variant); 220 exec->clearException();224 scope.clearException(); 221 225 return true; 222 226 } … … 248 252 if (!rootObject || !rootObject->isValid()) 249 253 return false; 250 JSC::ExecState* exec = rootObject->globalObject()->globalExec(); 251 JSC::JSLockHolder lock(exec); 254 255 auto globalObject = rootObject->globalObject(); 256 auto& vm = globalObject->vm(); 257 JSC::JSLockHolder lock(vm); 258 auto scope = DECLARE_CATCH_SCOPE(vm); 259 260 JSC::ExecState* exec = globalObject->globalExec(); 252 261 JSC::JSValue function = obj->imp->get(exec, JSC::Bindings::identifierFromNPIdentifier(exec, i->string())); 253 262 JSC::CallData callData; … … 263 272 // Convert and return the result of the function call. 264 273 JSC::Bindings::convertValueToNPVariant(exec, resultV, result); 265 exec->clearException();274 scope.clearException(); 266 275 return true; 267 276 } -
trunk/Source/WebKit2/ChangeLog
r205561 r205569 1 2016-09-07 Mark Lam <mark.lam@apple.com> 2 3 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. 4 https://bugs.webkit.org/show_bug.cgi?id=161498 5 6 Reviewed by Geoffrey Garen. 7 8 * WebProcess/Plugins/Netscape/NPJSObject.cpp: 9 (WebKit::NPJSObject::hasMethod): 10 (WebKit::NPJSObject::hasProperty): 11 (WebKit::NPJSObject::getProperty): 12 (WebKit::NPJSObject::setProperty): 13 (WebKit::NPJSObject::removeProperty): 14 (WebKit::NPJSObject::construct): 15 (WebKit::NPJSObject::invoke): 16 1 17 2016-09-07 Konstantin Tokarev <annulen@yandex.ru> 2 18 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
r197614 r205569 102 102 return false; 103 103 104 JSLockHolder lock(exec); 104 VM& vm = exec->vm(); 105 JSLockHolder lock(vm); 106 auto scope = DECLARE_CATCH_SCOPE(vm); 105 107 106 108 JSValue value = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep)); 107 exec->clearException();109 scope.clearException(); 108 110 109 111 CallData callData; … … 148 150 return false; 149 151 150 JSLockHolder lock(exec); 152 VM& vm = exec->vm(); 153 JSLockHolder lock(vm); 154 auto scope = DECLARE_CATCH_SCOPE(vm); 151 155 152 156 bool result; … … 156 160 result = m_jsObject->hasProperty(exec, identifierRep->number()); 157 161 158 exec->clearException();162 scope.clearException(); 159 163 return result; 160 164 } … … 168 172 return false; 169 173 170 JSLockHolder lock(exec); 174 VM& vm = exec->vm(); 175 JSLockHolder lock(vm); 176 auto scope = DECLARE_CATCH_SCOPE(vm); 177 171 178 JSValue jsResult; 172 179 if (identifierRep->isString()) … … 176 183 177 184 m_objectMap->convertJSValueToNPVariant(exec, jsResult, *result); 178 exec->clearException();185 scope.clearException(); 179 186 return true; 180 187 } … … 188 195 return false; 189 196 190 JSLockHolder lock(exec); 197 VM& vm = exec->vm(); 198 JSLockHolder lock(vm); 199 auto scope = DECLARE_CATCH_SCOPE(vm); 191 200 192 201 JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value); … … 196 205 } else 197 206 m_jsObject->methodTable()->putByIndex(m_jsObject.get(), exec, identifierRep->number(), jsValue, false); 198 exec->clearException();207 scope.clearException(); 199 208 200 209 return true; … … 209 218 return false; 210 219 211 JSLockHolder lock(exec); 220 VM& vm = exec->vm(); 221 JSLockHolder lock(vm); 222 auto scope = DECLARE_CATCH_SCOPE(vm); 223 212 224 if (identifierRep->isString()) { 213 225 Identifier identifier = identifierFromIdentifierRep(exec, identifierRep); 214 226 215 227 if (!m_jsObject->hasProperty(exec, identifier)) { 216 exec->clearException();228 scope.clearException(); 217 229 return false; 218 230 } … … 221 233 } else { 222 234 if (!m_jsObject->hasProperty(exec, identifierRep->number())) { 223 exec->clearException();235 scope.clearException(); 224 236 return false; 225 237 } … … 228 240 } 229 241 230 exec->clearException();242 scope.clearException(); 231 243 return true; 232 244 } … … 260 272 return false; 261 273 262 JSLockHolder lock(exec); 274 VM& vm = exec->vm(); 275 JSLockHolder lock(vm); 276 auto scope = DECLARE_CATCH_SCOPE(vm); 263 277 264 278 ConstructData constructData; … … 276 290 // Convert and return the new object. 277 291 m_objectMap->convertJSValueToNPVariant(exec, value, *result); 278 exec->clearException();292 scope.clearException(); 279 293 280 294 return true; … … 283 297 bool NPJSObject::invoke(ExecState* exec, JSGlobalObject* globalObject, JSValue function, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) 284 298 { 299 VM& vm = exec->vm(); 300 auto scope = DECLARE_CATCH_SCOPE(vm); 301 285 302 CallData callData; 286 303 CallType callType = getCallData(function, callData); … … 297 314 // Convert and return the result of the function call. 298 315 m_objectMap->convertJSValueToNPVariant(exec, value, *result); 299 exec->clearException();316 scope.clearException(); 300 317 301 318 return true;
Note:
See TracChangeset
for help on using the changeset viewer.