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

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
Index: runtime/vm/coverage.cc
===================================================================
--- runtime/vm/coverage.cc (revision 28180)
+++ runtime/vm/coverage.cc (working copy)
@@ -21,9 +21,24 @@
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.
hausner 2013/10/04 16:06:23 Or the enclosing function failed to compile.
Ivan Posva 2013/10/04 20:50:02 Done.
+ 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());

Powered by Google App Engine
This is Rietveld 408576698