| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 intptr_t fixed_parameter_count) | 1523 intptr_t fixed_parameter_count) |
| 1524 : values_(definitions.length()), | 1524 : values_(definitions.length()), |
| 1525 locations_(NULL), | 1525 locations_(NULL), |
| 1526 fixed_parameter_count_(fixed_parameter_count) { | 1526 fixed_parameter_count_(fixed_parameter_count) { |
| 1527 for (intptr_t i = 0; i < definitions.length(); ++i) { | 1527 for (intptr_t i = 0; i < definitions.length(); ++i) { |
| 1528 values_.Add(UseDefinition(definitions[i])); | 1528 values_.Add(UseDefinition(definitions[i])); |
| 1529 } | 1529 } |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 | 1532 |
| 1533 Environment* Environment::Copy() const { | 1533 // Copies the environment and updates the environment use lists. |
| 1534 void Environment::CopyTo(Instruction* instr) const { |
| 1534 Environment* copy = new Environment(values().length(), | 1535 Environment* copy = new Environment(values().length(), |
| 1535 fixed_parameter_count()); | 1536 fixed_parameter_count()); |
| 1536 GrowableArray<Value*>* values_copy = copy->values_ptr(); | 1537 GrowableArray<Value*>* values_copy = copy->values_ptr(); |
| 1537 for (intptr_t i = 0; i < values().length(); ++i) { | 1538 for (intptr_t i = 0; i < values().length(); ++i) { |
| 1538 values_copy->Add(values()[i]->CopyValue()); | 1539 Value* value = values()[i]->CopyValue(); |
| 1540 values_copy->Add(value); |
| 1541 UseVal* use = value->AsUse(); |
| 1542 if (use != NULL) { |
| 1543 use->set_instruction(instr); |
| 1544 use->set_use_index(i); |
| 1545 use->AddToEnvUseList(); |
| 1546 } |
| 1539 } | 1547 } |
| 1540 return copy; | 1548 instr->set_env(copy); |
| 1541 } | 1549 } |
| 1542 | 1550 |
| 1543 | 1551 |
| 1544 #undef __ | 1552 #undef __ |
| 1545 | 1553 |
| 1546 } // namespace dart | 1554 } // namespace dart |
| OLD | NEW |