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

Side by Side Diff: runtime/vm/become.cc

Issue 2953753002: Revert "Inline instance object hash code into object header on 64 bit." (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/become.h ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/become.h" 5 #include "vm/become.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 9
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
11 #include "vm/isolate_reload.h" 11 #include "vm/isolate_reload.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/raw_object.h" 13 #include "vm/raw_object.h"
14 #include "vm/safepoint.h" 14 #include "vm/safepoint.h"
15 #include "vm/timeline.h" 15 #include "vm/timeline.h"
16 #include "vm/visitor.h" 16 #include "vm/visitor.h"
17 17
18 namespace dart { 18 namespace dart {
19 19
20 ForwardingCorpse* ForwardingCorpse::AsForwarder(uword addr, intptr_t size) { 20 ForwardingCorpse* ForwardingCorpse::AsForwarder(uword addr, intptr_t size) {
21 ASSERT(size >= kObjectAlignment); 21 ASSERT(size >= kObjectAlignment);
22 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 22 ASSERT(Utils::IsAligned(size, kObjectAlignment));
23 23
24 ForwardingCorpse* result = reinterpret_cast<ForwardingCorpse*>(addr); 24 ForwardingCorpse* result = reinterpret_cast<ForwardingCorpse*>(addr);
25 25
26 uint32_t tags = 0; 26 uword tags = 0;
27 tags = RawObject::SizeTag::update(size, tags); 27 tags = RawObject::SizeTag::update(size, tags);
28 tags = RawObject::ClassIdTag::update(kForwardingCorpse, tags); 28 tags = RawObject::ClassIdTag::update(kForwardingCorpse, tags);
29 29
30 result->tags_ = tags; 30 result->tags_ = tags;
31 if (size > RawObject::SizeTag::kMaxSizeTag) { 31 if (size > RawObject::SizeTag::kMaxSizeTag) {
32 *result->SizeAddress() = size; 32 *result->SizeAddress() = size;
33 } 33 }
34 result->set_target(Object::null()); 34 result->set_target(Object::null());
35 return result; 35 return result;
36 } 36 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 if (after_obj->IsForwardingCorpse()) { 256 if (after_obj->IsForwardingCorpse()) {
257 // The Smalltalk become does allow this, and for very special cases 257 // The Smalltalk become does allow this, and for very special cases
258 // it is important (shape changes to Class or Mixin), but as these 258 // it is important (shape changes to Class or Mixin), but as these
259 // cases do not arise in Dart, better to prohibit it. 259 // cases do not arise in Dart, better to prohibit it.
260 FATAL("become: No indirect chains of forwarding"); 260 FATAL("become: No indirect chains of forwarding");
261 } 261 }
262 262
263 ForwardObjectTo(before_obj, after_obj); 263 ForwardObjectTo(before_obj, after_obj);
264 264
265 #if defined(HASH_IN_OBJECT_HEADER)
266 Object::SetCachedHash(after_obj, Object::GetCachedHash(before_obj));
267 #else
268 // Forward the identity hash too if it has one. 265 // Forward the identity hash too if it has one.
269 intptr_t hash = heap->GetHash(before_obj); 266 intptr_t hash = heap->GetHash(before_obj);
270 if (hash != 0) { 267 if (hash != 0) {
271 ASSERT(heap->GetHash(after_obj) == 0); 268 ASSERT(heap->GetHash(after_obj) == 0);
272 heap->SetHash(after_obj, hash); 269 heap->SetHash(after_obj, hash);
273 } 270 }
274 #endif
275 } 271 }
276 272
277 { 273 {
278 // Follow forwarding pointers. 274 // Follow forwarding pointers.
279 275
280 // C++ pointers 276 // C++ pointers
281 ForwardPointersVisitor pointer_visitor(isolate); 277 ForwardPointersVisitor pointer_visitor(isolate);
282 isolate->VisitObjectPointers(&pointer_visitor, true); 278 isolate->VisitObjectPointers(&pointer_visitor, true);
283 279
284 // Weak persistent handles. 280 // Weak persistent handles.
(...skipping 17 matching lines...) Expand all
302 } 298 }
303 299
304 #if defined(DEBUG) 300 #if defined(DEBUG)
305 for (intptr_t i = 0; i < before.Length(); i++) { 301 for (intptr_t i = 0; i < before.Length(); i++) {
306 ASSERT(before.At(i) == after.At(i)); 302 ASSERT(before.At(i) == after.At(i));
307 } 303 }
308 #endif 304 #endif
309 } 305 }
310 306
311 } // namespace dart 307 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/become.h ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698