Line data Source code
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/simplified-operator.h"
10 : #include "src/machine-type.h"
11 : #include "testing/gmock/include/gmock/gmock.h"
12 :
13 : namespace v8 {
14 : namespace internal {
15 :
16 : // Forward declarations.
17 : class ExternalReference;
18 : template <typename T>
19 : class Handle;
20 : class HeapObject;
21 : class Type;
22 : enum TypeofMode : int;
23 :
24 : namespace compiler {
25 :
26 : // Forward declarations.
27 : class BufferAccess;
28 : class CallDescriptor;
29 : class ContextAccess;
30 : struct ElementAccess;
31 : struct FieldAccess;
32 : class Node;
33 :
34 :
35 : using ::testing::Matcher;
36 :
37 : #define SPECULATIVE_BINOPS(V) \
38 : V(SpeculativeNumberAdd) \
39 : V(SpeculativeNumberSubtract) \
40 : V(SpeculativeNumberShiftLeft) \
41 : V(SpeculativeNumberShiftRight) \
42 : V(SpeculativeNumberShiftRightLogical) \
43 : V(SpeculativeNumberBitwiseAnd) \
44 : V(SpeculativeNumberBitwiseOr) \
45 : V(SpeculativeNumberBitwiseXor)
46 :
47 : Matcher<Node*> IsDead();
48 : Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher);
49 : Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
50 : const Matcher<Node*>& control1_matcher);
51 : Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
52 : const Matcher<Node*>& control1_matcher,
53 : const Matcher<Node*>& control2_matcher);
54 : Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
55 : const Matcher<Node*>& control_matcher);
56 : Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
57 : const Matcher<Node*>& control1_matcher);
58 : Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
59 : const Matcher<Node*>& control1_matcher,
60 : const Matcher<Node*>& control2_matcher);
61 : Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
62 : const Matcher<Node*>& control1_matcher);
63 : Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
64 : const Matcher<Node*>& control1_matcher,
65 : const Matcher<Node*>& control2_matcher);
66 : Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
67 : Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
68 : Matcher<Node*> IsIfSuccess(const Matcher<Node*>& control_matcher);
69 : Matcher<Node*> IsSwitch(const Matcher<Node*>& value_matcher,
70 : const Matcher<Node*>& control_matcher);
71 : Matcher<Node*> IsIfValue(const Matcher<int32_t>& value_matcher,
72 : const Matcher<Node*>& control_matcher);
73 : Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher);
74 : Matcher<Node*> IsBeginRegion(const Matcher<Node*>& effect_matcher);
75 : Matcher<Node*> IsFinishRegion(const Matcher<Node*>& value_matcher,
76 : const Matcher<Node*>& effect_matcher);
77 : Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
78 : const Matcher<Node*>& effect_matcher,
79 : const Matcher<Node*>& control_matcher);
80 : Matcher<Node*> IsReturn2(const Matcher<Node*>& value_matcher,
81 : const Matcher<Node*>& value2_matcher,
82 : const Matcher<Node*>& effect_matcher,
83 : const Matcher<Node*>& control_matcher);
84 : Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher,
85 : const Matcher<Node*>& control_matcher);
86 : Matcher<Node*> IsTypeGuard(const Matcher<Node*>& value_matcher,
87 : const Matcher<Node*>& control_matcher);
88 : Matcher<Node*> IsExternalConstant(
89 : const Matcher<ExternalReference>& value_matcher);
90 : Matcher<Node*> IsHeapConstant(Handle<HeapObject> value);
91 : Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher);
92 : Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
93 : Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
94 : Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
95 : Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
96 : Matcher<Node*> IsPointerConstant(const Matcher<intptr_t>& value_matcher);
97 : Matcher<Node*> IsSelect(const Matcher<MachineRepresentation>& type_matcher,
98 : const Matcher<Node*>& value0_matcher,
99 : const Matcher<Node*>& value1_matcher,
100 : const Matcher<Node*>& value2_matcher);
101 : Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
102 : const Matcher<Node*>& value0_matcher,
103 : const Matcher<Node*>& value1_matcher,
104 : const Matcher<Node*>& merge_matcher);
105 : Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
106 : const Matcher<Node*>& value0_matcher,
107 : const Matcher<Node*>& value1_matcher,
108 : const Matcher<Node*>& value2_matcher,
109 : const Matcher<Node*>& merge_matcher);
110 : Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
111 : const Matcher<Node*>& effect1_matcher,
112 : const Matcher<Node*>& merge_matcher);
113 : Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
114 : const Matcher<Node*>& base_matcher);
115 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
116 : const Matcher<Node*>& value0_matcher,
117 : const Matcher<Node*>& effect_matcher,
118 : const Matcher<Node*>& control_matcher);
119 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
120 : const Matcher<Node*>& value0_matcher,
121 : const Matcher<Node*>& value1_matcher,
122 : const Matcher<Node*>& effect_matcher,
123 : const Matcher<Node*>& control_matcher);
124 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
125 : const Matcher<Node*>& value0_matcher,
126 : const Matcher<Node*>& value1_matcher,
127 : const Matcher<Node*>& value2_matcher,
128 : const Matcher<Node*>& effect_matcher,
129 : const Matcher<Node*>& control_matcher);
130 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
131 : const Matcher<Node*>& value0_matcher,
132 : const Matcher<Node*>& value1_matcher,
133 : const Matcher<Node*>& value2_matcher,
134 : const Matcher<Node*>& value3_matcher,
135 : const Matcher<Node*>& effect_matcher,
136 : const Matcher<Node*>& control_matcher);
137 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
138 : const Matcher<Node*>& value0_matcher,
139 : const Matcher<Node*>& value1_matcher,
140 : const Matcher<Node*>& value2_matcher,
141 : const Matcher<Node*>& value3_matcher,
142 : const Matcher<Node*>& value4_matcher,
143 : const Matcher<Node*>& effect_matcher,
144 : const Matcher<Node*>& control_matcher);
145 : Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
146 : const Matcher<Node*>& value0_matcher,
147 : const Matcher<Node*>& value1_matcher,
148 : const Matcher<Node*>& value2_matcher,
149 : const Matcher<Node*>& value3_matcher,
150 : const Matcher<Node*>& value4_matcher,
151 : const Matcher<Node*>& value5_matcher,
152 : const Matcher<Node*>& effect_matcher,
153 : const Matcher<Node*>& control_matcher);
154 : Matcher<Node*> IsCall(
155 : const Matcher<const CallDescriptor*>& descriptor_matcher,
156 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
157 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
158 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
159 : const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
160 : const Matcher<Node*>& control_matcher);
161 : Matcher<Node*> IsTailCall(
162 : const Matcher<CallDescriptor const*>& descriptor_matcher,
163 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
164 : const Matcher<Node*>& effect_matcher,
165 : const Matcher<Node*>& control_matcher);
166 : Matcher<Node*> IsTailCall(
167 : const Matcher<CallDescriptor const*>& descriptor_matcher,
168 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
169 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& effect_matcher,
170 : const Matcher<Node*>& control_matcher);
171 : Matcher<Node*> IsTailCall(
172 : const Matcher<CallDescriptor const*>& descriptor_matcher,
173 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
174 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
175 : const Matcher<Node*>& effect_matcher,
176 : const Matcher<Node*>& control_matcher);
177 : Matcher<Node*> IsTailCall(
178 : const Matcher<CallDescriptor const*>& descriptor_matcher,
179 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
180 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
181 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& effect_matcher,
182 : const Matcher<Node*>& control_matcher);
183 : Matcher<Node*> IsTailCall(
184 : const Matcher<CallDescriptor const*>& descriptor_matcher,
185 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
186 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
187 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
188 : const Matcher<Node*>& effect_matcher,
189 : const Matcher<Node*>& control_matcher);
190 : Matcher<Node*> IsTailCall(
191 : const Matcher<CallDescriptor const*>& descriptor_matcher,
192 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
193 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
194 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
195 : const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
196 : const Matcher<Node*>& control_matcher);
197 : Matcher<Node*> IsTailCall(
198 : const Matcher<CallDescriptor const*>& descriptor_matcher,
199 : const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
200 : const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
201 : const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
202 : const Matcher<Node*>& value6_matcher, const Matcher<Node*>& value7_matcher,
203 : const Matcher<Node*>& effect_matcher,
204 : const Matcher<Node*>& control_matcher);
205 :
206 :
207 : Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
208 : Matcher<Node*> IsReferenceEqual(const Matcher<Node*>& lhs_matcher,
209 : const Matcher<Node*>& rhs_matcher);
210 : Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
211 : const Matcher<Node*>& rhs_matcher);
212 : Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
213 : const Matcher<Node*>& rhs_matcher);
214 : Matcher<Node*> IsNumberAdd(const Matcher<Node*>& lhs_matcher,
215 : const Matcher<Node*>& rhs_matcher);
216 :
217 : #define DECLARE_SPECULATIVE_BINOP_MATCHER(opcode) \
218 : Matcher<Node*> Is##opcode(const Matcher<NumberOperationHint>& hint_matcher, \
219 : const Matcher<Node*>& lhs_matcher, \
220 : const Matcher<Node*>& rhs_matcher, \
221 : const Matcher<Node*>& effect_matcher, \
222 : const Matcher<Node*>& control_matcher);
223 : SPECULATIVE_BINOPS(DECLARE_SPECULATIVE_BINOP_MATCHER);
224 : #undef DECLARE_SPECULATIVE_BINOP_MATCHER
225 :
226 : Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
227 : const Matcher<Node*>& rhs_matcher);
228 : Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
229 : const Matcher<Node*>& rhs_matcher);
230 : Matcher<Node*> IsNumberShiftLeft(const Matcher<Node*>& lhs_matcher,
231 : const Matcher<Node*>& rhs_matcher);
232 : Matcher<Node*> IsNumberShiftRight(const Matcher<Node*>& lhs_matcher,
233 : const Matcher<Node*>& rhs_matcher);
234 : Matcher<Node*> IsNumberShiftRightLogical(const Matcher<Node*>& lhs_matcher,
235 : const Matcher<Node*>& rhs_matcher);
236 : Matcher<Node*> IsNumberImul(const Matcher<Node*>& lhs_matcher,
237 : const Matcher<Node*>& rhs_matcher);
238 : Matcher<Node*> IsNumberAbs(const Matcher<Node*>& value_matcher);
239 : Matcher<Node*> IsNumberAcos(const Matcher<Node*>& value_matcher);
240 : Matcher<Node*> IsNumberAcosh(const Matcher<Node*>& value_matcher);
241 : Matcher<Node*> IsNumberAsin(const Matcher<Node*>& value_matcher);
242 : Matcher<Node*> IsNumberAsinh(const Matcher<Node*>& value_matcher);
243 : Matcher<Node*> IsNumberAtan(const Matcher<Node*>& value_matcher);
244 : Matcher<Node*> IsNumberAtanh(const Matcher<Node*>& value_matcher);
245 : Matcher<Node*> IsNumberAtan2(const Matcher<Node*>& lhs_matcher,
246 : const Matcher<Node*>& rhs_matcher);
247 : Matcher<Node*> IsNumberCbrt(const Matcher<Node*>& value_matcher);
248 : Matcher<Node*> IsNumberCeil(const Matcher<Node*>& value_matcher);
249 : Matcher<Node*> IsNumberClz32(const Matcher<Node*>& value_matcher);
250 : Matcher<Node*> IsNumberCos(const Matcher<Node*>& value_matcher);
251 : Matcher<Node*> IsNumberCosh(const Matcher<Node*>& value_matcher);
252 : Matcher<Node*> IsNumberExp(const Matcher<Node*>& value_matcher);
253 : Matcher<Node*> IsNumberExpm1(const Matcher<Node*>& value_matcher);
254 : Matcher<Node*> IsNumberFloor(const Matcher<Node*>& value_matcher);
255 : Matcher<Node*> IsNumberFround(const Matcher<Node*>& value_matcher);
256 : Matcher<Node*> IsNumberLog(const Matcher<Node*>& value_matcher);
257 : Matcher<Node*> IsNumberLog1p(const Matcher<Node*>& value_matcher);
258 : Matcher<Node*> IsNumberLog10(const Matcher<Node*>& value_matcher);
259 : Matcher<Node*> IsNumberLog2(const Matcher<Node*>& value_matcher);
260 : Matcher<Node*> IsNumberMax(const Matcher<Node*>& lhs_matcher,
261 : const Matcher<Node*>& rhs_matcher);
262 : Matcher<Node*> IsNumberMin(const Matcher<Node*>& lhs_matcher,
263 : const Matcher<Node*>& rhs_matcher);
264 : Matcher<Node*> IsNumberRound(const Matcher<Node*>& value_matcher);
265 : Matcher<Node*> IsNumberPow(const Matcher<Node*>& lhs_matcher,
266 : const Matcher<Node*>& rhs_matcher);
267 : Matcher<Node*> IsNumberSign(const Matcher<Node*>& value_matcher);
268 : Matcher<Node*> IsNumberSin(const Matcher<Node*>& value_matcher);
269 : Matcher<Node*> IsNumberSinh(const Matcher<Node*>& value_matcher);
270 : Matcher<Node*> IsNumberSqrt(const Matcher<Node*>& value_matcher);
271 : Matcher<Node*> IsNumberTan(const Matcher<Node*>& value_matcher);
272 : Matcher<Node*> IsNumberTanh(const Matcher<Node*>& value_matcher);
273 : Matcher<Node*> IsNumberTrunc(const Matcher<Node*>& value_matcher);
274 : Matcher<Node*> IsStringFromCharCode(const Matcher<Node*>& value_matcher);
275 : Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher,
276 : const Matcher<Node*>& effect_matcher,
277 : const Matcher<Node*>& control_matcher);
278 : Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
279 : const Matcher<Node*>& base_matcher,
280 : const Matcher<Node*>& effect_matcher,
281 : const Matcher<Node*>& control_matcher);
282 : Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher,
283 : const Matcher<Node*>& base_matcher,
284 : const Matcher<Node*>& value_matcher,
285 : const Matcher<Node*>& effect_matcher,
286 : const Matcher<Node*>& control_matcher);
287 : Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher,
288 : const Matcher<Node*>& buffer_matcher,
289 : const Matcher<Node*>& offset_matcher,
290 : const Matcher<Node*>& length_matcher,
291 : const Matcher<Node*>& effect_matcher,
292 : const Matcher<Node*>& control_matcher);
293 : Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher,
294 : const Matcher<Node*>& buffer_matcher,
295 : const Matcher<Node*>& offset_matcher,
296 : const Matcher<Node*>& length_matcher,
297 : const Matcher<Node*>& value_matcher,
298 : const Matcher<Node*>& effect_matcher,
299 : const Matcher<Node*>& control_matcher);
300 : Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
301 : const Matcher<Node*>& base_matcher,
302 : const Matcher<Node*>& index_matcher,
303 : const Matcher<Node*>& control_matcher,
304 : const Matcher<Node*>& effect_matcher);
305 : Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
306 : const Matcher<Node*>& base_matcher,
307 : const Matcher<Node*>& index_matcher,
308 : const Matcher<Node*>& value_matcher,
309 : const Matcher<Node*>& effect_matcher,
310 : const Matcher<Node*>& control_matcher);
311 : Matcher<Node*> IsObjectIsNaN(const Matcher<Node*>& value_matcher);
312 : Matcher<Node*> IsObjectIsReceiver(const Matcher<Node*>& value_matcher);
313 : Matcher<Node*> IsObjectIsSmi(const Matcher<Node*>& value_matcher);
314 : Matcher<Node*> IsObjectIsUndetectable(const Matcher<Node*>& value_matcher);
315 :
316 : Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
317 : const Matcher<Node*>& base_matcher,
318 : const Matcher<Node*>& index_matcher,
319 : const Matcher<Node*>& effect_matcher,
320 : const Matcher<Node*>& control_matcher);
321 : Matcher<Node*> IsUnalignedLoad(
322 : const Matcher<UnalignedLoadRepresentation>& rep_matcher,
323 : const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher,
324 : const Matcher<Node*>& effect_matcher,
325 : const Matcher<Node*>& control_matcher);
326 : Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
327 : const Matcher<Node*>& base_matcher,
328 : const Matcher<Node*>& index_matcher,
329 : const Matcher<Node*>& value_matcher,
330 : const Matcher<Node*>& effect_matcher,
331 : const Matcher<Node*>& control_matcher);
332 : Matcher<Node*> IsUnalignedStore(
333 : const Matcher<UnalignedStoreRepresentation>& rep_matcher,
334 : const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher,
335 : const Matcher<Node*>& value_matcher, const Matcher<Node*>& effect_matcher,
336 : const Matcher<Node*>& control_matcher);
337 : Matcher<Node*> IsStackSlot(const Matcher<StackSlotRepresentation>& rep_matcher);
338 : Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
339 : const Matcher<Node*>& rhs_matcher);
340 : Matcher<Node*> IsWord32Or(const Matcher<Node*>& lhs_matcher,
341 : const Matcher<Node*>& rhs_matcher);
342 : Matcher<Node*> IsWord32Xor(const Matcher<Node*>& lhs_matcher,
343 : const Matcher<Node*>& rhs_matcher);
344 : Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
345 : const Matcher<Node*>& rhs_matcher);
346 : Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
347 : const Matcher<Node*>& rhs_matcher);
348 : Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher,
349 : const Matcher<Node*>& rhs_matcher);
350 : Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
351 : const Matcher<Node*>& rhs_matcher);
352 : Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
353 : const Matcher<Node*>& rhs_matcher);
354 : Matcher<Node*> IsWord32Clz(const Matcher<Node*>& value_matcher);
355 : Matcher<Node*> IsWord32Ctz(const Matcher<Node*>& value_matcher);
356 : Matcher<Node*> IsWord32Popcnt(const Matcher<Node*>& value_matcher);
357 : Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
358 : const Matcher<Node*>& rhs_matcher);
359 : Matcher<Node*> IsWord64Or(const Matcher<Node*>& lhs_matcher,
360 : const Matcher<Node*>& rhs_matcher);
361 : Matcher<Node*> IsWord64Xor(const Matcher<Node*>& lhs_matcher,
362 : const Matcher<Node*>& rhs_matcher);
363 : Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
364 : const Matcher<Node*>& rhs_matcher);
365 : Matcher<Node*> IsWord64Shr(const Matcher<Node*>& lhs_matcher,
366 : const Matcher<Node*>& rhs_matcher);
367 : Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher,
368 : const Matcher<Node*>& rhs_matcher);
369 : Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher,
370 : const Matcher<Node*>& rhs_matcher);
371 : Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher,
372 : const Matcher<Node*>& rhs_matcher);
373 : Matcher<Node*> IsInt32SubWithOverflow(const Matcher<Node*>& lhs_matcher,
374 : const Matcher<Node*>& rhs_matcher);
375 : Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher,
376 : const Matcher<Node*>& rhs_matcher);
377 : Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher,
378 : const Matcher<Node*>& rhs_matcher);
379 : Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher,
380 : const Matcher<Node*>& rhs_matcher);
381 : Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher,
382 : const Matcher<Node*>& rhs_matcher);
383 : Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher,
384 : const Matcher<Node*>& rhs_matcher);
385 : Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher,
386 : const Matcher<Node*>& rhs_matcher);
387 : Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
388 : const Matcher<Node*>& rhs_matcher);
389 : Matcher<Node*> IsInt64Add(const Matcher<Node*>& lhs_matcher,
390 : const Matcher<Node*>& rhs_matcher);
391 : Matcher<Node*> IsInt64Sub(const Matcher<Node*>& lhs_matcher,
392 : const Matcher<Node*>& rhs_matcher);
393 : Matcher<Node*> IsInt64Mul(const Matcher<Node*>& lhs_matcher,
394 : const Matcher<Node*>& rhs_matcher);
395 : Matcher<Node*> IsJSAdd(const Matcher<Node*>& lhs_matcher,
396 : const Matcher<Node*>& rhs_matcher);
397 : Matcher<Node*> IsBitcastTaggedToWord(const Matcher<Node*>& input_matcher);
398 : Matcher<Node*> IsBitcastWordToTagged(const Matcher<Node*>& input_matcher);
399 : Matcher<Node*> IsBitcastWordToTaggedSigned(const Matcher<Node*>& input_matcher);
400 : Matcher<Node*> IsTruncateFloat64ToWord32(const Matcher<Node*>& input_matcher);
401 : Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
402 : Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher);
403 : Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
404 : Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
405 : Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
406 : Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
407 : Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
408 : Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
409 : Matcher<Node*> IsFloat32Abs(const Matcher<Node*>& input_matcher);
410 : Matcher<Node*> IsFloat32Neg(const Matcher<Node*>& input_matcher);
411 : Matcher<Node*> IsFloat32Equal(const Matcher<Node*>& lhs_matcher,
412 : const Matcher<Node*>& rhs_matcher);
413 : Matcher<Node*> IsFloat32LessThan(const Matcher<Node*>& lhs_matcher,
414 : const Matcher<Node*>& rhs_matcher);
415 : Matcher<Node*> IsFloat32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
416 : const Matcher<Node*>& rhs_matcher);
417 : Matcher<Node*> IsFloat64Max(const Matcher<Node*>& lhs_matcher,
418 : const Matcher<Node*>& rhs_matcher);
419 : Matcher<Node*> IsFloat64Min(const Matcher<Node*>& lhs_matcher,
420 : const Matcher<Node*>& rhs_matcher);
421 : Matcher<Node*> IsFloat64Add(const Matcher<Node*>& lhs_matcher,
422 : const Matcher<Node*>& rhs_matcher);
423 : Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher,
424 : const Matcher<Node*>& rhs_matcher);
425 : Matcher<Node*> IsFloat64Mul(const Matcher<Node*>& lhs_matcher,
426 : const Matcher<Node*>& rhs_matcher);
427 : Matcher<Node*> IsFloat64Abs(const Matcher<Node*>& input_matcher);
428 : Matcher<Node*> IsFloat64Neg(const Matcher<Node*>& input_matcher);
429 : Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
430 : Matcher<Node*> IsFloat64RoundDown(const Matcher<Node*>& input_matcher);
431 : Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
432 : Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
433 : Matcher<Node*> IsFloat64ExtractLowWord32(const Matcher<Node*>& input_matcher);
434 : Matcher<Node*> IsFloat64ExtractHighWord32(const Matcher<Node*>& input_matcher);
435 : Matcher<Node*> IsFloat64InsertLowWord32(const Matcher<Node*>& lhs_matcher,
436 : const Matcher<Node*>& rhs_matcher);
437 : Matcher<Node*> IsFloat64InsertHighWord32(const Matcher<Node*>& lhs_matcher,
438 : const Matcher<Node*>& rhs_matcher);
439 : Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
440 : const Matcher<Node*>& context_matcher,
441 : const Matcher<Node*>& effect_matcher,
442 : const Matcher<Node*>& control_matcher);
443 : Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher,
444 : const Matcher<Node*>& context_matcher);
445 : Matcher<Node*> IsNumberToBoolean(const Matcher<Node*>& input_matcher);
446 : Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
447 : Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher);
448 : Matcher<Node*> IsParameter(const Matcher<int> index_matcher);
449 : Matcher<Node*> IsLoadFramePointer();
450 : Matcher<Node*> IsLoadParentFramePointer();
451 : Matcher<Node*> IsPlainPrimitiveToNumber(const Matcher<Node*>& input_matcher);
452 :
453 : Matcher<Node*> IsInt32PairAdd(const Matcher<Node*>& a_matcher,
454 : const Matcher<Node*>& b_matcher,
455 : const Matcher<Node*>& c_matcher,
456 : const Matcher<Node*>& d_matcher);
457 : Matcher<Node*> IsInt32PairSub(const Matcher<Node*>& a_matcher,
458 : const Matcher<Node*>& b_matcher,
459 : const Matcher<Node*>& c_matcher,
460 : const Matcher<Node*>& d_matcher);
461 : Matcher<Node*> IsInt32PairMul(const Matcher<Node*>& a_matcher,
462 : const Matcher<Node*>& b_matcher,
463 : const Matcher<Node*>& c_matcher,
464 : const Matcher<Node*>& d_matcher);
465 :
466 : Matcher<Node*> IsWord32PairShl(const Matcher<Node*>& lhs_matcher,
467 : const Matcher<Node*>& mid_matcher,
468 : const Matcher<Node*>& rhs_matcher);
469 : Matcher<Node*> IsWord32PairShr(const Matcher<Node*>& lhs_matcher,
470 : const Matcher<Node*>& mid_matcher,
471 : const Matcher<Node*>& rhs_matcher);
472 :
473 : Matcher<Node*> IsWord32PairSar(const Matcher<Node*>& lhs_matcher,
474 : const Matcher<Node*>& mid_matcher,
475 : const Matcher<Node*>& rhs_matcher);
476 : Matcher<Node*> IsWord32ReverseBytes(const Matcher<Node*>& value_matcher);
477 :
478 : Matcher<Node*> IsStackSlot();
479 :
480 : // Helpers
481 3109 : static inline Matcher<Node*> IsIntPtrConstant(const intptr_t value) {
482 : return kPointerSize == 8 ? IsInt64Constant(static_cast<int64_t>(value))
483 6218 : : IsInt32Constant(static_cast<int32_t>(value));
484 : }
485 :
486 : static inline Matcher<Node*> IsIntPtrAdd(const Matcher<Node*>& lhs_matcher,
487 : const Matcher<Node*>& rhs_matcher) {
488 : return kPointerSize == 8 ? IsInt64Add(lhs_matcher, rhs_matcher)
489 1197 : : IsInt32Add(lhs_matcher, rhs_matcher);
490 : }
491 :
492 : static inline Matcher<Node*> IsIntPtrSub(const Matcher<Node*>& lhs_matcher,
493 : const Matcher<Node*>& rhs_matcher) {
494 : return kPointerSize == 8 ? IsInt64Sub(lhs_matcher, rhs_matcher)
495 1 : : IsInt32Sub(lhs_matcher, rhs_matcher);
496 : }
497 :
498 : static inline Matcher<Node*> IsIntPtrMul(const Matcher<Node*>& lhs_matcher,
499 : const Matcher<Node*>& rhs_matcher) {
500 : return kPointerSize == 8 ? IsInt64Mul(lhs_matcher, rhs_matcher)
501 1 : : IsInt32Mul(lhs_matcher, rhs_matcher);
502 : }
503 :
504 : static inline Matcher<Node*> IsWordShl(const Matcher<Node*>& lhs_matcher,
505 : const Matcher<Node*>& rhs_matcher) {
506 : return kPointerSize == 8 ? IsWord64Shl(lhs_matcher, rhs_matcher)
507 689 : : IsWord32Shl(lhs_matcher, rhs_matcher);
508 : }
509 :
510 : static inline Matcher<Node*> IsWordShr(const Matcher<Node*>& lhs_matcher,
511 : const Matcher<Node*>& rhs_matcher) {
512 : return kPointerSize == 8 ? IsWord64Shr(lhs_matcher, rhs_matcher)
513 1 : : IsWord32Shr(lhs_matcher, rhs_matcher);
514 : }
515 :
516 : static inline Matcher<Node*> IsWordSar(const Matcher<Node*>& lhs_matcher,
517 : const Matcher<Node*>& rhs_matcher) {
518 : return kPointerSize == 8 ? IsWord64Sar(lhs_matcher, rhs_matcher)
519 1 : : IsWord32Sar(lhs_matcher, rhs_matcher);
520 : }
521 :
522 : static inline Matcher<Node*> IsWordAnd(const Matcher<Node*>& lhs_matcher,
523 : const Matcher<Node*>& rhs_matcher) {
524 : return kPointerSize == 8 ? IsWord64And(lhs_matcher, rhs_matcher)
525 1 : : IsWord32And(lhs_matcher, rhs_matcher);
526 : }
527 :
528 : static inline Matcher<Node*> IsWordOr(const Matcher<Node*>& lhs_matcher,
529 : const Matcher<Node*>& rhs_matcher) {
530 : return kPointerSize == 8 ? IsWord64Or(lhs_matcher, rhs_matcher)
531 1 : : IsWord32Or(lhs_matcher, rhs_matcher);
532 : }
533 :
534 : static inline Matcher<Node*> IsWordXor(const Matcher<Node*>& lhs_matcher,
535 : const Matcher<Node*>& rhs_matcher) {
536 : return kPointerSize == 8 ? IsWord64Xor(lhs_matcher, rhs_matcher)
537 1 : : IsWord32Xor(lhs_matcher, rhs_matcher);
538 : }
539 :
540 : static inline Matcher<Node*> IsChangeInt32ToIntPtr(
541 : const Matcher<Node*>& matcher) {
542 315 : return kPointerSize == 8 ? IsChangeInt32ToInt64(matcher) : matcher;
543 : }
544 :
545 : static inline Matcher<Node*> IsChangeUint32ToWord(
546 : const Matcher<Node*>& matcher) {
547 342 : return kPointerSize == 8 ? IsChangeUint32ToUint64(matcher) : matcher;
548 : }
549 :
550 : static inline Matcher<Node*> IsTruncateWordToWord32(
551 : const Matcher<Node*>& matcher) {
552 : return kPointerSize == 8 ? IsTruncateInt64ToInt32(matcher) : matcher;
553 : }
554 :
555 : } // namespace compiler
556 : } // namespace internal
557 : } // namespace v8
558 :
559 : #endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
|