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

Unified Diff: runtime/vm/flow_graph.cc

Issue 14942010: Eliminate temporary locals for some expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph.cc
===================================================================
--- runtime/vm/flow_graph.cc (revision 23243)
+++ runtime/vm/flow_graph.cc (working copy)
@@ -418,6 +418,7 @@
LoadLocalInstr* load = current->AsLoadLocal();
if (load != NULL) {
const intptr_t index = load->local().BitIndexIn(num_non_copied_params_);
+ if (index >= live_in->length()) continue; // Skip tmp_locals.
live_in->Add(index);
if (!last_loads->Contains(index)) {
last_loads->Add(index);
@@ -774,6 +775,8 @@
Definition* input_defn = v->definition();
if (input_defn->IsLoadLocal() ||
input_defn->IsStoreLocal() ||
+ input_defn->IsPushTemp() ||
+ input_defn->IsDropTemps() ||
input_defn->IsConstant()) {
// Remove the load/store from the graph.
input_defn->RemoveFromGraph();
@@ -795,8 +798,14 @@
if (definition != NULL) {
LoadLocalInstr* load = definition->AsLoadLocal();
StoreLocalInstr* store = definition->AsStoreLocal();
+ PushTempInstr* push = definition->AsPushTemp();
+ DropTempsInstr* drop = definition->AsDropTemps();
ConstantInstr* constant = definition->AsConstant();
- if ((load != NULL) || (store != NULL) || (constant != NULL)) {
+ if ((load != NULL) ||
+ (store != NULL) ||
+ (push != NULL) ||
+ (drop != NULL) ||
+ (constant != NULL)) {
intptr_t index;
Definition* result;
if (store != NULL) {
@@ -825,6 +834,17 @@
if (variable_liveness->IsLastLoad(block_entry, load)) {
(*env)[index] = constant_null();
}
+ } else if (push != NULL) {
+ result = push->value()->definition();
+ env->Add(result);
+ it.RemoveCurrentFromGraph();
+ continue;
+ } else if (drop != NULL) {
+ // Drop temps from the environment.
+ for (intptr_t j = 0; j < drop->num_temps(); j++) {
+ env->RemoveLast();
+ }
+ result = drop->value()->definition();
} else {
ASSERT(definition->is_used());
result = GetConstant(constant->value());
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698