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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 784223006: Adjust environments we attach to the block entries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 8476a7c8491bd9c45630bacf2cf32fda3c11bddb..a4d70faf9b5a513af6b9a315108e3234a4cefd57 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -739,11 +739,17 @@ void Instruction::UnuseAllInputs() {
}
-void Instruction::InheritDeoptTargetAfter(Isolate* isolate,
- Instruction* other) {
- ASSERT(other->env() != NULL);
- deopt_id_ = Isolate::ToDeoptAfter(other->deopt_id_);
- other->env()->DeepCopyTo(isolate, this);
+void Instruction::InheritDeoptTargetAfter(FlowGraph* flow_graph,
+ Definition* call,
+ Definition* result) {
+ ASSERT(call->env() != NULL);
+ deopt_id_ = Isolate::ToDeoptAfter(call->deopt_id_);
+ call->env()->DeepCopyAfterTo(flow_graph->isolate(),
+ this,
+ call->ArgumentCount(),
+ flow_graph->constant_dead(),
+ result != NULL ? result
+ : flow_graph->constant_dead());
env()->set_deopt_id(deopt_id_);
}
@@ -3027,6 +3033,29 @@ void Environment::DeepCopyTo(Isolate* isolate, Instruction* instr) const {
}
+void Environment::DeepCopyAfterTo(Isolate* isolate,
+ Instruction* instr,
+ intptr_t argc,
+ Definition* dead,
+ Definition* result) const {
+ for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
+ it.CurrentValue()->RemoveFromUseList();
+ }
+
+ Environment* copy = DeepCopy(isolate, values_.length() - argc);
+ for (intptr_t i = 0; i < argc; i++) {
+ copy->values_.Add(new(isolate) Value(dead));
+ }
+ copy->values_.Add(new(isolate) Value(result));
+
+ instr->SetEnvironment(copy);
+ for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
+ Value* value = it.CurrentValue();
+ value->definition()->AddEnvUse(value);
+ }
+}
+
+
// Copies the environment as outer on an inlined instruction and updates the
// environment use lists.
void Environment::DeepCopyToOuter(Isolate* isolate, Instruction* instr) const {
« runtime/vm/flow_graph_range_analysis.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698