<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193649] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193649">193649</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2015-12-07 14:03:48 -0800 (Mon, 07 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add op_watchdog opcode that is generated when VM has a watchdog
https://bugs.webkit.org/show_bug.cgi?id=151954
Reviewed by Mark Lam.
Source/JavaScriptCore:
This patch also makes watchdog a private member
of VM and adds a getter function.
* API/JSContextRef.cpp:
(JSContextGroupClearExecutionTimeLimit):
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitLoopHint):
(JSC::BytecodeGenerator::emitWatchdog):
(JSC::BytecodeGenerator::retrieveLastBinaryOp):
* bytecompiler/BytecodeGenerator.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileCheckWatchdogTimer):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_loop_hint):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_watchdog):
(JSC::JIT::emitSlow_op_watchdog):
(JSC::JIT::emit_op_new_regexp):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LowLevelInterpreter.asm:
* runtime/VM.cpp:
(JSC::VM::ensureWatchdog):
* runtime/VM.h:
(JSC::VM::watchdog):
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):
* runtime/VMInlines.h:
(JSC::VM::shouldTriggerTermination):
Source/WebCore:
No new tests because JSC already has tests for this.
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::scheduleExecutionTermination):
(WebCore::WorkerScriptController::isTerminatingExecution):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSContextRefcpp">trunk/Source/JavaScriptCore/API/JSContextRef.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeListjson">trunk/Source/JavaScriptCore/bytecode/BytecodeList.json</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeUseDefh">trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp">trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCapabilitiescpp">trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITcpp">trunk/Source/JavaScriptCore/jit/JIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOpcodescpp">trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntSlowPathscpp">trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreterasm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMEntryScopecpp">trunk/Source/JavaScriptCore/runtime/VMEntryScope.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMInlinesh">trunk/Source/JavaScriptCore/runtime/VMInlines.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsWorkerScriptControllercpp">trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSContextRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSContextRef.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSContextRef.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/API/JSContextRef.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -108,8 +108,8 @@
</span><span class="cx"> {
</span><span class="cx"> VM& vm = *toJS(group);
</span><span class="cx"> JSLockHolder locker(&vm);
</span><del>- if (vm.watchdog)
- vm.watchdog->setTimeLimit(Watchdog::noTimeLimit);
</del><ins>+ if (vm.watchdog())
+ vm.watchdog()->setTimeLimit(Watchdog::noTimeLimit);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // From the API's perspective, a global context remains alive iff it has been JSGlobalContextRetained.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2015-12-07 Saam barati <sbarati@apple.com>
+
+ Add op_watchdog opcode that is generated when VM has a watchdog
+ https://bugs.webkit.org/show_bug.cgi?id=151954
+
+ Reviewed by Mark Lam.
+
+ This patch also makes watchdog a private member
+ of VM and adds a getter function.
+
+ * API/JSContextRef.cpp:
+ (JSContextGroupClearExecutionTimeLimit):
+ * bytecode/BytecodeList.json:
+ * bytecode/BytecodeUseDef.h:
+ (JSC::computeUsesForBytecodeOffset):
+ (JSC::computeDefsForBytecodeOffset):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpBytecode):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoopHint):
+ (JSC::BytecodeGenerator::emitWatchdog):
+ (JSC::BytecodeGenerator::retrieveLastBinaryOp):
+ * bytecompiler/BytecodeGenerator.h:
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGCapabilities.cpp:
+ (JSC::DFG::capabilityLevel):
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckWatchdogTimer):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_hint):
+ (JSC::JIT::emitSlow_op_loop_hint):
+ (JSC::JIT::emit_op_watchdog):
+ (JSC::JIT::emitSlow_op_watchdog):
+ (JSC::JIT::emit_op_new_regexp):
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * llint/LowLevelInterpreter.asm:
+ * runtime/VM.cpp:
+ (JSC::VM::ensureWatchdog):
+ * runtime/VM.h:
+ (JSC::VM::watchdog):
+ * runtime/VMEntryScope.cpp:
+ (JSC::VMEntryScope::VMEntryScope):
+ (JSC::VMEntryScope::~VMEntryScope):
+ * runtime/VMInlines.h:
+ (JSC::VM::shouldTriggerTermination):
+
</ins><span class="cx"> 2015-12-07 Alberto Garcia <berto@igalia.com>
</span><span class="cx">
</span><span class="cx"> Crashes on PPC64 due to mprotect() on address not aligned to the page size
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeListjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeList.json (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeList.json        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeList.json        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -134,7 +134,8 @@
</span><span class="cx"> { "name" : "op_copy_rest", "length": 4 },
</span><span class="cx"> { "name" : "op_get_rest_length", "length": 3 },
</span><span class="cx"> { "name" : "op_save", "length" : 4 },
</span><del>- { "name" : "op_resume", "length" : 3 }
</del><ins>+ { "name" : "op_resume", "length" : 3 },
+ { "name" : "op_watchdog", "length" : 1 }
</ins><span class="cx"> ]
</span><span class="cx"> },
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeUseDefh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> case op_create_direct_arguments:
</span><span class="cx"> case op_create_out_of_band_arguments:
</span><span class="cx"> case op_get_rest_length:
</span><ins>+ case op_watchdog:
</ins><span class="cx"> return;
</span><span class="cx"> case op_assert:
</span><span class="cx"> case op_get_scope:
</span><span class="lines">@@ -309,6 +310,7 @@
</span><span class="cx"> case op_profile_type:
</span><span class="cx"> case op_profile_control_flow:
</span><span class="cx"> case op_put_to_arguments:
</span><ins>+ case op_watchdog:
</ins><span class="cx"> #define LLINT_HELPER_OPCODES(opcode, length) case opcode:
</span><span class="cx"> FOR_EACH_LLINT_OPCODE_EXTENSION(LLINT_HELPER_OPCODES);
</span><span class="cx"> #undef LLINT_HELPER_OPCODES
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -1283,6 +1283,10 @@
</span><span class="cx"> printLocationAndOp(out, exec, location, it, "loop_hint");
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case op_watchdog: {
+ printLocationAndOp(out, exec, location, it, "watchdog");
+ break;
+ }
</ins><span class="cx"> case op_switch_imm: {
</span><span class="cx"> int tableIndex = (++it)->u.operand;
</span><span class="cx"> int defaultTarget = (++it)->u.operand;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -1011,8 +1011,15 @@
</span><span class="cx"> void BytecodeGenerator::emitLoopHint()
</span><span class="cx"> {
</span><span class="cx"> emitOpcode(op_loop_hint);
</span><ins>+ emitWatchdog();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void BytecodeGenerator::emitWatchdog()
+{
+ if (vm()->watchdog())
+ emitOpcode(op_watchdog);
+}
+
</ins><span class="cx"> void BytecodeGenerator::retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(instructions().size() >= 4);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -585,6 +585,8 @@
</span><span class="cx"> PassRefPtr<Label> emitJumpIfNotFunctionApply(RegisterID* cond, Label* target);
</span><span class="cx"> void emitPopScopes(RegisterID* srcDst, int targetScopeDepth);
</span><span class="cx">
</span><ins>+ void emitWatchdog();
+
</ins><span class="cx"> RegisterID* emitHasIndexedProperty(RegisterID* dst, RegisterID* base, RegisterID* propertyName);
</span><span class="cx"> RegisterID* emitHasStructureProperty(RegisterID* dst, RegisterID* base, RegisterID* propertyName, RegisterID* enumerator);
</span><span class="cx"> RegisterID* emitHasGenericProperty(RegisterID* dst, RegisterID* base, RegisterID* propertyName);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -4466,12 +4466,13 @@
</span><span class="cx"> m_currentBlock->isOSRTarget = true;
</span><span class="cx">
</span><span class="cx"> addToGraph(LoopHint);
</span><del>-
- if (m_vm->watchdog)
- addToGraph(CheckWatchdogTimer);
-
</del><span class="cx"> NEXT_OPCODE(op_loop_hint);
</span><span class="cx"> }
</span><ins>+
+ case op_watchdog: {
+ addToGraph(CheckWatchdogTimer);
+ NEXT_OPCODE(op_watchdog);
+ }
</ins><span class="cx">
</span><span class="cx"> case op_create_lexical_environment: {
</span><span class="cx"> VirtualRegister symbolTableRegister(currentInstruction[3].u.operand);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -173,6 +173,7 @@
</span><span class="cx"> case op_jngreater:
</span><span class="cx"> case op_jngreatereq:
</span><span class="cx"> case op_loop_hint:
</span><ins>+ case op_watchdog:
</ins><span class="cx"> case op_ret:
</span><span class="cx"> case op_end:
</span><span class="cx"> case op_new_object:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -4790,12 +4790,12 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CheckWatchdogTimer: {
</span><del>- ASSERT(m_jit.vm()->watchdog);
</del><ins>+ ASSERT(m_jit.vm()->watchdog());
</ins><span class="cx"> GPRTemporary unused(this);
</span><span class="cx"> GPRReg unusedGPR = unused.gpr();
</span><span class="cx">
</span><span class="cx"> JITCompiler::Jump timerDidFire = m_jit.branchTest8(JITCompiler::NonZero,
</span><del>- JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog->timerDidFireAddress()));
</del><ins>+ JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog()->timerDidFireAddress()));
</ins><span class="cx">
</span><span class="cx"> addSlowPathGenerator(slowPathCall(timerDidFire, this, operationHandleWatchdogTimer, unusedGPR));
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -4460,12 +4460,12 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CheckWatchdogTimer: {
</span><del>- ASSERT(m_jit.vm()->watchdog);
</del><ins>+ ASSERT(m_jit.vm()->watchdog());
</ins><span class="cx"> GPRTemporary unused(this);
</span><span class="cx"> GPRReg unusedGPR = unused.gpr();
</span><span class="cx">
</span><span class="cx"> JITCompiler::Jump timerDidFire = m_jit.branchTest8(JITCompiler::NonZero,
</span><del>- JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog->timerDidFireAddress()));
</del><ins>+ JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog()->timerDidFireAddress()));
</ins><span class="cx">
</span><span class="cx"> addSlowPathGenerator(slowPathCall(timerDidFire, this, operationHandleWatchdogTimer, unusedGPR));
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -6181,7 +6181,7 @@
</span><span class="cx"> LBasicBlock timerDidFire = FTL_NEW_BLOCK(m_out, ("CheckWatchdogTimer timer did fire"));
</span><span class="cx"> LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CheckWatchdogTimer continuation"));
</span><span class="cx">
</span><del>- LValue state = m_out.load8ZeroExt32(m_out.absolute(vm().watchdog->timerDidFireAddress()));
</del><ins>+ LValue state = m_out.load8ZeroExt32(m_out.absolute(vm().watchdog()->timerDidFireAddress()));
</ins><span class="cx"> m_out.branch(m_out.isZero32(state),
</span><span class="cx"> usually(continuation), rarely(timerDidFire));
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/jit/JIT.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -251,6 +251,7 @@
</span><span class="cx"> DEFINE_OP(op_jngreatereq)
</span><span class="cx"> DEFINE_OP(op_jtrue)
</span><span class="cx"> DEFINE_OP(op_loop_hint)
</span><ins>+ DEFINE_OP(op_watchdog)
</ins><span class="cx"> DEFINE_OP(op_lshift)
</span><span class="cx"> DEFINE_OP(op_mod)
</span><span class="cx"> DEFINE_OP(op_mov)
</span><span class="lines">@@ -412,6 +413,7 @@
</span><span class="cx"> DEFINE_SLOWCASE_OP(op_jngreatereq)
</span><span class="cx"> DEFINE_SLOWCASE_OP(op_jtrue)
</span><span class="cx"> DEFINE_SLOWCASE_OP(op_loop_hint)
</span><ins>+ DEFINE_SLOWCASE_OP(op_watchdog)
</ins><span class="cx"> DEFINE_SLOWCASE_OP(op_lshift)
</span><span class="cx"> DEFINE_SLOWCASE_OP(op_mod)
</span><span class="cx"> DEFINE_SLOWCASE_OP(op_mul)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/jit/JIT.h        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -532,6 +532,7 @@
</span><span class="cx"> void emit_op_jngreatereq(Instruction*);
</span><span class="cx"> void emit_op_jtrue(Instruction*);
</span><span class="cx"> void emit_op_loop_hint(Instruction*);
</span><ins>+ void emit_op_watchdog(Instruction*);
</ins><span class="cx"> void emit_op_lshift(Instruction*);
</span><span class="cx"> void emit_op_mod(Instruction*);
</span><span class="cx"> void emit_op_mov(Instruction*);
</span><span class="lines">@@ -629,6 +630,7 @@
</span><span class="cx"> void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
</span><span class="cx"> void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
</span><span class="cx"> void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&);
</span><ins>+ void emitSlow_op_watchdog(Instruction*, Vector<SlowCaseEntry>::iterator&);
</ins><span class="cx"> void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
</span><span class="cx"> void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
</span><span class="cx"> void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOpcodescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -892,10 +892,6 @@
</span><span class="cx"> addSlowCase(branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()),
</span><span class="cx"> AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter())));
</span><span class="cx"> }
</span><del>-
- // Emit the watchdog timer check:
- if (m_vm->watchdog)
- addSlowCase(branchTest8(NonZero, AbsoluteAddress(m_vm->watchdog->timerDidFireAddress())));
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JIT::emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator& iter)
</span><span class="lines">@@ -920,15 +916,19 @@
</span><span class="cx"> emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><ins>+}
</ins><span class="cx">
</span><del>- // Emit the slow path of the watchdog timer check:
- if (m_vm->watchdog) {
- linkSlowCase(iter);
- callOperation(operationHandleWatchdogTimer);
</del><ins>+void JIT::emit_op_watchdog(Instruction*)
+{
+ ASSERT(m_vm->watchdog());
+ addSlowCase(branchTest8(NonZero, AbsoluteAddress(m_vm->watchdog()->timerDidFireAddress())));
+}
</ins><span class="cx">
</span><del>- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
- }
-
</del><ins>+void JIT::emitSlow_op_watchdog(Instruction*, Vector<SlowCaseEntry>::iterator& iter)
+{
+ ASSERT(m_vm->watchdog());
+ linkSlowCase(iter);
+ callOperation(operationHandleWatchdogTimer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JIT::emit_op_new_regexp(Instruction* currentInstruction)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -1370,7 +1370,7 @@
</span><span class="cx"> LLINT_SLOW_PATH_DECL(slow_path_handle_watchdog_timer)
</span><span class="cx"> {
</span><span class="cx"> LLINT_BEGIN_NO_SET_PC();
</span><del>- ASSERT(vm.watchdog);
</del><ins>+ ASSERT(vm.watchdog());
</ins><span class="cx"> if (UNLIKELY(vm.shouldTriggerTermination(exec)))
</span><span class="cx"> LLINT_THROW(createTerminatedExecutionException(&vm));
</span><span class="cx"> LLINT_RETURN_TWO(0, exec);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreterasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -1438,12 +1438,17 @@
</span><span class="cx">
</span><span class="cx"> _llint_op_loop_hint:
</span><span class="cx"> traceExecution()
</span><ins>+ checkSwitchToJITForLoop()
+ dispatch(1)
+
+
+_llint_op_watchdog:
+ traceExecution()
</ins><span class="cx"> loadp CodeBlock[cfr], t1
</span><span class="cx"> loadp CodeBlock::m_vm[t1], t1
</span><del>- loadp VM::watchdog[t1], t0
</del><ins>+ loadp VM::m_watchdog[t1], t0
</ins><span class="cx"> btpnz t0, .handleWatchdogTimer
</span><span class="cx"> .afterWatchdogTimerCheck:
</span><del>- checkSwitchToJITForLoop()
</del><span class="cx"> dispatch(1)
</span><span class="cx"> .handleWatchdogTimer:
</span><span class="cx"> loadb Watchdog::m_timerDidFire[t0], t0
</span><span class="lines">@@ -1453,6 +1458,7 @@
</span><span class="cx"> .throwHandler:
</span><span class="cx"> jmp _llint_throw_from_slow_path_trampoline
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> _llint_op_switch_string:
</span><span class="cx"> traceExecution()
</span><span class="cx"> callSlowPath(_llint_slow_path_switch_string)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -402,20 +402,20 @@
</span><span class="cx">
</span><span class="cx"> Watchdog& VM::ensureWatchdog()
</span><span class="cx"> {
</span><del>- if (!watchdog) {
- watchdog = adoptRef(new Watchdog());
</del><ins>+ if (!m_watchdog) {
+ m_watchdog = adoptRef(new Watchdog());
</ins><span class="cx">
</span><span class="cx"> // The LLINT peeks into the Watchdog object directly. In order to do that,
</span><span class="cx"> // the LLINT assumes that the internal shape of a std::unique_ptr is the
</span><span class="cx"> // same as a plain C++ pointer, and loads the address of Watchdog from it.
</span><del>- RELEASE_ASSERT(*reinterpret_cast<Watchdog**>(&watchdog) == watchdog.get());
</del><ins>+ RELEASE_ASSERT(*reinterpret_cast<Watchdog**>(&m_watchdog) == m_watchdog.get());
</ins><span class="cx">
</span><span class="cx"> // And if we've previously compiled any functions, we need to revert
</span><span class="cx"> // them because they don't have the needed polling checks for the watchdog
</span><span class="cx"> // yet.
</span><span class="cx"> deleteAllCode();
</span><span class="cx"> }
</span><del>- return *watchdog;
</del><ins>+ return *m_watchdog;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -240,6 +240,7 @@
</span><span class="cx"> JS_EXPORT_PRIVATE ~VM();
</span><span class="cx">
</span><span class="cx"> JS_EXPORT_PRIVATE Watchdog& ensureWatchdog();
</span><ins>+ JS_EXPORT_PRIVATE Watchdog* watchdog() { return m_watchdog.get(); }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> RefPtr<JSLock> m_apiLock;
</span><span class="lines">@@ -263,8 +264,6 @@
</span><span class="cx"> ClientData* clientData;
</span><span class="cx"> VMEntryFrame* topVMEntryFrame;
</span><span class="cx"> ExecState* topCallFrame;
</span><del>- RefPtr<Watchdog> watchdog;
-
</del><span class="cx"> Strong<Structure> structureStructure;
</span><span class="cx"> Strong<Structure> structureRareDataStructure;
</span><span class="cx"> Strong<Structure> terminatedExecutionErrorStructure;
</span><span class="lines">@@ -650,6 +649,7 @@
</span><span class="cx"> unsigned m_controlFlowProfilerEnabledCount;
</span><span class="cx"> Deque<std::unique_ptr<QueuedTask>> m_microtaskQueue;
</span><span class="cx"> MallocPtr<EncodedJSValue> m_exceptionFuzzBuffer;
</span><ins>+ RefPtr<Watchdog> m_watchdog;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #if ENABLE(GC_VALIDATION)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMEntryScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VMEntryScope.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VMEntryScope.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/runtime/VMEntryScope.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -46,8 +46,8 @@
</span><span class="cx"> // observe time xone changes.
</span><span class="cx"> vm.resetDateCache();
</span><span class="cx">
</span><del>- if (vm.watchdog)
- vm.watchdog->enteredVM();
</del><ins>+ if (vm.watchdog())
+ vm.watchdog()->enteredVM();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> vm.clearLastException();
</span><span class="lines">@@ -63,8 +63,8 @@
</span><span class="cx"> if (m_vm.entryScope != this)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (m_vm.watchdog)
- m_vm.watchdog->exitedVM();
</del><ins>+ if (m_vm.watchdog())
+ m_vm.watchdog()->exitedVM();
</ins><span class="cx">
</span><span class="cx"> m_vm.entryScope = nullptr;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VMInlines.h (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VMInlines.h        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/JavaScriptCore/runtime/VMInlines.h        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -33,9 +33,9 @@
</span><span class="cx">
</span><span class="cx"> bool VM::shouldTriggerTermination(ExecState* exec)
</span><span class="cx"> {
</span><del>- if (!watchdog)
</del><ins>+ if (!watchdog())
</ins><span class="cx"> return false;
</span><del>- return watchdog->shouldTerminate(exec);
</del><ins>+ return watchdog()->shouldTerminate(exec);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/WebCore/ChangeLog        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-12-07 Saam barati <sbarati@apple.com>
+
+ Add op_watchdog opcode that is generated when VM has a watchdog
+ https://bugs.webkit.org/show_bug.cgi?id=151954
+
+ Reviewed by Mark Lam.
+
+ No new tests because JSC already has tests for this.
+
+ * bindings/js/WorkerScriptController.cpp:
+ (WebCore::WorkerScriptController::scheduleExecutionTermination):
+ (WebCore::WorkerScriptController::isTerminatingExecution):
+
</ins><span class="cx"> 2015-12-07 Brian Burg <bburg@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Uncaught Exception page should have better styles and handle more error cases
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsWorkerScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp (193648 => 193649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp        2015-12-07 21:35:02 UTC (rev 193648)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp        2015-12-07 22:03:48 UTC (rev 193649)
</span><span class="lines">@@ -153,8 +153,8 @@
</span><span class="cx"> LockHolder locker(m_scheduledTerminationMutex);
</span><span class="cx"> m_isTerminatingExecution = true;
</span><span class="cx">
</span><del>- ASSERT(m_vm->watchdog);
- m_vm->watchdog->terminateSoon();
</del><ins>+ ASSERT(m_vm->watchdog());
+ m_vm->watchdog()->terminateSoon();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WorkerScriptController::isTerminatingExecution() const
</span></span></pre>
</div>
</div>
</body>
</html>