Index: runtime/vm/intermediate_language_mips.cc |
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc |
index 9eb5cdca0466b2086c6be46d5a3137bb72e9f7f2..00ced9a10383d1eb909630537bde7d8a35d5cda6 100644 |
--- a/runtime/vm/intermediate_language_mips.cc |
+++ b/runtime/vm/intermediate_language_mips.cc |
@@ -620,6 +620,47 @@ 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()); |
+ if (Utils::IsUint(kImmBits, imm)) { |
+ __ andi(TMP1, left, Immediate(imm)); |
+ } else { |
+ __ LoadImmediate(TMP1, imm); |
+ __ and_(TMP1, left, TMP1); |
+ } |
+ } else { |
+ __ and_(TMP1, left, right.reg()); |
+ } |
+ branch->EmitBranchOnCondition(compiler, branch_condition); |
+} |
+ |
+ |
LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
const intptr_t kNumInputs = 2; |
const intptr_t kNumTemps = 0; |