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

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

Issue 10675010: - Premark vm_isolate objects to avoid having to test for them (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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/dart.cc ('k') | runtime/vm/heap.h » ('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_marker.h" 5 #include "vm/gc_marker.h"
6 6
7 #include "vm/allocation.h" 7 #include "vm/allocation.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/pages.h" 10 #include "vm/pages.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // Fast exit if the raw object is marked. 162 // Fast exit if the raw object is marked.
163 if (raw_obj->IsMarked()) return; 163 if (raw_obj->IsMarked()) return;
164 164
165 // Skip over new objects, but verify consistency of heap while at it. 165 // Skip over new objects, but verify consistency of heap while at it.
166 if (raw_obj->IsNewObject()) { 166 if (raw_obj->IsNewObject()) {
167 // TODO(iposva): Add consistency check. 167 // TODO(iposva): Add consistency check.
168 return; 168 return;
169 } 169 }
170 170
171 uword raw_addr = RawObject::ToAddr(raw_obj);
172 // TODO(iposva): Premark vm_isolate objects, to avoid this extra check here.
173 if (vm_heap_->Contains(raw_addr)) {
174 return;
175 }
176 // TODO(iposva): merge old and code spaces. 171 // TODO(iposva): merge old and code spaces.
177 ASSERT(page_space_->Contains(raw_addr)); 172 ASSERT(page_space_->Contains(RawObject::ToAddr(raw_obj)));
178 MarkAndPush(raw_obj); 173 MarkAndPush(raw_obj);
179 } 174 }
180 175
181 Heap* heap_; 176 Heap* heap_;
182 Heap* vm_heap_; 177 Heap* vm_heap_;
183 PageSpace* page_space_; 178 PageSpace* page_space_;
184 MarkingStack* marking_stack_; 179 MarkingStack* marking_stack_;
185 180
186 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); 181 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor);
187 }; 182 };
188 183
189 184
190 bool IsUnreachable(const RawObject* raw_obj) { 185 bool IsUnreachable(const RawObject* raw_obj) {
191 if (!raw_obj->IsHeapObject()) { 186 if (!raw_obj->IsHeapObject()) {
192 return false; 187 return false;
193 } 188 }
189 if (raw_obj == Object::null()) {
190 return true;
191 }
194 if (!raw_obj->IsOldObject()) { 192 if (!raw_obj->IsOldObject()) {
195 return false; 193 return false;
196 } 194 }
197 return !raw_obj->IsMarked(); 195 return !raw_obj->IsMarked();
198 } 196 }
199 197
200 198
201 class MarkingWeakVisitor : public HandleVisitor { 199 class MarkingWeakVisitor : public HandleVisitor {
202 public: 200 public:
203 MarkingWeakVisitor() { 201 MarkingWeakVisitor() {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack); 319 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack);
322 IterateRoots(isolate, &mark, !invoke_api_callbacks); 320 IterateRoots(isolate, &mark, !invoke_api_callbacks);
323 DrainMarkingStack(isolate, &mark); 321 DrainMarkingStack(isolate, &mark);
324 IterateWeakReferences(isolate, &mark); 322 IterateWeakReferences(isolate, &mark);
325 MarkingWeakVisitor mark_weak; 323 MarkingWeakVisitor mark_weak;
326 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); 324 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks);
327 Epilogue(isolate, invoke_api_callbacks); 325 Epilogue(isolate, invoke_api_callbacks);
328 } 326 }
329 327
330 } // namespace dart 328 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698