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

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 10918006: Rematerialize constants instead of spilling them. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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') | no next file » | 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 ac39023f54f2d00d58eef45012170d99899d9f49..a81a57acd99565302331a0c11d769f9d62119fd4 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -569,6 +569,8 @@ void FlowGraphAllocator::BuildLiveRanges() {
range->DefineAt(graph_entry->start_pos());
range->set_assigned_location(
Location::Constant(null_defn->computation()->AsConstant()->value()));
+ range->set_spill_slot(
+ Location::Constant(null_defn->computation()->AsConstant()->value()));
range->finger()->Initialize(range);
UsePosition* use =
range->finger()->FirstRegisterBeneficialUse(graph_entry->start_pos());
@@ -1935,6 +1937,18 @@ void FlowGraphAllocator::AllocateUnallocatedRanges() {
}
+bool FlowGraphAllocator::TargetLocationIsSpillSlot(LiveRange* range,
+ Location target) {
+ if (target.IsStackSlot() ||
+ target.IsDoubleStackSlot() ||
+ target.IsConstant()) {
+ ASSERT(GetLiveRange(range->vreg())->spill_slot().Equals(target));
+ return true;
+ }
+ return false;
+}
+
+
void FlowGraphAllocator::ConnectSplitSiblings(LiveRange* parent,
BlockEntryInstr* source_block,
BlockEntryInstr* target_block) {
@@ -1992,8 +2006,7 @@ void FlowGraphAllocator::ConnectSplitSiblings(LiveRange* parent,
if (source.Equals(target)) return;
// Values are eagerly spilled. Spill slot already contains appropriate value.
- if (target.IsStackSlot() || target.IsDoubleStackSlot()) {
- ASSERT(parent->spill_slot().Equals(target));
+ if (TargetLocationIsSpillSlot(parent, target)) {
return;
}
@@ -2024,8 +2037,7 @@ void FlowGraphAllocator::ResolveControlFlow() {
TRACE_ALLOC(sibling->assigned_location().Print());
TRACE_ALLOC(OS::Print("]\n"));
if ((range->End() == sibling->Start()) &&
- !sibling->assigned_location().IsStackSlot() &&
- !sibling->assigned_location().IsDoubleStackSlot() &&
+ !TargetLocationIsSpillSlot(range, sibling->assigned_location()) &&
!range->assigned_location().Equals(sibling->assigned_location()) &&
!IsBlockEntry(range->End())) {
AddMoveAt(sibling->Start(),
@@ -2054,7 +2066,8 @@ void FlowGraphAllocator::ResolveControlFlow() {
for (intptr_t i = 0; i < spilled_.length(); i++) {
LiveRange* range = spilled_[i];
if (range->assigned_location().IsStackSlot() ||
- range->assigned_location().IsDoubleStackSlot()) {
+ range->assigned_location().IsDoubleStackSlot() ||
+ range->assigned_location().IsConstant()) {
ASSERT(range->assigned_location().Equals(range->spill_slot()));
} else {
AddMoveAt(range->Start() + 1,
« no previous file with comments | « runtime/vm/flow_graph_allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698