| Index: runtime/vm/flow_graph_allocator.cc
|
| diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
|
| index 0d89e8b55eb7a31fd75138c9c9f52fffc29550f3..522efb2b0e8243639b671660d2b3e6a1899618e5 100644
|
| --- a/runtime/vm/flow_graph_allocator.cc
|
| +++ b/runtime/vm/flow_graph_allocator.cc
|
| @@ -101,19 +101,17 @@ void FlowGraphAllocator::EliminateEnvironmentUses() {
|
| ASSERT(current->env() != NULL);
|
| GrowableArray<Value*>* values = current->env()->values_ptr();
|
| for (intptr_t i = 0; i < values->length(); i++) {
|
| - UseVal* use = (*values)[i]->AsUse();
|
| - if (use == NULL) continue;
|
| -
|
| + Value* use = (*values)[i];
|
| Definition* def = use->definition();
|
| PushArgumentInstr* push_argument = def->AsPushArgument();
|
| if ((push_argument != NULL) && push_argument->WasEliminated()) {
|
| - (*values)[i] = push_argument->value()->CopyValue();
|
| + (*values)[i] = push_argument->value()->Copy();
|
| continue;
|
| }
|
|
|
| PhiInstr* phi = def->AsPhi();
|
| if ((phi != NULL) && !phi->is_alive()) {
|
| - (*values)[i] = new UseVal(constant_null);
|
| + (*values)[i] = new Value(constant_null);
|
| continue;
|
| }
|
| }
|
| @@ -147,19 +145,17 @@ void FlowGraphAllocator::ComputeInitialSets() {
|
| // Handle uses.
|
| for (intptr_t j = 0; j < current->InputCount(); j++) {
|
| Value* input = current->InputAt(j);
|
| - if (input->IsUse()) {
|
| - const intptr_t use = input->AsUse()->definition()->ssa_temp_index();
|
| - live_in->Add(use);
|
| - }
|
| + const intptr_t use = input->definition()->ssa_temp_index();
|
| + live_in->Add(use);
|
| }
|
|
|
| // Add uses from the deoptimization environment.
|
| if (current->env() != NULL) {
|
| const GrowableArray<Value*>& values = current->env()->values();
|
| for (intptr_t j = 0; j < values.length(); j++) {
|
| - UseVal* use_val = values[j]->AsUse();
|
| - if ((use_val != NULL) && !use_val->definition()->IsPushArgument()) {
|
| - live_in->Add(use_val->definition()->ssa_temp_index());
|
| + Value* value = values[j];
|
| + if (!value->definition()->IsPushArgument()) {
|
| + live_in->Add(value->definition()->ssa_temp_index());
|
| }
|
| }
|
| }
|
| @@ -180,12 +176,10 @@ void FlowGraphAllocator::ComputeInitialSets() {
|
| // live-in for a predecessor.
|
| for (intptr_t k = 0; k < phi->InputCount(); k++) {
|
| Value* val = phi->InputAt(k);
|
| - if (val->IsUse()) {
|
| - BlockEntryInstr* pred = block->PredecessorAt(k);
|
| - const intptr_t use = val->AsUse()->definition()->ssa_temp_index();
|
| - if (!kill_[pred->postorder_number()]->Contains(use)) {
|
| - live_in_[pred->postorder_number()]->Add(use);
|
| - }
|
| + BlockEntryInstr* pred = block->PredecessorAt(k);
|
| + const intptr_t use = val->definition()->ssa_temp_index();
|
| + if (!kill_[pred->postorder_number()]->Contains(use)) {
|
| + live_in_[pred->postorder_number()]->Add(use);
|
| }
|
| }
|
| }
|
| @@ -197,11 +191,9 @@ void FlowGraphAllocator::ComputeInitialSets() {
|
| GraphEntryInstr* graph_entry = postorder_.Last()->AsGraphEntry();
|
| for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) {
|
| Value* val = graph_entry->start_env()->values()[i];
|
| - if (val->IsUse()) {
|
| - intptr_t vreg = val->AsUse()->definition()->ssa_temp_index();
|
| - kill_[graph_entry->postorder_number()]->Add(vreg);
|
| - live_in_[graph_entry->postorder_number()]->Remove(vreg);
|
| - }
|
| + intptr_t vreg = val->definition()->ssa_temp_index();
|
| + kill_[graph_entry->postorder_number()]->Add(vreg);
|
| + live_in_[graph_entry->postorder_number()]->Remove(vreg);
|
| }
|
|
|
| // Process global constants.
|
| @@ -533,8 +525,7 @@ void FlowGraphAllocator::BuildLiveRanges() {
|
| GraphEntryInstr* graph_entry = postorder_.Last()->AsGraphEntry();
|
| for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) {
|
| Value* val = graph_entry->start_env()->values()[i];
|
| - ASSERT(val->IsUse());
|
| - ParameterInstr* param = val->AsUse()->definition()->AsParameter();
|
| + ParameterInstr* param = val->definition()->AsParameter();
|
| if (param == NULL) continue;
|
|
|
| // Handle the parameters specially. They are spilled on entry.
|
| @@ -650,15 +641,13 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves(
|
|
|
| Value* val = phi->InputAt(pred_idx);
|
| MoveOperands* move = parallel_move->MoveOperandsAt(move_idx);
|
| - ASSERT(val->IsUse());
|
| // Expected shape of live ranges:
|
| //
|
| // g g'
|
| // value --*
|
| //
|
|
|
| - LiveRange* range =
|
| - GetLiveRange(val->AsUse()->definition()->ssa_temp_index());
|
| + LiveRange* range = GetLiveRange(val->definition()->ssa_temp_index());
|
|
|
| range->AddUseInterval(block->start_pos(), pos);
|
| range->AddHintedUse(pos, move->src_slot(), move->dest_slot());
|
| @@ -749,9 +738,8 @@ void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block,
|
|
|
| for (intptr_t i = 0; i < values.length(); ++i) {
|
| Value* value = values[i];
|
| - ASSERT(value->IsUse());
|
| locations[i] = Location::Any();
|
| - Definition* def = value->AsUse()->definition();
|
| + Definition* def = value->definition();
|
|
|
| if (def->IsPushArgument()) {
|
| // Frame size is unknown until after allocation.
|
| @@ -821,8 +809,7 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
|
| j < current->InputCount();
|
| j++) {
|
| Value* input = current->InputAt(j);
|
| - ASSERT(input->IsUse()); // Can not be a constant currently.
|
| - const intptr_t vreg = input->AsUse()->definition()->ssa_temp_index();
|
| + const intptr_t vreg = input->definition()->ssa_temp_index();
|
| LiveRange* range = GetLiveRange(vreg);
|
|
|
| Location* in_ref = locs->in_slot(j);
|
| @@ -981,9 +968,8 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
|
|
|
| // Add uses to the live range of the input.
|
| Value* input = current->InputAt(0);
|
| - ASSERT(input->IsUse()); // Can not be a constant currently.
|
| - LiveRange* input_range = GetLiveRange(
|
| - input->AsUse()->definition()->ssa_temp_index());
|
| + LiveRange* input_range =
|
| + GetLiveRange(input->definition()->ssa_temp_index());
|
| input_range->AddUseInterval(block->start_pos(), pos);
|
| input_range->AddUse(pos, move->src_slot());
|
|
|
|
|