| Index: runtime/vm/intermediate_language.cc
|
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
|
| index d2734acb9112ed65ded1f32154aff129ee9e8b76..a7d1f6b8118561c9e6e21b1afa40494095eebe4c 100644
|
| --- a/runtime/vm/intermediate_language.cc
|
| +++ b/runtime/vm/intermediate_language.cc
|
| @@ -1612,27 +1612,42 @@ void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| }
|
|
|
|
|
| -Environment::Environment(const GrowableArray<Definition*>& definitions,
|
| - intptr_t fixed_parameter_count)
|
| - : values_(definitions.length()),
|
| - locations_(NULL),
|
| - fixed_parameter_count_(fixed_parameter_count) {
|
| +Environment* Environment::From(const GrowableArray<Definition*>& definitions,
|
| + intptr_t fixed_parameter_count,
|
| + const Environment* outer) {
|
| + Environment* env =
|
| + new Environment(definitions.length(),
|
| + fixed_parameter_count,
|
| + Isolate::kNoDeoptId,
|
| + (outer == NULL) ? NULL : outer->Copy());
|
| for (intptr_t i = 0; i < definitions.length(); ++i) {
|
| - values_.Add(new Value(definitions[i]));
|
| + env->values_.Add(new Value(definitions[i]));
|
| }
|
| + return env;
|
| +}
|
| +
|
| +
|
| +Environment* Environment::Copy() const {
|
| + Environment* copy =
|
| + new Environment(values_.length(),
|
| + fixed_parameter_count_,
|
| + deopt_id_,
|
| + (outer_ == NULL) ? NULL : outer_->Copy());
|
| + for (intptr_t i = 0; i < values_.length(); ++i) {
|
| + copy->values_.Add(values_[i]->Copy());
|
| + }
|
| + return copy;
|
| }
|
|
|
|
|
| // Copies the environment and updates the environment use lists.
|
| void Environment::CopyTo(Instruction* instr) const {
|
| - Environment* copy = new Environment(values().length(),
|
| - fixed_parameter_count());
|
| - GrowableArray<Value*>* values_copy = copy->values_ptr();
|
| - for (intptr_t i = 0; i < values().length(); ++i) {
|
| - Value* value = values()[i]->Copy();
|
| - values_copy->Add(value);
|
| + Environment* copy = Copy();
|
| + intptr_t use_index = 0;
|
| + for (EnvironmentIterator it(copy); !it.Done(); it.Advance()) {
|
| + Value* value = it.CurrentValue();
|
| value->set_instruction(instr);
|
| - value->set_use_index(i);
|
| + value->set_use_index(use_index++);
|
| value->AddToEnvUseList();
|
| }
|
| instr->set_env(copy);
|
|
|