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

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

Issue 12638040: Compute local variable liveness before translation to SSA. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 } else { 3245 } else {
3246 // TODO(vegorov): this can be optimized for the case of a single 3246 // TODO(vegorov): this can be optimized for the case of a single
3247 // predecessor. 3247 // predecessor.
3248 // TODO(vegorov): this can be reordered to reduce amount of operations 3248 // TODO(vegorov): this can be reordered to reduce amount of operations
3249 // temp->CopyFrom(first_predecessor) 3249 // temp->CopyFrom(first_predecessor)
3250 temp->SetAll(); 3250 temp->SetAll();
3251 ASSERT(block->PredecessorCount() > 0); 3251 ASSERT(block->PredecessorCount() > 0);
3252 for (intptr_t i = 0; i < block->PredecessorCount(); i++) { 3252 for (intptr_t i = 0; i < block->PredecessorCount(); i++) {
3253 BlockEntryInstr* pred = block->PredecessorAt(i); 3253 BlockEntryInstr* pred = block->PredecessorAt(i);
3254 BitVector* pred_out = out_[pred->preorder_number()]; 3254 BitVector* pred_out = out_[pred->preorder_number()];
3255 temp->Intersect(*pred_out); 3255 temp->Intersect(pred_out);
3256 } 3256 }
3257 } 3257 }
3258 3258
3259 if (!temp->Equals(*block_in)) { 3259 if (!temp->Equals(*block_in)) {
3260 // If IN set has changed propagate the change to OUT set. 3260 // If IN set has changed propagate the change to OUT set.
3261 block_in->CopyFrom(temp); 3261 block_in->CopyFrom(temp);
3262 if (block_out->KillAndAdd(block_kill, block_in)) { 3262 if (block_out->KillAndAdd(block_kill, block_in)) {
3263 // If OUT set has changed then we have new values available out of 3263 // If OUT set has changed then we have new values available out of
3264 // the block. Compute these values creating phi where necessary. 3264 // the block. Compute these values creating phi where necessary.
3265 for (BitVector::Iterator it(block_out); 3265 for (BitVector::Iterator it(block_out);
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4428 // Drop the comparison, which does not have side effects as long 4428 // Drop the comparison, which does not have side effects as long
4429 // as it is a strict compare (the only one we can determine is 4429 // as it is a strict compare (the only one we can determine is
4430 // constant with the current analysis). 4430 // constant with the current analysis).
4431 GotoInstr* jump = new GotoInstr(join); 4431 GotoInstr* jump = new GotoInstr(join);
4432 Instruction* previous = branch->previous(); 4432 Instruction* previous = branch->previous();
4433 branch->set_previous(NULL); 4433 branch->set_previous(NULL);
4434 previous->LinkTo(jump); 4434 previous->LinkTo(jump);
4435 // Replace the false target entry with the new join entry. We will 4435 // Replace the false target entry with the new join entry. We will
4436 // recompute the dominators after this pass. 4436 // recompute the dominators after this pass.
4437 join->LinkTo(next); 4437 join->LinkTo(next);
4438 jump->SetEnvironment(branch->env());
Vyacheslav Egorov (Google) 2013/03/21 22:48:27 This change revealed serious flaw in the way we re
Kevin Millikin (Google) 2013/03/22 11:57:52 I wouldn't say it's a flaw in the way we restructu
4439 branch->SetEnvironment(NULL);
4438 branch->UnuseAllInputs(); 4440 branch->UnuseAllInputs();
4439 } 4441 }
4440 } 4442 }
4441 } 4443 }
4442 4444
4443 graph_->DiscoverBlocks(); 4445 graph_->DiscoverBlocks();
4444 GrowableArray<BitVector*> dominance_frontier; 4446 GrowableArray<BitVector*> dominance_frontier;
4445 graph_->ComputeDominators(&dominance_frontier); 4447 graph_->ComputeDominators(&dominance_frontier);
4446 4448
4447 if (FLAG_trace_constant_propagation) { 4449 if (FLAG_trace_constant_propagation) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
4627 if (changed) { 4629 if (changed) {
4628 // We may have changed the block order and the dominator tree. 4630 // We may have changed the block order and the dominator tree.
4629 flow_graph->DiscoverBlocks(); 4631 flow_graph->DiscoverBlocks();
4630 GrowableArray<BitVector*> dominance_frontier; 4632 GrowableArray<BitVector*> dominance_frontier;
4631 flow_graph->ComputeDominators(&dominance_frontier); 4633 flow_graph->ComputeDominators(&dominance_frontier);
4632 } 4634 }
4633 } 4635 }
4634 4636
4635 4637
4636 } // namespace dart 4638 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698