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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 14308009: Detect leaf optimized methods and skip stack check overflow test in those, unless it is in a loop (… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
===================================================================
--- runtime/vm/flow_graph_compiler.cc (revision 21683)
+++ runtime/vm/flow_graph_compiler.cc (working copy)
@@ -129,6 +129,7 @@
bool is_optimizing)
: assembler_(assembler),
parsed_function_(flow_graph.parsed_function()),
+ flow_graph_(flow_graph),
block_order_(flow_graph.reverse_postorder()),
current_block_(NULL),
exception_handlers_list_(NULL),
@@ -160,6 +161,8 @@
pc_descriptors_list_ = new DescriptorList(64);
exception_handlers_list_ = new ExceptionHandlerList();
block_info_.Clear();
+ bool is_leaf = !parsed_function().function().IsClosureFunction() &&
+ is_optimizing();
for (int i = 0; i < block_order_.length(); ++i) {
block_info_.Add(new BlockInfo());
if (is_optimizing()) {
@@ -185,9 +188,24 @@
may_reoptimize_ = true;
break;
}
+ if (is_leaf && !current->IsCheckStackOverflow()) {
+ // Note that we do no care if the code contains instructions that
+ // can deoptimize.
+ LocationSummary* locs = current->locs();
+ if ((locs != NULL) && locs->can_call()) {
+ is_leaf = false;
+ }
+ }
}
}
}
+ if (is_leaf) {
+ // Remove check stack overflow at entry.
+ CheckStackOverflowInstr* check = flow_graph_.graph_entry()->normal_entry()
+ ->next()->AsCheckStackOverflow();
+ ASSERT(check != NULL);
+ check->RemoveFromGraph();
+ }
}
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698