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

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

Issue 261753012: Make ObjectGraph a StackResource. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
« runtime/vm/object_graph.h ('K') | « runtime/vm/object_graph.h ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/object_graph.h" 5 #include "vm/object_graph.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 static void UnmarkAll(Isolate* isolate) { 106 static void UnmarkAll(Isolate* isolate) {
107 Unmarker unmarker(isolate); 107 Unmarker unmarker(isolate);
108 isolate->heap()->IterateObjects(&unmarker); 108 isolate->heap()->IterateObjects(&unmarker);
109 } 109 }
110 110
111 private: 111 private:
112 DISALLOW_COPY_AND_ASSIGN(Unmarker); 112 DISALLOW_COPY_AND_ASSIGN(Unmarker);
113 }; 113 };
114 114
115 115
116 ObjectGraph::ObjectGraph(Isolate* isolate) : isolate_(isolate) { 116 ObjectGraph::ObjectGraph(Isolate* isolate)
117 : StackResource(isolate), isolate_(isolate) {
117 // The VM isolate has all its objects pre-marked, so iterating over it 118 // The VM isolate has all its objects pre-marked, so iterating over it
118 // would be a no-op. 119 // would be a no-op.
119 ASSERT(isolate_ != Dart::vm_isolate()); 120 ASSERT(isolate_ != Dart::vm_isolate());
120 isolate_->heap()->WriteProtectCode(false); 121 isolate_->heap()->WriteProtectCode(false);
121 } 122 }
122 123
123 124
124 ObjectGraph::~ObjectGraph() { 125 ObjectGraph::~ObjectGraph() {
125 isolate_->heap()->WriteProtectCode(true); 126 isolate_->heap()->WriteProtectCode(true);
126 } 127 }
(...skipping 13 matching lines...) Expand all
140 NoGCScope no_gc_scope_; 141 NoGCScope no_gc_scope_;
141 Stack stack(isolate_); 142 Stack stack(isolate_);
142 RawObject* root_raw = root.raw(); 143 RawObject* root_raw = root.raw();
143 stack.VisitPointer(&root_raw); 144 stack.VisitPointer(&root_raw);
144 stack.TraverseGraph(visitor); 145 stack.TraverseGraph(visitor);
145 // TODO(koda): Optimize if we only visited a small subgraph. 146 // TODO(koda): Optimize if we only visited a small subgraph.
146 Unmarker::UnmarkAll(isolate_); 147 Unmarker::UnmarkAll(isolate_);
147 } 148 }
148 149
149 } // namespace dart 150 } // namespace dart
OLDNEW
« runtime/vm/object_graph.h ('K') | « runtime/vm/object_graph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698