Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2053213004: DBC: Adds BinarySmiOp instruction (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments, fix bugs Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index 0e1afc637a52de73e7ebfecb5d0475cae0c60142..bcb342643f5a665c5fe4dae910b0ed6a8cfc9bb5 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -108,9 +108,7 @@ DECLARE_FLAG(int, optimization_counter_threshold);
M(UnboxInteger32) \
M(CheckedSmiOp) \
M(CheckArrayBound) \
- M(CheckClassId) \
M(CheckClass) \
- M(BinarySmiOp) \
M(TestSmi) \
M(RelationalOp) \
M(EqualityCompare) \
@@ -184,7 +182,9 @@ DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(RelationalOp)
DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(EqualityCompare)
-DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2, Location::SameAsFirstInput());
+DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2,
+ Location::RequiresRegister(),
+ LocationSummary::kCall);
EMIT_NATIVE_CODE(AssertBoolean,
@@ -913,6 +913,72 @@ EMIT_NATIVE_CODE(CheckSmi, 1) {
licm_hoisted_ ? ICData::kHoisted : 0);
}
+
+EMIT_NATIVE_CODE(CheckClassId, 1) {
+ __ Push(locs()->in(0).reg());
Vyacheslav Egorov (Google) 2016/06/16 08:31:53 CheckClassId should also probably be a single inst
+ __ PushConstant(Smi::Handle(Smi::New(cid_)));
+ __ IfNeStrictTOS();
+ compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass);
+}
+
+
+EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) {
+ const Register left = locs()->in(0).reg();
+ const Register right = locs()->in(1).reg();
+ const Register out = locs()->out(0).reg();
+ const bool can_deopt = CanDeoptimize();
+ bool needs_nop = false;
+ switch (op_kind()) {
+ case Token::kADD:
+ __ Add(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kSUB:
+ __ Sub(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kMUL:
+ __ Mul(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kTRUNCDIV:
+ ASSERT(can_deopt);
+ __ Div(out, left, right);
+ break;
+ case Token::kBIT_AND:
+ ASSERT(!can_deopt);
+ __ BitAnd(out, left, right);
+ break;
+ case Token::kBIT_OR:
+ ASSERT(!can_deopt);
+ __ BitOr(out, left, right);
+ break;
+ case Token::kBIT_XOR:
+ ASSERT(!can_deopt);
+ __ BitXor(out, left, right);
+ break;
+ case Token::kMOD:
+ __ Mod(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kSHR:
+ __ Shr(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kSHL:
+ __ Shl(out, left, right);
+ needs_nop = true;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ if (can_deopt) {
+ compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinarySmiOp);
+ } else if (needs_nop) {
+ __ Nop();
+ }
+}
+
} // namespace dart
#endif // defined TARGET_ARCH_DBC

Powered by Google App Engine
This is Rietveld 408576698