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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10704119: Use the instruction iterator rather than an explicit loop in more places. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 29adc4e956f1f7859a885cdd719a29c8ec535a38..a02a048f50c3c75d750092c4c44fcd1c185e0c58 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -24,17 +24,6 @@ void FlowGraphOptimizer::ApplyICData() {
}
-void FlowGraphOptimizer::VisitBlocks() {
- for (intptr_t i = 0; i < block_order_.length(); ++i) {
- Instruction* instr = block_order_[i]->Accept(this);
- // Optimize all successors until an exit, branch, or a block entry.
- while ((instr != NULL) && !instr->IsBlockEntry()) {
- instr = instr->Accept(this);
- }
- }
-}
-
-
static bool ICDataHasReceiverClassId(const ICData& ic_data, intptr_t class_id) {
ASSERT(ic_data.num_args_tested() > 0);
for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
@@ -621,25 +610,16 @@ void FlowGraphOptimizer::VisitBind(BindInstr* instr) {
-FlowGraphAnalyzer::FlowGraphAnalyzer(
- const GrowableArray<BlockEntryInstr*>& blocks)
- :blocks_(blocks), is_leaf_(false) {}
-
-
void FlowGraphAnalyzer::Analyze() {
is_leaf_ = true;
for (intptr_t i = 0; i < blocks_.length(); ++i) {
- BlockEntryInstr* block_entry = blocks_[i];
- Instruction* instr = block_entry->next();
- while ((instr != NULL) && !instr->IsBlockEntry()) {
- LocationSummary* locs = instr->locs();
- if (locs != NULL) {
- if (locs->is_call()) {
- is_leaf_ = false;
- return;
- }
+ BlockEntryInstr* entry = blocks_[i];
+ for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
+ LocationSummary* locs = it.Current()->locs();
+ if ((locs != NULL) && locs->is_call()) {
+ is_leaf_ = false;
+ return;
}
- instr = instr->next();
}
}
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698