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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 11783066: Optimize function at its entry instead of at exit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/code_patcher_x64.cc ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('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 16874)
+++ runtime/vm/flow_graph_compiler.cc (working copy)
@@ -178,6 +178,31 @@
block_info_.Clear();
for (int i = 0; i < block_order_.length(); ++i) {
block_info_.Add(new BlockInfo());
+ if (is_optimizing()) {
+ BlockEntryInstr* entry = block_order_[i];
+ for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
+ Instruction* current = it.Current();
+ const ICData* ic_data = NULL;
+ if (current->IsBranch()) {
+ current = current->AsBranch()->comparison();
+ }
+ // In optimized code, ICData is always set in the instructions.
+ if (current->IsInstanceCall()) {
+ ic_data = current->AsInstanceCall()->ic_data();
+ ASSERT(ic_data != NULL);
+ } else if (current->IsRelationalOp()) {
+ ic_data = current->AsRelationalOp()->ic_data();
+ ASSERT(ic_data != NULL);
+ } else if (current->IsEqualityCompare()) {
+ ic_data = current->AsEqualityCompare()->ic_data();
+ ASSERT(ic_data != NULL);
+ }
+ if ((ic_data != NULL) && (ic_data->NumberOfChecks() == 0)) {
+ may_reoptimize_ = true;
+ break;
+ }
+ }
+ }
}
}
@@ -516,7 +541,7 @@
}
// Emit IC call that will count and thus may need reoptimization at
// return instruction.
- may_reoptimize_ = true;
+ ASSERT(!is_optimizing() || may_reoptimize());
switch (ic_data.num_args_tested()) {
case 1:
label_address = StubCode::OneArgOptimizedCheckInlineCacheEntryPoint();
« no previous file with comments | « runtime/vm/code_patcher_x64.cc ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698