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

Unified Diff: src/hydrogen.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 | « no previous file | src/hydrogen-sce.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index c4afb3be7df4be3b696987d60c5c34b389a20e67..5cc5e80e25e354d368c08cbe7594e6b0164c3431 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -40,6 +40,7 @@
#include "hydrogen-gvn.h"
#include "hydrogen-osr.h"
#include "hydrogen-range-analysis.h"
+#include "hydrogen-sce.h"
#include "hydrogen-uint32-analysis.h"
#include "lithium-allocator.h"
#include "parser.h"
@@ -2632,47 +2633,6 @@ void HGraph::InferTypes(ZoneList<HValue*>* worklist) {
}
-class HStackCheckEliminator BASE_EMBEDDED {
- public:
- explicit HStackCheckEliminator(HGraph* graph) : graph_(graph) { }
-
- void Process();
-
- private:
- HGraph* graph_;
-};
-
-
-void HStackCheckEliminator::Process() {
- HPhase phase("H_Stack check elimination", graph_);
- // 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);
- 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();
- }
- }
- }
-}
-
-
void HGraph::MergeRemovableSimulates() {
HPhase phase("H_Merge removable simulates", this);
ZoneList<HSimulate*> mergelist(2, zone());
@@ -3498,8 +3458,7 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
ComputeMinusZeroChecks();
// Eliminate redundant stack checks on backwards branches.
- HStackCheckEliminator sce(this);
- sce.Process();
+ Run<HStackCheckEliminationPhase>();
if (FLAG_idefs) SetupInformativeDefinitions();
if (FLAG_array_bounds_checks_elimination && !FLAG_idefs) {
« no previous file with comments | « no previous file | src/hydrogen-sce.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698