Chromium Code Reviews| Index: runtime/vm/flow_graph_allocator.cc |
| diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc |
| index 2118c08fb44d5cee13d1d9f4921779269795ed71..d01dcce64b76eaf67b3df11ba31d35fbbe750cfc 100644 |
| --- a/runtime/vm/flow_graph_allocator.cc |
| +++ b/runtime/vm/flow_graph_allocator.cc |
| @@ -149,8 +149,10 @@ void FlowGraphAllocator::ComputeInitialSets() { |
| // Add non-argument uses from the deoptimization environment (pushed |
| // arguments are not allocated by the register allocator). |
| if (current->env() != NULL) { |
| - for (intptr_t i = 0; i < current->env()->Length(); ++i) { |
| - Value* value = current->env()->ValueAt(i); |
| + for (Environment::DeepIterator env_it(current->env()); |
| + !env_it.Done(); |
| + env_it.Advance()) { |
| + Value* value = env_it.CurrentValue(); |
| if (!value->definition()->IsPushArgument()) { |
| live_in->Add(value->definition()->ssa_temp_index()); |
| } |
| @@ -735,11 +737,14 @@ void FlowGraphAllocator::ConnectIncomingPhiMoves(BlockEntryInstr* block) { |
| } |
| -void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block, |
| - Instruction* current) { |
| - ASSERT(current->env() != NULL); |
| +void FlowGraphAllocator::ProcessEnvironmentUsesRecursive(BlockEntryInstr* block, |
| + Instruction* current, |
| + Environment* env) { |
| + if (env == NULL) return; |
| - Environment* env = current->env(); |
| + if (env->outer() != NULL) { |
|
Kevin Millikin (Google)
2012/09/18 11:01:55
The base of the recursion handles env == NULL, so
zerny-google
2012/09/18 11:53:07
Done.
|
| + ProcessEnvironmentUsesRecursive(block, current, env->outer()); |
| + } |
| // Any value mentioned in the deoptimization environment should survive |
| // until the end of instruction but it does not need to be in the register. |
| @@ -784,6 +789,13 @@ void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block, |
| } |
| +void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block, |
| + Instruction* current) { |
| + ASSERT(current->env() != NULL); |
| + ProcessEnvironmentUsesRecursive(block, current, current->env()); |
| +} |
| + |
| + |
| // Create and update live ranges corresponding to instruction's inputs, |
| // temporaries and output. |
| void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block, |