Title: [94918] trunk/Source
Revision
94918
Author
[email protected]
Date
2011-09-10 22:16:09 -0700 (Sat, 10 Sep 2011)

Log Message

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

Reviewed by Andy "First Time Reviewer" Estes.

../_javascript_Core: 

* _javascript_Core.exp:
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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (94917 => 94918)


--- trunk/Source/_javascript_Core/ChangeLog	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-09-11 05:16:09 UTC (rev 94918)
@@ -1,3 +1,26 @@
+2011-09-10  Sam Weinig  <[email protected]>
+
+        Add isInterruptedExecutionException and isTerminatedExecutionException predicates
+        https://bugs.webkit.org/show_bug.cgi?id=67892
+
+        Reviewed by Andy "First Time Reviewer" Estes.
+
+        * _javascript_Core.exp:
+        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.
+
 2011-09-10  Filip Pizlo  <[email protected]>
 
         DFG JIT completely undoes speculative compilation even in the case of

Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (94917 => 94918)


--- trunk/Source/_javascript_Core/_javascript_Core.exp	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp	2011-09-11 05:16:09 UTC (rev 94918)
@@ -219,14 +219,15 @@
 __ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
 __ZN3JSC22globalMemoryStatisticsEv
 __ZN3JSC22objectConstructorTableE
+__ZN3JSC23AbstractSamplingCounter30s_abstractSamplingCounterChainE
 __ZN3JSC23AbstractSamplingCounter4dumpEv
-__ZN3JSC23AbstractSamplingCounter30s_abstractSamplingCounterChainE
 __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
 __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
 __ZN3JSC24DynamicGlobalObjectScopeC1ERNS_12JSGlobalDataEPNS_14JSGlobalObjectE
 __ZN3JSC24TerminatedExecutionError6s_infoE
 __ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
 __ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
+__ZN3JSC30isTerminatedExecutionExceptionENS_7JSValueE
 __ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
 __ZN3JSC41constructFunctionSkippingEvalEnabledCheckEPNS_9ExecStateEPNS_14JSGlobalObjectERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
 __ZN3JSC4Heap11objectCountEv

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (94917 => 94918)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-09-11 05:16:09 UTC (rev 94918)
@@ -18,7 +18,7 @@
     ??0RegExpObject@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@@Z
     ??0SHA1@WTF@@QAE@XZ
     ??0StringObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z
-   ??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z
+    ??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z
     ??0ThreadCondition@WTF@@QAE@XZ
     ??0UString@JSC@@QAE@PBD@Z
     ??0UString@JSC@@QAE@PBDI@Z
@@ -240,6 +240,7 @@
     ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
     ?isMainThread@WTF@@YA_NXZ
     ?isReachableFromOpaqueRoots@WeakHandleOwner@JSC@@UAE_NV?$Handle@W4Unknown@JSC@@@2@PAXAAVSlotVisitor@2@@Z
+    ?isTerminatedExecutionException@JSC@@YA_NVJSValue@1@@Z
     ?isValidAllocation@Heap@JSC@@AAE_NI@Z
     ?isValidCallee@JSValue@JSC@@QAE_NXZ
     ?isVariableObject@JSVariableObject@JSC@@UBE_NXZ

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (94917 => 94918)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2011-09-11 05:16:09 UTC (rev 94918)
@@ -708,7 +708,7 @@
             addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source());
         }
 
-        isInterrupt = (exception->inherits(&InterruptedExecutionError::s_info) || exception->inherits(&TerminatedExecutionError::s_info));
+        isInterrupt = isInterruptedExecutionException(exception) || isTerminatedExecutionException(exception);
     }
 
     if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {

Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp (94917 => 94918)


--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp	2011-09-11 05:16:09 UTC (rev 94918)
@@ -48,6 +48,22 @@
     return "_javascript_ execution exceeded timeout.";
 }
 
+JSObject* createInterruptedExecutionException(JSGlobalData* globalData)
+{
+    return InterruptedExecutionError::create(*globalData);
+}
+
+bool isInterruptedExecutionException(JSObject* object)
+{
+    return object->inherits(&InterruptedExecutionError::s_info);
+}
+
+bool isInterruptedExecutionException(JSValue value)
+{
+    return value.inherits(&InterruptedExecutionError::s_info);
+}
+
+
 const ClassInfo TerminatedExecutionError::s_info = { "TerminatedExecutionError", &Base::s_info, 0, 0 };
 
 UString TerminatedExecutionError::toString(ExecState*) const
@@ -55,17 +71,22 @@
     return "_javascript_ execution terminated.";
 }
 
+JSObject* createTerminatedExecutionException(JSGlobalData* globalData)
+{
+    return TerminatedExecutionError::create(*globalData);
+}
 
-JSObject* createInterruptedExecutionException(JSGlobalData* globalData)
+bool isTerminatedExecutionException(JSObject* object)
 {
-    return InterruptedExecutionError::create(*globalData);
+    return object->inherits(&TerminatedExecutionError::s_info);
 }
 
-JSObject* createTerminatedExecutionException(JSGlobalData* globalData)
+bool isTerminatedExecutionException(JSValue value)
 {
-    return TerminatedExecutionError::create(*globalData);
+    return value.inherits(&TerminatedExecutionError::s_info);
 }
 
+
 JSObject* createStackOverflowError(ExecState* exec)
 {
     return createRangeError(exec, "Maximum call stack size exceeded.");

Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.h (94917 => 94918)


--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.h	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.h	2011-09-11 05:16:09 UTC (rev 94918)
@@ -34,7 +34,13 @@
 namespace JSC {
 
 JSObject* createInterruptedExecutionException(JSGlobalData*);
+bool isInterruptedExecutionException(JSObject*);
+bool isInterruptedExecutionException(JSValue);
+
 JSObject* createTerminatedExecutionException(JSGlobalData*);
+bool isTerminatedExecutionException(JSObject*);
+bool isTerminatedExecutionException(JSValue);
+
 JSObject* createStackOverflowError(ExecState*);
 JSObject* createStackOverflowError(JSGlobalObject*);
 JSObject* createOutOfMemoryError(JSGlobalObject*);

Modified: trunk/Source/WebCore/ChangeLog (94917 => 94918)


--- trunk/Source/WebCore/ChangeLog	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/WebCore/ChangeLog	2011-09-11 05:16:09 UTC (rev 94918)
@@ -1,3 +1,18 @@
+2011-09-10  Sam Weinig  <[email protected]>
+
+        Add isInterruptedExecutionException and isTerminatedExecutionException predicates
+        https://bugs.webkit.org/show_bug.cgi?id=67892
+
+        Reviewed by Andy "First Time Reviewer" Estes.
+
+        * 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.
+
 2011-09-10  Kevin Ollivier  <[email protected]>
 
         [wx] Unreviewed build fix. MSW build fixes.

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (94917 => 94918)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2011-09-11 05:16:09 UTC (rev 94918)
@@ -171,7 +171,7 @@
 
 void reportException(ExecState* exec, JSValue exception)
 {
-    if (exception.inherits(&TerminatedExecutionError::s_info))
+    if (isTerminatedExecutionException(exception))
         return;
 
     UString errorMessage = exception.toString(exec);

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (94917 => 94918)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2011-09-11 05:16:09 UTC (rev 94918)
@@ -134,7 +134,7 @@
 
 #if ENABLE(WORKERS)
         if (scriptExecutionContext->isWorkerContext()) {
-            bool terminatorCausedException = (exec->hadException() && exec->exception().inherits(&TerminatedExecutionError::s_info));
+            bool terminatorCausedException = (exec->hadException() && isTerminatedExecutionException(exec->exception()));
             if (terminatorCausedException || globalData.terminator.shouldTerminate())
                 static_cast<WorkerContext*>(scriptExecutionContext)->script()->forbidExecution();
         }

Modified: trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp (94917 => 94918)


--- trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp	2011-09-11 05:16:03 UTC (rev 94917)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp	2011-09-11 05:16:09 UTC (rev 94918)
@@ -132,13 +132,14 @@
 
     ExecState* exec = m_workerContextWrapper->globalExec();
 
+    m_workerContextWrapper->globalData().timeoutChecker.start();
+
     JSValue evaluationException;
+    JSValue returnValue = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper.get(), &evaluationException);
 
-    m_workerContextWrapper->globalData().timeoutChecker.start();
-    JSValue returnValue = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper.get(), &evaluationException);
     m_workerContextWrapper->globalData().timeoutChecker.stop();
 
-    if ((evaluationException && evaluationException.inherits(&TerminatedExecutionError::s_info)) ||  m_workerContextWrapper->globalData().terminator.shouldTerminate()) {
+    if ((evaluationException && isTerminatedExecutionException(evaluationException)) ||  m_workerContextWrapper->globalData().terminator.shouldTerminate()) {
         forbidExecution();
         return ScriptValue();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to