OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_VERIFIER_H_ | 5 #ifndef V8_COMPILER_VERIFIER_H_ |
6 #define V8_COMPILER_VERIFIER_H_ | 6 #define V8_COMPILER_VERIFIER_H_ |
7 | 7 |
8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 class Graph; | 14 class Graph; |
| 15 class Edge; |
| 16 class Node; |
15 class Schedule; | 17 class Schedule; |
16 | 18 |
17 // Verifies properties of a graph, such as the well-formedness of inputs to | 19 // Verifies properties of a graph, such as the well-formedness of inputs to |
18 // each node, etc. | 20 // each node, etc. |
19 class Verifier { | 21 class Verifier { |
20 public: | 22 public: |
21 enum Typing { TYPED, UNTYPED }; | 23 enum Typing { TYPED, UNTYPED }; |
22 | 24 |
23 static void Run(Graph* graph, Typing typing = TYPED); | 25 static void Run(Graph* graph, Typing typing = TYPED); |
24 | 26 |
| 27 #ifdef DEBUG |
| 28 // Verifies consistency of node inputs and uses: |
| 29 // - node inputs should agree with the input count computed from |
| 30 // the node's operator. |
| 31 // - effect inputs should have effect outputs. |
| 32 // - control inputs should have control outputs. |
| 33 // - frame state inputs should be frame states. |
| 34 // - if the node has control uses, it should produce control. |
| 35 // - if the node has effect uses, it should produce effect. |
| 36 // - if the node has frame state uses, it must be a frame state. |
| 37 static void VerifyNode(Node* node); |
| 38 |
| 39 // Verify that {replacement} has the required outputs |
| 40 // (effect, control or frame state) to be used as an input for {edge}. |
| 41 static void VerifyEdgeInputReplacement(const Edge& edge, |
| 42 const Node* replacement); |
| 43 #else |
| 44 static void VerifyNode(Node* node) {} |
| 45 static void VerifyEdgeInputReplacement(const Edge& edge, |
| 46 const Node* replacement) {} |
| 47 #endif // DEBUG |
| 48 |
25 private: | 49 private: |
26 class Visitor; | 50 class Visitor; |
27 DISALLOW_COPY_AND_ASSIGN(Verifier); | 51 DISALLOW_COPY_AND_ASSIGN(Verifier); |
28 }; | 52 }; |
29 | 53 |
30 // Verifies properties of a schedule, such as dominance, phi placement, etc. | 54 // Verifies properties of a schedule, such as dominance, phi placement, etc. |
31 class ScheduleVerifier { | 55 class ScheduleVerifier { |
32 public: | 56 public: |
33 static void Run(Schedule* schedule); | 57 static void Run(Schedule* schedule); |
34 }; | 58 }; |
35 } | 59 } |
36 } | 60 } |
37 } // namespace v8::internal::compiler | 61 } // namespace v8::internal::compiler |
38 | 62 |
39 #endif // V8_COMPILER_VERIFIER_H_ | 63 #endif // V8_COMPILER_VERIFIER_H_ |
OLD | NEW |