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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 183513015: Move StackOverflow check after context chaining at function entry so that the context is properly s… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 | « no previous file | no next file » | 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 33310)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -3491,6 +3491,22 @@
}
}
+ // This check may be deleted if the generated code is leaf.
+ // Native functions don't need a stack check at entry.
+ const Function& function = owner()->parsed_function()->function();
+ if ((node == owner()->parsed_function()->node_sequence()) &&
+ !function.is_native()) {
+ // Always allocate CheckOverflowInstr so that deopt-ids match regardless
+ // if we inline or not.
+ CheckStackOverflowInstr* check =
+ new CheckStackOverflowInstr(function.token_pos(), 0);
+ // If we are inlining don't actually attach the stack check. We must still
+ // create the stack check in order to allocate a deopt id.
+ if (!owner()->IsInlining()) {
+ AddInstruction(check);
+ }
+ }
+
if (FLAG_enable_type_checks &&
(node == owner()->parsed_function()->node_sequence())) {
const Function& function = owner()->parsed_function()->function();
@@ -3866,23 +3882,11 @@
if (FLAG_print_scopes) {
AstPrinter::PrintFunctionScope(*parsed_function());
}
- const Function& function = parsed_function()->function();
TargetEntryInstr* normal_entry =
new TargetEntryInstr(AllocateBlockId(),
CatchClauseNode::kInvalidTryIndex);
graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
EffectGraphVisitor for_effect(this);
- // This check may be deleted if the generated code is leaf.
- // Native functions don't need a stack check at entry.
- if (!function.is_native()) {
- CheckStackOverflowInstr* check =
- new CheckStackOverflowInstr(function.token_pos(), 0);
- // If we are inlining don't actually attach the stack check. We must still
- // create the stack check in order to allocate a deopt id.
- if (!IsInlining()) {
- for_effect.AddInstruction(check);
- }
- }
parsed_function()->node_sequence()->Visit(&for_effect);
AppendFragment(normal_entry, for_effect);
// Check that the graph is properly terminated.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698