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

Side by Side Diff: vm/pages.cc

Issue 8761006: - Implement a simple old-generation marker. (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/pages.h ('k') | 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/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/gc_marker.h"
8 #include "vm/object.h" 9 #include "vm/object.h"
9 #include "vm/virtual_memory.h" 10 #include "vm/virtual_memory.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 HeapPage* HeapPage::Initialize(VirtualMemory* memory, bool is_executable) { 14 HeapPage* HeapPage::Initialize(VirtualMemory* memory, bool is_executable) {
14 ASSERT(memory->size() > VirtualMemory::PageSize()); 15 ASSERT(memory->size() > VirtualMemory::PageSize());
15 memory->Commit(is_executable); 16 memory->Commit(is_executable);
16 17
17 HeapPage* result = reinterpret_cast<HeapPage*>(memory->address()); 18 HeapPage* result = reinterpret_cast<HeapPage*>(memory->address());
(...skipping 30 matching lines...) Expand all
48 49
49 50
50 PageSpace::PageSpace(Heap* heap, intptr_t max_capacity, bool is_executable) 51 PageSpace::PageSpace(Heap* heap, intptr_t max_capacity, bool is_executable)
51 : heap_(heap), 52 : heap_(heap),
52 pages_(NULL), 53 pages_(NULL),
53 pages_tail_(NULL), 54 pages_tail_(NULL),
54 large_pages_(NULL), 55 large_pages_(NULL),
55 max_capacity_(max_capacity), 56 max_capacity_(max_capacity),
56 capacity_(0), 57 capacity_(0),
57 in_use_(0), 58 in_use_(0),
58 is_executable_(is_executable) { } 59 count_(0),
60 is_executable_(is_executable),
61 sweeping_(false) { }
59 62
60 63
61 PageSpace::~PageSpace() { 64 PageSpace::~PageSpace() {
62 FreePages(pages_); 65 FreePages(pages_);
63 FreePages(large_pages_); 66 FreePages(large_pages_);
64 } 67 }
65 68
66 69
67 void PageSpace::AllocatePage() { 70 void PageSpace::AllocatePage() {
68 HeapPage* page = HeapPage::Allocate(kPageSize, is_executable_); 71 HeapPage* page = HeapPage::Allocate(kPageSize, is_executable_);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 page = page->next(); 170 page = page->next();
168 } 171 }
169 172
170 page = large_pages_; 173 page = large_pages_;
171 while (page != NULL) { 174 while (page != NULL) {
172 page->VisitObjectPointers(visitor); 175 page->VisitObjectPointers(visitor);
173 page = page->next(); 176 page = page->next();
174 } 177 }
175 } 178 }
176 179
180
181 void PageSpace::MarkSweep() {
182 // MarkSweep is not reentrant. Make sure that is the case.
183 ASSERT(!sweeping_);
184 sweeping_ = true;
185 Isolate* isolate = Isolate::Current();
186 NoHandleScope no_handles(isolate);
187
188 Timer timer(FLAG_verbose_gc, "MarkSweep");
189 timer.Start();
190
191 // Mark all reachable old-gen objects.
192 GCMarker marker(heap_);
193 marker.MarkObjects(isolate, this);
194
195 UNIMPLEMENTED();
196 timer.Stop();
197 if (FLAG_verbose_gc) {
198 OS::PrintErr("Mark-Sweep[%d]: %dus\n", count_, timer.TotalElapsedTime());
199 }
200
201 count_++;
202 // Done, reset the marker.
203 ASSERT(sweeping_);
204 sweeping_ = false;
205 }
206
177 } // namespace dart 207 } // namespace dart
OLDNEW
« no previous file with comments | « vm/pages.h ('k') | vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698