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

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

Issue 9398014: Ignore deleted handles when processing weak roots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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_api_impl_test.cc ('k') | runtime/vm/scavenger.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_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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 class MarkingWeakVisitor : public HandleVisitor { 191 class MarkingWeakVisitor : public HandleVisitor {
192 public: 192 public:
193 MarkingWeakVisitor() { 193 MarkingWeakVisitor() {
194 } 194 }
195 195
196 void VisitHandle(uword addr) { 196 void VisitHandle(uword addr) {
197 WeakPersistentHandle* handle = 197 WeakPersistentHandle* handle =
198 reinterpret_cast<WeakPersistentHandle*>(addr); 198 reinterpret_cast<WeakPersistentHandle*>(addr);
199 RawObject* raw_obj = handle->raw(); 199 RawObject* raw_obj = handle->raw();
200 ASSERT(raw_obj->IsHeapObject()); 200 if (!raw_obj->IsHeapObject()) {
201 // Deleted handles are identified by a Smi as the raw object value.
siva 2012/02/15 01:45:07 We could probably do a Clear() in FreeHandle() tha
202 return;
203 }
201 if (!raw_obj->IsMarked() && raw_obj->IsOldObject()) { 204 if (!raw_obj->IsMarked() && raw_obj->IsOldObject()) {
202 WeakPersistentHandle::Finalize(handle); 205 WeakPersistentHandle::Finalize(handle);
203 } 206 }
204 } 207 }
205 208
206 private: 209 private:
207 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); 210 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor);
208 }; 211 };
209 212
210 213
(...skipping 28 matching lines...) Expand all
239 MarkingStack marking_stack; 242 MarkingStack marking_stack;
240 Prologue(isolate); 243 Prologue(isolate);
241 MarkingVisitor mark(heap_, page_space, &marking_stack); 244 MarkingVisitor mark(heap_, page_space, &marking_stack);
242 IterateRoots(isolate, &mark); 245 IterateRoots(isolate, &mark);
243 DrainMarkingStack(isolate, &mark); 246 DrainMarkingStack(isolate, &mark);
244 MarkingWeakVisitor mark_weak; 247 MarkingWeakVisitor mark_weak;
245 IterateWeakRoots(isolate, &mark_weak); 248 IterateWeakRoots(isolate, &mark_weak);
246 } 249 }
247 250
248 } // namespace dart 251 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698