Bug 879727: IonMonkey: During UCE remove corresponding MPassArgs when removing calls, r=jandem
authorHannes Verschore <hv1989@gmail.com>
Wed, 12 Jun 2013 21:46:19 +0200
changeset 146337 6f52e55ac5be1f0fd5e43063882fdf155fca4cc3
parent 146336 e3344f97b4bedf68d28ed15c407ae1afd2f6e1a9
child 146338 2810e80e1393bbc47c438871ae6a826621880a9a
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs879727
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 879727: IonMonkey: During UCE remove corresponding MPassArgs when removing calls, r=jandem
js/src/ion/UnreachableCodeElimination.cpp
--- a/js/src/ion/UnreachableCodeElimination.cpp
+++ b/js/src/ion/UnreachableCodeElimination.cpp
@@ -230,16 +230,32 @@ 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());
+                        JS_ASSERT(call->getArg(i)->defUseCount() == 1);
+                        MPassArg *arg = call->getArg(i)->toPassArg();
+                        arg->replaceAllUsesWith(arg->getArgument());
+                    }
+                }
+            }
+
             graph_.removeBlock(block);
         }
     }
 
     JS_ASSERT(id == 0);
 
     return true;
 }