From 0c918a1289a86bccfae60a16bbfcab1983283c08 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Mon, 6 Aug 2012 17:23:39 -0700 Subject: [PATCH] Bug 779818 - Substitute MPhi of Magic type by the lazy argument constant. r=dvander --- js/src/ion/IonAnalysis.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/src/ion/IonAnalysis.cpp b/js/src/ion/IonAnalysis.cpp index afe90783dbc7..98842b5ac1db 100644 --- a/js/src/ion/IonAnalysis.cpp +++ b/js/src/ion/IonAnalysis.cpp @@ -394,7 +394,21 @@ void TypeAnalyzer::replaceRedundantPhi(MPhi *phi) { MBasicBlock *block = phi->block(); - js::Value v = (phi->type() == MIRType_Undefined) ? UndefinedValue() : NullValue(); + js::Value v; + switch (phi->type()) { + case MIRType_Undefined: + v = UndefinedValue(); + break; + case MIRType_Null: + v = NullValue(); + break; + case MIRType_Magic: + v = MagicValue(JS_OPTIMIZED_ARGUMENTS); + break; + default: + JS_NOT_REACHED("unexpected type"); + return; + } MConstant *c = MConstant::New(v); // The instruction pass will insert the box block->insertBefore(*(block->begin()), c); @@ -409,7 +423,7 @@ TypeAnalyzer::insertConversions() // inputs of uses) does not conflict with input adjustment. for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++) { for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd();) { - if (phi->type() <= MIRType_Null) { + if (phi->type() <= MIRType_Null || phi->type() == MIRType_Magic) { replaceRedundantPhi(*phi); phi = block->discardPhiAt(phi); } else {