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

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

Issue 2566383002: ObjectGraph: Establish a HeapIterationScope *before* making the heap writable, least the sweeper in… (Closed)
Patch Set: . Created 4 years 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_graph_test.cc ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 } 2332 }
2333 const Object& obj = Object::Handle(LookupHeapObject(thread, target_id, NULL)); 2333 const Object& obj = Object::Handle(LookupHeapObject(thread, target_id, NULL));
2334 if (obj.raw() == Object::sentinel().raw() || !obj.IsClass()) { 2334 if (obj.raw() == Object::sentinel().raw() || !obj.IsClass()) {
2335 PrintInvalidParamError(js, "classId"); 2335 PrintInvalidParamError(js, "classId");
2336 return true; 2336 return true;
2337 } 2337 }
2338 const Class& cls = Class::Cast(obj); 2338 const Class& cls = Class::Cast(obj);
2339 Array& storage = Array::Handle(Array::New(limit)); 2339 Array& storage = Array::Handle(Array::New(limit));
2340 GetInstancesVisitor visitor(cls, storage); 2340 GetInstancesVisitor visitor(cls, storage);
2341 ObjectGraph graph(thread); 2341 ObjectGraph graph(thread);
2342 HeapIterationScope iteration_scope(true);
2342 graph.IterateObjects(&visitor); 2343 graph.IterateObjects(&visitor);
2343 intptr_t count = visitor.count(); 2344 intptr_t count = visitor.count();
2344 JSONObject jsobj(js); 2345 JSONObject jsobj(js);
2345 jsobj.AddProperty("type", "InstanceSet"); 2346 jsobj.AddProperty("type", "InstanceSet");
2346 jsobj.AddProperty("totalCount", count); 2347 jsobj.AddProperty("totalCount", count);
2347 { 2348 {
2348 JSONArray samples(&jsobj, "samples"); 2349 JSONArray samples(&jsobj, "samples");
2349 for (int i = 0; (i < storage.Length()) && (i < count); i++) { 2350 for (int i = 0; (i < storage.Length()) && (i < count); i++) {
2350 const Object& sample = Object::Handle(storage.At(i)); 2351 const Object& sample = Object::Handle(storage.At(i));
2351 samples.AddValue(sample); 2352 samples.AddValue(sample);
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
4123 if (strcmp(method_name, method.name) == 0) { 4124 if (strcmp(method_name, method.name) == 0) {
4124 return &method; 4125 return &method;
4125 } 4126 }
4126 } 4127 }
4127 return NULL; 4128 return NULL;
4128 } 4129 }
4129 4130
4130 #endif // !PRODUCT 4131 #endif // !PRODUCT
4131 4132
4132 } // namespace dart 4133 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698