Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sts=4 et sw=4 tw=99:
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/. */
6 :
7 : #include "jit/EdgeCaseAnalysis.h"
8 :
9 : #include "jit/MIR.h"
10 : #include "jit/MIRGraph.h"
11 :
12 : using namespace js;
13 : using namespace js::jit;
14 :
15 8 : EdgeCaseAnalysis::EdgeCaseAnalysis(MIRGenerator* mir, MIRGraph& graph)
16 8 : : mir(mir), graph(graph)
17 : {
18 8 : }
19 :
20 : bool
21 8 : EdgeCaseAnalysis::analyzeLate()
22 : {
23 : // Renumber definitions for NeedNegativeZeroCheck under analyzeEdgeCasesBackward.
24 8 : uint32_t nextId = 0;
25 :
26 411 : for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++) {
27 1647 : for (MDefinitionIterator iter(*block); iter; iter++) {
28 1244 : if (mir->shouldCancel("Analyze Late (first loop)"))
29 0 : return false;
30 :
31 1244 : iter->setId(nextId++);
32 1244 : iter->analyzeEdgeCasesForward();
33 : }
34 403 : block->lastIns()->setId(nextId++);
35 : }
36 :
37 411 : for (PostorderIterator block(graph.poBegin()); block != graph.poEnd(); block++) {
38 1875 : for (MInstructionReverseIterator riter(block->rbegin()); riter != block->rend(); riter++) {
39 1472 : if (mir->shouldCancel("Analyze Late (second loop)"))
40 0 : return false;
41 :
42 1472 : riter->analyzeEdgeCasesBackward();
43 : }
44 : }
45 :
46 8 : return true;
47 : }
|