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

Side by Side Diff: vm/heap.cc

Issue 8898034: - Implement the old sweeper. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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 | « vm/heap.h ('k') | vm/heap_test.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) 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/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/compiler_stats.h" 8 #include "vm/compiler_stats.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
11 #include "vm/os.h" 11 #include "vm/os.h"
12 #include "vm/pages.h" 12 #include "vm/pages.h"
13 #include "vm/scavenger.h" 13 #include "vm/scavenger.h"
14 #include "vm/utils.h" 14 #include "vm/utils.h"
15 #include "vm/verifier.h" 15 #include "vm/verifier.h"
16 #include "vm/virtual_memory.h" 16 #include "vm/virtual_memory.h"
17 17
18 namespace dart { 18 namespace dart {
19 19
20 DEFINE_FLAG(bool, verbose_gc, false, "Enables verbose GC."); 20 DEFINE_FLAG(bool, verbose_gc, false, "Enables verbose GC.");
21 DEFINE_FLAG(bool, verify_before_gc, false,
22 "Enables heap verification before GC.");
23 DEFINE_FLAG(bool, verify_after_gc, false,
24 "Enables heap verification after GC.");
21 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); 25 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation.");
22 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," 26 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB,"
23 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); 27 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap");
24 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, 28 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB,
25 "old gen heap size in MB," 29 "old gen heap size in MB,"
26 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); 30 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap");
27 DEFINE_FLAG(int, code_heap_size, Heap::kCodeHeapSizeInMB, 31 DEFINE_FLAG(int, code_heap_size, Heap::kCodeHeapSizeInMB,
28 "code heap size in MB," 32 "code heap size in MB,"
29 "e.g: --code_heap_size=8 allocates a 8MB old gen heap"); 33 "e.g: --code_heap_size=8 allocates a 8MB old gen heap");
30 34
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 new_space_->VisitObjectPointers(visitor); 111 new_space_->VisitObjectPointers(visitor);
108 } 112 }
109 113
110 114
111 void Heap::IterateOldPointers(ObjectPointerVisitor* visitor) { 115 void Heap::IterateOldPointers(ObjectPointerVisitor* visitor) {
112 old_space_->VisitObjectPointers(visitor); 116 old_space_->VisitObjectPointers(visitor);
113 code_space_->VisitObjectPointers(visitor); 117 code_space_->VisitObjectPointers(visitor);
114 } 118 }
115 119
116 120
121 void Heap::IterateCodePointers(ObjectPointerVisitor* visitor) {
122 code_space_->VisitObjectPointers(visitor);
123 }
124
125
117 void Heap::CollectGarbage(Space space) { 126 void Heap::CollectGarbage(Space space) {
118 switch (space) { 127 switch (space) {
119 case kNew: 128 case kNew:
120 new_space_->Scavenge(); 129 new_space_->Scavenge();
121 break; 130 break;
122 case kOld: 131 case kOld:
123 old_space_->MarkSweep(); 132 old_space_->MarkSweep();
124 break; 133 break;
125 case kExecutable: 134 case kExecutable:
126 UNIMPLEMENTED(); 135 UNIMPLEMENTED();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 isolate()->IncrementNoGCScopeDepth(); 181 isolate()->IncrementNoGCScopeDepth();
173 } 182 }
174 183
175 184
176 NoGCScope::~NoGCScope() { 185 NoGCScope::~NoGCScope() {
177 isolate()->DecrementNoGCScopeDepth(); 186 isolate()->DecrementNoGCScopeDepth();
178 } 187 }
179 #endif // defined(DEBUG) 188 #endif // defined(DEBUG)
180 189
181 } // namespace dart 190 } // namespace dart
OLDNEW
« no previous file with comments | « vm/heap.h ('k') | vm/heap_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698