Changeset 94918 in webkit


Ignore:
Timestamp:
Sep 10, 2011 10:16:09 PM (13 years ago)
Author:
weinig@apple.com
Message:

Add isInterruptedExecutionException and isTerminatedExecutionException predicates
https://bugs.webkit.org/show_bug.cgi?id=67892

Reviewed by Andy "First Time Reviewer" Estes.

../JavaScriptCore:

Add symbols.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::throwException):
Use new predicates.

  • runtime/ExceptionHelpers.cpp:

(JSC::createInterruptedExecutionException):
(JSC::isInterruptedExecutionException):
(JSC::createTerminatedExecutionException):
(JSC::isTerminatedExecutionException):

  • runtime/ExceptionHelpers.h:

(JSC::InterruptedExecutionError::InterruptedExecutionError):
Add predicates.

../WebCore:

  • bindings/js/JSDOMBinding.cpp:

(WebCore::reportException):

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::handleEvent):

  • bindings/js/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::evaluate):
Use the new predicates instead of probing the ClassInfo directly.

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r94914 r94918  
     12011-09-10  Sam Weinig  <sam@webkit.org>
     2
     3        Add isInterruptedExecutionException and isTerminatedExecutionException predicates
     4        https://bugs.webkit.org/show_bug.cgi?id=67892
     5
     6        Reviewed by Andy "First Time Reviewer" Estes.
     7
     8        * JavaScriptCore.exp:
     9        Add symbols.
     10
     11        * interpreter/Interpreter.cpp:
     12        (JSC::Interpreter::throwException):
     13        Use new predicates.
     14
     15        * runtime/ExceptionHelpers.cpp:
     16        (JSC::createInterruptedExecutionException):
     17        (JSC::isInterruptedExecutionException):
     18        (JSC::createTerminatedExecutionException):
     19        (JSC::isTerminatedExecutionException):
     20        * runtime/ExceptionHelpers.h:
     21        (JSC::InterruptedExecutionError::InterruptedExecutionError):
     22        Add predicates.
     23
    1242011-09-10  Filip Pizlo  <fpizlo@apple.com>
    225
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r94875 r94918  
    220220__ZN3JSC22globalMemoryStatisticsEv
    221221__ZN3JSC22objectConstructorTableE
     222__ZN3JSC23AbstractSamplingCounter30s_abstractSamplingCounterChainE
    222223__ZN3JSC23AbstractSamplingCounter4dumpEv
    223 __ZN3JSC23AbstractSamplingCounter30s_abstractSamplingCounterChainE
    224224__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
    225225__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
     
    228228__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
    229229__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
     230__ZN3JSC30isTerminatedExecutionExceptionENS_7JSValueE
    230231__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
    231232__ZN3JSC41constructFunctionSkippingEvalEnabledCheckEPNS_9ExecStateEPNS_14JSGlobalObjectERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r94875 r94918  
    1919    ??0SHA1@WTF@@QAE@XZ
    2020    ??0StringObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z
    21    ??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z
     21    ??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z
    2222    ??0ThreadCondition@WTF@@QAE@XZ
    2323    ??0UString@JSC@@QAE@PBD@Z
     
    241241    ?isMainThread@WTF@@YA_NXZ
    242242    ?isReachableFromOpaqueRoots@WeakHandleOwner@JSC@@UAE_NV?$Handle@W4Unknown@JSC@@@2@PAXAAVSlotVisitor@2@@Z
     243    ?isTerminatedExecutionException@JSC@@YA_NVJSValue@1@@Z
    243244    ?isValidAllocation@Heap@JSC@@AAE_NI@Z
    244245    ?isValidCallee@JSValue@JSC@@QAE_NXZ
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r94811 r94918  
    709709        }
    710710
    711         isInterrupt = (exception->inherits(&InterruptedExecutionError::s_info) || exception->inherits(&TerminatedExecutionError::s_info));
     711        isInterrupt = isInterruptedExecutionException(exception) || isTerminatedExecutionException(exception);
    712712    }
    713713
  • trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r94835 r94918  
    4949}
    5050
     51JSObject* createInterruptedExecutionException(JSGlobalData* globalData)
     52{
     53    return InterruptedExecutionError::create(*globalData);
     54}
     55
     56bool isInterruptedExecutionException(JSObject* object)
     57{
     58    return object->inherits(&InterruptedExecutionError::s_info);
     59}
     60
     61bool isInterruptedExecutionException(JSValue value)
     62{
     63    return value.inherits(&InterruptedExecutionError::s_info);
     64}
     65
     66
    5167const ClassInfo TerminatedExecutionError::s_info = { "TerminatedExecutionError", &Base::s_info, 0, 0 };
    5268
     
    5672}
    5773
    58 
    59 JSObject* createInterruptedExecutionException(JSGlobalData* globalData)
    60 {
    61     return InterruptedExecutionError::create(*globalData);
    62 }
    63 
    6474JSObject* createTerminatedExecutionException(JSGlobalData* globalData)
    6575{
    6676    return TerminatedExecutionError::create(*globalData);
    6777}
     78
     79bool isTerminatedExecutionException(JSObject* object)
     80{
     81    return object->inherits(&TerminatedExecutionError::s_info);
     82}
     83
     84bool isTerminatedExecutionException(JSValue value)
     85{
     86    return value.inherits(&TerminatedExecutionError::s_info);
     87}
     88
    6889
    6990JSObject* createStackOverflowError(ExecState* exec)
  • trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.h

    r94811 r94918  
    3535
    3636JSObject* createInterruptedExecutionException(JSGlobalData*);
     37bool isInterruptedExecutionException(JSObject*);
     38bool isInterruptedExecutionException(JSValue);
     39
    3740JSObject* createTerminatedExecutionException(JSGlobalData*);
     41bool isTerminatedExecutionException(JSObject*);
     42bool isTerminatedExecutionException(JSValue);
     43
    3844JSObject* createStackOverflowError(ExecState*);
    3945JSObject* createStackOverflowError(JSGlobalObject*);
  • trunk/Source/WebCore/ChangeLog

    r94916 r94918  
     12011-09-10  Sam Weinig  <sam@webkit.org>
     2
     3        Add isInterruptedExecutionException and isTerminatedExecutionException predicates
     4        https://bugs.webkit.org/show_bug.cgi?id=67892
     5
     6        Reviewed by Andy "First Time Reviewer" Estes.
     7
     8        * bindings/js/JSDOMBinding.cpp:
     9        (WebCore::reportException):
     10        * bindings/js/JSEventListener.cpp:
     11        (WebCore::JSEventListener::handleEvent):
     12        * bindings/js/WorkerScriptController.cpp:
     13        (WebCore::WorkerScriptController::evaluate):
     14        Use the new predicates instead of probing the ClassInfo directly.
     15
    1162011-09-10  Kevin Ollivier  <kevino@theolliviers.com>
    217
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp

    r94811 r94918  
    172172void reportException(ExecState* exec, JSValue exception)
    173173{
    174     if (exception.inherits(&TerminatedExecutionError::s_info))
     174    if (isTerminatedExecutionException(exception))
    175175        return;
    176176
  • trunk/Source/WebCore/bindings/js/JSEventListener.cpp

    r94811 r94918  
    135135#if ENABLE(WORKERS)
    136136        if (scriptExecutionContext->isWorkerContext()) {
    137             bool terminatorCausedException = (exec->hadException() && exec->exception().inherits(&TerminatedExecutionError::s_info));
     137            bool terminatorCausedException = (exec->hadException() && isTerminatedExecutionException(exec->exception()));
    138138            if (terminatorCausedException || globalData.terminator.shouldTerminate())
    139139                static_cast<WorkerContext*>(scriptExecutionContext)->script()->forbidExecution();
  • trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp

    r94811 r94918  
    133133    ExecState* exec = m_workerContextWrapper->globalExec();
    134134
     135    m_workerContextWrapper->globalData().timeoutChecker.start();
     136
    135137    JSValue evaluationException;
     138    JSValue returnValue = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper.get(), &evaluationException);
    136139
    137     m_workerContextWrapper->globalData().timeoutChecker.start();
    138     JSValue returnValue = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper.get(), &evaluationException);
    139140    m_workerContextWrapper->globalData().timeoutChecker.stop();
    140141
    141     if ((evaluationException && evaluationException.inherits(&TerminatedExecutionError::s_info)) ||  m_workerContextWrapper->globalData().terminator.shouldTerminate()) {
     142    if ((evaluationException && isTerminatedExecutionException(evaluationException)) ||  m_workerContextWrapper->globalData().terminator.shouldTerminate()) {
    142143        forbidExecution();
    143144        return ScriptValue();
Note: See TracChangeset for help on using the changeset viewer.