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 | 8 |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/coverage.h" | 10 #include "vm/coverage.h" |
11 #include "vm/cpu.h" | 11 #include "vm/cpu.h" |
12 #include "vm/dart_api_impl.h" | 12 #include "vm/dart_api_impl.h" |
13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
14 #include "vm/debugger.h" | 14 #include "vm/debugger.h" |
15 #include "vm/heap_histogram.h" | |
16 #include "vm/isolate.h" | 15 #include "vm/isolate.h" |
17 #include "vm/message.h" | 16 #include "vm/message.h" |
18 #include "vm/native_entry.h" | 17 #include "vm/native_entry.h" |
19 #include "vm/native_arguments.h" | 18 #include "vm/native_arguments.h" |
20 #include "vm/object.h" | 19 #include "vm/object.h" |
21 #include "vm/object_id_ring.h" | 20 #include "vm/object_id_ring.h" |
22 #include "vm/object_store.h" | 21 #include "vm/object_store.h" |
23 #include "vm/port.h" | 22 #include "vm/port.h" |
24 #include "vm/profiler.h" | 23 #include "vm/profiler.h" |
25 #include "vm/stack_frame.h" | 24 #include "vm/stack_frame.h" |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 JSONObject jsobj(&jsarr); | 611 JSONObject jsobj(&jsarr); |
613 frame->PrintToJSONObject(&jsobj); | 612 frame->PrintToJSONObject(&jsobj); |
614 // TODO(turnidge): Implement depth differently -- differentiate | 613 // TODO(turnidge): Implement depth differently -- differentiate |
615 // inlined frames. | 614 // inlined frames. |
616 jsobj.AddProperty("depth", i); | 615 jsobj.AddProperty("depth", i); |
617 } | 616 } |
618 return true; | 617 return true; |
619 } | 618 } |
620 | 619 |
621 | 620 |
622 static bool HandleObjectHistogram(Isolate* isolate, JSONStream* js) { | |
623 ObjectHistogram* histogram = Isolate::Current()->object_histogram(); | |
624 if (histogram == NULL) { | |
625 JSONObject jsobj(js); | |
626 jsobj.AddProperty("type", "Error"); | |
627 jsobj.AddProperty("text", "Run with --print_object_histogram"); | |
628 return true; | |
629 } | |
630 histogram->PrintToJSONStream(js); | |
631 return true; | |
632 } | |
633 | |
634 | |
635 static bool HandleIsolateEcho(Isolate* isolate, JSONStream* js) { | 621 static bool HandleIsolateEcho(Isolate* isolate, JSONStream* js) { |
636 JSONObject jsobj(js); | 622 JSONObject jsobj(js); |
637 jsobj.AddProperty("type", "message"); | 623 jsobj.AddProperty("type", "message"); |
638 PrintArgumentsAndOptions(jsobj, js); | 624 PrintArgumentsAndOptions(jsobj, js); |
639 return true; | 625 return true; |
640 } | 626 } |
641 | 627 |
642 | 628 |
643 // Print an error message if there is no ID argument. | 629 // Print an error message if there is no ID argument. |
644 #define REQUIRE_COLLECTION_ID(collection) \ | 630 #define REQUIRE_COLLECTION_ID(collection) \ |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 static IsolateMessageHandlerEntry isolate_handlers[] = { | 1133 static IsolateMessageHandlerEntry isolate_handlers[] = { |
1148 { "_echo", HandleIsolateEcho }, | 1134 { "_echo", HandleIsolateEcho }, |
1149 { "", HandleIsolate }, | 1135 { "", HandleIsolate }, |
1150 { "allocationprofile", HandleAllocationProfile }, | 1136 { "allocationprofile", HandleAllocationProfile }, |
1151 { "classes", HandleClasses }, | 1137 { "classes", HandleClasses }, |
1152 { "code", HandleCode }, | 1138 { "code", HandleCode }, |
1153 { "coverage", HandleCoverage }, | 1139 { "coverage", HandleCoverage }, |
1154 { "cpu", HandleCpu }, | 1140 { "cpu", HandleCpu }, |
1155 { "debug", HandleDebug }, | 1141 { "debug", HandleDebug }, |
1156 { "libraries", HandleLibraries }, | 1142 { "libraries", HandleLibraries }, |
1157 { "objecthistogram", HandleObjectHistogram}, | |
1158 { "objects", HandleObjects }, | 1143 { "objects", HandleObjects }, |
1159 { "profile", HandleProfile }, | 1144 { "profile", HandleProfile }, |
1160 { "unpin", HandleUnpin }, | 1145 { "unpin", HandleUnpin }, |
1161 { "scripts", HandleScripts }, | 1146 { "scripts", HandleScripts }, |
1162 { "stacktrace", HandleStackTrace }, | 1147 { "stacktrace", HandleStackTrace }, |
1163 }; | 1148 }; |
1164 | 1149 |
1165 | 1150 |
1166 static IsolateMessageHandler FindIsolateMessageHandler(const char* command) { | 1151 static IsolateMessageHandler FindIsolateMessageHandler(const char* command) { |
1167 intptr_t num_message_handlers = sizeof(isolate_handlers) / | 1152 intptr_t num_message_handlers = sizeof(isolate_handlers) / |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 while (current != NULL) { | 1357 while (current != NULL) { |
1373 if (strcmp(name, current->name()) == 0) { | 1358 if (strcmp(name, current->name()) == 0) { |
1374 return current; | 1359 return current; |
1375 } | 1360 } |
1376 current = current->next(); | 1361 current = current->next(); |
1377 } | 1362 } |
1378 return NULL; | 1363 return NULL; |
1379 } | 1364 } |
1380 | 1365 |
1381 } // namespace dart | 1366 } // namespace dart |
OLD | NEW |