OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | |
6 #define V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | |
7 | |
8 #include "src/compiler/graph.h" | |
9 #include "src/compiler/machine-operator.h" | |
10 #include "test/compiler-unittests/common-operator-unittest.h" | |
11 #include "testing/gmock/include/gmock/gmock.h" | |
12 | |
13 namespace v8 { | |
14 namespace internal { | |
15 | |
16 // Forward declarations. | |
17 class HeapObject; | |
18 template <class T> | |
19 class PrintableUnique; | |
20 | |
21 namespace compiler { | |
22 | |
23 using ::testing::Matcher; | |
24 | |
25 | |
26 class GraphTest : public CommonOperatorTest { | |
27 public: | |
28 explicit GraphTest(int parameters = 1); | |
29 virtual ~GraphTest(); | |
30 | |
31 protected: | |
32 Node* Parameter(int32_t index); | |
33 Node* Float64Constant(double value); | |
34 Node* Int32Constant(int32_t value); | |
35 Node* Int64Constant(int64_t value); | |
36 Node* NumberConstant(double value); | |
37 Node* HeapConstant(const PrintableUnique<HeapObject>& value); | |
38 Node* FalseConstant(); | |
39 Node* TrueConstant(); | |
40 | |
41 Matcher<Node*> IsFalseConstant(); | |
42 Matcher<Node*> IsTrueConstant(); | |
43 | |
44 Graph* graph() { return &graph_; } | |
45 | |
46 private: | |
47 Graph graph_; | |
48 }; | |
49 | |
50 | |
51 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, | |
52 const Matcher<Node*>& control_matcher); | |
53 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, | |
54 const Matcher<Node*>& control1_matcher); | |
55 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); | |
56 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); | |
57 Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher); | |
58 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher); | |
59 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, | |
60 const Matcher<Node*>& effect_matcher); | |
61 Matcher<Node*> IsExternalConstant( | |
62 const Matcher<ExternalReference>& value_matcher); | |
63 Matcher<Node*> IsHeapConstant( | |
64 const Matcher<PrintableUnique<HeapObject> >& value_matcher); | |
65 Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher); | |
66 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); | |
67 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher); | |
68 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher); | |
69 Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, | |
70 const Matcher<Node*>& value1_matcher, | |
71 const Matcher<Node*>& merge_matcher); | |
72 Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, | |
73 const Matcher<Node*>& base_matcher); | |
74 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, | |
75 const Matcher<Node*>& value0_matcher, | |
76 const Matcher<Node*>& value1_matcher, | |
77 const Matcher<Node*>& value2_matcher, | |
78 const Matcher<Node*>& value3_matcher, | |
79 const Matcher<Node*>& effect_matcher, | |
80 const Matcher<Node*>& control_matcher); | |
81 | |
82 Matcher<Node*> IsLoad(const Matcher<MachineType>& type_matcher, | |
83 const Matcher<Node*>& base_matcher, | |
84 const Matcher<Node*>& index_matcher, | |
85 const Matcher<Node*>& effect_matcher); | |
86 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, | |
87 const Matcher<WriteBarrierKind>& write_barrier_matcher, | |
88 const Matcher<Node*>& base_matcher, | |
89 const Matcher<Node*>& index_matcher, | |
90 const Matcher<Node*>& value_matcher, | |
91 const Matcher<Node*>& effect_matcher, | |
92 const Matcher<Node*>& control_matcher); | |
93 Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher, | |
94 const Matcher<Node*>& rhs_matcher); | |
95 Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher, | |
96 const Matcher<Node*>& rhs_matcher); | |
97 Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher, | |
98 const Matcher<Node*>& rhs_matcher); | |
99 Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher, | |
100 const Matcher<Node*>& rhs_matcher); | |
101 Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher, | |
102 const Matcher<Node*>& rhs_matcher); | |
103 Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher, | |
104 const Matcher<Node*>& rhs_matcher); | |
105 Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher, | |
106 const Matcher<Node*>& rhs_matcher); | |
107 Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher, | |
108 const Matcher<Node*>& rhs_matcher); | |
109 Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher, | |
110 const Matcher<Node*>& rhs_matcher); | |
111 Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher, | |
112 const Matcher<Node*>& rhs_matcher); | |
113 Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher, | |
114 const Matcher<Node*>& rhs_matcher); | |
115 Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher); | |
116 Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher); | |
117 Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher); | |
118 Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher); | |
119 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); | |
120 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); | |
121 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); | |
122 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); | |
123 | |
124 } // namespace compiler | |
125 } // namespace internal | |
126 } // namespace v8 | |
127 | |
128 #endif // V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | |
OLD | NEW |