OLD | NEW |
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 "platform/globals.h" | 8 #include "platform/globals.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
11 #include "vm/coverage.h" | 11 #include "vm/coverage.h" |
12 #include "vm/cpu.h" | 12 #include "vm/cpu.h" |
13 #include "vm/dart_api_impl.h" | 13 #include "vm/dart_api_impl.h" |
14 #include "vm/dart_entry.h" | 14 #include "vm/dart_entry.h" |
15 #include "vm/debugger.h" | 15 #include "vm/debugger.h" |
16 #include "vm/isolate.h" | 16 #include "vm/isolate.h" |
17 #include "vm/message.h" | 17 #include "vm/message.h" |
18 #include "vm/message_handler.h" | 18 #include "vm/message_handler.h" |
19 #include "vm/native_entry.h" | 19 #include "vm/native_entry.h" |
20 #include "vm/native_arguments.h" | 20 #include "vm/native_arguments.h" |
21 #include "vm/object.h" | 21 #include "vm/object.h" |
| 22 #include "vm/object_graph.h" |
22 #include "vm/object_id_ring.h" | 23 #include "vm/object_id_ring.h" |
23 #include "vm/object_store.h" | 24 #include "vm/object_store.h" |
24 #include "vm/port.h" | 25 #include "vm/port.h" |
25 #include "vm/profiler.h" | 26 #include "vm/profiler.h" |
26 #include "vm/stack_frame.h" | 27 #include "vm/stack_frame.h" |
27 #include "vm/symbols.h" | 28 #include "vm/symbols.h" |
28 #include "vm/version.h" | 29 #include "vm/version.h" |
29 | 30 |
30 | 31 |
31 namespace dart { | 32 namespace dart { |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 } | 882 } |
882 const String& expr_str = String::Handle(isolate, String::New(expr)); | 883 const String& expr_str = String::Handle(isolate, String::New(expr)); |
883 ASSERT(obj.IsInstance()); | 884 ASSERT(obj.IsInstance()); |
884 const Instance& instance = Instance::Cast(obj); | 885 const Instance& instance = Instance::Cast(obj); |
885 const Object& result = | 886 const Object& result = |
886 Object::Handle(instance.Evaluate(expr_str, | 887 Object::Handle(instance.Evaluate(expr_str, |
887 Array::empty_array(), | 888 Array::empty_array(), |
888 Array::empty_array())); | 889 Array::empty_array())); |
889 result.PrintJSON(js, true); | 890 result.PrintJSON(js, true); |
890 return true; | 891 return true; |
| 892 } else if (strcmp(action, "retained") == 0) { |
| 893 ObjectGraph graph(isolate); |
| 894 intptr_t retained_size = graph.SizeRetainedByInstance(obj); |
| 895 const Object& result = Object::Handle(Integer::New(retained_size)); |
| 896 result.PrintJSON(js, true); |
| 897 return true; |
891 } | 898 } |
892 | 899 |
893 PrintError(js, "unrecognized action '%s'\n", action); | 900 PrintError(js, "unrecognized action '%s'\n", action); |
894 return true; | 901 return true; |
895 } | 902 } |
896 | 903 |
897 | 904 |
898 static bool HandleClassesClosures(Isolate* isolate, const Class& cls, | 905 static bool HandleClassesClosures(Isolate* isolate, const Class& cls, |
899 JSONStream* js) { | 906 JSONStream* js) { |
900 intptr_t id; | 907 intptr_t id; |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 while (current != NULL) { | 1969 while (current != NULL) { |
1963 if (strcmp(name, current->name()) == 0) { | 1970 if (strcmp(name, current->name()) == 0) { |
1964 return current; | 1971 return current; |
1965 } | 1972 } |
1966 current = current->next(); | 1973 current = current->next(); |
1967 } | 1974 } |
1968 return NULL; | 1975 return NULL; |
1969 } | 1976 } |
1970 | 1977 |
1971 } // namespace dart | 1978 } // namespace dart |
OLD | NEW |