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

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 10916082: Make register allocator to disregard constant computation with no uses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/assembler_x64_test.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_allocator.cc
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index b529679d213fc8cb4c4cb6d2ebb42314f5a337ec..ee601440942b68051a83b30767f9426bb172a6dd 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -762,6 +762,12 @@ void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block,
continue;
}
+ ConstantComp* constant = def->AsConstant();
+ if (constant != NULL) {
+ locations[i] = Location::Constant(constant->value());
+ continue;
+ }
+
const intptr_t vreg = def->ssa_temp_index();
LiveRange* range = GetLiveRange(vreg);
range->AddUseInterval(block_start_pos, use_pos);
@@ -776,11 +782,20 @@ void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block,
// temporaries and output.
void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
Instruction* current) {
+ LocationSummary* locs = current->locs();
+
+ Definition* def = current->AsDefinition();
+ if ((def != NULL) &&
+ (def->AsConstant() != NULL) &&
+ (GetLiveRange(def->ssa_temp_index())->first_use() == NULL)) {
+ // Drop definitions of constants that have no uses.
+ locs->set_out(Location::NoLocation());
+ return;
+ }
+
const intptr_t pos = current->lifetime_position();
ASSERT(IsInstructionStartPosition(pos));
- LocationSummary* locs = current->locs();
-
// Number of input locations and number of input operands have to agree.
ASSERT(locs->input_count() == current->InputCount());
@@ -824,7 +839,7 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
BlockLocation(*in_ref, pos - 1, pos + 1);
range->AddUseInterval(block->start_pos(), pos - 1);
range->AddHintedUse(pos - 1, move->src_slot(), in_ref);
- } else {
+ } else if (in_ref->IsUnallocated()) {
// Normal unallocated input. Expected shape of
// live ranges:
//
@@ -834,6 +849,8 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
ASSERT(in_ref->IsUnallocated());
range->AddUseInterval(block->start_pos(), pos + 1);
range->AddUse(pos + 1, in_ref);
+ } else {
+ ASSERT(in_ref->IsConstant());
}
}
@@ -900,7 +917,6 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
safepoints_.Add(current);
}
- Definition* def = current->AsDefinition();
if (def == NULL) {
ASSERT(locs->out().IsInvalid());
return;
« no previous file with comments | « runtime/vm/assembler_x64_test.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698