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

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

Issue 2622053002: Refactor snapshots pieces to include a section for loading instructions into the heap of a regular … (Closed)
Patch Set: . Created 3 years, 11 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 | « runtime/vm/object.cc ('k') | runtime/vm/pages.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) 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 Unmarker() {} 142 Unmarker() {}
143 143
144 void VisitObject(RawObject* obj) { 144 void VisitObject(RawObject* obj) {
145 if (obj->IsMarked()) { 145 if (obj->IsMarked()) {
146 obj->ClearMarkBit(); 146 obj->ClearMarkBit();
147 } 147 }
148 } 148 }
149 149
150 static void UnmarkAll(Isolate* isolate) { 150 static void UnmarkAll(Isolate* isolate) {
151 Unmarker unmarker; 151 Unmarker unmarker;
152 isolate->heap()->VisitObjects(&unmarker); 152 isolate->heap()->VisitObjectsNoExternalPages(&unmarker);
153 } 153 }
154 154
155 private: 155 private:
156 DISALLOW_COPY_AND_ASSIGN(Unmarker); 156 DISALLOW_COPY_AND_ASSIGN(Unmarker);
157 }; 157 };
158 158
159 159
160 ObjectGraph::ObjectGraph(Thread* thread) : StackResource(thread) { 160 ObjectGraph::ObjectGraph(Thread* thread) : StackResource(thread) {
161 // The VM isolate has all its objects pre-marked, so iterating over it 161 // The VM isolate has all its objects pre-marked, so iterating over it
162 // would be a no-op. 162 // would be a no-op.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 DISALLOW_COPY_AND_ASSIGN(InstanceAccumulator); 206 DISALLOW_COPY_AND_ASSIGN(InstanceAccumulator);
207 }; 207 };
208 208
209 209
210 void ObjectGraph::IterateObjectsFrom(intptr_t class_id, 210 void ObjectGraph::IterateObjectsFrom(intptr_t class_id,
211 ObjectGraph::Visitor* visitor) { 211 ObjectGraph::Visitor* visitor) {
212 NoSafepointScope no_safepoint_scope_; 212 NoSafepointScope no_safepoint_scope_;
213 Stack stack(isolate()); 213 Stack stack(isolate());
214 214
215 InstanceAccumulator accumulator(&stack, class_id); 215 InstanceAccumulator accumulator(&stack, class_id);
216 isolate()->heap()->VisitObjects(&accumulator); 216 isolate()->heap()->VisitObjectsNoExternalPages(&accumulator);
217 217
218 stack.TraverseGraph(visitor); 218 stack.TraverseGraph(visitor);
219 Unmarker::UnmarkAll(isolate()); 219 Unmarker::UnmarkAll(isolate());
220 } 220 }
221 221
222 222
223 class SizeVisitor : public ObjectGraph::Visitor { 223 class SizeVisitor : public ObjectGraph::Visitor {
224 public: 224 public:
225 SizeVisitor() : size_(0) {} 225 SizeVisitor() : size_(0) {}
226 intptr_t size() const { return size_; } 226 intptr_t size() const { return size_; }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 intptr_t object_count = visitor.count(); 654 intptr_t object_count = visitor.count();
655 if (roots == kVM) { 655 if (roots == kVM) {
656 object_count += 1; // root 656 object_count += 1; // root
657 } else { 657 } else {
658 object_count += 2; // root and stack 658 object_count += 2; // root and stack
659 } 659 }
660 return object_count; 660 return object_count;
661 } 661 }
662 662
663 } // namespace dart 663 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698