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

Unified Diff: runtime/vm/coverage.cc

Issue 1436243005: Collect closure functions in isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
Index: runtime/vm/coverage.cc
diff --git a/runtime/vm/coverage.cc b/runtime/vm/coverage.cc
index 9c38d8b4db214a43942cd862f9cc447896dbc3bd..8fede5858b11ee2cc3a40efc1c8ecef18e299105 100644
--- a/runtime/vm/coverage.cc
+++ b/runtime/vm/coverage.cc
@@ -191,41 +191,43 @@ void CodeCoverage::PrintClass(const Library& lib,
}
}
- GrowableObjectArray& closures =
- GrowableObjectArray::Handle(cls.closures());
- if (!closures.IsNull()) {
- i = 0;
- pos_to_line.Clear();
- // We need to keep rechecking the length of the closures array, as handling
- // a closure potentially adds new entries to the end.
+ const GrowableObjectArray& closures = GrowableObjectArray::Handle(
+ thread->isolate()->object_store()->closure_functions());
+ pos_to_line.Clear();
+ // We need to keep rechecking the length of the closures array, as handling
+ // a closure potentially adds new entries to the end.
+ i = 0;
+ while (i < closures.Length()) {
+ HANDLESCOPE(thread);
+ function ^= closures.At(i);
+ if (function.Owner() != cls.raw()) {
+ i++;
+ continue;
+ }
+ script = function.script();
+ saved_url = script.url();
+ if (!filter->ShouldOutputCoverageFor(lib, script, cls, function)) {
+ i++;
+ continue;
+ }
+ ComputeTokenPosToLineNumberMap(script, &pos_to_line);
+ JSONObject jsobj(&jsarr);
+ jsobj.AddProperty("source", saved_url.ToCString());
+ jsobj.AddProperty("script", script);
+ JSONArray hits_or_sites(&jsobj, as_call_sites ? "callSites" : "hits");
+
+ // We stay within this loop while we are seeing functions from the same
+ // source URI.
while (i < closures.Length()) {
- HANDLESCOPE(thread);
function ^= closures.At(i);
script = function.script();
- saved_url = script.url();
- if (!filter->ShouldOutputCoverageFor(lib, script, cls, function)) {
- i++;
- continue;
- }
- ComputeTokenPosToLineNumberMap(script, &pos_to_line);
- JSONObject jsobj(&jsarr);
- jsobj.AddProperty("source", saved_url.ToCString());
- jsobj.AddProperty("script", script);
- JSONArray hits_or_sites(&jsobj, as_call_sites ? "callSites" : "hits");
-
- // We stay within this loop while we are seeing functions from the same
- // source URI.
- while (i < closures.Length()) {
- function ^= closures.At(i);
- script = function.script();
- url = script.url();
- if (!url.Equals(saved_url)) {
- pos_to_line.Clear();
- break;
- }
- CompileAndAdd(function, hits_or_sites, pos_to_line, as_call_sites);
- i++;
+ url = script.url();
+ if (!url.Equals(saved_url)) {
+ pos_to_line.Clear();
+ break;
}
+ CompileAndAdd(function, hits_or_sites, pos_to_line, as_call_sites);
+ i++;
}
}
}
« no previous file with comments | « runtime/vm/compiler_stats.cc ('k') | runtime/vm/debugger.cc » ('j') | runtime/vm/debugger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698