Bug 879727 - IonMonkey: During UCE remove corresponding MPassArgs when removing calls. r=jandem, a=akeybl
authorHannes Verschore <hv1989@gmail.com>
Fri, 14 Jun 2013 23:16:33 -0400
changeset 142889 ba1a561d63754e3d0425355ddd54c7a59efb19c4
parent 142888 8cfa59681649d73dd81148015dadf5122873f49b
child 142890 512e62ac59d92e2d4a09f093855e89d321a26793
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, akeybl
bugs879727
milestone23.0a2
Bug 879727 - IonMonkey: During UCE remove corresponding MPassArgs when removing calls. r=jandem, a=akeybl
js/src/ion/UnreachableCodeElimination.cpp
--- a/js/src/ion/UnreachableCodeElimination.cpp
+++ b/js/src/ion/UnreachableCodeElimination.cpp
@@ -216,16 +216,31 @@ UnreachableCodeElimination::removeUnmark
                                 redundantPhis_ = true;
                                 break;
                             }
                         }
                     }
                 }
             }
 
+            // When we remove a call, we can't leave the corresponding MPassArg in the graph.
+            // Since lowering will fail. Replace it with the argument for the exceptional
+            // case when it is kept alive in a ResumePoint.
+            // DCE will remove the unused MPassArg instruction.
+            for (MInstructionIterator iter(block->begin()); iter != block->end(); iter++) {
+                if (iter->isCall()) {
+                    MCall *call = iter->toCall();
+                    for (size_t i = 0; i < call->numStackArgs(); i++) {
+                        JS_ASSERT(call->getArg(i)->isPassArg());
+                        MPassArg *arg = call->getArg(i)->toPassArg();
+                        arg->replaceAllUsesWith(arg->getArgument());
+                    }
+                }
+            }
+
             graph_.removeBlock(block);
         }
     }
 
     JS_ASSERT(id == 0);
 
     return true;
 }