Commit 5d91a8d3 authored by eric@webkit.org's avatar eric@webkit.org

2010-04-06 Adam Barth <abarth@webkit.org>

        Reviewed by Eric Seidel.

        REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
        https://bugs.webkit.org/show_bug.cgi?id=36646

        Add a new exception type for forcibly terminating a JavaScript stack.
        The new exception functions similarly to the
        InterruptedExecutionException but is conceptually different because
        execution is terminated instead of just interrupted.

        * GNUmakefile.am:
            - Added new Terminator.h file.
        * JavaScriptCore.gypi:
            - Added new Terminator.h file.
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
            - Added new Terminator.h file.
        * JavaScriptCore.xcodeproj/project.pbxproj:
            - Added new Terminator.h file.
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::throwException):
            - Fully unwind the stack for TerminatedExecutionException.
        (JSC::Interpreter::privateExecute):
            - Check if we've been terminated at the same time we check if we've
              timed out.
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
            - Check if we've been terminated at the same time we check if we've
              timed out.
        * runtime/Completion.cpp:
            - Some exceptions define special completion types so that calls can
              see why we terminated evaluation.
        (JSC::evaluate):
        * runtime/Completion.h:
            - Define a new completion type for termination.
        (JSC::):
        * runtime/ExceptionHelpers.cpp:
            - Define TerminatedExecutionException and refactor pseudo-RTTI
              virtual function to be more semantic.
        (JSC::InterruptedExecutionError::exceptionType):
        (JSC::TerminatedExecutionError::TerminatedExecutionError):
        (JSC::TerminatedExecutionError::exceptionType):
        (JSC::TerminatedExecutionError::toString):
        (JSC::createTerminatedExecutionException):
        * runtime/ExceptionHelpers.h:
            - Entry point for generating a TerminatedExecutionException.
        * runtime/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData):
            - Add a Terminator object that can be used to asynchronously
              terminate a JavaScript execution stack.
        * runtime/JSGlobalData.h:
        * runtime/JSObject.h:
        (JSC::JSObject::exceptionType):
            - Define that, by default, thrown objects have a normal exception
              type.
        * runtime/Terminator.h: Added.
            - Added a new controller object that can be used to terminate
              execution asynchronously.  This object is more or less a
              glorified bool.
        (JSC::Terminator::Terminator):
        (JSC::Terminator::termianteSoon):
        (JSC::Terminator::shouldTerminate):
2010-04-06  Adam Barth  <abarth@webkit.org>

        Reviewed by Eric Seidel.

        REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
        https://bugs.webkit.org/show_bug.cgi?id=36646

        * fast/workers/resources/worker-run-forever.js: Added.
        * fast/workers/worker-terminate-forever-expected.txt: Added.
        * fast/workers/worker-terminate-forever.html: Added.
            - Test what happens when we terminate an infinitely running worker.
              The essential point is that we don't spam the console with
              nonsense about a timeout.
        * platform/mac/Skipped:
            - Rescue worker-terminate.html from the Skipped list now that we've
              fixed the underlying bug that was causing the flakiness.
2010-04-06  Adam Barth  <abarth@webkit.org>

        Reviewed by Eric Seidel.

        REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
        https://bugs.webkit.org/show_bug.cgi?id=36646

        Cause the worker code to swallow termination exceptions because these
        need not be reported to the user because they are an implementation
        detail of how we terminate worker execution.

        Test: fast/workers/worker-terminate-forever.html

        * bindings/js/JSDOMBinding.cpp:
        (WebCore::reportException):
            - Refuse to report termination exceptions to the user because they
              are an implementation detail.
        * bindings/js/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::forbidExecution):
            - Instead of using timeouts to stop run away workers, use our fancy
              new Terminator object.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 84a1dbfb
2010-04-06 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
https://bugs.webkit.org/show_bug.cgi?id=36646
Add a new exception type for forcibly terminating a JavaScript stack.
The new exception functions similarly to the
InterruptedExecutionException but is conceptually different because
execution is terminated instead of just interrupted.
* GNUmakefile.am:
- Added new Terminator.h file.
* JavaScriptCore.gypi:
- Added new Terminator.h file.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
- Added new Terminator.h file.
* JavaScriptCore.xcodeproj/project.pbxproj:
- Added new Terminator.h file.
* interpreter/Interpreter.cpp:
(JSC::Interpreter::throwException):
- Fully unwind the stack for TerminatedExecutionException.
(JSC::Interpreter::privateExecute):
- Check if we've been terminated at the same time we check if we've
timed out.
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
- Check if we've been terminated at the same time we check if we've
timed out.
* runtime/Completion.cpp:
- Some exceptions define special completion types so that calls can
see why we terminated evaluation.
(JSC::evaluate):
* runtime/Completion.h:
- Define a new completion type for termination.
(JSC::):
* runtime/ExceptionHelpers.cpp:
- Define TerminatedExecutionException and refactor pseudo-RTTI
virtual function to be more semantic.
(JSC::InterruptedExecutionError::exceptionType):
(JSC::TerminatedExecutionError::TerminatedExecutionError):
(JSC::TerminatedExecutionError::exceptionType):
(JSC::TerminatedExecutionError::toString):
(JSC::createTerminatedExecutionException):
* runtime/ExceptionHelpers.h:
- Entry point for generating a TerminatedExecutionException.
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
- Add a Terminator object that can be used to asynchronously
terminate a JavaScript execution stack.
* runtime/JSGlobalData.h:
* runtime/JSObject.h:
(JSC::JSObject::exceptionType):
- Define that, by default, thrown objects have a normal exception
type.
* runtime/Terminator.h: Added.
- Added a new controller object that can be used to terminate
execution asynchronously. This object is more or less a
glorified bool.
(JSC::Terminator::Terminator):
(JSC::Terminator::termianteSoon):
(JSC::Terminator::shouldTerminate):
2010-04-05 Oliver Hunt <oliver@apple.com>
And another one.
......
......@@ -209,6 +209,7 @@ javascriptcore_sources += \
JavaScriptCore/runtime/StructureChain.cpp \
JavaScriptCore/runtime/StructureChain.h \
JavaScriptCore/runtime/StructureTransitionTable.h \
JavaScriptCore/runtime/Terminator.h \
JavaScriptCore/runtime/TimeoutChecker.cpp \
JavaScriptCore/runtime/TimeoutChecker.h \
JavaScriptCore/runtime/JSTypeInfo.h \
......
......@@ -325,6 +325,7 @@
'runtime/StructureChain.h',
'runtime/StructureTransitionTable.h',
'runtime/SymbolTable.h',
'runtime/Terminator.h',
'runtime/TimeoutChecker.cpp',
'runtime/TimeoutChecker.h',
'runtime/Tracing.h',
......
......@@ -1212,6 +1212,10 @@
RelativePath="..\..\runtime\SymbolTable.h"
>
</File>
<File
RelativePath="..\..\runtime\Terminator.h"
>
</File>
<File
RelativePath="..\..\runtime\TimeoutChecker.cpp"
>
......
......@@ -269,6 +269,7 @@
969A079A0ED1D3AE00F1F681 /* Opcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07940ED1D3AE00F1F681 /* Opcode.cpp */; };
969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07950ED1D3AE00F1F681 /* Opcode.h */; settings = {ATTRIBUTES = (Private, ); }; };
96DD73790F9DA3100027FBCC /* VMTags.h in Headers */ = {isa = PBXBuildFile; fileRef = 96DD73780F9DA3100027FBCC /* VMTags.h */; settings = {ATTRIBUTES = (Private, ); }; };
971EDEA61169E0D3005E4262 /* Terminator.h in Headers */ = {isa = PBXBuildFile; fileRef = 97F6903A1169DF7F00A6BB46 /* Terminator.h */; settings = {ATTRIBUTES = (Private, ); }; };
A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; };
A72701B90DADE94900E548D7 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; };
A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */; };
......@@ -826,6 +827,7 @@
969A07950ED1D3AE00F1F681 /* Opcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Opcode.h; sourceTree = "<group>"; };
969A09220ED1E09C00F1F681 /* Completion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Completion.cpp; sourceTree = "<group>"; };
96DD73780F9DA3100027FBCC /* VMTags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTags.h; sourceTree = "<group>"; };
97F6903A1169DF7F00A6BB46 /* Terminator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Terminator.h; sourceTree = "<group>"; };
A72700770DAC605600E548D7 /* JSNotAnObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotAnObject.h; sourceTree = "<group>"; };
A72700780DAC605600E548D7 /* JSNotAnObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotAnObject.cpp; sourceTree = "<group>"; };
A72701B30DADE94900E548D7 /* ExceptionHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionHelpers.h; sourceTree = "<group>"; };
......@@ -1618,6 +1620,7 @@
7E4EE7080EBB7963005934AA /* StructureChain.h */,
BC9041470EB9250900FE26FA /* StructureTransitionTable.h */,
14A396A60CD2933100B5B4FF /* SymbolTable.h */,
97F6903A1169DF7F00A6BB46 /* Terminator.h */,
14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */,
14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */,
5D53726D0E1C546B0021E549 /* Tracing.d */,
......@@ -2008,6 +2011,7 @@
18BAB55410DAE066000D945B /* ThreadIdentifierDataPthreads.h in Headers */,
BC18C4700E16F5CD00B34460 /* Threading.h in Headers */,
BC18C4710E16F5CD00B34460 /* ThreadSpecific.h in Headers */,
971EDEA61169E0D3005E4262 /* Terminator.h in Headers */,
14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */,
5D53726F0E1C54880021E549 /* Tracing.h in Headers */,
0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */,
......
......@@ -522,8 +522,9 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerExecutable()->sourceID()), ReadOnly | DontDelete);
exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerExecutable()->sourceURL()), ReadOnly | DontDelete);
}
if (exception->isWatchdogException()) {
ComplType exceptionType = exception->exceptionType();
if (exceptionType == Interrupted || exceptionType == Terminated) {
while (unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock)) {
// Don't need handler checks or anything, we just want to unroll all the JS callframes possible.
}
......@@ -1174,7 +1175,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#define CHECK_FOR_TIMEOUT() \
if (!--tickCount) { \
if (globalData->timeoutChecker.didTimeOut(callFrame)) { \
if (globalData->terminator.shouldTerminate() || globalData->timeoutChecker.didTimeOut(callFrame)) { \
exceptionValue = jsNull(); \
goto vm_throw; \
} \
......
......@@ -1257,15 +1257,18 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_pre_inc)
DEFINE_STUB_FUNCTION(int, timeout_check)
{
STUB_INIT_STACK_FRAME(stackFrame);
JSGlobalData* globalData = stackFrame.globalData;
TimeoutChecker& timeoutChecker = globalData->timeoutChecker;
if (timeoutChecker.didTimeOut(stackFrame.callFrame)) {
if (globalData->terminator.shouldTerminate()) {
globalData->exception = createTerminatedExecutionException(globalData);
VM_THROW_EXCEPTION_AT_END();
} else if (timeoutChecker.didTimeOut(stackFrame.callFrame)) {
globalData->exception = createInterruptedExecutionException(globalData);
VM_THROW_EXCEPTION_AT_END();
}
return timeoutChecker.ticksUntilNextCheck();
}
......
......@@ -62,9 +62,10 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s
JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj, &exception);
if (exception) {
if (exception.isObject() && asObject(exception)->isWatchdogException())
return Completion(Interrupted, exception);
return Completion(Throw, exception);
ComplType exceptionType = Throw;
if (exception.isObject())
exceptionType = asObject(exception)->exceptionType();
return Completion(exceptionType, exception);
}
return Completion(Normal, result);
}
......
......@@ -31,7 +31,7 @@ namespace JSC {
class ScopeChain;
class SourceCode;
enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted };
enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted, Terminated };
/*
* Completion objects are used to convey the return status and value
......
......@@ -46,7 +46,7 @@ public:
{
}
virtual bool isWatchdogException() const { return true; }
virtual ComplType exceptionType() const { return Interrupted; }
virtual UString toString(ExecState*) const { return "JavaScript execution exceeded timeout."; }
};
......@@ -56,6 +56,23 @@ JSValue createInterruptedExecutionException(JSGlobalData* globalData)
return new (globalData) InterruptedExecutionError(globalData);
}
class TerminatedExecutionError : public JSObject {
public:
TerminatedExecutionError(JSGlobalData* globalData)
: JSObject(globalData->terminatedExecutionErrorStructure)
{
}
virtual ComplType exceptionType() const { return Terminated; }
virtual UString toString(ExecState*) const { return "JavaScript execution terminated."; }
};
JSValue createTerminatedExecutionException(JSGlobalData* globalData)
{
return new (globalData) TerminatedExecutionError(globalData);
}
static JSValue createError(ExecState* exec, ErrorType e, const char* msg)
{
return Error::create(exec, e, msg, -1, -1, UString());
......
......@@ -43,6 +43,7 @@ namespace JSC {
struct Instruction;
JSValue createInterruptedExecutionException(JSGlobalData*);
JSValue createTerminatedExecutionException(JSGlobalData*);
JSValue createStackOverflowError(ExecState*);
JSValue createTypeError(ExecState*, const char* message);
JSValue createUndefinedVariableError(ExecState*, const Identifier&, unsigned bytecodeOffset, CodeBlock*);
......
......@@ -115,6 +115,7 @@ JSGlobalData::JSGlobalData(bool isShared)
, stringTable(fastNew<HashTable>(JSC::stringTable))
, activationStructure(JSActivation::createStructure(jsNull()))
, interruptedExecutionErrorStructure(JSObject::createStructure(jsNull()))
, terminatedExecutionErrorStructure(JSObject::createStructure(jsNull()))
, staticScopeStructure(JSStaticScopeObject::createStructure(jsNull()))
, stringStructure(JSString::createStructure(jsNull()))
, notAnObjectErrorStubStructure(JSNotAnObjectErrorStub::createStructure(jsNull()))
......
......@@ -37,6 +37,7 @@
#include "MarkStack.h"
#include "NumericStrings.h"
#include "SmallStrings.h"
#include "Terminator.h"
#include "TimeoutChecker.h"
#include "WeakRandom.h"
#include <wtf/Forward.h>
......@@ -116,6 +117,7 @@ namespace JSC {
RefPtr<Structure> activationStructure;
RefPtr<Structure> interruptedExecutionErrorStructure;
RefPtr<Structure> terminatedExecutionErrorStructure;
RefPtr<Structure> staticScopeStructure;
RefPtr<Structure> stringStructure;
RefPtr<Structure> notAnObjectErrorStubStructure;
......@@ -153,6 +155,7 @@ namespace JSC {
JITThunks jitStubs;
#endif
TimeoutChecker timeoutChecker;
Terminator terminator;
Heap heap;
JSValue exception;
......
......@@ -26,6 +26,7 @@
#include "ArgList.h"
#include "ClassInfo.h"
#include "CommonIdentifiers.h"
#include "Completion.h"
#include "CallFrame.h"
#include "JSCell.h"
#include "JSNumberCell.h"
......@@ -195,9 +196,10 @@ namespace JSC {
virtual bool isGlobalObject() const { return false; }
virtual bool isVariableObject() const { return false; }
virtual bool isActivationObject() const { return false; }
virtual bool isWatchdogException() const { return false; }
virtual bool isNotAnObjectErrorStub() const { return false; }
virtual ComplType exceptionType() const { return Throw; }
void allocatePropertyStorage(size_t oldSize, size_t newSize);
void allocatePropertyStorageInline(size_t oldSize, size_t newSize);
bool isUsingInlineStorage() const { return m_structure->isUsingInlineStorage(); }
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Google Inc. ("Google") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Terminator_h
#define Terminator_h
namespace JSC {
class Terminator {
public:
Terminator() : m_shouldTerminate(false) { }
void terminateSoon() { m_shouldTerminate = true; }
bool shouldTerminate() const { return m_shouldTerminate; }
private:
bool m_shouldTerminate;
};
} // namespace JSC
#endif // Terminator_h
2010-04-06 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
https://bugs.webkit.org/show_bug.cgi?id=36646
* fast/workers/resources/worker-run-forever.js: Added.
* fast/workers/worker-terminate-forever-expected.txt: Added.
* fast/workers/worker-terminate-forever.html: Added.
- Test what happens when we terminate an infinitely running worker.
The essential point is that we don't spam the console with
nonsense about a timeout.
* platform/mac/Skipped:
- Rescue worker-terminate.html from the Skipped list now that we've
fixed the underlying bug that was causing the flakiness.
2010-04-06 Andrew Scherkus <scherkus@chromium.org>
Reviewed by Eric Seidel.
......
Test Worker.terminate() for a worker that tries to run forever.
<body>
<p>Test Worker.terminate() for a worker that tries to run forever.</p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var worker = new Worker('resources/worker-run-forever.js');
worker.terminate();
</script>
</body>
</html>
......@@ -151,8 +151,3 @@ fast/media/media-feature-wgt-view-mode.html
# Test is flaky and thus not useful until fixed.
# https://bugs.webkit.org/show_bug.cgi?id=36642
fast/replaced/border-radius-clip.html
# This test is very flaky with a high failure rate (around 25%).
# https://bugs.webkit.org/show_bug.cgi?id=36646
fast/workers/worker-terminate.html
2010-04-06 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
https://bugs.webkit.org/show_bug.cgi?id=36646
Cause the worker code to swallow termination exceptions because these
need not be reported to the user because they are an implementation
detail of how we terminate worker execution.
Test: fast/workers/worker-terminate-forever.html
* bindings/js/JSDOMBinding.cpp:
(WebCore::reportException):
- Refuse to report termination exceptions to the user because they
are an implementation detail.
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::forbidExecution):
- Instead of using timeouts to stop run away workers, use our fancy
new Terminator object.
2010-04-06 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by Jian Li.
......@@ -533,6 +533,9 @@ double valueToDate(ExecState* exec, JSValue value)
void reportException(ExecState* exec, JSValue exception)
{
if (exception.isObject() && asObject(exception)->exceptionType() == Terminated)
return;
UString errorMessage = exception.toString(exec);
JSObject* exceptionObject = exception.toObject(exec);
int lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec);
......
......@@ -141,10 +141,10 @@ void WorkerScriptController::forbidExecution()
// This function is called from another thread.
// Mutex protection for m_executionForbidden is needed to guarantee that the value is synchronized between processors, because
// if it were not, the worker could re-enter JSC::evaluate(), but with timeout already reset.
// It is not critical for Interpreter::m_timeoutTime to be synchronized, we just rely on it reaching the worker thread's processor sooner or later.
// It is not critical for Terminator::m_shouldTerminate to be synchronized, we just rely on it reaching the worker thread's processor sooner or later.
MutexLocker lock(m_sharedDataMutex);
m_executionForbidden = true;
m_globalData->timeoutChecker.setTimeoutInterval(1); // 1ms is the smallest timeout that can be set.
m_globalData->terminator.terminateSoon();
}
} // namespace WebCore
......
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