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

Unified 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 349fae043e8748a9ac110f9bca2ac7feafff515e..0d4f6f88036647806b8d10549a163648ee6c4df6 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1613,27 +1613,42 @@ void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
-Environment::Environment(const GrowableArray<Definition*>& definitions,
- intptr_t fixed_parameter_count)
- : values_(definitions.length()),
- locations_(NULL),
- fixed_parameter_count_(fixed_parameter_count) {
+Environment* Environment::From(const GrowableArray<Definition*>& definitions,
+ intptr_t fixed_parameter_count,
+ const Environment* outer) {
+ Environment* env =
+ new Environment(definitions.length(),
+ fixed_parameter_count,
+ Isolate::kNoDeoptId,
+ (outer == NULL) ? NULL : outer->Copy());
for (intptr_t i = 0; i < definitions.length(); ++i) {
- values_.Add(new Value(definitions[i]));
+ env->values_.Add(new Value(definitions[i]));
}
+ return env;
+}
+
+
+Environment* Environment::Copy() const {
+ Environment* copy =
+ new Environment(values_.length(),
+ fixed_parameter_count_,
+ deopt_id_,
+ (outer_ == NULL) ? NULL : outer_->Copy());
+ for (intptr_t i = 0; i < values_.length(); ++i) {
+ copy->values_.Add(values_[i]->Copy());
+ }
+ return copy;
}
// Copies the environment and updates the environment use lists.
void Environment::CopyTo(Instruction* instr) const {
- Environment* copy = new Environment(values().length(),
- fixed_parameter_count());
- GrowableArray<Value*>* values_copy = copy->values_ptr();
- for (intptr_t i = 0; i < values().length(); ++i) {
- Value* value = values()[i]->Copy();
- values_copy->Add(value);
+ Environment* copy = Copy();
+ intptr_t use_index = 0;
+ 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.
+ Value* value = it.CurrentValue();
value->set_instruction(instr);
- value->set_use_index(i);
+ value->set_use_index(use_index++);
value->AddToEnvUseList();
}
instr->set_env(copy);
« 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