| 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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 value->AddToEnvUseList(); | 1821 value->AddToEnvUseList(); |
| 1822 } | 1822 } |
| 1823 instr->set_env(copy); | 1823 instr->set_env(copy); |
| 1824 } | 1824 } |
| 1825 | 1825 |
| 1826 | 1826 |
| 1827 // Copies the environment as outer on an inlined instruction and updates the | 1827 // Copies the environment as outer on an inlined instruction and updates the |
| 1828 // environment use lists. | 1828 // environment use lists. |
| 1829 void Environment::DeepCopyToOuter(Instruction* instr) const { | 1829 void Environment::DeepCopyToOuter(Instruction* instr) const { |
| 1830 ASSERT(instr->env()->outer() == NULL); | 1830 ASSERT(instr->env()->outer() == NULL); |
| 1831 Environment* copy = DeepCopy(); | 1831 // Create a deep copy removing caller arguments from the environment. |
| 1832 intptr_t argument_count = instr->env()->fixed_parameter_count(); |
| 1833 Environment* copy = |
| 1834 new Environment(values_.length() - argument_count, |
| 1835 fixed_parameter_count_, |
| 1836 deopt_id_, |
| 1837 function_, |
| 1838 (outer_ == NULL) ? NULL : outer_->DeepCopy()); |
| 1839 for (intptr_t i = 0; i < values_.length() - argument_count; ++i) { |
| 1840 copy->values_.Add(values_[i]->Copy()); |
| 1841 } |
| 1832 intptr_t use_index = instr->env()->Length(); // Start index after inner. | 1842 intptr_t use_index = instr->env()->Length(); // Start index after inner. |
| 1833 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) { | 1843 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) { |
| 1834 Value* value = it.CurrentValue(); | 1844 Value* value = it.CurrentValue(); |
| 1835 value->set_instruction(instr); | 1845 value->set_instruction(instr); |
| 1836 value->set_use_index(use_index++); | 1846 value->set_use_index(use_index++); |
| 1837 value->AddToEnvUseList(); | 1847 value->AddToEnvUseList(); |
| 1838 } | 1848 } |
| 1839 instr->env()->outer_ = copy; | 1849 instr->env()->outer_ = copy; |
| 1840 } | 1850 } |
| 1841 | 1851 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1980 | 1990 |
| 1981 ASSERT(!new_min.IsUnknown() && !new_max.IsUnknown()); | 1991 ASSERT(!new_min.IsUnknown() && !new_max.IsUnknown()); |
| 1982 set_overflow(new_min.Overflowed() || new_max.Overflowed()); | 1992 set_overflow(new_min.Overflowed() || new_max.Overflowed()); |
| 1983 return Range::Update(&range_, new_min, new_max); | 1993 return Range::Update(&range_, new_min, new_max); |
| 1984 } | 1994 } |
| 1985 | 1995 |
| 1986 | 1996 |
| 1987 #undef __ | 1997 #undef __ |
| 1988 | 1998 |
| 1989 } // namespace dart | 1999 } // namespace dart |
| OLD | NEW |