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

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

Issue 2912863006: Inline instance object hash code into object header on 64 bit. (Closed)
Patch Set: Use visitor to give objects in VM isolate hash codes. 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
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"
(...skipping 244 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
265 // Forward the identity hash too if it has one. 268 // Forward the identity hash too if it has one.
266 intptr_t hash = heap->GetHash(before_obj); 269 intptr_t hash = heap->GetHash(before_obj);
267 if (hash != 0) { 270 if (hash != 0) {
268 ASSERT(heap->GetHash(after_obj) == 0); 271 ASSERT(heap->GetHash(after_obj) == 0);
269 heap->SetHash(after_obj, hash); 272 heap->SetHash(after_obj, hash);
270 } 273 }
274 #endif
271 } 275 }
272 276
273 { 277 {
274 // Follow forwarding pointers. 278 // Follow forwarding pointers.
275 279
276 // C++ pointers 280 // C++ pointers
277 ForwardPointersVisitor pointer_visitor(isolate); 281 ForwardPointersVisitor pointer_visitor(isolate);
278 isolate->VisitObjectPointers(&pointer_visitor, true); 282 isolate->VisitObjectPointers(&pointer_visitor, true);
279 283
280 // Weak persistent handles. 284 // Weak persistent handles.
(...skipping 17 matching lines...) Expand all
298 } 302 }
299 303
300 #if defined(DEBUG) 304 #if defined(DEBUG)
301 for (intptr_t i = 0; i < before.Length(); i++) { 305 for (intptr_t i = 0; i < before.Length(); i++) {
302 ASSERT(before.At(i) == after.At(i)); 306 ASSERT(before.At(i) == after.At(i));
303 } 307 }
304 #endif 308 #endif
305 } 309 }
306 310
307 } // namespace dart 311 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/become.h ('k') | runtime/vm/heap.h » ('j') | runtime/vm/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698