Chromium Code Reviews| Index: runtime/vm/intermediate_language_ia32.cc |
| =================================================================== |
| --- runtime/vm/intermediate_language_ia32.cc (revision 14796) |
| +++ runtime/vm/intermediate_language_ia32.cc (working copy) |
| @@ -284,7 +284,10 @@ |
| LocationSummary* locs = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| locs->set_in(0, Location::RegisterOrConstant(left())); |
| - locs->set_in(1, Location::RegisterOrConstant(right())); |
| + // Only one input can be a constant operand. |
| + locs->set_in(1, locs->in(0).IsConstant() |
| + ? Location::RequiresRegister() |
| + : Location::RegisterOrConstant(right())); |
| locs->set_out(Location::RequiresRegister()); |
| return locs; |
| } |
| @@ -608,36 +611,10 @@ |
| BranchInstr* branch) { |
| Location left = locs.in(0); |
| Location right = locs.in(1); |
| + ASSERT(!left.IsConstant() || !right.IsConstant()); |
| Condition true_condition = TokenKindToSmiCondition(kind); |
| - if (left.IsConstant() && right.IsConstant()) { |
| - bool result = false; |
| - // One of them could be NULL (for equality only). |
| - if (left.constant().IsNull() || right.constant().IsNull()) { |
| - ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); |
| - result = left.constant().IsNull() && right.constant().IsNull(); |
| - if (kind == Token::kNE) { |
| - result = !result; |
| - } |
| - } else { |
| - // TODO(vegorov): should be eliminated earlier by constant propagation. |
| - result = FlowGraphCompiler::EvaluateCondition( |
| - true_condition, |
| - Smi::Cast(left.constant()).Value(), |
| - Smi::Cast(right.constant()).Value()); |
| - } |
| - |
| - if (branch != NULL) { |
| - branch->EmitBranchOnValue(compiler, result); |
| - } else { |
| - __ LoadObject(locs.out().reg(), result ? compiler->bool_true() |
| - : compiler->bool_false()); |
| - } |
| - |
| - return; |
| - } |
| - |
| if (left.IsConstant()) { |
| __ CompareObject(right.reg(), left.constant()); |
| true_condition = FlowGraphCompiler::FlipCondition(true_condition); |
| @@ -919,7 +896,10 @@ |
| LocationSummary* summary = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| summary->set_in(0, Location::RegisterOrConstant(left())); |
| - summary->set_in(1, Location::RegisterOrConstant(right())); |
| + // Only one input can be a constant operand. |
|
srdjan
2012/11/12 20:48:18
Why don't you allow both to be constant? You expec
Florian Schneider
2012/11/12 22:43:45
Done.
|
| + summary->set_in(1, summary->in(0).IsConstant() |
| + ? Location::RequiresRegister() |
| + : Location::RegisterOrConstant(right())); |
| summary->set_out(Location::RequiresRegister()); |
| return summary; |
| } |
| @@ -1717,7 +1697,7 @@ |
| LocationSummary* summary = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| summary->set_in(0, Location::RequiresRegister()); |
| - summary->set_in(1, Location::FixedRegisterOrConstant(right(), ECX)); |
| + summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); |
| summary->set_out(Location::SameAsFirstInput()); |
| return summary; |
| } else if (op_kind() == Token::kSHL) { |
| @@ -1725,7 +1705,7 @@ |
| LocationSummary* summary = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| summary->set_in(0, Location::RequiresRegister()); |
| - summary->set_in(1, Location::FixedRegisterOrConstant(right(), ECX)); |
| + summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); |
| summary->set_temp(0, Location::RequiresRegister()); |
| summary->set_out(Location::SameAsFirstInput()); |
| return summary; |
| @@ -1734,7 +1714,7 @@ |
| LocationSummary* summary = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| summary->set_in(0, Location::RequiresRegister()); |
| - summary->set_in(1, Location::RegisterOrConstant(right())); |
| + summary->set_in(1, Location::RegisterOrSmiConstant(right())); |
| summary->set_out(Location::SameAsFirstInput()); |
| return summary; |
| } |
| @@ -2369,8 +2349,8 @@ |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| - locs->set_in(0, Location::RegisterOrConstant(array())); |
| - locs->set_in(1, Location::RegisterOrConstant(index())); |
| + locs->set_in(0, Location::RegisterOrSmiConstant(array())); |
| + locs->set_in(1, Location::RegisterOrSmiConstant(index())); |
| return locs; |
| } |