| 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 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 | 2431 |
| 2432 static const MethodParameter* get_vm_params[] = { | 2432 static const MethodParameter* get_vm_params[] = { |
| 2433 NO_ISOLATE_PARAMETER, | 2433 NO_ISOLATE_PARAMETER, |
| 2434 NULL, | 2434 NULL, |
| 2435 }; | 2435 }; |
| 2436 | 2436 |
| 2437 | 2437 |
| 2438 static bool GetVM(Isolate* isolate, JSONStream* js) { | 2438 static bool GetVM(Isolate* isolate, JSONStream* js) { |
| 2439 JSONObject jsobj(js); | 2439 JSONObject jsobj(js); |
| 2440 jsobj.AddProperty("type", "VM"); | 2440 jsobj.AddProperty("type", "VM"); |
| 2441 jsobj.AddProperty("id", "vm"); | |
| 2442 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); | 2441 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); |
| 2443 jsobj.AddProperty("targetCPU", CPU::Id()); | 2442 jsobj.AddProperty("targetCPU", CPU::Id()); |
| 2444 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 2443 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
| 2445 jsobj.AddProperty("version", Version::String()); | 2444 jsobj.AddProperty("version", Version::String()); |
| 2446 // Send pid as a string because it allows us to avoid any issues with | 2445 // Send pid as a string because it allows us to avoid any issues with |
| 2447 // pids > 53-bits (when consumed by JavaScript). | 2446 // pids > 53-bits (when consumed by JavaScript). |
| 2448 // TODO(johnmccutchan): Codify how integers are sent across the service. | 2447 // TODO(johnmccutchan): Codify how integers are sent across the service. |
| 2449 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); | 2448 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); |
| 2450 jsobj.AddProperty("assertsEnabled", isolate->AssertsEnabled()); | 2449 jsobj.AddProperty("_assertsEnabled", isolate->AssertsEnabled()); |
| 2451 jsobj.AddProperty("typeChecksEnabled", isolate->TypeChecksEnabled()); | 2450 jsobj.AddProperty("_typeChecksEnabled", isolate->TypeChecksEnabled()); |
| 2452 int64_t start_time_millis = (Dart::vm_isolate()->start_time() / | 2451 int64_t start_time_millis = (Dart::vm_isolate()->start_time() / |
| 2453 kMicrosecondsPerMillisecond); | 2452 kMicrosecondsPerMillisecond); |
| 2454 jsobj.AddProperty64("refreshTime", OS::GetCurrentTimeMillis()); | |
| 2455 jsobj.AddProperty64("startTime", start_time_millis); | 2453 jsobj.AddProperty64("startTime", start_time_millis); |
| 2456 // Construct the isolate list. | 2454 // Construct the isolate list. |
| 2457 { | 2455 { |
| 2458 JSONArray jsarr(&jsobj, "isolates"); | 2456 JSONArray jsarr(&jsobj, "isolates"); |
| 2459 ServiceIsolateVisitor visitor(&jsarr); | 2457 ServiceIsolateVisitor visitor(&jsarr); |
| 2460 Isolate::VisitIsolates(&visitor); | 2458 Isolate::VisitIsolates(&visitor); |
| 2461 } | 2459 } |
| 2462 return true; | 2460 return true; |
| 2463 } | 2461 } |
| 2464 | 2462 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 { "addBreakpointAtEntry", AddBreakpointAtEntry, | 2538 { "addBreakpointAtEntry", AddBreakpointAtEntry, |
| 2541 add_breakpoint_at_entry_params }, | 2539 add_breakpoint_at_entry_params }, |
| 2542 { "clearCpuProfile", ClearCpuProfile, | 2540 { "clearCpuProfile", ClearCpuProfile, |
| 2543 clear_cpu_profile_params }, | 2541 clear_cpu_profile_params }, |
| 2544 { "eval", Eval, | 2542 { "eval", Eval, |
| 2545 eval_params }, | 2543 eval_params }, |
| 2546 { "evalFrame", EvalFrame, | 2544 { "evalFrame", EvalFrame, |
| 2547 eval_frame_params }, | 2545 eval_frame_params }, |
| 2548 { "getAllocationProfile", GetAllocationProfile, | 2546 { "getAllocationProfile", GetAllocationProfile, |
| 2549 get_allocation_profile_params }, | 2547 get_allocation_profile_params }, |
| 2550 { "getCallSiteData", GetCallSiteData, | 2548 { "_getCallSiteData", GetCallSiteData, |
| 2551 get_call_site_data_params }, | 2549 get_call_site_data_params }, |
| 2552 { "getClassList", GetClassList, | 2550 { "getClassList", GetClassList, |
| 2553 get_class_list_params }, | 2551 get_class_list_params }, |
| 2554 { "getCoverage", GetCoverage, | 2552 { "getCoverage", GetCoverage, |
| 2555 get_coverage_params }, | 2553 get_coverage_params }, |
| 2556 { "getCpuProfile", GetCpuProfile, | 2554 { "getCpuProfile", GetCpuProfile, |
| 2557 get_cpu_profile_params }, | 2555 get_cpu_profile_params }, |
| 2558 { "getFlagList", GetFlagList , | 2556 { "getFlagList", GetFlagList , |
| 2559 get_flag_list_params }, | 2557 get_flag_list_params }, |
| 2560 { "getHeapMap", GetHeapMap, | 2558 { "getHeapMap", GetHeapMap, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 ServiceMethodDescriptor& method = service_methods_[i]; | 2609 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2612 if (strcmp(method_name, method.name) == 0) { | 2610 if (strcmp(method_name, method.name) == 0) { |
| 2613 return &method; | 2611 return &method; |
| 2614 } | 2612 } |
| 2615 } | 2613 } |
| 2616 return NULL; | 2614 return NULL; |
| 2617 } | 2615 } |
| 2618 | 2616 |
| 2619 | 2617 |
| 2620 } // namespace dart | 2618 } // namespace dart |
| OLD | NEW |