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

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 10809047: Cleanups. (Closed) Base URL: http://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_allocator.h ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_allocator.cc
===================================================================
--- runtime/vm/flow_graph_allocator.cc (revision 9794)
+++ runtime/vm/flow_graph_allocator.cc (working copy)
@@ -121,15 +121,15 @@
// Update initial live_in sets to match live_out sets. Has to be
// done in a separate path because of backwards branches.
for (intptr_t i = 0; i < block_count; i++) {
- UpdateLiveIn(postorder_[i]);
+ UpdateLiveIn(*postorder_[i]);
}
}
-bool FlowGraphAllocator::UpdateLiveOut(BlockEntryInstr* instr) {
- BitVector* live_out = live_out_[instr->postorder_number()];
+bool FlowGraphAllocator::UpdateLiveOut(const BlockEntryInstr& instr) {
+ BitVector* live_out = live_out_[instr.postorder_number()];
bool changed = false;
- Instruction* last = instr->last_instruction();
+ Instruction* last = instr.last_instruction();
ASSERT(last != NULL);
for (intptr_t i = 0; i < last->SuccessorCount(); i++) {
BlockEntryInstr* succ = last->SuccessorAt(i);
@@ -142,10 +142,10 @@
}
-bool FlowGraphAllocator::UpdateLiveIn(BlockEntryInstr* instr) {
- BitVector* live_out = live_out_[instr->postorder_number()];
- BitVector* kill = kill_[instr->postorder_number()];
- BitVector* live_in = live_in_[instr->postorder_number()];
+bool FlowGraphAllocator::UpdateLiveIn(const BlockEntryInstr& instr) {
+ BitVector* live_out = live_out_[instr.postorder_number()];
+ BitVector* kill = kill_[instr.postorder_number()];
+ BitVector* live_in = live_in_[instr.postorder_number()];
return live_in->KillAndAdd(kill, live_out);
}
@@ -157,7 +157,7 @@
changed = false;
for (intptr_t i = 0; i < block_count; i++) {
- BlockEntryInstr* block = postorder_[i];
+ const BlockEntryInstr& block = *postorder_[i];
// Live-in set depends only on kill set which does not
// change in this loop and live-out set. If live-out
@@ -411,11 +411,8 @@
// the join.
// TODO(kmillikin): record the predecessor index in the goto when
// building the predecessor list to avoid this search.
- intptr_t pred_idx = 0;
- for (; pred_idx < join->PredecessorCount(); pred_idx++) {
- if (join->PredecessorAt(pred_idx) == block) break;
- }
- ASSERT(pred_idx < join->PredecessorCount());
+ intptr_t pred_idx = join->IndexOfPredecessor(block);
+ ASSERT(pred_idx >= 0);
// Record the corresponding phi input use for each phi.
ZoneGrowableArray<PhiInstr*>* phis = join->phis();
@@ -864,8 +861,9 @@
}
-static inline bool ShouldBeAllocatedBefore(UseInterval* a, UseInterval* b) {
- return a->start() <= b->start();
+static inline bool ShouldBeAllocatedBefore(const UseInterval& a,
+ const UseInterval& b) {
+ return a.start() <= b.start();
}
@@ -876,7 +874,7 @@
}
for (intptr_t i = unallocated_.length() - 1; i >= 0; i--) {
- if (ShouldBeAllocatedBefore(chain, unallocated_[i])) {
+ if (ShouldBeAllocatedBefore(*chain, *unallocated_[i])) {
unallocated_.InsertAt(i + 1, chain);
return;
}
@@ -889,7 +887,7 @@
for (intptr_t i = unallocated_.length() - 1; i >= 1; i--) {
UseInterval* a = unallocated_[i];
UseInterval* b = unallocated_[i - 1];
- if (!ShouldBeAllocatedBefore(a, b)) return false;
+ if (!ShouldBeAllocatedBefore(*a, *b)) return false;
}
return true;
}
« no previous file with comments | « runtime/vm/flow_graph_allocator.h ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698