From 29223a2c06733e8f854b47b2f95fd474aae8b7d0 Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Wed, 12 Jun 2013 21:46:19 +0200 Subject: [PATCH] Bug 879727: IonMonkey: During UCE remove corresponding MPassArgs when removing calls, r=jandem --- js/src/ion/UnreachableCodeElimination.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/js/src/ion/UnreachableCodeElimination.cpp b/js/src/ion/UnreachableCodeElimination.cpp index 0710d54ba08..b664dafe39e 100644 --- a/js/src/ion/UnreachableCodeElimination.cpp +++ b/js/src/ion/UnreachableCodeElimination.cpp @@ -235,6 +235,22 @@ UnreachableCodeElimination::removeUnmarkedBlocksAndClearDominators() } } + // 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); } }