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

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 10928232: Deoptimization support in inlined code. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intrinsifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 // TODO(fschneider): Avoid special-casing for SSA mode here. 1649 // TODO(fschneider): Avoid special-casing for SSA mode here.
1650 if (compiler->is_optimizing()) { 1650 if (compiler->is_optimizing()) {
1651 ASSERT(locs()->in(0).IsRegister()); 1651 ASSERT(locs()->in(0).IsRegister());
1652 __ PushRegister(locs()->in(0).reg()); 1652 __ PushRegister(locs()->in(0).reg());
1653 } 1653 }
1654 } 1654 }
1655 1655
1656 1656
1657 Environment* Environment::From(const GrowableArray<Definition*>& definitions, 1657 Environment* Environment::From(const GrowableArray<Definition*>& definitions,
1658 intptr_t fixed_parameter_count, 1658 intptr_t fixed_parameter_count,
1659 const Environment* outer) { 1659 const Function& function) {
1660 Environment* env = 1660 Environment* env =
1661 new Environment(definitions.length(), 1661 new Environment(definitions.length(),
1662 fixed_parameter_count, 1662 fixed_parameter_count,
1663 Isolate::kNoDeoptId, 1663 Isolate::kNoDeoptId,
1664 (outer == NULL) ? NULL : outer->DeepCopy()); 1664 function,
1665 NULL);
1665 for (intptr_t i = 0; i < definitions.length(); ++i) { 1666 for (intptr_t i = 0; i < definitions.length(); ++i) {
1666 env->values_.Add(new Value(definitions[i])); 1667 env->values_.Add(new Value(definitions[i]));
1667 } 1668 }
1668 return env; 1669 return env;
1669 } 1670 }
1670 1671
1671 1672
1672 Environment* Environment::DeepCopy() const { 1673 Environment* Environment::DeepCopy() const {
1673 Environment* copy = 1674 Environment* copy =
1674 new Environment(values_.length(), 1675 new Environment(values_.length(),
1675 fixed_parameter_count_, 1676 fixed_parameter_count_,
1676 deopt_id_, 1677 deopt_id_,
1678 function_,
1677 (outer_ == NULL) ? NULL : outer_->DeepCopy()); 1679 (outer_ == NULL) ? NULL : outer_->DeepCopy());
1678 for (intptr_t i = 0; i < values_.length(); ++i) { 1680 for (intptr_t i = 0; i < values_.length(); ++i) {
1679 copy->values_.Add(values_[i]->Copy()); 1681 copy->values_.Add(values_[i]->Copy());
1680 } 1682 }
1681 return copy; 1683 return copy;
1682 } 1684 }
1683 1685
1684 1686
1685 // Copies the environment and updates the environment use lists. 1687 // Copies the environment and updates the environment use lists.
1686 void Environment::DeepCopyTo(Instruction* instr) const { 1688 void Environment::DeepCopyTo(Instruction* instr) const {
1687 Environment* copy = DeepCopy(); 1689 Environment* copy = DeepCopy();
1688 intptr_t use_index = 0; 1690 intptr_t use_index = 0;
1689 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) { 1691 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
1690 Value* value = it.CurrentValue(); 1692 Value* value = it.CurrentValue();
1691 value->set_instruction(instr); 1693 value->set_instruction(instr);
1692 value->set_use_index(use_index++); 1694 value->set_use_index(use_index++);
1693 value->AddToEnvUseList(); 1695 value->AddToEnvUseList();
1694 } 1696 }
1695 instr->set_env(copy); 1697 instr->set_env(copy);
1696 } 1698 }
1697 1699
1698 1700
1701 // Copies the environment as outer on an inlined instruction and updates the
1702 // environment use lists.
1703 void Environment::DeepCopyToOuter(Instruction* instr) const {
1704 ASSERT(instr->env()->outer() == NULL);
1705 Environment* copy = DeepCopy();
1706 intptr_t use_index = instr->env()->Length(); // Start index after inner.
1707 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
1708 Value* value = it.CurrentValue();
1709 value->set_instruction(instr);
1710 value->set_use_index(use_index++);
1711 value->AddToEnvUseList();
1712 }
1713 instr->env()->outer_ = copy;
1714 }
1715
1716
1699 #undef __ 1717 #undef __
1700 1718
1701 } // namespace dart 1719 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intrinsifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698