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); |