| 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" |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 return true; | 1059 return true; |
| 1060 } | 1060 } |
| 1061 if (js->num_arguments() == 4) { | 1061 if (js->num_arguments() == 4) { |
| 1062 type.PrintJSON(js, false); | 1062 type.PrintJSON(js, false); |
| 1063 return true; | 1063 return true; |
| 1064 } | 1064 } |
| 1065 return HandleInstanceCommands(isolate, type, js, 4); | 1065 return HandleInstanceCommands(isolate, type, js, 4); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 | 1068 |
| 1069 static bool HandleClassesRetained(Isolate* isolate, const Class& cls, |
| 1070 JSONStream* js) { |
| 1071 if (js->num_arguments() != 3) { |
| 1072 PrintError(js, "Command too long"); |
| 1073 return true; |
| 1074 } |
| 1075 ObjectGraph graph(isolate); |
| 1076 intptr_t retained_size = graph.SizeRetainedByClass(cls.id()); |
| 1077 const Object& result = Object::Handle(Integer::New(retained_size)); |
| 1078 result.PrintJSON(js, true); |
| 1079 return true; |
| 1080 } |
| 1081 |
| 1082 |
| 1069 static bool HandleClasses(Isolate* isolate, JSONStream* js) { | 1083 static bool HandleClasses(Isolate* isolate, JSONStream* js) { |
| 1070 if (js->num_arguments() == 1) { | 1084 if (js->num_arguments() == 1) { |
| 1071 ClassTable* table = isolate->class_table(); | 1085 ClassTable* table = isolate->class_table(); |
| 1072 JSONObject jsobj(js); | 1086 JSONObject jsobj(js); |
| 1073 table->PrintToJSONObject(&jsobj); | 1087 table->PrintToJSONObject(&jsobj); |
| 1074 return true; | 1088 return true; |
| 1075 } | 1089 } |
| 1076 ASSERT(js->num_arguments() >= 2); | 1090 ASSERT(js->num_arguments() >= 2); |
| 1077 intptr_t id; | 1091 intptr_t id; |
| 1078 if (!GetIntegerId(js->GetArgument(1), &id)) { | 1092 if (!GetIntegerId(js->GetArgument(1), &id)) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1097 } else if (strcmp(second, "fields") == 0) { | 1111 } else if (strcmp(second, "fields") == 0) { |
| 1098 return HandleClassesFields(isolate, cls, js); | 1112 return HandleClassesFields(isolate, cls, js); |
| 1099 } else if (strcmp(second, "functions") == 0) { | 1113 } else if (strcmp(second, "functions") == 0) { |
| 1100 return HandleClassesFunctions(isolate, cls, js); | 1114 return HandleClassesFunctions(isolate, cls, js); |
| 1101 } else if (strcmp(second, "implicit_closures") == 0) { | 1115 } else if (strcmp(second, "implicit_closures") == 0) { |
| 1102 return HandleClassesImplicitClosures(isolate, cls, js); | 1116 return HandleClassesImplicitClosures(isolate, cls, js); |
| 1103 } else if (strcmp(second, "dispatchers") == 0) { | 1117 } else if (strcmp(second, "dispatchers") == 0) { |
| 1104 return HandleClassesDispatchers(isolate, cls, js); | 1118 return HandleClassesDispatchers(isolate, cls, js); |
| 1105 } else if (!strcmp(second, "types")) { | 1119 } else if (!strcmp(second, "types")) { |
| 1106 return HandleClassesTypes(isolate, cls, js); | 1120 return HandleClassesTypes(isolate, cls, js); |
| 1121 } else if (!strcmp(second, "retained")) { |
| 1122 return HandleClassesRetained(isolate, cls, js); |
| 1107 } else { | 1123 } else { |
| 1108 PrintError(js, "Invalid sub collection %s", second); | 1124 PrintError(js, "Invalid sub collection %s", second); |
| 1109 return true; | 1125 return true; |
| 1110 } | 1126 } |
| 1111 } | 1127 } |
| 1112 UNREACHABLE(); | 1128 UNREACHABLE(); |
| 1113 return true; | 1129 return true; |
| 1114 } | 1130 } |
| 1115 | 1131 |
| 1116 | 1132 |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 while (current != NULL) { | 1985 while (current != NULL) { |
| 1970 if (strcmp(name, current->name()) == 0) { | 1986 if (strcmp(name, current->name()) == 0) { |
| 1971 return current; | 1987 return current; |
| 1972 } | 1988 } |
| 1973 current = current->next(); | 1989 current = current->next(); |
| 1974 } | 1990 } |
| 1975 return NULL; | 1991 return NULL; |
| 1976 } | 1992 } |
| 1977 | 1993 |
| 1978 } // namespace dart | 1994 } // namespace dart |
| OLD | NEW |