Index: runtime/vm/intermediate_language_x64.cc |
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc |
index 3a7a6e1e82a2df1241185aa42824ca76f92afd12..bfc2c42f3770c1422867d0053259d1f17d8774de 100644 |
--- a/runtime/vm/intermediate_language_x64.cc |
+++ b/runtime/vm/intermediate_language_x64.cc |
@@ -165,8 +165,7 @@ bool IfThenElseInstr::Supports(ComparisonInstr* comparison, |
Value* v2) { |
if (!(comparison->IsStrictCompare() && |
!comparison->AsStrictCompare()->needs_number_check()) && |
- !(comparison->IsEqualityCompare() && |
- (comparison->AsEqualityCompare()->receiver_class_id() == kSmiCid))) { |
+ !comparison->IsSmiEquality()) { |
return false; |
} |
@@ -918,6 +917,41 @@ 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) ? NOT_ZERO : ZERO; |
+ Location right = locs()->in(1); |
+ if (right.IsConstant()) { |
+ ASSERT(right.constant().IsSmi()); |
+ const int64_t imm = |
+ reinterpret_cast<int64_t>(right.constant().raw()); |
+ __ testq(locs()->in(0).reg(), Immediate(imm)); |
+ } else { |
+ __ testq(locs()->in(0).reg(), right.reg()); |
+ } |
+ branch->EmitBranchOnCondition(compiler, branch_condition); |
+} |
+ |
+ |
LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
const intptr_t kNumInputs = 2; |
const intptr_t kNumTemps = 0; |