From: titzer@chromium.org Date: Wed, 27 Nov 2013 07:13:00 +0000 (+0000) Subject: Avoid copying flow-sensitive state when only a goto separates blocks. X-Git-Tag: upstream/4.7.83~11538 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddb4ad853bbfe297c8ccfddaf479e211ac4e96e8;p=platform%2Fupstream%2Fv8.git Avoid copying flow-sensitive state when only a goto separates blocks. BUG= R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/48353007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18090 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/hydrogen-flow-engine.h b/src/hydrogen-flow-engine.h index dfe43ec..4e12755 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_));