Title: [206752] trunk/Source/_javascript_Core
Revision
206752
Author
[email protected]
Date
2016-10-03 14:51:11 -0700 (Mon, 03 Oct 2016)

Log Message

Creating pcToOriginMap in FTL shouldn't insert unnecessary NOPs
https://bugs.webkit.org/show_bug.cgi?id=162879

Reviewed by Filip Pizlo.

If there is a recent watchpoint label, using MacroAssembler::label() will pad
the instruction stream with NOPs to provide space for a jump.  This changes
Air::generate() to use labelIgnoringWatchpoints() to create pcToOriginMap
entries to eliminate unneccesary NOPs.
        
* b3/air/AirGenerate.cpp:
(JSC::B3::Air::generate):
* b3/testb3.cpp:
(JSC::B3::testPCOriginMapDoesntInsertNops): New test.
(JSC::B3::run):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (206751 => 206752)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-03 21:36:46 UTC (rev 206751)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-03 21:51:11 UTC (rev 206752)
@@ -1,3 +1,21 @@
+2016-10-03  Michael Saboff  <[email protected]>
+
+        Creating pcToOriginMap in FTL shouldn't insert unnecessary NOPs
+        https://bugs.webkit.org/show_bug.cgi?id=162879
+
+        Reviewed by Filip Pizlo.
+
+        If there is a recent watchpoint label, using MacroAssembler::label() will pad
+        the instruction stream with NOPs to provide space for a jump.  This changes
+        Air::generate() to use labelIgnoringWatchpoints() to create pcToOriginMap
+        entries to eliminate unneccesary NOPs.
+        
+        * b3/air/AirGenerate.cpp:
+        (JSC::B3::Air::generate):
+        * b3/testb3.cpp:
+        (JSC::B3::testPCOriginMapDoesntInsertNops): New test.
+        (JSC::B3::run):
+
 2016-10-03  Saam Barati  <[email protected]>
 
         MapHash should speculate on the type of its child node

Modified: trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp (206751 => 206752)


--- trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp	2016-10-03 21:36:46 UTC (rev 206751)
+++ trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp	2016-10-03 21:51:11 UTC (rev 206752)
@@ -190,10 +190,10 @@
     PCToOriginMap& pcToOriginMap = code.proc().pcToOriginMap();
     auto addItem = [&] (Inst& inst) {
         if (!inst.origin) {
-            pcToOriginMap.appendItem(jit.label(), Origin());
+            pcToOriginMap.appendItem(jit.labelIgnoringWatchpoints(), Origin());
             return;
         }
-        pcToOriginMap.appendItem(jit.label(), inst.origin->origin());
+        pcToOriginMap.appendItem(jit.labelIgnoringWatchpoints(), inst.origin->origin());
     };
 
     for (BasicBlock* block : code) {

Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (206751 => 206752)


--- trunk/Source/_javascript_Core/b3/testb3.cpp	2016-10-03 21:36:46 UTC (rev 206751)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp	2016-10-03 21:51:11 UTC (rev 206752)
@@ -13301,6 +13301,32 @@
     }
 }
 
+void testPCOriginMapDoesntInsertNops()
+{
+    Procedure proc;
+    BasicBlock* root = proc.addBlock();
+
+    CCallHelpers::Label watchpointLabel;
+
+    PatchpointValue* patchpoint = root->appendNew<PatchpointValue>(proc, Void, Origin());
+    patchpoint->setGenerator(
+        [&] (CCallHelpers& jit, const StackmapGenerationParams&) {
+            watchpointLabel = jit.watchpointLabel();
+        });
+
+    patchpoint = root->appendNew<PatchpointValue>(proc, Void, Origin());
+    patchpoint->setGenerator(
+        [&] (CCallHelpers& jit, const StackmapGenerationParams&) {
+            CCallHelpers::Label labelIgnoringWatchpoints = jit.labelIgnoringWatchpoints();
+
+            CHECK(watchpointLabel == labelIgnoringWatchpoints);
+        });
+
+    root->appendNew<Value>(proc, Return, Origin());
+
+    compile(proc);
+}
+
 // Make sure the compiler does not try to optimize anything out.
 NEVER_INLINE double zero()
 {
@@ -14747,6 +14773,7 @@
     RUN(testTrappingLoadDCE());
     RUN(testTrappingStoreElimination());
     RUN(testMoveConstants());
+    RUN(testPCOriginMapDoesntInsertNops());
     
     if (tasks.isEmpty())
         usage();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to