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

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2098573004: DBC: CheckClassInstr (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix bug, cleanup, add tests 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 d28bbb2c30aff544c47e1e37ad46739edb5d8879..f9fd3f620a984dee168d4a9b79a544f44d5bfa9d 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -105,7 +105,6 @@ DECLARE_FLAG(int, optimization_counter_threshold);
M(UnboxInteger32) \
M(CheckedSmiOp) \
M(CheckArrayBound) \
- M(CheckClass) \
M(TestSmi) \
M(RelationalOp) \
M(EqualityCompare) \
@@ -481,6 +480,13 @@ void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EMIT_NATIVE_CODE(Goto, 0) {
+ if (!compiler->is_optimizing()) {
+ // Add a deoptimization descriptor for deoptimizing instructions that
+ // may be inserted before this instruction.
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+ GetDeoptId(),
+ TokenPosition::kNoSource);
+ }
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
}
@@ -945,6 +951,34 @@ EMIT_NATIVE_CODE(CheckClassId, 1) {
}
+EMIT_NATIVE_CODE(CheckClass, 1) {
+ const Register value = locs()->in(0).reg();
+ if (IsNullCheck()) {
+ ASSERT(DeoptIfNull() || DeoptIfNotNull());
+ __ CheckNull(value, DeoptIfNull() ? 1 : 0);
+ compiler->EmitDeopt(deopt_id(),
+ ICData::kDeoptCheckClass,
+ licm_hoisted_ ? ICData::kHoisted : 0);
+ return;
+ }
+
+ ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) ||
+ (unary_checks().NumberOfChecks() > 1));
+ const intptr_t ic_data = __ AddConstant(unary_checks());
+ if (IsDenseSwitch()) {
+ ASSERT(cids_[0] < cids_[cids_.length() - 1]);
+ __ PushConstant(Smi::Handle(Smi::New(cids_[0])));
Vyacheslav Egorov (Google) 2016/06/28 13:03:10 This encoding of the dense switch is suboptimal. I
zra 2016/06/28 19:31:40 It looks like cids can be 32-bits, so I think thos
+ __ PushConstant(Smi::Handle(Smi::New(ComputeCidMask())));
+ __ CheckDenseSwitchTOS(value, ic_data);
+ } else {
+ __ CheckForCid(value, ic_data);
Vyacheslav Egorov (Google) 2016/06/28 13:03:10 Similar note here. I suggest making this very fast
zra 2016/06/28 19:31:40 Done.
+ }
+ compiler->EmitDeopt(deopt_id(),
+ ICData::kDeoptCheckClass,
Vyacheslav Egorov (Google) 2016/06/28 13:03:10 Indentation. Can this be shared with NullCheck c
zra 2016/06/28 19:31:40 Done.
+ licm_hoisted_ ? ICData::kHoisted : 0);
+}
+
+
EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) {
const Register left = locs()->in(0).reg();
const Register right = locs()->in(1).reg();

Powered by Google App Engine
This is Rietveld 408576698