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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2954453002: VM: Reland Inline instance object hash code into object header on 64bit. (Closed)
Patch Set: Incorporate last minute code review feedback Created 3 years, 6 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/simulator_arm64.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index 3a9b2d8414b70a5574ac244ed85d12e38565671c..127b6d4f6e4b26c1423497d92293d197f30c382c 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -322,6 +322,7 @@ class SimulatorHelpers {
uword tags = 0;
tags = RawObject::ClassIdTag::update(kDoubleCid, tags);
tags = RawObject::SizeTag::update(instance_size, tags);
+ // Also writes zero in the hash_ field.
*reinterpret_cast<uword*>(start + Double::tags_offset()) = tags;
*reinterpret_cast<double*>(start + Double::value_offset()) = value;
return reinterpret_cast<RawObject*>(start + kHeapObjectTag);
@@ -2855,9 +2856,10 @@ RawObject* Simulator::Call(const Code& code,
const intptr_t instance_size = Context::InstanceSize(num_context_variables);
const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
if (LIKELY(start != 0)) {
- uword tags = 0;
+ uint32_t tags = 0;
tags = RawObject::ClassIdTag::update(kContextCid, tags);
tags = RawObject::SizeTag::update(instance_size, tags);
+ // Also writes 0 in the hash_ field of the header.
*reinterpret_cast<uword*>(start + Array::tags_offset()) = tags;
*reinterpret_cast<uword*>(start + Context::num_variables_offset()) =
num_context_variables;
@@ -2898,6 +2900,7 @@ RawObject* Simulator::Call(const Code& code,
const intptr_t instance_size = RawObject::SizeTag::decode(tags);
const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
if (LIKELY(start != 0)) {
+ // Writes both the tags and the initial identity hash on 64 bit platforms.
*reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
for (intptr_t current_offset = sizeof(RawInstance);
current_offset < instance_size; current_offset += kWordSize) {
@@ -2929,6 +2932,7 @@ RawObject* Simulator::Call(const Code& code,
if (LIKELY(start != 0)) {
RawObject* type_args = SP[0];
const intptr_t type_args_offset = Bytecode::DecodeD(*pc);
+ // Writes both the tags and the initial identity hash on 64 bit platforms.
*reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
for (intptr_t current_offset = sizeof(RawInstance);
current_offset < instance_size; current_offset += kWordSize) {
@@ -2972,6 +2976,8 @@ RawObject* Simulator::Call(const Code& code,
tags = RawObject::SizeTag::update(instance_size, tags);
}
tags = RawObject::ClassIdTag::update(cid, tags);
+ // Writes both the tags and the initial identity hash on 64 bit
+ // platforms.
*reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
*reinterpret_cast<RawObject**>(start + Array::length_offset()) =
FP[rB];
« no previous file with comments | « runtime/vm/simulator_arm64.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698