Index: runtime/vm/intermediate_language_arm.cc |
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc |
index 5ae8494bc9020b3a23ab190dc77f75b6dcb4e9ed..0a6e74b64513d6bac361d729e98f66f4209ab32c 100644 |
--- a/runtime/vm/intermediate_language_arm.cc |
+++ b/runtime/vm/intermediate_language_arm.cc |
@@ -609,6 +609,49 @@ void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
} |
+LocationSummary* TestSmiInstr::MakeLocationSummary() const { |
+ const intptr_t kNumInputs = 2; |
+ const intptr_t kNumTemps = 0; |
+ LocationSummary* locs = |
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
+ locs->set_in(0, Location::RequiresRegister()); |
+ // Only one input can be a constant operand. The case of two constant |
+ // operands should be handled by constant propagation. |
+ locs->set_in(1, Location::RegisterOrConstant(right())); |
+ return locs; |
+} |
+ |
+ |
+void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
+ // Never emitted outside of the BranchInstr. |
+ UNREACHABLE(); |
+} |
+ |
+ |
+void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
+ BranchInstr* branch) { |
+ Condition branch_condition = (kind() == Token::kNE) ? NE : EQ; |
+ Register left = locs()->in(0).reg(); |
+ Location right = locs()->in(1); |
+ if (right.IsConstant()) { |
+ ASSERT(right.constant().IsSmi()); |
+ const int32_t imm = |
+ reinterpret_cast<int32_t>(right.constant().raw()); |
+ ShifterOperand shifter_op; |
+ if (ShifterOperand::CanHold(imm, &shifter_op)) { |
+ __ tst(left, shifter_op); |
+ } else { |
+ // TODO(regis): Try to use bic. |
+ __ LoadImmediate(IP, imm); |
+ __ tst(left, ShifterOperand(IP)); |
+ } |
+ } else { |
+ __ tst(left, ShifterOperand(right.reg())); |
+ } |
+ branch->EmitBranchOnCondition(compiler, branch_condition); |
+} |
+ |
+ |
LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
const intptr_t kNumInputs = 2; |
const intptr_t kNumTemps = 0; |