- Revision
- 213302
- Author
- [email protected]
- Date
- 2017-03-02 14:06:04 -0800 (Thu, 02 Mar 2017)
Log Message
Add Options::alwaysCheckTraps() and Options::usePollingTraps() options.
https://bugs.webkit.org/show_bug.cgi?id=169088
Reviewed by Keith Miller.
Options::alwaysCheckTraps() forces the op_check_traps bytecode to always be
generated. This is useful for testing purposes until we have signal based
traps, at which point, we will always emit the op_check_traps bytecode and remove
this option.
Options::usePollingTraps() enables the use of polling VM traps all the time.
This will be useful for benchmark comparisons, (between polling and non-polling
traps), as well as for forcing polling traps later for ports that don't support
signal based traps.
Note: signal based traps are not fully implemented yet. As a result, if the VM
watchdog is in use, we will force Options::usePollingTraps() to be true.
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCheckTraps):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCheckTraps):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileCheckTraps):
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):
* runtime/Options.h:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (213301 => 213302)
--- trunk/Source/_javascript_Core/ChangeLog 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-03-02 22:06:04 UTC (rev 213302)
@@ -1,3 +1,40 @@
+2017-03-02 Mark Lam <[email protected]>
+
+ Add Options::alwaysCheckTraps() and Options::usePollingTraps() options.
+ https://bugs.webkit.org/show_bug.cgi?id=169088
+
+ Reviewed by Keith Miller.
+
+ Options::alwaysCheckTraps() forces the op_check_traps bytecode to always be
+ generated. This is useful for testing purposes until we have signal based
+ traps, at which point, we will always emit the op_check_traps bytecode and remove
+ this option.
+
+ Options::usePollingTraps() enables the use of polling VM traps all the time.
+ This will be useful for benchmark comparisons, (between polling and non-polling
+ traps), as well as for forcing polling traps later for ports that don't support
+ signal based traps.
+
+ Note: signal based traps are not fully implemented yet. As a result, if the VM
+ watchdog is in use, we will force Options::usePollingTraps() to be true.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCheckTraps):
+ * dfg/DFGClobberize.h:
+ (JSC::DFG::clobberize):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compileCheckTraps):
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileNode):
+ (JSC::FTL::DFG::LowerDFGToB3::compileCheckTraps):
+ * runtime/Options.cpp:
+ (JSC::recomputeDependentOptions):
+ * runtime/Options.h:
+
2017-03-02 Keith Miller <[email protected]>
Fix addressing mode for B3WasmAddress
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (213301 => 213302)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2017-03-02 22:06:04 UTC (rev 213302)
@@ -1274,7 +1274,7 @@
void BytecodeGenerator::emitCheckTraps()
{
- if (vm()->watchdog() || vm()->needAsynchronousTerminationSupport())
+ if (Options::alwaysCheckTraps() || vm()->watchdog() || vm()->needAsynchronousTerminationSupport())
emitOpcode(op_check_traps);
}
Modified: trunk/Source/_javascript_Core/dfg/DFGClobberize.h (213301 => 213302)
--- trunk/Source/_javascript_Core/dfg/DFGClobberize.h 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/dfg/DFGClobberize.h 2017-03-02 22:06:04 UTC (rev 213302)
@@ -434,6 +434,14 @@
write(JSCell_cellState);
return;
+ case CheckTraps:
+ if (Options::usePollingTraps()) {
+ read(InternalState);
+ write(InternalState);
+ } else
+ write(Watchpoint_fire);
+ return;
+
case InvalidationPoint:
write(SideState);
def(HeapLocation(InvalidationPointLoc, Watchpoint_fire), LazyNode(node));
@@ -1411,7 +1419,6 @@
return;
case CountExecution:
- case CheckTraps:
read(InternalState);
write(InternalState);
return;
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (213301 => 213302)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2017-03-02 22:06:04 UTC (rev 213302)
@@ -1898,6 +1898,7 @@
void SpeculativeJIT::compileCheckTraps(Node*)
{
+ ASSERT(Options::usePollingTraps());
GPRTemporary unused(this);
GPRReg unusedGPR = unused.gpr();
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (213301 => 213302)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2017-03-02 22:06:04 UTC (rev 213302)
@@ -5544,7 +5544,10 @@
break;
case CheckTraps:
- compileCheckTraps(node);
+ if (Options::usePollingTraps())
+ compileCheckTraps(node);
+ else
+ noResult(node); // This is a no-op.
break;
case CountExecution:
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (213301 => 213302)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2017-03-02 22:06:04 UTC (rev 213302)
@@ -5328,7 +5328,10 @@
break;
case CheckTraps:
- compileCheckTraps(node);
+ if (Options::usePollingTraps())
+ compileCheckTraps(node);
+ else
+ noResult(node); // This is a no-op.
break;
case Phantom:
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (213301 => 213302)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2017-03-02 22:06:04 UTC (rev 213302)
@@ -1023,7 +1023,8 @@
compileMaterializeCreateActivation();
break;
case CheckTraps:
- compileCheckTraps();
+ if (Options::usePollingTraps())
+ compileCheckTraps();
break;
case CreateRest:
compileCreateRest();
@@ -8986,6 +8987,7 @@
void compileCheckTraps()
{
+ ASSERT(Options::usePollingTraps());
LBasicBlock needTrapHandling = m_out.newBlock();
LBasicBlock continuation = m_out.newBlock();
Modified: trunk/Source/_javascript_Core/runtime/Options.h (213301 => 213302)
--- trunk/Source/_javascript_Core/runtime/Options.h 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2017-03-02 22:06:04 UTC (rev 213302)
@@ -406,6 +406,8 @@
v(bool, useSigillCrashAnalyzer, false, Configurable, "logs data about SIGILL crashes") \
\
v(unsigned, watchdog, 0, Normal, "watchdog timeout (0 = Disabled, N = a timeout period of N milliseconds)") \
+ v(bool, alwaysCheckTraps, false, Normal, "always emit op_check_traps bytecode") \
+ v(bool, usePollingTraps, false, Normal, "use polling (instead of signalling) VM traps") \
\
v(bool, useICStats, false, Normal, nullptr) \
\
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (213301 => 213302)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2017-03-02 22:06:04 UTC (rev 213302)
@@ -462,6 +462,8 @@
Watchdog& VM::ensureWatchdog()
{
if (!m_watchdog) {
+ Options::usePollingTraps() = true; // Force polling traps on until we have support for signal based traps.
+
m_watchdog = adoptRef(new Watchdog(this));
// The LLINT peeks into the Watchdog object directly. In order to do that,
@@ -973,4 +975,10 @@
}
}
+void VM::setNeedAsynchronousTerminationSupport()
+{
+ Options::usePollingTraps() = true; // Force polling traps on until we have support for signal based traps.
+ m_needAsynchronousTerminationSupport = true;
+}
+
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/VM.h (213301 => 213302)
--- trunk/Source/_javascript_Core/runtime/VM.h 2017-03-02 21:55:55 UTC (rev 213301)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2017-03-02 22:06:04 UTC (rev 213302)
@@ -680,7 +680,7 @@
void notifyNeedWatchdogCheck() { m_traps.fireTrap(VMTraps::NeedWatchdogCheck); }
bool needAsynchronousTerminationSupport() const { return m_needAsynchronousTerminationSupport; }
- void setNeedAsynchronousTerminationSupport() { m_needAsynchronousTerminationSupport = true; }
+ JS_EXPORT_PRIVATE void setNeedAsynchronousTerminationSupport();
private:
friend class LLIntOffsetsExtractor;