Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index a66b6ab35ce51628d0caf51c438d9f21b336794c..431fc3c703c42fbd5a8a76bd88a95dd446338dbc 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -509,6 +509,17 @@ const char* HValue::Mnemonic() const { |
| } |
| +bool HValue::CanReplaceWithDummyUses() { |
| + return FLAG_unreachable_code_elimination && |
| + !(block()->IsReachable() || |
| + IsBlockEntry() || |
| + IsControlInstruction() || |
| + IsSimulate() || |
| + IsEnterInlined() || |
| + IsLeaveInlined()); |
| +} |
| + |
| + |
| bool HValue::IsInteger32Constant() { |
| return IsConstant() && HConstant::cast(this)->HasInteger32Value(); |
| } |
| @@ -1050,6 +1061,21 @@ Representation HBranch::observed_input_representation(int index) { |
| } |
| +bool HBranch::KnownSuccessorBlock(HBasicBlock** block) { |
| + HValue* value = this->value(); |
| + if (value->EmitAtUses()) { |
| + ASSERT(value->IsConstant()); |
| + ASSERT(!value->representation().IsDouble()); |
| + *block = HConstant::cast(value)->BooleanValue() |
| + ? FirstSuccessor() |
| + : SecondSuccessor(); |
| + return true; |
| + } |
| + *block = NULL; |
| + return false; |
| +} |
| + |
| + |
| void HCompareMap::PrintDataTo(StringStream* stream) { |
| value()->PrintNameTo(stream); |
| stream->Add(" (%p)", *map().handle()); |
| @@ -2857,6 +2883,20 @@ void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { |
| } |
| +bool HCompareObjectEqAndBranch::KnownSuccessorBlock(HBasicBlock** block) { |
| + if (left()->IsConstant() && right()->IsConstant()) { |
| + bool comparison_result = |
| + HConstant::cast(left())->DataEquals(HConstant::cast(right())); |
|
Michael Starzinger
2013/10/01 11:17:47
suggestion: We could use Equals() instead of DataE
danno
2013/10/23 11:46:51
Done.
|
| + *block = comparison_result |
| + ? FirstSuccessor() |
| + : SecondSuccessor(); |
| + return true; |
| + } |
| + *block = NULL; |
| + return false; |
| +} |
| + |
| + |
| void HCompareHoleAndBranch::InferRepresentation( |
| HInferRepresentationPhase* h_infer) { |
| ChangeRepresentation(value()->representation()); |