Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index b3158685fcf40e3e60d7088b8af06e9e39fa0775..ac693121fa0393bc67529f4ea29fe1b02d54bae1 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -1048,10 +1048,8 @@ LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
if (value->EmitAtUses()) { |
ASSERT(value->IsConstant()); |
ASSERT(!value->representation().IsDouble()); |
- HBasicBlock* successor = HConstant::cast(value)->BooleanValue() |
- ? instr->FirstSuccessor() |
- : instr->SecondSuccessor(); |
- return new(zone()) LGoto(successor->block_id()); |
+ return ElideControlInstruction(instr, |
+ HConstant::cast(value)->BooleanValue()); |
} |
ToBooleanStub::Types expected = instr->expected_input_types(); |
@@ -1737,6 +1735,13 @@ LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
HCompareObjectEqAndBranch* instr) { |
+ if (instr->left()->IsConstant() && instr->right()->IsConstant()) { |
+ bool comparison_result = |
+ HConstant::cast(instr->left())->SameConstantObject( |
+ HConstant::cast(instr->right())); |
+ return ElideControlInstruction(instr, comparison_result); |
+ } |
+ |
LOperand* left = UseRegisterAtStart(instr->left()); |
LOperand* right = UseOrConstantAtStart(instr->right()); |
return new(zone()) LCmpObjectEqAndBranch(left, right); |