Chromium Code Reviews| 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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1481 result.PrintJSON(js, true); | 1481 result.PrintJSON(js, true); |
| 1482 return true; | 1482 return true; |
| 1483 } | 1483 } |
| 1484 PrintError(js, "%s: Invalid 'targetId' parameter value: " | 1484 PrintError(js, "%s: Invalid 'targetId' parameter value: " |
| 1485 "id '%s' does not correspond to a " | 1485 "id '%s' does not correspond to a " |
| 1486 "library, class, or instance", js->method(), target_id); | 1486 "library, class, or instance", js->method(), target_id); |
| 1487 return true; | 1487 return true; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 | 1490 |
| 1491 static const MethodParameter* get_call_site_data_params[] = { | |
| 1492 ISOLATE_PARAMETER, | |
| 1493 NULL, | |
|
Cutch
2015/02/12 20:38:02
Should be:
ISOLATE_PARAMETER,
new IdParameter("ta
rmacnak
2015/02/12 20:55:12
Done.
| |
| 1494 }; | |
| 1495 | |
| 1496 | |
| 1497 static bool HandleIsolateGetCallSiteData(Isolate* isolate, JSONStream* js) { | |
| 1498 const char* target_id = js->LookupParam("targetId"); | |
| 1499 Object& obj = Object::Handle(LookupHeapObject(isolate, target_id, NULL)); | |
| 1500 if (obj.raw() == Object::sentinel().raw()) { | |
| 1501 PrintInvalidParamError(js, "targetId"); | |
| 1502 return true; | |
| 1503 } | |
| 1504 if (obj.IsFunction()) { | |
| 1505 const Function& func = Function::Cast(obj); | |
| 1506 const GrowableObjectArray& ics = | |
| 1507 GrowableObjectArray::Handle(func.CollectICsWithSourcePositions()); | |
| 1508 JSONObject jsobj(js); | |
| 1509 jsobj.AddProperty("type", "CallSiteData"); | |
|
Cutch
2015/02/12 20:38:02
If this isn't guaranteed to be stable across VM ve
rmacnak
2015/02/12 20:55:12
Good idea for a first cut.
| |
| 1510 jsobj.AddProperty("function", func); | |
| 1511 JSONArray elements(&jsobj, "callSites"); | |
| 1512 Smi& line = Smi::Handle(); | |
| 1513 Smi& column = Smi::Handle(); | |
| 1514 ICData& ic_data = ICData::Handle(); | |
| 1515 for (intptr_t i = 0; i < ics.Length();) { | |
| 1516 ic_data ^= ics.At(i++); | |
| 1517 line ^= ics.At(i++); | |
| 1518 column ^= ics.At(i++); | |
| 1519 ic_data.PrintToJSONArray(&elements, line.Value(), column.Value()); | |
| 1520 } | |
| 1521 return true; | |
| 1522 } | |
| 1523 return false; | |
| 1524 } | |
| 1525 | |
| 1526 | |
| 1491 class GetInstancesVisitor : public ObjectGraph::Visitor { | 1527 class GetInstancesVisitor : public ObjectGraph::Visitor { |
| 1492 public: | 1528 public: |
| 1493 GetInstancesVisitor(const Class& cls, const Array& storage) | 1529 GetInstancesVisitor(const Class& cls, const Array& storage) |
| 1494 : cls_(cls), storage_(storage), count_(0) {} | 1530 : cls_(cls), storage_(storage), count_(0) {} |
| 1495 | 1531 |
| 1496 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { | 1532 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { |
| 1497 RawObject* raw_obj = it->Get(); | 1533 RawObject* raw_obj = it->Get(); |
| 1498 if (raw_obj->IsFreeListElement()) { | 1534 if (raw_obj->IsFreeListElement()) { |
| 1499 return kProceed; | 1535 return kProceed; |
| 1500 } | 1536 } |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2412 { "_triggerEchoEvent", HandleIsolateTriggerEchoEvent, | 2448 { "_triggerEchoEvent", HandleIsolateTriggerEchoEvent, |
| 2413 NULL }, | 2449 NULL }, |
| 2414 { "addBreakpoint", HandleIsolateAddBreakpoint, | 2450 { "addBreakpoint", HandleIsolateAddBreakpoint, |
| 2415 add_breakpoint_params }, | 2451 add_breakpoint_params }, |
| 2416 { "eval", HandleIsolateEval, | 2452 { "eval", HandleIsolateEval, |
| 2417 eval_params }, | 2453 eval_params }, |
| 2418 { "getAllocationProfile", HandleIsolateGetAllocationProfile, | 2454 { "getAllocationProfile", HandleIsolateGetAllocationProfile, |
| 2419 get_allocation_profile_params }, | 2455 get_allocation_profile_params }, |
| 2420 { "getBreakpoints", HandleIsolateGetBreakpoints, | 2456 { "getBreakpoints", HandleIsolateGetBreakpoints, |
| 2421 get_breakpoints_params }, | 2457 get_breakpoints_params }, |
| 2458 { "getCallSiteData", HandleIsolateGetCallSiteData, | |
|
Cutch
2015/02/12 20:38:02
Please add this to service.idl
rmacnak
2015/02/12 20:55:12
Done.
| |
| 2459 get_call_site_data_params }, | |
| 2422 { "getClassList", HandleIsolateGetClassList, | 2460 { "getClassList", HandleIsolateGetClassList, |
| 2423 get_class_list_params }, | 2461 get_class_list_params }, |
| 2424 { "getCoverage", HandleIsolateGetCoverage, | 2462 { "getCoverage", HandleIsolateGetCoverage, |
| 2425 get_coverage_params }, | 2463 get_coverage_params }, |
| 2426 { "getCpuProfile", HandleIsolateGetCpuProfile, | 2464 { "getCpuProfile", HandleIsolateGetCpuProfile, |
| 2427 get_cpu_profile_params }, | 2465 get_cpu_profile_params }, |
| 2428 { "getFlagList", HandleVMFlagList , | 2466 { "getFlagList", HandleVMFlagList , |
| 2429 get_flag_list_params }, | 2467 get_flag_list_params }, |
| 2430 { "getHeapMap", HandleIsolateGetHeapMap, | 2468 { "getHeapMap", HandleIsolateGetHeapMap, |
| 2431 get_heap_map_params }, | 2469 get_heap_map_params }, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2479 ServiceMethodDescriptor& method = service_methods_[i]; | 2517 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2480 if (strcmp(method_name, method.name) == 0) { | 2518 if (strcmp(method_name, method.name) == 0) { |
| 2481 return &method; | 2519 return &method; |
| 2482 } | 2520 } |
| 2483 } | 2521 } |
| 2484 return NULL; | 2522 return NULL; |
| 2485 } | 2523 } |
| 2486 | 2524 |
| 2487 | 2525 |
| 2488 } // namespace dart | 2526 } // namespace dart |
| OLD | NEW |