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

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

Issue 18259014: Object ID Ring with tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scavenger.h ('k') | runtime/vm/vm_sources.gypi » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
11 #include "vm/dart.h" 11 #include "vm/dart.h"
12 #include "vm/dart_api_state.h" 12 #include "vm/dart_api_state.h"
13 #include "vm/isolate.h" 13 #include "vm/isolate.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/stack_frame.h" 15 #include "vm/stack_frame.h"
16 #include "vm/store_buffer.h" 16 #include "vm/store_buffer.h"
17 #include "vm/verifier.h" 17 #include "vm/verifier.h"
18 #include "vm/visitor.h" 18 #include "vm/visitor.h"
19 #include "vm/weak_table.h" 19 #include "vm/weak_table.h"
20 #include "vm/object_id_ring.h"
20 21
21 namespace dart { 22 namespace dart {
22 23
23 // Scavenger uses RawObject::kMarkBit to distinguish forwaded and non-forwarded 24 // Scavenger uses RawObject::kMarkBit to distinguish forwaded and non-forwarded
24 // objects. The kMarkBit does not intersect with the target address because of 25 // objects. The kMarkBit does not intersect with the target address because of
25 // object alignment. 26 // object alignment.
26 enum { 27 enum {
27 kForwardingMask = 1 << RawObject::kMarkBit, 28 kForwardingMask = 1 << RawObject::kMarkBit,
28 kNotForwarded = 0, 29 kNotForwarded = 0,
29 kForwarded = kForwardingMask, 30 kForwarded = kForwardingMask,
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 398 }
398 delete pending; 399 delete pending;
399 pending = next; 400 pending = next;
400 } 401 }
401 heap_->RecordData(kStoreBufferEntries, entries); 402 heap_->RecordData(kStoreBufferEntries, entries);
402 // Done iterating through old objects remembered in the store buffers. 403 // Done iterating through old objects remembered in the store buffers.
403 visitor->VisitingOldObject(NULL); 404 visitor->VisitingOldObject(NULL);
404 } 405 }
405 406
406 407
408 void Scavenger::IterateObjectIdTable(Isolate* isolate,
409 ScavengerVisitor* visitor) {
410 ObjectIdRing* ring = isolate->object_id_ring();
411 ASSERT(ring != NULL);
412 ring->VisitPointers(visitor);
413 }
414
415
407 void Scavenger::IterateRoots(Isolate* isolate, 416 void Scavenger::IterateRoots(Isolate* isolate,
408 ScavengerVisitor* visitor, 417 ScavengerVisitor* visitor,
409 bool visit_prologue_weak_persistent_handles) { 418 bool visit_prologue_weak_persistent_handles) {
410 int64_t start = OS::GetCurrentTimeMicros(); 419 int64_t start = OS::GetCurrentTimeMicros();
411 isolate->VisitObjectPointers(visitor, 420 isolate->VisitObjectPointers(visitor,
412 visit_prologue_weak_persistent_handles, 421 visit_prologue_weak_persistent_handles,
413 StackFrameIterator::kDontValidateFrames); 422 StackFrameIterator::kDontValidateFrames);
414 int64_t middle = OS::GetCurrentTimeMicros(); 423 int64_t middle = OS::GetCurrentTimeMicros();
415 IterateStoreBuffers(isolate, visitor); 424 IterateStoreBuffers(isolate, visitor);
425 IterateObjectIdTable(isolate, visitor);
416 int64_t end = OS::GetCurrentTimeMicros(); 426 int64_t end = OS::GetCurrentTimeMicros();
417 heap_->RecordTime(kVisitIsolateRoots, middle - start); 427 heap_->RecordTime(kVisitIsolateRoots, middle - start);
418 heap_->RecordTime(kIterateStoreBuffers, end - middle); 428 heap_->RecordTime(kIterateStoreBuffers, end - middle);
419 } 429 }
420 430
421 431
422 bool Scavenger::IsUnreachable(RawObject** p) { 432 bool Scavenger::IsUnreachable(RawObject** p) {
423 RawObject* raw_obj = *p; 433 RawObject* raw_obj = *p;
424 if (!raw_obj->IsHeapObject()) { 434 if (!raw_obj->IsHeapObject()) {
425 return false; 435 return false;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 669 }
660 670
661 671
662 void Scavenger::WriteProtect(bool read_only) { 672 void Scavenger::WriteProtect(bool read_only) {
663 space_->Protect( 673 space_->Protect(
664 read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite); 674 read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite);
665 } 675 }
666 676
667 677
668 } // namespace dart 678 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698