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

Unified Diff: runtime/vm/object_store.cc

Issue 2137673002: Sped up hashCode by removing megamorphic call to _identityHashCode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Improved the speed of instance-of for unoptimized code. 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..19e7ebd5819722ee20db3e40fa89c7b22b74c724 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -90,6 +90,10 @@ ObjectStore::ObjectStore()
empty_uint32_array_(TypedData::null()),
handle_message_function_(Function::null()),
library_load_error_table_(Array::null()),
+ simple_instance_of_function_(Function::null()),
+ simple_instance_of_true_function_(Function::null()),
+ simple_instance_of_false_function_(Function::null()),
+ compile_time_constants_(Array::null()),
unique_dynamic_targets_(Array::null()),
token_objects_(GrowableObjectArray::null()),
token_objects_map_(Array::null()),
@@ -201,6 +205,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 +241,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