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

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

Issue 1292353004: Safepointing in GC (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: More git cleanup. Created 5 years, 3 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 | « no previous file | runtime/vm/pages.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/gc_sweeper.h" 5 #include "vm/gc_sweeper.h"
6 6
7 #include "vm/freelist.h" 7 #include "vm/freelist.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
11 #include "vm/pages.h" 11 #include "vm/pages.h"
12 #include "vm/thread_pool.h" 12 #include "vm/thread_pool.h"
13 #include "vm/thread_registry.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) { 17 bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) {
17 // Keep track whether this page is still in use. 18 // Keep track whether this page is still in use.
18 bool in_use = false; 19 bool in_use = false;
19 20
20 bool is_executable = (page->type() == HeapPage::kExecutable); 21 bool is_executable = (page->type() == HeapPage::kExecutable);
21 uword start = page->object_start(); 22 uword start = page->object_start();
22 uword end = page->object_end(); 23 uword end = page->object_end();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 114 }
114 115
115 virtual void Run() { 116 virtual void Run() {
116 Thread::EnterIsolateAsHelper(task_isolate_); 117 Thread::EnterIsolateAsHelper(task_isolate_);
117 GCSweeper sweeper; 118 GCSweeper sweeper;
118 119
119 HeapPage* page = first_; 120 HeapPage* page = first_;
120 HeapPage* prev_page = NULL; 121 HeapPage* prev_page = NULL;
121 122
122 while (page != NULL) { 123 while (page != NULL) {
124 task_isolate_->thread_registry()->CheckSafepoint();
123 HeapPage* next_page = page->next(); 125 HeapPage* next_page = page->next();
124 ASSERT(page->type() == HeapPage::kData); 126 ASSERT(page->type() == HeapPage::kData);
125 bool page_in_use = sweeper.SweepPage(page, freelist_, false); 127 bool page_in_use = sweeper.SweepPage(page, freelist_, false);
126 if (page_in_use) { 128 if (page_in_use) {
127 prev_page = page; 129 prev_page = page;
128 } else { 130 } else {
129 old_space_->FreePage(page, prev_page); 131 old_space_->FreePage(page, prev_page);
130 } 132 }
131 { 133 {
132 // Notify the mutator thread that we have added elements to the free 134 // Notify the mutator thread that we have added elements to the free
(...skipping 30 matching lines...) Expand all
163 SweeperTask* task = 165 SweeperTask* task =
164 new SweeperTask(isolate, 166 new SweeperTask(isolate,
165 isolate->heap()->old_space(), 167 isolate->heap()->old_space(),
166 first, last, 168 first, last,
167 freelist); 169 freelist);
168 ThreadPool* pool = Dart::thread_pool(); 170 ThreadPool* pool = Dart::thread_pool();
169 pool->Run(task); 171 pool->Run(task);
170 } 172 }
171 173
172 } // namespace dart 174 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698