Bug 1319888 - MBasicBlock::NewSplitEdge: use the successor info instead of the predecessor info. r=h4writer
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Wed, 30 Nov 2016 15:08:30 +0000
changeset 324820 13f67e1da316e494f62a3ddc4b7d2a940a07f4c2
parent 324819 9ce6e0f0095e50c50df060e81f188324b7f961db
child 324821 7c0ca61c3552c2c7809dc769e7365e629402b947
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersh4writer
bugs1319888
milestone53.0a1
Bug 1319888 - MBasicBlock::NewSplitEdge: use the successor info instead of the predecessor info. r=h4writer
js/src/jit/IonAnalysis.cpp
js/src/jit/MIRGraph.cpp
js/src/jit/MIRGraph.h
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -546,17 +546,17 @@ SplitCriticalEdgesForBlock(MIRGraph& gra
         return true;
     for (size_t i = 0; i < block->numSuccessors(); i++) {
         MBasicBlock* target = block->getSuccessor(i);
         if (target->numPredecessors() < 2)
             continue;
 
         // Create a simple new block which contains a goto and which split the
         // edge between block and target.
-        MBasicBlock* split = MBasicBlock::NewSplitEdge(graph, block->info(), block, i, target);
+        MBasicBlock* split = MBasicBlock::NewSplitEdge(graph, block, i, target);
         if (!split)
             return false;
     }
     return true;
 }
 
 // A critical edge is an edge which is neither its successor's only predecessor
 // nor its predecessor's only successor. Critical edges must be split to
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -270,30 +270,30 @@ MBasicBlock::NewPendingLoopHeader(MIRGra
 
     if (!block->inherit(graph.alloc(), nullptr, pred, 0, stackPhiCount))
         return nullptr;
 
     return block;
 }
 
 MBasicBlock*
-MBasicBlock::NewSplitEdge(MIRGraph& graph, const CompileInfo& info, MBasicBlock* pred, size_t predEdgeIdx, MBasicBlock* succ)
+MBasicBlock::NewSplitEdge(MIRGraph& graph, MBasicBlock* pred, size_t predEdgeIdx, MBasicBlock* succ)
 {
     MBasicBlock* split = nullptr;
-    if (!pred->pc()) {
+    if (!succ->pc()) {
         // The predecessor does not have a PC, this is a Wasm compilation.
-        split = MBasicBlock::New(graph, info, pred, SPLIT_EDGE);
+        split = MBasicBlock::New(graph, succ->info(), pred, SPLIT_EDGE);
         if (!split)
             return nullptr;
     } else {
         // The predecessor has a PC, this is an IonBuilder compilation.
         MResumePoint* succEntry = succ->entryResumePoint();
 
         BytecodeSite* site = new(graph.alloc()) BytecodeSite(succ->trackedTree(), succEntry->pc());
-        split = new(graph.alloc()) MBasicBlock(graph, info, site, SPLIT_EDGE);
+        split = new(graph.alloc()) MBasicBlock(graph, succ->info(), site, SPLIT_EDGE);
 
         if (!split->init())
             return nullptr;
 
         // A split edge is used to simplify the graph to avoid having a
         // predecessor with multiple successors as well as a successor with
         // multiple predecessors.  As instructions can be moved in this
         // split-edge block, we need to give this block a resume point. To do
--- a/js/src/jit/MIRGraph.h
+++ b/js/src/jit/MIRGraph.h
@@ -112,19 +112,18 @@ class MBasicBlock : public TempObject, p
     static MBasicBlock* NewPopN(MIRGraph& graph, const CompileInfo& info,
                                 MBasicBlock* pred, BytecodeSite* site, Kind kind, uint32_t popn);
     static MBasicBlock* NewWithResumePoint(MIRGraph& graph, const CompileInfo& info,
                                            MBasicBlock* pred, BytecodeSite* site,
                                            MResumePoint* resumePoint);
     static MBasicBlock* NewPendingLoopHeader(MIRGraph& graph, const CompileInfo& info,
                                              MBasicBlock* pred, BytecodeSite* site,
                                              unsigned loopStateSlots);
-    static MBasicBlock* NewSplitEdge(MIRGraph& graph, const CompileInfo& info,
-                                     MBasicBlock* pred, size_t predEdgeIdx,
-                                     MBasicBlock* succ);
+    static MBasicBlock* NewSplitEdge(MIRGraph& graph, MBasicBlock* pred,
+                                     size_t predEdgeIdx, MBasicBlock* succ);
 
     bool dominates(const MBasicBlock* other) const {
         return other->domIndex() - domIndex() < numDominated();
     }
 
     void setId(uint32_t id) {
         id_ = id;
     }