| Index: runtime/vm/flow_graph_allocator.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_allocator.cc (revision 9862)
|
| +++ runtime/vm/flow_graph_allocator.cc (working copy)
|
| @@ -860,11 +860,22 @@
|
| }
|
|
|
|
|
| -static UsePosition* FirstUseAfter(UsePosition* use, intptr_t after) {
|
| - while ((use != NULL) && (use->pos() < after)) {
|
| - use = use->next();
|
| +void AllocationFinger::Initialize(LiveRange* range) {
|
| + first_pending_use_interval_ = range->first_use_interval();
|
| + first_register_use_ = range->first_use();
|
| + first_register_beneficial_use_ = range->first_use();
|
| + first_hinted_use_ = range->first_use();
|
| +}
|
| +
|
| +
|
| +bool AllocationFinger::Advance(const intptr_t start) {
|
| + UseInterval* a = first_pending_use_interval_;
|
| + while (a != NULL && a->end() <= start) a = a->next();
|
| + first_pending_use_interval_ = a;
|
| + if (first_pending_use_interval_ == NULL) {
|
| + return true;
|
| }
|
| - return use;
|
| + return false;
|
| }
|
|
|
|
|
| @@ -880,6 +891,14 @@
|
| }
|
|
|
|
|
| +static UsePosition* FirstUseAfter(UsePosition* use, intptr_t after) {
|
| + while ((use != NULL) && (use->pos() < after)) {
|
| + use = use->next();
|
| + }
|
| + return use;
|
| +}
|
| +
|
| +
|
| UsePosition* AllocationFinger::FirstRegisterUse(intptr_t after) {
|
| for (UsePosition* use = FirstUseAfter(first_register_use_, after);
|
| use != NULL;
|
| @@ -1168,7 +1187,7 @@
|
|
|
| void FlowGraphAllocator::AllocateAnyRegister(LiveRange* unallocated) {
|
| UsePosition* register_use =
|
| - unallocated->finger()->FirstRegisterUse(unallocated->Start());
|
| + unallocated->finger()->FirstRegisterUse(unallocated->Start());
|
| if (register_use == NULL) {
|
| Spill(unallocated);
|
| return;
|
| @@ -1218,7 +1237,7 @@
|
| LiveRange* allocated = cpu_regs_[reg][i];
|
|
|
| UseInterval* first_pending_use_interval =
|
| - allocated->finger()->first_pending_use_interval();
|
| + allocated->finger()->first_pending_use_interval();
|
| if (first_pending_use_interval->Contains(start)) {
|
| // This is an active interval.
|
| if (allocated->vreg() <= 0) {
|
| @@ -1244,7 +1263,7 @@
|
| } else {
|
| // This is inactive interval.
|
| const intptr_t intersection = FirstIntersection(
|
| - first_pending_use_interval, unallocated->first_use_interval());
|
| + first_pending_use_interval, unallocated->first_use_interval());
|
| if (intersection != kMaxPosition) {
|
| if (intersection < free_until) free_until = intersection;
|
| if (allocated->vreg() == kNoVirtualRegister) blocked_at = intersection;
|
| @@ -1284,8 +1303,7 @@
|
| for (intptr_t i = cpu_regs_[reg].length() - 1; i >= 0; i--) {
|
| LiveRange* allocated = cpu_regs_[reg][i];
|
| if (allocated->vreg() < 0) continue; // Can't be evicted.
|
| - if (EvictIntersection(allocated,
|
| - unallocated)) {
|
| + if (EvictIntersection(allocated, unallocated)) {
|
| cpu_regs_[reg][i] = NULL;
|
| first_evicted = i;
|
| }
|
| @@ -1362,17 +1380,6 @@
|
| }
|
|
|
|
|
| -bool AllocationFinger::Advance(const intptr_t start) {
|
| - UseInterval* a = first_pending_use_interval_;
|
| - while (a != NULL && a->end() <= start) a = a->next();
|
| - first_pending_use_interval_ = a;
|
| - if (first_pending_use_interval_ == NULL) {
|
| - return true;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| -
|
| void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) {
|
| for (intptr_t reg = 0; reg < kNumberOfCpuRegisters; reg++) {
|
| if (cpu_regs_[reg].is_empty()) continue;
|
| @@ -1394,14 +1401,6 @@
|
| }
|
|
|
|
|
| -void AllocationFinger::Initialize(LiveRange* range) {
|
| - first_pending_use_interval_ = range->first_use_interval();
|
| - first_register_use_ = range->first_use();
|
| - first_register_beneficial_use_ = range->first_use();
|
| - first_hinted_use_ = range->first_use();
|
| -}
|
| -
|
| -
|
| static inline bool ShouldBeAllocatedBefore(LiveRange* a, LiveRange* b) {
|
| return a->Start() <= b->Start();
|
| }
|
|
|