PCToCodeOriginMap builder should use labelIgnoringWatchpoints() inside the DFG
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 00:50:59 +0000 (00:50 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 00:50:59 +0000 (00:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162936

Reviewed by Michael Saboff.

label() may insert nops because of an InvalidationPoint. It does that
because we don't want code that comes after an InvalidationPoint that isn't
effected by the invalidation point to be overwritten if we fire the
InvalidationPoint. PCToCodeOriginMap just grabs labels to build
a mapping, it never emits code that actually jumps to those labels.
Therefore, it should never cause us to emit nops.

* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::runSlowPathGenerators):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

index 0f25e98..a18b11f 100644 (file)
@@ -1,3 +1,24 @@
+2016-10-05  Saam Barati  <sbarati@apple.com>
+
+        PCToCodeOriginMap builder should use labelIgnoringWatchpoints() inside the DFG
+        https://bugs.webkit.org/show_bug.cgi?id=162936
+
+        Reviewed by Michael Saboff.
+
+        label() may insert nops because of an InvalidationPoint. It does that
+        because we don't want code that comes after an InvalidationPoint that isn't
+        effected by the invalidation point to be overwritten if we fire the
+        InvalidationPoint. PCToCodeOriginMap just grabs labels to build
+        a mapping, it never emits code that actually jumps to those labels.
+        Therefore, it should never cause us to emit nops.
+
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::compile):
+        (JSC::DFG::JITCompiler::compileFunction):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::runSlowPathGenerators):
+        (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
+
 2016-10-05  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Put variation fonts work behind a compile-time flag
index 81c0698..42e0746 100644 (file)
@@ -366,7 +366,7 @@ void JITCompiler::compile()
 
     // Generate slow path code.
     m_speculative->runSlowPathGenerators(m_pcToCodeOriginMapBuilder);
-    m_pcToCodeOriginMapBuilder.appendItem(label(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
+    m_pcToCodeOriginMapBuilder.appendItem(labelIgnoringWatchpoints(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
     
     compileExceptionHandlers();
     linkOSRExits();
@@ -459,7 +459,7 @@ void JITCompiler::compileFunction()
     
     // Generate slow path code.
     m_speculative->runSlowPathGenerators(m_pcToCodeOriginMapBuilder);
-    m_pcToCodeOriginMapBuilder.appendItem(label(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
+    m_pcToCodeOriginMapBuilder.appendItem(labelIgnoringWatchpoints(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
     
     compileExceptionHandlers();
     linkOSRExits();
index 3e17dec..239be9d 100644 (file)
@@ -385,14 +385,14 @@ void SpeculativeJIT::addSlowPathGenerator(std::function<void()> lambda)
 void SpeculativeJIT::runSlowPathGenerators(PCToCodeOriginMapBuilder& pcToCodeOriginMapBuilder)
 {
     for (auto& slowPathGenerator : m_slowPathGenerators) {
-        pcToCodeOriginMapBuilder.appendItem(m_jit.label(), slowPathGenerator->origin().semantic);
+        pcToCodeOriginMapBuilder.appendItem(m_jit.labelIgnoringWatchpoints(), slowPathGenerator->origin().semantic);
         slowPathGenerator->generate(this);
     }
     for (auto& slowPathLambda : m_slowPathLambdas) {
         Node* currentNode = slowPathLambda.currentNode;
         m_currentNode = currentNode;
         m_outOfLineStreamIndex = slowPathLambda.streamIndex;
-        pcToCodeOriginMapBuilder.appendItem(m_jit.label(), currentNode->origin.semantic);
+        pcToCodeOriginMapBuilder.appendItem(m_jit.labelIgnoringWatchpoints(), currentNode->origin.semantic);
         slowPathLambda.generator();
         m_outOfLineStreamIndex = Nullopt;
     }
@@ -1740,7 +1740,7 @@ void SpeculativeJIT::compileCurrentBlock()
         if (Options::validateDFGExceptionHandling() && (mayExit(m_jit.graph(), m_currentNode) != DoesNotExit || m_currentNode->isTerminal()))
             m_jit.jitReleaseAssertNoException();
 
-        m_jit.pcToCodeOriginMapBuilder().appendItem(m_jit.label(), m_origin.semantic);
+        m_jit.pcToCodeOriginMapBuilder().appendItem(m_jit.labelIgnoringWatchpoints(), m_origin.semantic);
 
         compile(m_currentNode);