Bug 1089769: Emitted at uses instructions should be added to the MIR graph in redefine; r=nbp

This commit is contained in:
Benjamin Bouvier 2014-11-03 14:06:26 +01:00
parent f36293e337
commit aef716e1d5

View File

@ -212,17 +212,18 @@ LIRGeneratorShared::redefine(MDefinition *def, MDefinition *as)
(def->type() == MIRType_Int32 || def->type() == MIRType_Boolean) &&
(as->type() == MIRType_Int32 || as->type() == MIRType_Boolean))))
{
MDefinition *replacement;
MInstruction *replacement;
if (def->type() != as->type()) {
Value v = as->toConstant()->value();
if (as->type() == MIRType_Int32)
replacement = MConstant::New(alloc(), BooleanValue(v.toInt32()));
else
replacement = MConstant::New(alloc(), Int32Value(v.toBoolean()));
def->block()->insertBefore(def->toInstruction(), replacement);
if (!emitAtUses(replacement->toInstruction()))
return false;
} else {
replacement = as;
replacement = as->toInstruction();
}
def->replaceAllUsesWith(replacement);
return true;