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

Unified Diff: runtime/vm/object.cc

Issue 2912863006: Inline instance object hash code into object header on 64 bit. (Closed)
Patch Set: Created 3 years, 7 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/heap.cc ('k') | runtime/vm/raw_object.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 2c6422e7d0e5d68d8799ed3ba5034b6b3bc99174..435f6a42891b241c34b77e393155644602ba46f7 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -911,6 +911,21 @@ void Object::InitOnce(Isolate* isolate) {
cls = void_class_;
*void_type_ = Type::NewNonParameterizedType(cls);
+#if defined(HASH_IN_OBJECT_HEADER)
Vyacheslav Egorov (Google) 2017/05/30 15:25:00 How do we make sure that this list is exhaustive?
erikcorry 2017/06/02 15:34:04 Good point that does not work. Instead, the new v
+ // These need to be set now because they can end up in read-only memory where
+ // they can't be overwritten. Some of them actually have hashCode methods,
+ // so the value won't be used once the VM is fully booted.
+ Object::SetCachedHash(sentinel_->raw(), 1);
+ Object::SetCachedHash(transition_sentinel_->raw(), 2);
+ Object::SetCachedHash(unknown_constant_->raw(), 3);
+ Object::SetCachedHash(non_constant_->raw(), 4);
+ Object::SetCachedHash(empty_array_->raw(), 256);
+ Object::SetCachedHash(zero_array_->raw(), 257);
+ Object::SetCachedHash(dynamic_type_->raw(), 103);
+ Object::SetCachedHash(void_type_->raw(), 104);
+ Object::SetCachedHash(null_instance_->raw(), 42);
+#endif
+
// Allocate and initialize singleton true and false boolean objects.
cls = Class::New<Bool>();
isolate->object_store()->set_bool_class(cls);
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698