Chromium Code Reviews| Index: runtime/vm/service.cc |
| diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
| index 4878a6e6f5efaf7eded9e13b67d08fb2b9093a87..1cf0420921c90c26d57ecc895c221c762c13354e 100644 |
| --- a/runtime/vm/service.cc |
| +++ b/runtime/vm/service.cc |
| @@ -1555,41 +1555,6 @@ static bool EvalFrame(Isolate* isolate, JSONStream* js) { |
| } |
| -static const MethodParameter* get_call_site_data_params[] = { |
| - ISOLATE_PARAMETER, |
| - new IdParameter("targetId", true), |
| - NULL, |
| -}; |
| - |
| - |
| -static bool GetCallSiteData(Isolate* isolate, JSONStream* js) { |
| - const char* target_id = js->LookupParam("targetId"); |
| - Object& obj = Object::Handle(LookupHeapObject(isolate, target_id, NULL)); |
| - if (obj.raw() == Object::sentinel().raw()) { |
| - PrintInvalidParamError(js, "targetId"); |
| - return true; |
| - } |
| - if (obj.IsFunction()) { |
| - const Function& func = Function::Cast(obj); |
| - const GrowableObjectArray& ics = |
| - GrowableObjectArray::Handle(func.CollectICsWithSourcePositions()); |
| - JSONObject jsobj(js); |
| - jsobj.AddProperty("type", "_CallSiteData"); |
| - jsobj.AddProperty("function", func); |
| - JSONArray elements(&jsobj, "callSites"); |
| - ICData& ic_data = ICData::Handle(); |
| - Smi& token_pos = Smi::Handle(); |
| - for (intptr_t i = 0; i < ics.Length();) { |
| - ic_data ^= ics.At(i++); |
| - token_pos ^= ics.At(i++); |
| - ic_data.PrintToJSONArray(&elements, token_pos.Value()); |
| - } |
| - return true; |
| - } |
| - return false; |
| -} |
| - |
| - |
| class GetInstancesVisitor : public ObjectGraph::Visitor { |
| public: |
| GetInstancesVisitor(const Class& cls, const Array& storage) |
| @@ -1731,15 +1696,9 @@ class FunctionCoverageFilter : public CoverageFilter { |
| }; |
| -static const MethodParameter* get_coverage_params[] = { |
| - ISOLATE_PARAMETER, |
| - NULL, |
| -}; |
| - |
| - |
| -static bool GetCoverage(Isolate* isolate, JSONStream* js) { |
| +static bool GetHitsOrSites(Isolate* isolate, JSONStream* js, bool as_sites) { |
| if (!js->HasParam("targetId")) { |
| - CodeCoverage::PrintJSON(isolate, js, NULL); |
| + CodeCoverage::PrintJSON(isolate, js, NULL, as_sites); |
| return true; |
| } |
| const char* target_id = js->LookupParam("targetId"); |
| @@ -1750,22 +1709,22 @@ static bool GetCoverage(Isolate* isolate, JSONStream* js) { |
| } |
| if (obj.IsScript()) { |
| ScriptCoverageFilter sf(Script::Cast(obj)); |
| - CodeCoverage::PrintJSON(isolate, js, &sf); |
| + CodeCoverage::PrintJSON(isolate, js, &sf, as_sites); |
| return true; |
| } |
| if (obj.IsLibrary()) { |
| LibraryCoverageFilter lf(Library::Cast(obj)); |
| - CodeCoverage::PrintJSON(isolate, js, &lf); |
| + CodeCoverage::PrintJSON(isolate, js, &lf, as_sites); |
| return true; |
| } |
| if (obj.IsClass()) { |
| ClassCoverageFilter cf(Class::Cast(obj)); |
| - CodeCoverage::PrintJSON(isolate, js, &cf); |
| + CodeCoverage::PrintJSON(isolate, js, &cf, as_sites); |
| return true; |
| } |
| if (obj.IsFunction()) { |
| FunctionCoverageFilter ff(Function::Cast(obj)); |
| - CodeCoverage::PrintJSON(isolate, js, &ff); |
| + CodeCoverage::PrintJSON(isolate, js, &ff, as_sites); |
| return true; |
| } |
| PrintError(js, "%s: Invalid 'targetId' parameter value: " |
| @@ -1775,6 +1734,29 @@ static bool GetCoverage(Isolate* isolate, JSONStream* js) { |
| } |
| +static const MethodParameter* get_coverage_params[] = { |
| + ISOLATE_PARAMETER, |
| + NULL, |
| +}; |
| + |
| + |
| +static bool GetCoverage(Isolate* isolate, JSONStream* js) { |
|
Cutch
2015/03/18 19:53:52
Add a TODO here to remove this.
rmacnak
2015/03/18 20:06:47
Done.
|
| + return GetHitsOrSites(isolate, js, false); |
| +} |
| + |
| + |
| +static const MethodParameter* get_call_site_data_params[] = { |
| + ISOLATE_PARAMETER, |
| + new IdParameter("targetId", true), |
| + NULL, |
| +}; |
| + |
| + |
| +static bool GetCallSiteData(Isolate* isolate, JSONStream* js) { |
| + return GetHitsOrSites(isolate, js, true); |
| +} |
| + |
| + |
| static const MethodParameter* add_breakpoint_params[] = { |
| ISOLATE_PARAMETER, |
| new IdParameter("scriptId", true), |