| Index: runtime/vm/flow_graph.cc
|
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
|
| index 79d9ea9e38b3a8f75d212633836170ea54661297..6e721444765039cfb73fc84e061aa1ad13fd23f9 100644
|
| --- a/runtime/vm/flow_graph.cc
|
| +++ b/runtime/vm/flow_graph.cc
|
| @@ -552,18 +552,16 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| // Update expression stack.
|
| ASSERT(env->length() > variable_count());
|
|
|
| - Definition* input_defn = env->Last();
|
| + Definition* reaching_defn = env->Last();
|
| env->RemoveLast();
|
|
|
| - BindInstr* as_bind = v->definition()->AsBind();
|
| - if ((as_bind != NULL) &&
|
| - (as_bind->computation()->IsLoadLocal() ||
|
| - as_bind->computation()->IsStoreLocal())) {
|
| + Definition* input_defn = v->definition();
|
| + if (input_defn->IsLoadLocal() || input_defn->IsStoreLocal()) {
|
| // Remove the load/store from the graph.
|
| - as_bind->RemoveFromGraph();
|
| + input_defn->RemoveFromGraph();
|
| // Assert we are not referencing nulls in the initial environment.
|
| - ASSERT(input_defn->ssa_temp_index() != -1);
|
| - current->SetInputAt(i, new Value(input_defn));
|
| + ASSERT(reaching_defn->ssa_temp_index() != -1);
|
| + current->SetInputAt(i, new Value(reaching_defn));
|
| }
|
| }
|
|
|
| @@ -575,10 +573,10 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| // 2b. Handle LoadLocal and StoreLocal.
|
| // For each LoadLocal: Remove it from the graph.
|
| // For each StoreLocal: Remove it from the graph and update the environment.
|
| - BindInstr* bind = current->AsBind();
|
| - if (bind != NULL) {
|
| - LoadLocalComp* load = bind->computation()->AsLoadLocal();
|
| - StoreLocalComp* store = bind->computation()->AsStoreLocal();
|
| + Definition* definition = current->AsDefinition();
|
| + if (definition != NULL) {
|
| + LoadLocalInstr* load = definition->AsLoadLocal();
|
| + StoreLocalInstr* store = definition->AsStoreLocal();
|
| if ((load != NULL) || (store != NULL)) {
|
| intptr_t index;
|
| if (store != NULL) {
|
| @@ -588,7 +586,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| } else {
|
| // The graph construction ensures we do not have an unused LoadLocal
|
| // computation.
|
| - ASSERT(bind->is_used());
|
| + ASSERT(definition->is_used());
|
| index = load->local().BitIndexIn(non_copied_parameter_count_);
|
|
|
| PhiInstr* phi = (*env)[index]->AsPhi();
|
| @@ -598,7 +596,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| }
|
| }
|
| // Update expression stack or remove from graph.
|
| - if (bind->is_used()) {
|
| + if (definition->is_used()) {
|
| env->Add((*env)[index]);
|
| // We remove load/store instructions when we find their use in 2a.
|
| } else {
|
| @@ -606,10 +604,10 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| }
|
| } else {
|
| // Not a load or store.
|
| - if (bind->is_used()) {
|
| + if (definition->is_used()) {
|
| // Assign fresh SSA temporary and update expression stack.
|
| - bind->set_ssa_temp_index(alloc_ssa_temp_index());
|
| - env->Add(bind);
|
| + definition->set_ssa_temp_index(alloc_ssa_temp_index());
|
| + env->Add(definition);
|
| }
|
| }
|
| }
|
| @@ -701,9 +699,7 @@ static void Link(Instruction* prev, Instruction* next) {
|
| //
|
| // After inlining the caller graph will correctly have adjusted the pre/post
|
| // orders, the dominator tree and the use lists.
|
| -void FlowGraph::InlineCall(BindInstr* caller_instr,
|
| - StaticCallComp* caller_comp,
|
| - FlowGraph* callee_graph) {
|
| +void FlowGraph::InlineCall(StaticCallInstr* call, FlowGraph* callee_graph) {
|
| ASSERT(callee_graph->exits() != NULL);
|
| ASSERT(callee_graph->graph_entry()->SuccessorCount() == 1);
|
| ASSERT(callee_graph->max_virtual_register_number() >
|
| @@ -724,9 +720,9 @@ void FlowGraph::InlineCall(BindInstr* caller_instr,
|
| // TODO(zerny): Support one exit graph containing control flow.
|
| ASSERT(callee_entry == GetBlockEntry(exit));
|
| // For just one exit, replace the uses and remove the call from the graph.
|
| - caller_instr->ReplaceUsesWith(exit->value()->definition());
|
| - Link(caller_instr->previous(), callee_entry->next());
|
| - Link(exit->previous(), caller_instr->next());
|
| + call->ReplaceUsesWith(exit->value()->definition());
|
| + Link(call->previous(), callee_entry->next());
|
| + Link(exit->previous(), call->next());
|
| } else {
|
| // TODO(zerny): Support multiple exits.
|
| UNREACHABLE();
|
| @@ -736,8 +732,8 @@ void FlowGraph::InlineCall(BindInstr* caller_instr,
|
| // TODO(zerny): Update dominator tree.
|
|
|
| // Remove original arguments to the call.
|
| - for (intptr_t i = 0; i < caller_comp->ArgumentCount(); ++i) {
|
| - PushArgumentInstr* push = caller_comp->ArgumentAt(i);
|
| + for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
|
| + PushArgumentInstr* push = call->ArgumentAt(i);
|
| push->ReplaceUsesWith(push->value()->definition());
|
| push->RemoveFromGraph();
|
| }
|
|
|