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

Unified Diff: runtime/vm/object.cc

Issue 2147123002: Made simple instance-of checks fast for unoptimized code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed compile_time_constants_ from object_store. Created 4 years, 5 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/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 26e4466590c1772af86a7a2c296ca02c8c7492ac..832a958a5b159da4b5f3a90fb261397a32a18846 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12848,10 +12848,20 @@ void ICData::AddTarget(const Function& target) const {
}
+bool ICData::ValidateInterceptor(const Function& target) const {
+ ObjectStore* store = Isolate::Current()->object_store();
+ ASSERT((target.raw() == store->simple_instance_of_true_function()) ||
+ (target.raw() == store->simple_instance_of_false_function()));
+ const String& instance_of_name = String::Handle(
+ Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()).raw());
+ ASSERT(target_name() == instance_of_name.raw());
+ return true;
+}
+
void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids,
const Function& target) const {
ASSERT(!target.IsNull());
- ASSERT(target.name() == target_name());
+ ASSERT((target.name() == target_name()) || ValidateInterceptor(target));
DEBUG_ASSERT(!HasCheck(class_ids));
ASSERT(NumArgsTested() > 1); // Otherwise use 'AddReceiverCheck'.
ASSERT(class_ids.length() == NumArgsTested());
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698