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

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

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: explicit-thread Created 3 years, 4 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/scavenger.cc ('k') | runtime/vm/stack_frame_test.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) 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 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 } 2397 }
2398 const Object& obj = Object::Handle(LookupHeapObject(thread, target_id, NULL)); 2398 const Object& obj = Object::Handle(LookupHeapObject(thread, target_id, NULL));
2399 if (obj.raw() == Object::sentinel().raw() || !obj.IsClass()) { 2399 if (obj.raw() == Object::sentinel().raw() || !obj.IsClass()) {
2400 PrintInvalidParamError(js, "classId"); 2400 PrintInvalidParamError(js, "classId");
2401 return true; 2401 return true;
2402 } 2402 }
2403 const Class& cls = Class::Cast(obj); 2403 const Class& cls = Class::Cast(obj);
2404 Array& storage = Array::Handle(Array::New(limit)); 2404 Array& storage = Array::Handle(Array::New(limit));
2405 GetInstancesVisitor visitor(cls, storage); 2405 GetInstancesVisitor visitor(cls, storage);
2406 ObjectGraph graph(thread); 2406 ObjectGraph graph(thread);
2407 HeapIterationScope iteration_scope(true); 2407 HeapIterationScope iteration_scope(Thread::Current(), true);
2408 graph.IterateObjects(&visitor); 2408 graph.IterateObjects(&visitor);
2409 intptr_t count = visitor.count(); 2409 intptr_t count = visitor.count();
2410 JSONObject jsobj(js); 2410 JSONObject jsobj(js);
2411 jsobj.AddProperty("type", "InstanceSet"); 2411 jsobj.AddProperty("type", "InstanceSet");
2412 jsobj.AddProperty("totalCount", count); 2412 jsobj.AddProperty("totalCount", count);
2413 { 2413 {
2414 JSONArray samples(&jsobj, "samples"); 2414 JSONArray samples(&jsobj, "samples");
2415 for (int i = 0; (i < storage.Length()) && (i < count); i++) { 2415 for (int i = 0; (i < storage.Length()) && (i < count); i++) {
2416 const Object& sample = Object::Handle(storage.At(i)); 2416 const Object& sample = Object::Handle(storage.At(i));
2417 samples.AddValue(sample); 2417 samples.AddValue(sample);
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
4126 if (strcmp(method_name, method.name) == 0) { 4126 if (strcmp(method_name, method.name) == 0) {
4127 return &method; 4127 return &method;
4128 } 4128 }
4129 } 4129 }
4130 return NULL; 4130 return NULL;
4131 } 4131 }
4132 4132
4133 #endif // !PRODUCT 4133 #endif // !PRODUCT
4134 4134
4135 } // namespace dart 4135 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698