Chromium Code Reviews| Index: src/ia32/lithium-ia32.cc |
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
| index bfcbfb96c869f3200c313660e961f748eec15551..4f4b3f78f142f9fcf7393a8139a0fc8dca544123 100644 |
| --- a/src/ia32/lithium-ia32.cc |
| +++ b/src/ia32/lithium-ia32.cc |
| @@ -909,7 +909,22 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| HInstruction* old_current = current_instruction_; |
| current_instruction_ = current; |
| if (current->has_position()) position_ = current->position(); |
| - LInstruction* instr = current->CompileToLithium(this); |
| + |
| + LInstruction* instr = NULL; |
| + if (current->CanReplaceWithDummyUses()) { |
| + HValue* first_operand = current->OperandCount() == 0 |
| + ? graph()->GetConstant1() : |
|
Jakob Kummerow
2013/10/01 11:59:20
nit: please put the ':' in the next line, under th
danno
2013/10/23 11:46:51
Done.
|
| + current->OperandAt(0); |
| + instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); |
| + for (int i = 1; i < current->OperandCount(); ++i) { |
| + LInstruction* dummy = |
| + new(zone()) LDummyUse(UseAny(current->OperandAt(1))); |
|
Jakob Kummerow
2013/10/01 11:59:20
bug: OperandAt(i)!
danno
2013/10/23 11:46:51
Done.
|
| + dummy->set_hydrogen_value(current); |
| + chunk_->AddInstruction(dummy, current_block_); |
| + } |
| + } else { |
| + instr = current->CompileToLithium(this); |
| + } |
| if (instr != NULL) { |
| #if DEBUG |
| @@ -1055,21 +1070,15 @@ LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| - HValue* value = instr->value(); |
| - 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); |
| - } |
| + LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| + if (goto_instr != NULL) return goto_instr; |
| ToBooleanStub::Types expected = instr->expected_input_types(); |
| // Tagged values that are not known smis or booleans require a |
| // deoptimization environment. If the instruction is generic no |
| // environment is needed since all cases are handled. |
| + HValue* value = instr->value(); |
| Representation rep = value->representation(); |
| HType type = value->type(); |
| if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { |
| @@ -1741,6 +1750,8 @@ LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| HCompareObjectEqAndBranch* instr) { |
| + LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| + if (goto_instr != NULL) return goto_instr; |
| LOperand* left = UseRegisterAtStart(instr->left()); |
| LOperand* right = UseOrConstantAtStart(instr->right()); |
| return new(zone()) LCmpObjectEqAndBranch(left, right); |