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

Unified Diff: src/hydrogen-flow-engine.h

Issue 48353007: Avoid copying flow-sensitive state when only a goto separates blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-flow-engine.h
diff --git a/src/hydrogen-flow-engine.h b/src/hydrogen-flow-engine.h
index dfe43ec6c3ba94b3c38ee2aa2fb4c561ea390919..4e1275546f611e2401e467484976f73d59b3e784 100644
--- a/src/hydrogen-flow-engine.h
+++ b/src/hydrogen-flow-engine.h
@@ -138,12 +138,19 @@ class HFlowEngine {
}
// Propagate the block state forward to all successor blocks.
- for (int i = 0; i < block->end()->SuccessorCount(); i++) {
+ int max = block->end()->SuccessorCount();
+ for (int i = 0; i < max; i++) {
HBasicBlock* succ = block->end()->SuccessorAt(i);
IncrementPredecessorCount(succ);
if (StateAt(succ) == NULL) {
// This is the first state to reach the successor.
- SetStateAt(succ, state->Copy(succ, zone_));
+ if (max == 1 && succ->predecessors()->length() == 1) {
+ // Optimization: successor can inherit this state.
+ SetStateAt(succ, state);
+ } else {
+ // Successor needs a copy of the state.
+ SetStateAt(succ, state->Copy(succ, zone_));
+ }
} else {
// Merge the current state with the state already at the successor.
SetStateAt(succ, state->Merge(succ, StateAt(succ), zone_));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698