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

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

Issue 10928048: 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 1605 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
1606 // where PushArgument is handled by BindInstr::EmitNativeCode. 1606 // where PushArgument is handled by BindInstr::EmitNativeCode.
1607 // TODO(fschneider): Avoid special-casing for SSA mode here. 1607 // TODO(fschneider): Avoid special-casing for SSA mode here.
1608 if (compiler->is_optimizing()) { 1608 if (compiler->is_optimizing()) {
1609 ASSERT(locs()->in(0).IsRegister()); 1609 ASSERT(locs()->in(0).IsRegister());
1610 __ PushRegister(locs()->in(0).reg()); 1610 __ PushRegister(locs()->in(0).reg());
1611 } 1611 }
1612 } 1612 }
1613 1613
1614 1614
1615 Environment::Environment(const GrowableArray<Definition*>& definitions, 1615 Environment* Environment::From(const GrowableArray<Definition*>& definitions,
1616 intptr_t fixed_parameter_count) 1616 intptr_t fixed_parameter_count,
1617 : values_(definitions.length()), 1617 const Environment* outer) {
1618 locations_(NULL), 1618 Environment* env = new Environment(
Kevin Millikin (Google) 2012/09/07 12:51:52 All other things being equal, I tend to try to bre
zerny-google 2012/09/07 13:51:37 Done.
1619 fixed_parameter_count_(fixed_parameter_count) { 1619 definitions.length(),
1620 fixed_parameter_count,
1621 -1,
Kevin Millikin (Google) 2012/09/07 12:51:52 Isolate::kNoDeoptId,
zerny-google 2012/09/07 13:51:37 Done.
1622 (outer == NULL) ? NULL : outer->Copy());
1620 for (intptr_t i = 0; i < definitions.length(); ++i) { 1623 for (intptr_t i = 0; i < definitions.length(); ++i) {
1621 values_.Add(new Value(definitions[i])); 1624 env->values_.Add(new Value(definitions[i]));
1622 } 1625 }
1626 return env;
1627 }
1628
1629
1630 Environment* Environment::Copy() const {
1631 Environment* copy = new Environment(
Kevin Millikin (Google) 2012/09/07 12:51:52 Same comment about indentation.
zerny-google 2012/09/07 13:51:37 Done.
1632 values_.length(),
1633 fixed_parameter_count_,
1634 deopt_id_,
1635 (outer_ == NULL) ? NULL : outer_->Copy());
1636 for (intptr_t i = 0; i < values_.length(); ++i) {
1637 copy->values_.Add(values_[i]->Copy());
1638 }
1639 return copy;
1623 } 1640 }
1624 1641
1625 1642
1626 // Copies the environment and updates the environment use lists. 1643 // Copies the environment and updates the environment use lists.
1627 void Environment::CopyTo(Instruction* instr) const { 1644 void Environment::CopyTo(Instruction* instr) const {
1628 Environment* copy = new Environment(values().length(), 1645 Environment* copy = Copy();
1629 fixed_parameter_count()); 1646 intptr_t use_index = 0;
1630 GrowableArray<Value*>* values_copy = copy->values_ptr(); 1647 for (EnvironmentIterator it(copy); !it.Done(); it.Advance()) {
1631 for (intptr_t i = 0; i < values().length(); ++i) { 1648 Value* value = it.CurrentValue();
1632 Value* value = values()[i]->Copy();
1633 values_copy->Add(value);
1634 value->set_instruction(instr); 1649 value->set_instruction(instr);
1635 value->set_use_index(i); 1650 value->set_use_index(use_index++);
1636 value->AddToEnvUseList(); 1651 value->AddToEnvUseList();
1637 } 1652 }
1638 instr->set_env(copy); 1653 instr->set_env(copy);
1639 } 1654 }
1640 1655
1641 1656
1642 #undef __ 1657 #undef __
1643 1658
1644 } // namespace dart 1659 } // 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