Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
<rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
Reviewed by Sam
Adds support for the slow script dialog in squirrelfish. This requires the addition
of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
same behaviour as their simple jump equivalents but have an additional time out check.
Additional assertions were added to other jump instructions to prevent accidentally
creating loops with jump types that do not support time out checks.
Sunspider does not report a regression, however this appears very sensitive to code
layout and hardware, so i would expect up to a 1% regression on other systems.
Part of this required moving the old timeout logic from JSGlobalObject and into Machine
which is the cause of a number of the larger diff blocks.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/Machine.h b/JavaScriptCore/VM/Machine.h
index ba195b8..64ff28b 100644
--- a/JavaScriptCore/VM/Machine.h
+++ b/JavaScriptCore/VM/Machine.h
@@ -42,6 +42,7 @@
class FunctionBodyNode;
class Instruction;
class JSFunction;
+ class JSGlobalObject;
class ProgramNode;
class Register;
class RegisterFile;
@@ -96,7 +97,27 @@
JSValue* retrieveCaller(ExecState*, JSFunction*) const;
void getFunctionAndArguments(Register** registerBase, Register* callFrame, JSFunction*&, Register*& argv, int& argc);
+ void setTimeoutTime(unsigned timeoutTime) { m_timeoutTime = timeoutTime; }
+
+ void startTimeoutCheck()
+ {
+ if (!m_timeoutCheckCount)
+ resetTimeoutCheck();
+
+ ++m_timeoutCheckCount;
+ }
+
+ void stopTimeoutCheck()
+ {
+ --m_timeoutCheckCount;
+ }
+ inline void initTimeout()
+ {
+ resetTimeoutCheck();
+ m_timeoutTime = 0;
+ m_timeoutCheckCount = 0;
+ }
void mark(Heap* heap) { m_registerFile.mark(heap); }
private:
@@ -118,7 +139,16 @@
void dumpCallFrame(const CodeBlock*, ScopeChainNode*, RegisterFile*, const Register*);
void dumpRegisters(const CodeBlock*, RegisterFile*, const Register*);
+ JSValue* checkTimeout(JSGlobalObject*);
+ void resetTimeoutCheck();
+
int m_reentryDepth;
+ unsigned m_timeoutTime;
+ unsigned m_timeAtLastCheckTimeout;
+ unsigned m_timeExecuting;
+ unsigned m_timeoutCheckCount;
+ unsigned m_ticksUntilNextTimeoutCheck;
+
RegisterFile m_registerFile;
#if HAVE(COMPUTED_GOTO)