Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1882)

Unified Diff: runtime/vm/service.cc

Issue 1000933004: Display ICData entries at call sites, with links to the targets and guarded classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 4878a6e6f5efaf7eded9e13b67d08fb2b9093a87..baa4cf80748236cc48b153f6d4c68e78da2c2a3f 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,30 @@ static bool GetCoverage(Isolate* isolate, JSONStream* js) {
}
+static const MethodParameter* get_coverage_params[] = {
+ ISOLATE_PARAMETER,
+ NULL,
+};
+
+
+static bool GetCoverage(Isolate* isolate, JSONStream* js) {
+ // TODO(rmacnak): Remove this response; it is subsumed by GetCallSiteData.
+ 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),
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698