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

Unified Diff: src/hydrogen-sce.cc

Issue 18816002: Turn stack check elimination into proper HPhase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « src/hydrogen-sce.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-sce.cc
diff --git a/src/hydrogen-escape-analysis.cc b/src/hydrogen-sce.cc
similarity index 63%
copy from src/hydrogen-escape-analysis.cc
copy to src/hydrogen-sce.cc
index e852fb8d6d75d7756df6e4e03399bfb8789d4c76..a6995f647afc00437783f057110c7654a28265c3 100644
--- a/src/hydrogen-escape-analysis.cc
+++ b/src/hydrogen-sce.cc
@@ -25,42 +25,38 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "hydrogen-escape-analysis.h"
+#include "hydrogen-sce.h"
+#include "v8.h"
namespace v8 {
namespace internal {
-
-void HEscapeAnalysisPhase::CollectIfNoEscapingUses(HInstruction* instr) {
- for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
- HValue* use = it.value();
- if (use->HasEscapingOperandAt(it.index())) {
- if (FLAG_trace_escape_analysis) {
- PrintF("#%d (%s) escapes through #%d (%s) @%d\n", instr->id(),
- instr->Mnemonic(), use->id(), use->Mnemonic(), it.index());
- }
- return;
- }
- }
- if (FLAG_trace_escape_analysis) {
- PrintF("#%d (%s) is being captured\n", instr->id(), instr->Mnemonic());
- }
- captured_.Add(instr, zone());
-}
-
-
-void HEscapeAnalysisPhase::CollectCapturedValues() {
- int block_count = graph()->blocks()->length();
- for (int i = 0; i < block_count; ++i) {
+void HStackCheckEliminationPhase::Run() {
+ // For each loop block walk the dominator tree from the backwards branch to
+ // the loop header. If a call instruction is encountered the backwards branch
+ // is dominated by a call and the stack check in the backwards branch can be
+ // removed.
+ for (int i = 0; i < graph()->blocks()->length(); i++) {
HBasicBlock* block = graph()->blocks()->at(i);
- for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
- HInstruction* instr = it.Current();
- if (instr->IsAllocate() || instr->IsAllocateObject()) {
- CollectIfNoEscapingUses(instr);
+ if (block->IsLoopHeader()) {
+ HBasicBlock* back_edge = block->loop_information()->GetLastBackEdge();
+ HBasicBlock* dominator = back_edge;
+ while (true) {
+ for (HInstructionIterator it(dominator); !it.Done(); it.Advance()) {
+ if (it.Current()->IsCall()) {
+ block->loop_information()->stack_check()->Eliminate();
+ break;
+ }
+ }
+
+ // Done when the loop header is processed.
+ if (dominator == block) break;
+
+ // Move up the dominator tree.
+ dominator = dominator->dominator();
}
}
}
}
-
} } // namespace v8::internal
« no previous file with comments | « src/hydrogen-sce.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698