Index: src/hydrogen-sce.cc |
diff --git a/src/a64/frames-a64.cc b/src/hydrogen-sce.cc |
similarity index 62% |
copy from src/a64/frames-a64.cc |
copy to src/hydrogen-sce.cc |
index b1764e0c5fc4b2d8dc4567931990170da2dccaa0..a6995f647afc00437783f057110c7654a28265c3 100644 |
--- a/src/a64/frames-a64.cc |
+++ b/src/hydrogen-sce.cc |
@@ -25,27 +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-sce.h" |
#include "v8.h" |
-#if defined(V8_TARGET_ARCH_A64) |
- |
-#include "assembler.h" |
-#include "assembler-a64.h" |
-#include "assembler-a64-inl.h" |
-#include "frames.h" |
- |
namespace v8 { |
namespace internal { |
- |
-Register JavaScriptFrame::fp_register() { return v8::internal::fp; } |
-Register JavaScriptFrame::context_register() { return cp; } |
- |
- |
-Register StubFailureTrampolineFrame::fp_register() { return v8::internal::fp; } |
-Register StubFailureTrampolineFrame::context_register() { return cp; } |
- |
+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); |
+ 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 |
- |
-#endif // V8_TARGET_ARCH_A64 |