deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / test / unittests / compiler / node-test-utils.h
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_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
6 #define V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
7
8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/machine-type.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11
12 namespace v8 {
13 namespace internal {
14
15 // Forward declarations.
16 class ExternalReference;
17 class HeapObject;
18 template <class T>
19 class Unique;
20
21 namespace compiler {
22
23 // Forward declarations.
24 class BufferAccess;
25 class CallDescriptor;
26 struct ElementAccess;
27 struct FieldAccess;
28 class Node;
29
30
31 using ::testing::Matcher;
32
33
34 Matcher<Node*> IsAlways();
35 Matcher<Node*> IsEnd(const Matcher<Node*>& control_matcher);
36 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
37                         const Matcher<Node*>& control_matcher);
38 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
39                        const Matcher<Node*>& control1_matcher);
40 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
41                        const Matcher<Node*>& control1_matcher,
42                        const Matcher<Node*>& control2_matcher);
43 Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
44                       const Matcher<Node*>& control1_matcher);
45 Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
46                       const Matcher<Node*>& control1_matcher,
47                       const Matcher<Node*>& control2_matcher);
48 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
49 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
50 Matcher<Node*> IsIfSuccess(const Matcher<Node*>& control_matcher);
51 Matcher<Node*> IsSwitch(const Matcher<Node*>& value_matcher,
52                         const Matcher<Node*>& control_matcher);
53 Matcher<Node*> IsIfValue(const Matcher<int32_t>& value_matcher,
54                          const Matcher<Node*>& control_matcher);
55 Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher);
56 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher);
57 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
58                         const Matcher<Node*>& effect_matcher);
59 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
60                         const Matcher<Node*>& effect_matcher,
61                         const Matcher<Node*>& control_matcher);
62 Matcher<Node*> IsExternalConstant(
63     const Matcher<ExternalReference>& value_matcher);
64 Matcher<Node*> IsHeapConstant(
65     const Matcher<Unique<HeapObject> >& value_matcher);
66 Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher);
67 Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
68 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
69 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
70 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
71 Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
72                         const Matcher<Node*>& value0_matcher,
73                         const Matcher<Node*>& value1_matcher,
74                         const Matcher<Node*>& value2_matcher);
75 Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
76                      const Matcher<Node*>& value0_matcher,
77                      const Matcher<Node*>& value1_matcher,
78                      const Matcher<Node*>& merge_matcher);
79 Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
80                      const Matcher<Node*>& value0_matcher,
81                      const Matcher<Node*>& value1_matcher,
82                      const Matcher<Node*>& value2_matcher,
83                      const Matcher<Node*>& merge_matcher);
84 Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
85                            const Matcher<Node*>& effect1_matcher,
86                            const Matcher<Node*>& merge_matcher);
87 Matcher<Node*> IsEffectSet(const Matcher<Node*>& effect0_matcher,
88                            const Matcher<Node*>& effect1_matcher);
89 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
90                             const Matcher<Node*>& base_matcher);
91 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
92                       const Matcher<Node*>& value0_matcher,
93                       const Matcher<Node*>& value1_matcher,
94                       const Matcher<Node*>& effect_matcher,
95                       const Matcher<Node*>& control_matcher);
96 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
97                       const Matcher<Node*>& value0_matcher,
98                       const Matcher<Node*>& value1_matcher,
99                       const Matcher<Node*>& value2_matcher,
100                       const Matcher<Node*>& value3_matcher,
101                       const Matcher<Node*>& effect_matcher,
102                       const Matcher<Node*>& control_matcher);
103
104 Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
105 Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
106                              const Matcher<Node*>& rhs_matcher);
107 Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
108                                 const Matcher<Node*>& rhs_matcher);
109 Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
110                                 const Matcher<Node*>& rhs_matcher);
111 Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
112                                 const Matcher<Node*>& rhs_matcher);
113 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
114                            const Matcher<Node*>& base_matcher,
115                            const Matcher<Node*>& effect_matcher,
116                            const Matcher<Node*>& control_matcher);
117 Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher,
118                             const Matcher<Node*>& base_matcher,
119                             const Matcher<Node*>& value_matcher,
120                             const Matcher<Node*>& effect_matcher,
121                             const Matcher<Node*>& control_matcher);
122 Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher,
123                             const Matcher<Node*>& buffer_matcher,
124                             const Matcher<Node*>& offset_matcher,
125                             const Matcher<Node*>& length_matcher,
126                             const Matcher<Node*>& effect_matcher,
127                             const Matcher<Node*>& control_matcher);
128 Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher,
129                              const Matcher<Node*>& buffer_matcher,
130                              const Matcher<Node*>& offset_matcher,
131                              const Matcher<Node*>& length_matcher,
132                              const Matcher<Node*>& value_matcher,
133                              const Matcher<Node*>& effect_matcher,
134                              const Matcher<Node*>& control_matcher);
135 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
136                              const Matcher<Node*>& base_matcher,
137                              const Matcher<Node*>& index_matcher,
138                              const Matcher<Node*>& control_matcher,
139                              const Matcher<Node*>& effect_matcher);
140 Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
141                               const Matcher<Node*>& base_matcher,
142                               const Matcher<Node*>& index_matcher,
143                               const Matcher<Node*>& value_matcher,
144                               const Matcher<Node*>& effect_matcher,
145                               const Matcher<Node*>& control_matcher);
146 Matcher<Node*> IsObjectIsSmi(const Matcher<Node*>& value_matcher);
147 Matcher<Node*> IsObjectIsNonNegativeSmi(const Matcher<Node*>& value_matcher);
148
149 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
150                       const Matcher<Node*>& base_matcher,
151                       const Matcher<Node*>& index_matcher,
152                       const Matcher<Node*>& effect_matcher,
153                       const Matcher<Node*>& control_matcher);
154 Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
155                        const Matcher<Node*>& base_matcher,
156                        const Matcher<Node*>& index_matcher,
157                        const Matcher<Node*>& value_matcher,
158                        const Matcher<Node*>& effect_matcher,
159                        const Matcher<Node*>& control_matcher);
160 Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
161                            const Matcher<Node*>& rhs_matcher);
162 Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
163                            const Matcher<Node*>& rhs_matcher);
164 Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
165                            const Matcher<Node*>& rhs_matcher);
166 Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher,
167                            const Matcher<Node*>& rhs_matcher);
168 Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
169                            const Matcher<Node*>& rhs_matcher);
170 Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
171                              const Matcher<Node*>& rhs_matcher);
172 Matcher<Node*> IsWord32Clz(const Matcher<Node*>& value_matcher);
173 Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
174                            const Matcher<Node*>& rhs_matcher);
175 Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
176                            const Matcher<Node*>& rhs_matcher);
177 Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher,
178                            const Matcher<Node*>& rhs_matcher);
179 Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher,
180                              const Matcher<Node*>& rhs_matcher);
181 Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher,
182                                       const Matcher<Node*>& rhs_matcher);
183 Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher,
184                           const Matcher<Node*>& rhs_matcher);
185 Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher,
186                           const Matcher<Node*>& rhs_matcher);
187 Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher,
188                           const Matcher<Node*>& rhs_matcher);
189 Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher,
190                               const Matcher<Node*>& rhs_matcher);
191 Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher,
192                                const Matcher<Node*>& rhs_matcher);
193 Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher,
194                                 const Matcher<Node*>& rhs_matcher);
195 Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
196                                        const Matcher<Node*>& rhs_matcher);
197 Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
198 Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher);
199 Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
200 Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
201 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
202 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
203 Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
204 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher);
205 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
206 Matcher<Node*> IsFloat64Max(const Matcher<Node*>& lhs_matcher,
207                             const Matcher<Node*>& rhs_matcher);
208 Matcher<Node*> IsFloat64Min(const Matcher<Node*>& lhs_matcher,
209                             const Matcher<Node*>& rhs_matcher);
210 Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher,
211                             const Matcher<Node*>& rhs_matcher);
212 Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
213 Matcher<Node*> IsFloat64RoundDown(const Matcher<Node*>& input_matcher);
214 Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
215 Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
216 Matcher<Node*> IsFloat64ExtractLowWord32(const Matcher<Node*>& input_matcher);
217 Matcher<Node*> IsFloat64ExtractHighWord32(const Matcher<Node*>& input_matcher);
218 Matcher<Node*> IsFloat64InsertLowWord32(const Matcher<Node*>& lhs_matcher,
219                                         const Matcher<Node*>& rhs_matcher);
220 Matcher<Node*> IsFloat64InsertHighWord32(const Matcher<Node*>& lhs_matcher,
221                                          const Matcher<Node*>& rhs_matcher);
222 Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
223                           const Matcher<Node*>& context_matcher,
224                           const Matcher<Node*>& effect_matcher,
225                           const Matcher<Node*>& control_matcher);
226 Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
227 Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher);
228
229 }  // namespace compiler
230 }  // namespace internal
231 }  // namespace v8
232
233 #endif  // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_