Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index c058b0df44a44d3cbdf465f76752e4b76f53b7fb..c1f3d7566704f4ed19d1c89cc8dbca8551a5701a 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -997,10 +997,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()); |
} |
LBranch* result = new(zone()) LBranch(UseRegister(value)); |
@@ -1637,6 +1635,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 = UseRegisterOrConstantAtStart(instr->right()); |
return new(zone()) LCmpObjectEqAndBranch(left, right); |