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

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2109743002: DBC: Implement InstanceOf. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . 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
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..aef3bb86e2d5b435a6026baa361edf76f6a67611 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -32,7 +32,6 @@ DECLARE_FLAG(int, optimization_counter_threshold);
#define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \
M(IndirectGoto) \
M(LoadCodeUnits) \
- M(InstanceOf) \
M(LoadUntagged) \
M(AllocateUninitializedContext) \
M(BinaryInt32Op) \
@@ -179,6 +178,32 @@ DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(RelationalOp)
DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(EqualityCompare)
+EMIT_NATIVE_CODE(InstanceOf, 2, Location::SameAsFirstInput(),
+ LocationSummary::kCall) {
+ SubtypeTestCache& test_cache = SubtypeTestCache::Handle();
+ if (!type().IsVoidType() && type().IsInstantiated()) {
+ test_cache = SubtypeTestCache::New();
+ }
+
+ if (compiler->is_optimizing()) {
+ __ Push(locs()->in(0).reg()); // Value.
+ __ Push(locs()->in(1).reg()); // Instantiator type arguments.
+ }
+
+ __ PushConstant(type());
+ __ PushConstant(test_cache);
+ __ InstanceOf(negate_result() ? 1 : 0);
+ compiler->RecordSafepoint(locs());
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
+ deopt_id(),
+ token_pos());
+
+ if (compiler->is_optimizing()) {
+ __ PopLocal(locs()->out(0).reg());
+ }
+}
+
+
DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2,
Location::SameAsFirstInput(),
LocationSummary::kCall);
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698