| Index: runtime/vm/intermediate_language.cc
|
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
|
| index 2feac05d8c30c8ecb13a06571aacd8c67d812802..8cd4099c8d334a3780f1fd9d5ab8bd190f7c6f9f 100644
|
| --- a/runtime/vm/intermediate_language.cc
|
| +++ b/runtime/vm/intermediate_language.cc
|
| @@ -1530,14 +1530,22 @@ Environment::Environment(const GrowableArray<Definition*>& definitions,
|
| }
|
|
|
|
|
| -Environment* Environment::Copy() const {
|
| +// 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) {
|
| - values_copy->Add(values()[i]->CopyValue());
|
| + Value* value = values()[i]->CopyValue();
|
| + values_copy->Add(value);
|
| + UseVal* use = value->AsUse();
|
| + if (use != NULL) {
|
| + use->set_instruction(instr);
|
| + use->set_use_index(i);
|
| + use->AddToEnvUseList();
|
| + }
|
| }
|
| - return copy;
|
| + instr->set_env(copy);
|
| }
|
|
|
|
|
|
|