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

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 10928048: Nested deoptimization environments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | 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 a3664ede81aa48f9131678830e93a257942aff32..4ebf4a7352d0233945dfdea3e5e5f1ded4769289 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -95,19 +95,18 @@ void FlowGraphAllocator::EliminateEnvironmentUses() {
Instruction* current = it.Current();
if (current->CanDeoptimize()) {
ASSERT(current->env() != NULL);
- GrowableArray<Value*>* values = current->env()->values_ptr();
- for (intptr_t i = 0; i < values->length(); i++) {
- Value* use = (*values)[i];
+ for (EnvironmentIterator it(current->env()); !it.Done(); it.Advance()) {
+ Value* use = it.CurrentValue();
Definition* def = use->definition();
PushArgumentInstr* push_argument = def->AsPushArgument();
if ((push_argument != NULL) && push_argument->WasEliminated()) {
- (*values)[i] = push_argument->value()->Copy();
+ it.ReplaceCurrentValue(push_argument->value()->Copy());
continue;
}
PhiInstr* phi = def->AsPhi();
if ((phi != NULL) && !phi->is_alive()) {
- (*values)[i] = new Value(constant_null);
+ it.ReplaceCurrentValue(new Value(constant_null));
continue;
}
}
@@ -147,9 +146,8 @@ void FlowGraphAllocator::ComputeInitialSets() {
// 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++) {
- Value* value = values[j];
+ for (intptr_t i = 0; i < current->env()->Length(); ++i) {
+ Value* value = current->env()->ValueAt(i);
if (!value->definition()->IsPushArgument()) {
live_in->Add(value->definition()->ssa_temp_index());
}
@@ -185,8 +183,8 @@ void FlowGraphAllocator::ComputeInitialSets() {
// Process incoming parameters.
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];
+ for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) {
+ Value* val = graph_entry->start_env()->ValueAt(i);
intptr_t vreg = val->definition()->ssa_temp_index();
kill_[graph_entry->postorder_number()]->Add(vreg);
live_in_[graph_entry->postorder_number()]->Remove(vreg);
@@ -519,8 +517,8 @@ void FlowGraphAllocator::BuildLiveRanges() {
// Process incoming parameters. Do this after all other instructions so
// that safepoints for all calls have already been found.
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];
+ for (intptr_t i = 0; i < graph_entry->start_env()->Length(); i++) {
+ Value* val = graph_entry->start_env()->ValueAt(i);
ParameterInstr* param = val->definition()->AsParameter();
if (param == NULL) continue;
@@ -748,17 +746,16 @@ void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block,
// value -----*
//
- const GrowableArray<Value*>& values = env->values();
- if (values.length() == 0) return;
+ if (env->Length() == 0) return;
const intptr_t block_start_pos = block->start_pos();
const intptr_t use_pos = current->lifetime_position() + 1;
Location* locations =
- Isolate::Current()->current_zone()->Alloc<Location>(values.length());
+ Isolate::Current()->current_zone()->Alloc<Location>(env->Length());
- for (intptr_t i = 0; i < values.length(); ++i) {
- Value* value = values[i];
+ for (intptr_t i = 0; i < env->Length(); ++i) {
+ Value* value = env->ValueAt(i);
locations[i] = Location::Any();
Definition* def = value->definition();
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698