Ignore:
Timestamp:
May 8, 2017, 9:56:32 AM (8 years ago)
Author:
[email protected]
Message:

Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
https://bugs.webkit.org/show_bug.cgi?id=171776

Reviewed by Keith Miller.

Source/JavaScriptCore:

Instead of ASSERT(!scope.exception()), we can now do scope.assertNoException().
Ditto for RELEASE_ASSERT and scope.releaseAssertNoException().

The advantage of using ExceptionScope::assertNoException() and
releaseAssertNoException() is that if the assertion fails, these utility
functions will print the stack trace for where the unexpected exception is
detected as well as where the unexpected exception was thrown from. This makes
it much easier to debug the source of unhandled exceptions.

  • debugger/Debugger.cpp:

(JSC::Debugger::pauseIfNeeded):

  • dfg/DFGOperations.cpp:
  • interpreter/Interpreter.cpp:

(JSC::eval):
(JSC::notifyDebuggerOfUnwinding):
(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::execute):
(JSC::Interpreter::debug):

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::functionsOnStack):

  • jsc.cpp:

(GlobalObject::moduleLoaderResolve):
(GlobalObject::moduleLoaderFetch):
(functionGenerateHeapSnapshot):
(functionSamplingProfilerStackTraces):
(box):
(runWithScripts):

  • runtime/AbstractModuleRecord.cpp:

(JSC::AbstractModuleRecord::finishCreation):

  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::tryInitializeSpeciesWatchpoint):

  • runtime/Completion.cpp:

(JSC::rejectPromise):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::sanitizedToString):

  • runtime/ExceptionHelpers.cpp:

(JSC::createError):

  • runtime/ExceptionScope.cpp:

(JSC::ExceptionScope::unexpectedExceptionMessage):

  • runtime/ExceptionScope.h:

(JSC::ExceptionScope::assertNoException):
(JSC::ExceptionScope::releaseAssertNoException):
(JSC::ExceptionScope::unexpectedExceptionMessage):

  • runtime/GenericArgumentsInlines.h:

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

  • runtime/IntlCollator.cpp:

(JSC::IntlCollator::createCollator):
(JSC::IntlCollator::resolvedOptions):

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::resolvedOptions):
(JSC::IntlDateTimeFormat::format):

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::createNumberFormat):
(JSC::IntlNumberFormat::resolvedOptions):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::putToPrimitiveByIndex):

  • runtime/JSGenericTypedArrayViewPrototypeFunctions.h:

(JSC::genericTypedArrayViewProtoFuncIncludes):
(JSC::genericTypedArrayViewProtoFuncIndexOf):
(JSC::genericTypedArrayViewProtoFuncLastIndexOf):
(JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncHostPromiseRejectionTracker):

  • runtime/JSModuleEnvironment.cpp:

(JSC::JSModuleEnvironment::getOwnPropertySlot):

  • runtime/JSModuleLoader.cpp:

(JSC::JSModuleLoader::finishCreation):

  • runtime/JSModuleNamespaceObject.cpp:

(JSC::JSModuleNamespaceObject::finishCreation):

  • runtime/JSONObject.cpp:

(JSC::Stringifier::toJSON):

  • runtime/JSObject.cpp:

(JSC::JSObject::ordinaryToPrimitive):

  • runtime/JSPropertyNameEnumerator.h:

(JSC::propertyNameEnumerator):

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorGetOwnPropertyDescriptors):
(JSC::objectConstructorDefineProperty):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncHasOwnProperty):

  • runtime/ProgramExecutable.cpp:

(JSC::ProgramExecutable::initializeGlobalProperties):

  • runtime/ReflectObject.cpp:

(JSC::reflectObjectDefineProperty):

  • runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::StackFrame::nameFromCallee):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncRepeatCharacter):

  • runtime/TemplateRegistry.cpp:

(JSC::TemplateRegistry::getTemplateObject):

  • runtime/VM.cpp:

(JSC::VM::throwException):

  • runtime/VM.h:

(JSC::VM::nativeStackTraceOfLastThrow):
(JSC::VM::clearException):

  • wasm/WasmB3IRGenerator.cpp:
  • wasm/js/JSWebAssemblyInstance.cpp:

(JSC::JSWebAssemblyInstance::create):

Source/WebCore:

No new tests because there's no behavior change in functionality. We're only
refactoring the code to use the new assertion utility function.

  • Modules/plugins/QuickTimePluginReplacement.mm:

(WebCore::QuickTimePluginReplacement::installReplacement):

  • bindings/js/JSCryptoKeySerializationJWK.cpp:

(WebCore::getJSArrayFromJSON):
(WebCore::getStringFromJSON):
(WebCore::getBooleanFromJSON):

  • bindings/js/JSCustomElementRegistryCustom.cpp:

(WebCore::JSCustomElementRegistry::whenDefined):

  • bindings/js/JSDOMExceptionHandling.cpp:

(WebCore::propagateExceptionSlowPath):
(WebCore::throwNotSupportedError):
(WebCore::throwInvalidStateError):
(WebCore::throwSecurityError):
(WebCore::throwDOMSyntaxError):
(WebCore::throwDataCloneError):
(WebCore::throwIndexSizeError):
(WebCore::throwTypeMismatchError):

  • bindings/js/JSDOMGlobalObject.cpp:

(WebCore::makeThisTypeErrorForBuiltins):
(WebCore::makeGetterTypeErrorForBuiltins):

  • bindings/js/JSDOMGlobalObjectTask.cpp:
  • bindings/js/JSDOMPromise.h:

(WebCore::callPromiseFunction):

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowMicrotaskCallback::call):

  • bindings/js/JSMainThreadExecState.h:

(WebCore::JSMainThreadExecState::~JSMainThreadExecState):

  • bindings/js/ReadableStreamDefaultController.cpp:

(WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked):

  • bindings/js/ReadableStreamDefaultController.h:

(WebCore::ReadableStreamDefaultController::enqueue):

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneDeserializer::readTerminal):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateSerializerFunction):

  • bindings/scripts/test/JS/JSTestNode.cpp:

(WebCore::JSTestNode::serialize):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObj::serialize):

  • bindings/scripts/test/JS/JSTestSerialization.cpp:

(WebCore::JSTestSerialization::serialize):

  • bindings/scripts/test/JS/JSTestSerializationInherit.cpp:

(WebCore::JSTestSerializationInherit::serialize):

  • bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:

(WebCore::JSTestSerializationInheritFinal::serialize):

  • contentextensions/ContentExtensionParser.cpp:

(WebCore::ContentExtensions::getTypeFlags):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):

Source/WTF:

  1. Add an option to skip some number of top frames when capturing the StackTrace.
  2. Add an option to use an indentation string when dumping the StackTrace.
  • wtf/StackTrace.cpp:

(WTF::StackTrace::captureStackTrace):
(WTF::StackTrace::dump):

  • wtf/StackTrace.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp

    r211319 r216428  
    11/*
    22 * Copyright (C) 2015 Yusuke Suzuki <[email protected]>.
    3  * Copyright (C) 2016 Apple Inc. All Rights Reserved.
     3 * Copyright (C) 2016-2017 Apple Inc. All Rights Reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    7171
    7272    objectConstructorFreeze(exec, rawObject);
    73     ASSERT(!scope.exception());
     73    scope.assertNoException();
    7474
    7575    templateObject->putDirect(vm, vm.propertyNames->raw, rawObject, ReadOnly | DontEnum | DontDelete);
     
    8080
    8181    objectConstructorFreeze(exec, templateObject);
    82     ASSERT(!scope.exception());
     82    scope.assertNoException();
    8383
    8484    m_templateMap.set(&templateKey, templateObject);
Note: See TracChangeset for help on using the changeset viewer.