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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1288593002: dart2js: add function coverage tracking in dart2js output, dumpinfo, and (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index bdd1cc3a191627127c1f758e0476e1f6ecff0083..a6aff4b0a211d913c0acaf45959430b43f7e2e66 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1451,7 +1451,15 @@ class JavaScriptBackend extends Backend {
}
}
- generatedCode[element] = functionCompiler.compile(work);
+ jsAst.Fun code = functionCompiler.compile(work);
+ if (const bool.fromEnvironment('instrumentForCoverage')
+ && compiler.dumpInfo) {
+ // TODO(sigmund): do this properly (e.g. add an embedded global, etc).
+ code.body.statements.insert(0, js.statement(
+ '__record_use("${element.hashCode}", "${element.name}")'));
+ }
+
+ generatedCode[element] = code;
return const WorldImpact();
}

Powered by Google App Engine
This is Rietveld 408576698