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

Unified Diff: runtime/vm/object_store.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_store.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_store.cc
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index 5528afd0487c9a0963997af94b07d0e7b80f73bf..09a9ad44a89a749679050d2c482ffa1b2ba4fe76 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -89,6 +89,9 @@ ObjectStore::ObjectStore()
lookup_port_handler_(Function::null()),
empty_uint32_array_(TypedData::null()),
handle_message_function_(Function::null()),
+ simple_instance_of_function_(Function::null()),
+ simple_instance_of_true_function_(Function::null()),
+ simple_instance_of_false_function_(Function::null()),
library_load_error_table_(Array::null()),
unique_dynamic_targets_(Array::null()),
token_objects_(GrowableObjectArray::null()),
@@ -201,6 +204,16 @@ RawError* ObjectStore::PreallocateObjects() {
}
+RawFunction* ObjectStore::PrivateObjectLookup(const String& name) {
+ const Library& core_lib = Library::Handle(core_library());
+ const String& mangled = String::ZoneHandle(core_lib.PrivateName(name));
+ const Class& cls = Class::Handle(object_class());
+ const Function& result = Function::Handle(cls.LookupDynamicFunction(mangled));
+ ASSERT(!result.IsNull());
+ return result.raw();
+}
+
+
void ObjectStore::InitKnownObjects() {
#ifdef DART_PRECOMPILED_RUNTIME
// These objects are only needed for code generation.
@@ -227,6 +240,14 @@ void ObjectStore::InitKnownObjects() {
const Library& internal_lib = Library::Handle(internal_library());
cls = internal_lib.LookupClass(Symbols::Symbol());
set_symbol_class(cls);
+
+ // Cache the core private functions used for fast instance of checks.
+ simple_instance_of_function_ =
+ PrivateObjectLookup(Symbols::_simpleInstanceOf());
+ simple_instance_of_true_function_ =
+ PrivateObjectLookup(Symbols::_simpleInstanceOfTrue());
+ simple_instance_of_false_function_ =
+ PrivateObjectLookup(Symbols::_simpleInstanceOfFalse());
#endif
}
« no previous file with comments | « runtime/vm/object_store.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698