Commit 76c11465 authored by weinig@apple.com's avatar weinig@apple.com

Add isInterruptedExecutionException and isTerminatedExecutionException predicates

https://bugs.webkit.org/show_bug.cgi?id=67892

Reviewed by Andy "First Time Reviewer" Estes.

../JavaScriptCore: 

* JavaScriptCore.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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 87c77d58
2011-09-10 Sam Weinig <sam@webkit.org>
Add isInterruptedExecutionException and isTerminatedExecutionException predicates
https://bugs.webkit.org/show_bug.cgi?id=67892
Reviewed by Andy "First Time Reviewer" Estes.
* JavaScriptCore.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 <fpizlo@apple.com>
DFG JIT completely undoes speculative compilation even in the case of
......
......@@ -219,14 +219,15 @@ __ZN3JSC20WriteBarrierCounters25usesWithoutBarrierFromCppE
__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC22globalMemoryStatisticsEv
__ZN3JSC22objectConstructorTableE
__ZN3JSC23AbstractSamplingCounter4dumpEv
__ZN3JSC23AbstractSamplingCounter30s_abstractSamplingCounterChainE
__ZN3JSC23AbstractSamplingCounter4dumpEv
__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
......
......@@ -18,7 +18,7 @@ EXPORTS
??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 @@ EXPORTS
?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
......
......@@ -708,7 +708,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
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()) {
......
......@@ -48,6 +48,22 @@ UString InterruptedExecutionError::toString(ExecState*) const
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 @@ UString TerminatedExecutionError::toString(ExecState*) const
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.");
......
......@@ -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*);
......
2011-09-10 Sam Weinig <sam@webkit.org>
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 <kevino@theolliviers.com>
[wx] Unreviewed build fix. MSW build fixes.
......@@ -171,7 +171,7 @@ double valueToDate(ExecState* exec, JSValue value)
void reportException(ExecState* exec, JSValue exception)
{
if (exception.inherits(&TerminatedExecutionError::s_info))
if (isTerminatedExecutionException(exception))
return;
UString errorMessage = exception.toString(exec);
......
......@@ -134,7 +134,7 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
#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();
}
......
......@@ -132,13 +132,14 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode,
ExecState* exec = m_workerContextWrapper->globalExec();
JSValue evaluationException;
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.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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment