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

Unified Diff: runtime/vm/flow_graph_builder.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/coverage.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 28280)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -2051,12 +2051,30 @@
// The context scope may have already been set by the non-optimizing
// compiler. If it was not, set it here.
if (function.context_scope() == ContextScope::null()) {
- // TODO(regis): Why are we not doing this in the parser?
const ContextScope& context_scope = ContextScope::ZoneHandle(
node->scope()->PreserveOuterScope(owner()->context_level()));
ASSERT(!function.HasCode());
ASSERT(function.context_scope() == ContextScope::null());
function.set_context_scope(context_scope);
+ const Class& cls = Class::Handle(
+ owner()->parsed_function()->function().Owner());
+ // The closure is now properly setup, add it to the lookup table.
+#if DEBUG
+ const Function& found_func = Function::Handle(
+ cls.LookupClosureFunction(function.token_pos()));
+ ASSERT(found_func.IsNull() ||
+ (found_func.token_pos() != function.token_pos()) ||
+ // TODO(hausner): The following check should not be necessary.
+ // Since we only lookup based on the token_pos we can get
+ // duplicate entries due to closurized and non-closurized parent
+ // functions (see Parser::ParseFunctionStatement).
+ // We need two ways to lookup in this cache: One way to cache the
+ // appropriate closure function and one way to find the functions
+ // while debugging (we might need to set breakpoints in multiple
+ // different function for a single token index.)
+ (found_func.parent_function() != function.parent_function()));
+#endif // DEBUG
+ cls.AddClosureFunction(function);
}
ZoneGrowableArray<PushArgumentInstr*>* arguments =
new ZoneGrowableArray<PushArgumentInstr*>(2);
« no previous file with comments | « runtime/vm/coverage.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698