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

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

Issue 10909168: Introduce nested deoptimization environments. (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
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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 1606 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
1607 // where PushArgument is handled by BindInstr::EmitNativeCode. 1607 // where PushArgument is handled by BindInstr::EmitNativeCode.
1608 // TODO(fschneider): Avoid special-casing for SSA mode here. 1608 // TODO(fschneider): Avoid special-casing for SSA mode here.
1609 if (compiler->is_optimizing()) { 1609 if (compiler->is_optimizing()) {
1610 ASSERT(locs()->in(0).IsRegister()); 1610 ASSERT(locs()->in(0).IsRegister());
1611 __ PushRegister(locs()->in(0).reg()); 1611 __ PushRegister(locs()->in(0).reg());
1612 } 1612 }
1613 } 1613 }
1614 1614
1615 1615
1616 Environment::Environment(const GrowableArray<Definition*>& definitions, 1616 Environment* Environment::From(const GrowableArray<Definition*>& definitions,
1617 intptr_t fixed_parameter_count) 1617 intptr_t fixed_parameter_count,
1618 : values_(definitions.length()), 1618 const Environment* outer) {
1619 locations_(NULL), 1619 Environment* env =
1620 fixed_parameter_count_(fixed_parameter_count) { 1620 new Environment(definitions.length(),
1621 fixed_parameter_count,
1622 Isolate::kNoDeoptId,
1623 (outer == NULL) ? NULL : outer->Copy());
1621 for (intptr_t i = 0; i < definitions.length(); ++i) { 1624 for (intptr_t i = 0; i < definitions.length(); ++i) {
1622 values_.Add(new Value(definitions[i])); 1625 env->values_.Add(new Value(definitions[i]));
1623 } 1626 }
1627 return env;
1628 }
1629
1630
1631 Environment* Environment::Copy() const {
1632 Environment* copy =
1633 new Environment(values_.length(),
1634 fixed_parameter_count_,
1635 deopt_id_,
1636 (outer_ == NULL) ? NULL : outer_->Copy());
1637 for (intptr_t i = 0; i < values_.length(); ++i) {
1638 copy->values_.Add(values_[i]->Copy());
1639 }
1640 return copy;
1624 } 1641 }
1625 1642
1626 1643
1627 // Copies the environment and updates the environment use lists. 1644 // Copies the environment and updates the environment use lists.
1628 void Environment::CopyTo(Instruction* instr) const { 1645 void Environment::CopyTo(Instruction* instr) const {
1629 Environment* copy = new Environment(values().length(), 1646 Environment* copy = Copy();
1630 fixed_parameter_count()); 1647 intptr_t use_index = 0;
1631 GrowableArray<Value*>* values_copy = copy->values_ptr(); 1648 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
Florian Schneider 2012/09/11 12:07:38 Maybe rename Copy and CopyTo into DeepCopy and Dee
Kevin Millikin (Google) 2012/09/11 12:38:15 Done.
1632 for (intptr_t i = 0; i < values().length(); ++i) { 1649 Value* value = it.CurrentValue();
1633 Value* value = values()[i]->Copy();
1634 values_copy->Add(value);
1635 value->set_instruction(instr); 1650 value->set_instruction(instr);
1636 value->set_use_index(i); 1651 value->set_use_index(use_index++);
1637 value->AddToEnvUseList(); 1652 value->AddToEnvUseList();
1638 } 1653 }
1639 instr->set_env(copy); 1654 instr->set_env(copy);
1640 } 1655 }
1641 1656
1642 1657
1643 #undef __ 1658 #undef __
1644 1659
1645 } // namespace dart 1660 } // namespace dart
OLDNEW
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698