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

Unified Diff: runtime/vm/coverage.cc

Issue 25954003: - Harden coverage generation, by not attempting to compile (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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/compiler.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/coverage.cc
===================================================================
--- runtime/vm/coverage.cc (revision 28280)
+++ runtime/vm/coverage.cc (working copy)
@@ -21,9 +21,25 @@
void CodeCoverage::CompileAndAdd(const Function& function,
const JSONArray& hits_arr) {
if (!function.HasCode()) {
- if (Compiler::CompileFunction(function) != Error::null()) {
+ // If the function should not be compiled or if the compilation failed,
+ // then just skip this method.
+ // TODO(iposva): Maybe we should skip synthesized methods in general too.
+ if (function.is_abstract() || function.IsRedirectingFactory()) {
return;
}
+ if (function.IsNonImplicitClosureFunction() &&
+ (function.context_scope() == ContextScope::null())) {
+ // TODO(iposva): This can arise if we attempt to compile an inner function
+ // before we have compiled its enclosing function or if the enclosing
+ // function failed to compile.
+ OS::Print("### Coverage skipped compiling: %s\n", function.ToCString());
+ return;
+ }
+ const Error& err = Error::Handle(Compiler::CompileFunction(function));
+ if (!err.IsNull()) {
+ OS::Print("### Coverage failed compiling:\n%s\n", err.ToErrorCString());
+ return;
+ }
}
ASSERT(function.HasCode());
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698