1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "jit/EdgeCaseAnalysis.h"
10 #include "jit/MIRGenerator.h"
11 #include "jit/MIRGraph.h"
14 using namespace js::jit
;
16 EdgeCaseAnalysis::EdgeCaseAnalysis(MIRGenerator
* mir
, MIRGraph
& graph
)
17 : mir(mir
), graph(graph
) {}
19 bool EdgeCaseAnalysis::analyzeLate() {
20 // Renumber definitions for NeedNegativeZeroCheck under
21 // analyzeEdgeCasesBackward.
24 for (ReversePostorderIterator
block(graph
.rpoBegin());
25 block
!= graph
.rpoEnd(); block
++) {
26 for (MDefinitionIterator
iter(*block
); iter
; iter
++) {
27 if (mir
->shouldCancel("Analyze Late (first loop)")) {
31 iter
->setId(nextId
++);
32 iter
->analyzeEdgeCasesForward();
34 block
->lastIns()->setId(nextId
++);
37 for (PostorderIterator
block(graph
.poBegin()); block
!= graph
.poEnd();
39 for (MInstructionReverseIterator
riter(block
->rbegin());
40 riter
!= block
->rend(); riter
++) {
41 if (mir
->shouldCancel("Analyze Late (second loop)")) {
45 riter
->analyzeEdgeCasesBackward();