node-test-utils.h 33.3 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
#define V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_

8
#include "src/codegen/machine-type.h"
9
#include "src/compiler/common-operator.h"
10
#include "src/compiler/machine-operator.h"
11
#include "src/compiler/opcodes.h"
12
#include "src/compiler/simplified-operator.h"
13 14 15 16 17 18 19
#include "testing/gmock/include/gmock/gmock.h"

namespace v8 {
namespace internal {

// Forward declarations.
class ExternalReference;
20 21
template <typename T>
class Handle;
22
class HeapObject;
23
class Type;
24
enum TypeofMode : int;
25 26 27 28

namespace compiler {

// Forward declarations.
29
class BufferAccess;
30
class CallDescriptor;
31
class ContextAccess;
32 33 34 35 36 37 38
struct ElementAccess;
struct FieldAccess;
class Node;


using ::testing::Matcher;

39
Matcher<Node*> IsDead();
40 41 42
Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher);
Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
                     const Matcher<Node*>& control1_matcher);
43 44 45
Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
                     const Matcher<Node*>& control1_matcher,
                     const Matcher<Node*>& control2_matcher);
46 47 48 49
Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
                        const Matcher<Node*>& control_matcher);
Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
                       const Matcher<Node*>& control1_matcher);
50 51 52
Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
                       const Matcher<Node*>& control1_matcher,
                       const Matcher<Node*>& control2_matcher);
53 54 55 56 57
Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
                      const Matcher<Node*>& control1_matcher);
Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
                      const Matcher<Node*>& control1_matcher,
                      const Matcher<Node*>& control2_matcher);
58 59
Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
60
Matcher<Node*> IsIfSuccess(const Matcher<Node*>& control_matcher);
61 62
Matcher<Node*> IsSwitch(const Matcher<Node*>& value_matcher,
                        const Matcher<Node*>& control_matcher);
63
Matcher<Node*> IsIfValue(const Matcher<IfValueParameters>& value_matcher,
64 65
                         const Matcher<Node*>& control_matcher);
Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher);
66 67 68
Matcher<Node*> IsBeginRegion(const Matcher<Node*>& effect_matcher);
Matcher<Node*> IsFinishRegion(const Matcher<Node*>& value_matcher,
                              const Matcher<Node*>& effect_matcher);
69 70 71
Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
                        const Matcher<Node*>& effect_matcher,
                        const Matcher<Node*>& control_matcher);
72 73 74 75
Matcher<Node*> IsReturn2(const Matcher<Node*>& value_matcher,
                         const Matcher<Node*>& value2_matcher,
                         const Matcher<Node*>& effect_matcher,
                         const Matcher<Node*>& control_matcher);
76 77
Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher,
                           const Matcher<Node*>& control_matcher);
78 79
Matcher<Node*> IsTypeGuard(const Matcher<Node*>& value_matcher,
                           const Matcher<Node*>& control_matcher);
80 81
Matcher<Node*> IsExternalConstant(
    const Matcher<ExternalReference>& value_matcher);
82
Matcher<Node*> IsHeapConstant(Handle<HeapObject> value);
83 84 85 86 87
Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher);
Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
88
Matcher<Node*> IsPointerConstant(const Matcher<intptr_t>& value_matcher);
89
Matcher<Node*> IsSelect(const Matcher<MachineRepresentation>& type_matcher,
90 91 92
                        const Matcher<Node*>& value0_matcher,
                        const Matcher<Node*>& value1_matcher,
                        const Matcher<Node*>& value2_matcher);
93
Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
94 95 96
                     const Matcher<Node*>& value0_matcher,
                     const Matcher<Node*>& value1_matcher,
                     const Matcher<Node*>& merge_matcher);
97
Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
98 99 100 101
                     const Matcher<Node*>& value0_matcher,
                     const Matcher<Node*>& value1_matcher,
                     const Matcher<Node*>& value2_matcher,
                     const Matcher<Node*>& merge_matcher);
102 103 104
Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
                           const Matcher<Node*>& effect1_matcher,
                           const Matcher<Node*>& merge_matcher);
105 106
Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
                            const Matcher<Node*>& base_matcher);
107 108 109 110
Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
                      const Matcher<Node*>& value0_matcher,
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
111
Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
112 113 114 115
                      const Matcher<Node*>& value0_matcher,
                      const Matcher<Node*>& value1_matcher,
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
116
Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
117 118 119 120 121
                      const Matcher<Node*>& value0_matcher,
                      const Matcher<Node*>& value1_matcher,
                      const Matcher<Node*>& value2_matcher,
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
122
Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
123 124 125 126 127 128
                      const Matcher<Node*>& value0_matcher,
                      const Matcher<Node*>& value1_matcher,
                      const Matcher<Node*>& value2_matcher,
                      const Matcher<Node*>& value3_matcher,
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
129
Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
130 131 132 133
                      const Matcher<Node*>& value0_matcher,
                      const Matcher<Node*>& value1_matcher,
                      const Matcher<Node*>& value2_matcher,
                      const Matcher<Node*>& value3_matcher,
134
                      const Matcher<Node*>& value4_matcher,
135 136
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
137
Matcher<Node*> IsCall(const Matcher<const CallDescriptor*>& descriptor_matcher,
138 139 140 141 142 143 144 145 146
                      const Matcher<Node*>& value0_matcher,
                      const Matcher<Node*>& value1_matcher,
                      const Matcher<Node*>& value2_matcher,
                      const Matcher<Node*>& value3_matcher,
                      const Matcher<Node*>& value4_matcher,
                      const Matcher<Node*>& value5_matcher,
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
Matcher<Node*> IsCall(
147
    const Matcher<const CallDescriptor*>& descriptor_matcher,
148 149 150 151 152
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
    const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
    const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
153 154 155 156 157
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
158 159 160 161 162
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
163 164 165 166 167 168
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
    const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
169 170 171 172 173 174 175 176 177 178 179 180 181
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
    const Matcher<Node*>& value4_matcher, const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
    const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
    const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
    const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
    const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
Matcher<Node*> IsTailCall(
    const Matcher<CallDescriptor const*>& descriptor_matcher,
    const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
    const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
    const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
    const Matcher<Node*>& value6_matcher, const Matcher<Node*>& value7_matcher,
    const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
197

198

199
Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
200
Matcher<Node*> IsReferenceEqual(const Matcher<Node*>& lhs_matcher,
201
                                const Matcher<Node*>& rhs_matcher);
202 203
Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
                             const Matcher<Node*>& rhs_matcher);
204 205
Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
                                const Matcher<Node*>& rhs_matcher);
206 207
Matcher<Node*> IsNumberAdd(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
208

209 210 211 212 213 214
#define DECLARE_SPECULATIVE_BINOP_MATCHER(opcode)                             \
  Matcher<Node*> Is##opcode(const Matcher<NumberOperationHint>& hint_matcher, \
                            const Matcher<Node*>& lhs_matcher,                \
                            const Matcher<Node*>& rhs_matcher,                \
                            const Matcher<Node*>& effect_matcher,             \
                            const Matcher<Node*>& control_matcher);
215
SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_SPECULATIVE_BINOP_MATCHER)
216 217 218
DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual)
DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan)
DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual)
219 220
#undef DECLARE_SPECULATIVE_BINOP_MATCHER

221 222
Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
                                const Matcher<Node*>& rhs_matcher);
223 224
Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
                                const Matcher<Node*>& rhs_matcher);
225 226 227 228 229 230
Matcher<Node*> IsNumberShiftLeft(const Matcher<Node*>& lhs_matcher,
                                 const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsNumberShiftRight(const Matcher<Node*>& lhs_matcher,
                                  const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsNumberShiftRightLogical(const Matcher<Node*>& lhs_matcher,
                                         const Matcher<Node*>& rhs_matcher);
231 232
Matcher<Node*> IsNumberImul(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
233
Matcher<Node*> IsNumberAbs(const Matcher<Node*>& value_matcher);
234 235 236 237
Matcher<Node*> IsNumberAcos(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberAcosh(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberAsin(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberAsinh(const Matcher<Node*>& value_matcher);
238
Matcher<Node*> IsNumberAtan(const Matcher<Node*>& value_matcher);
239
Matcher<Node*> IsNumberAtanh(const Matcher<Node*>& value_matcher);
240 241
Matcher<Node*> IsNumberAtan2(const Matcher<Node*>& lhs_matcher,
                             const Matcher<Node*>& rhs_matcher);
242
Matcher<Node*> IsNumberCbrt(const Matcher<Node*>& value_matcher);
243 244
Matcher<Node*> IsNumberCeil(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberClz32(const Matcher<Node*>& value_matcher);
245
Matcher<Node*> IsNumberCos(const Matcher<Node*>& value_matcher);
246
Matcher<Node*> IsNumberCosh(const Matcher<Node*>& value_matcher);
247
Matcher<Node*> IsNumberExp(const Matcher<Node*>& value_matcher);
248
Matcher<Node*> IsNumberExpm1(const Matcher<Node*>& value_matcher);
249 250
Matcher<Node*> IsNumberFloor(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberFround(const Matcher<Node*>& value_matcher);
251 252
Matcher<Node*> IsNumberLog(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberLog1p(const Matcher<Node*>& value_matcher);
253
Matcher<Node*> IsNumberLog10(const Matcher<Node*>& value_matcher);
254
Matcher<Node*> IsNumberLog2(const Matcher<Node*>& value_matcher);
255 256 257 258
Matcher<Node*> IsNumberMax(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsNumberMin(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
259
Matcher<Node*> IsNumberRound(const Matcher<Node*>& value_matcher);
260 261
Matcher<Node*> IsNumberPow(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
262
Matcher<Node*> IsNumberSign(const Matcher<Node*>& value_matcher);
263
Matcher<Node*> IsNumberSin(const Matcher<Node*>& value_matcher);
264
Matcher<Node*> IsNumberSinh(const Matcher<Node*>& value_matcher);
265
Matcher<Node*> IsNumberSqrt(const Matcher<Node*>& value_matcher);
266
Matcher<Node*> IsNumberTan(const Matcher<Node*>& value_matcher);
267
Matcher<Node*> IsNumberTanh(const Matcher<Node*>& value_matcher);
268
Matcher<Node*> IsNumberTrunc(const Matcher<Node*>& value_matcher);
269 270 271
Matcher<Node*> IsStringConcat(const Matcher<Node*>& length_matcher,
                              const Matcher<Node*>& lhs_matcher,
                              const Matcher<Node*>& rhs_matcher);
272
Matcher<Node*> IsStringFromSingleCharCode(const Matcher<Node*>& value_matcher);
273
Matcher<Node*> IsStringLength(const Matcher<Node*>& value_matcher);
274 275 276
Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher,
                          const Matcher<Node*>& effect_matcher,
                          const Matcher<Node*>& control_matcher);
277 278
Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
                           const Matcher<Node*>& base_matcher,
279 280
                           const Matcher<Node*>& effect_matcher,
                           const Matcher<Node*>& control_matcher);
281 282 283 284 285
Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher,
                            const Matcher<Node*>& base_matcher,
                            const Matcher<Node*>& value_matcher,
                            const Matcher<Node*>& effect_matcher,
                            const Matcher<Node*>& control_matcher);
286 287 288 289 290 291 292 293 294 295 296 297 298
Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher,
                            const Matcher<Node*>& buffer_matcher,
                            const Matcher<Node*>& offset_matcher,
                            const Matcher<Node*>& length_matcher,
                            const Matcher<Node*>& effect_matcher,
                            const Matcher<Node*>& control_matcher);
Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher,
                             const Matcher<Node*>& buffer_matcher,
                             const Matcher<Node*>& offset_matcher,
                             const Matcher<Node*>& length_matcher,
                             const Matcher<Node*>& value_matcher,
                             const Matcher<Node*>& effect_matcher,
                             const Matcher<Node*>& control_matcher);
299 300 301
Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
                             const Matcher<Node*>& base_matcher,
                             const Matcher<Node*>& index_matcher,
302
                             const Matcher<Node*>& control_matcher,
303
                             const Matcher<Node*>& effect_matcher);
304 305 306 307 308 309
Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
                              const Matcher<Node*>& base_matcher,
                              const Matcher<Node*>& index_matcher,
                              const Matcher<Node*>& value_matcher,
                              const Matcher<Node*>& effect_matcher,
                              const Matcher<Node*>& control_matcher);
310 311

Matcher<Node*> IsObjectIsFiniteNumber(const Matcher<Node*>& value_matcher);
312
Matcher<Node*> IsNumberIsFinite(const Matcher<Node*>& value_matcher);
313
Matcher<Node*> IsObjectIsInteger(const Matcher<Node*>& value_matcher);
314
Matcher<Node*> IsObjectIsSafeInteger(const Matcher<Node*>& value_matcher);
315
Matcher<Node*> IsObjectIsNaN(const Matcher<Node*>& value_matcher);
316
Matcher<Node*> IsNumberIsNaN(const Matcher<Node*>& value_matcher);
317
Matcher<Node*> IsObjectIsReceiver(const Matcher<Node*>& value_matcher);
318
Matcher<Node*> IsObjectIsSmi(const Matcher<Node*>& value_matcher);
319
Matcher<Node*> IsObjectIsUndetectable(const Matcher<Node*>& value_matcher);
320 321 322 323 324 325

Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
                      const Matcher<Node*>& base_matcher,
                      const Matcher<Node*>& index_matcher,
                      const Matcher<Node*>& effect_matcher,
                      const Matcher<Node*>& control_matcher);
326 327 328 329 330
Matcher<Node*> IsPoisonedLoad(const Matcher<LoadRepresentation>& rep_matcher,
                              const Matcher<Node*>& base_matcher,
                              const Matcher<Node*>& index_matcher,
                              const Matcher<Node*>& effect_matcher,
                              const Matcher<Node*>& control_matcher);
331 332 333 334 335
Matcher<Node*> IsUnalignedLoad(const Matcher<LoadRepresentation>& rep_matcher,
                               const Matcher<Node*>& base_matcher,
                               const Matcher<Node*>& index_matcher,
                               const Matcher<Node*>& effect_matcher,
                               const Matcher<Node*>& control_matcher);
336 337 338 339 340 341
Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
                       const Matcher<Node*>& base_matcher,
                       const Matcher<Node*>& index_matcher,
                       const Matcher<Node*>& value_matcher,
                       const Matcher<Node*>& effect_matcher,
                       const Matcher<Node*>& control_matcher);
342 343 344 345 346
Matcher<Node*> IsUnalignedStore(
    const Matcher<UnalignedStoreRepresentation>& rep_matcher,
    const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher,
    const Matcher<Node*>& value_matcher, const Matcher<Node*>& effect_matcher,
    const Matcher<Node*>& control_matcher);
347
Matcher<Node*> IsStackSlot(const Matcher<StackSlotRepresentation>& rep_matcher);
348
Matcher<Node*> IsWord32Popcnt(const Matcher<Node*>& value_matcher);
349 350
Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
351 352
Matcher<Node*> IsWord32Or(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
353 354
Matcher<Node*> IsWord32Xor(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
355 356 357 358 359 360 361 362 363 364
Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
                             const Matcher<Node*>& rhs_matcher);
365
Matcher<Node*> IsWord32Clz(const Matcher<Node*>& value_matcher);
366
Matcher<Node*> IsWord32Ctz(const Matcher<Node*>& value_matcher);
367
Matcher<Node*> IsWord32Popcnt(const Matcher<Node*>& value_matcher);
368 369
Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
370 371
Matcher<Node*> IsWord64Or(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
372 373
Matcher<Node*> IsWord64Xor(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
374 375
Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
376 377
Matcher<Node*> IsWord64Shr(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
378 379 380 381 382 383
Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher,
                           const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher,
                             const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher,
                                      const Matcher<Node*>& rhs_matcher);
384 385
Matcher<Node*> IsInt32SubWithOverflow(const Matcher<Node*>& lhs_matcher,
                                      const Matcher<Node*>& rhs_matcher);
386 387 388 389
Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
390 391
Matcher<Node*> IsInt32Div(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
392 393 394 395 396 397 398 399 400 401
Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher,
                              const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher,
                               const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher,
                                const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
                                       const Matcher<Node*>& rhs_matcher);
402 403
Matcher<Node*> IsInt64Add(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
404 405
Matcher<Node*> IsInt64Sub(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
406 407
Matcher<Node*> IsInt64Mul(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
408 409
Matcher<Node*> IsInt64Div(const Matcher<Node*>& lhs_matcher,
                          const Matcher<Node*>& rhs_matcher);
410 411
Matcher<Node*> IsJSAdd(const Matcher<Node*>& lhs_matcher,
                       const Matcher<Node*>& rhs_matcher);
412 413
Matcher<Node*> IsJSParseInt(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
414 415 416
Matcher<Node*> IsBitcastTaggedToWord(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsBitcastWordToTagged(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsBitcastWordToTaggedSigned(const Matcher<Node*>& input_matcher);
417
Matcher<Node*> IsTruncateFloat64ToWord32(const Matcher<Node*>& input_matcher);
418 419 420 421 422 423
Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
424
Matcher<Node*> IsChangeCompressedToTagged(const Matcher<Node*>& input_matcher);
425 426
Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
427
Matcher<Node*> IsFloat32Abs(const Matcher<Node*>& input_matcher);
428
Matcher<Node*> IsFloat32Neg(const Matcher<Node*>& input_matcher);
429 430 431 432 433 434
Matcher<Node*> IsFloat32Equal(const Matcher<Node*>& lhs_matcher,
                              const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsFloat32LessThan(const Matcher<Node*>& lhs_matcher,
                                 const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsFloat32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
                                        const Matcher<Node*>& rhs_matcher);
435 436 437 438
Matcher<Node*> IsFloat64Max(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsFloat64Min(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
439 440
Matcher<Node*> IsFloat64Add(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
441 442
Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
443 444
Matcher<Node*> IsFloat64Mul(const Matcher<Node*>& lhs_matcher,
                            const Matcher<Node*>& rhs_matcher);
445
Matcher<Node*> IsFloat64Abs(const Matcher<Node*>& input_matcher);
446
Matcher<Node*> IsFloat64Neg(const Matcher<Node*>& input_matcher);
447
Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
448
Matcher<Node*> IsFloat64RoundDown(const Matcher<Node*>& input_matcher);
449 450
Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
451 452 453 454 455 456
Matcher<Node*> IsFloat64ExtractLowWord32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsFloat64ExtractHighWord32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsFloat64InsertLowWord32(const Matcher<Node*>& lhs_matcher,
                                        const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsFloat64InsertHighWord32(const Matcher<Node*>& lhs_matcher,
                                         const Matcher<Node*>& rhs_matcher);
457 458 459 460
Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
                          const Matcher<Node*>& context_matcher,
                          const Matcher<Node*>& effect_matcher,
                          const Matcher<Node*>& control_matcher);
461 462
Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher,
                             const Matcher<Node*>& context_matcher);
463
Matcher<Node*> IsNumberToBoolean(const Matcher<Node*>& input_matcher);
464 465
Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher);
466
Matcher<Node*> IsParameter(const Matcher<int> index_matcher);
467
Matcher<Node*> IsSpeculationPoison();
468
Matcher<Node*> IsLoadFramePointer();
469
Matcher<Node*> IsLoadParentFramePointer();
470
Matcher<Node*> IsPlainPrimitiveToNumber(const Matcher<Node*>& input_matcher);
471

472 473 474 475
Matcher<Node*> IsInt32PairAdd(const Matcher<Node*>& a_matcher,
                              const Matcher<Node*>& b_matcher,
                              const Matcher<Node*>& c_matcher,
                              const Matcher<Node*>& d_matcher);
476 477 478
Matcher<Node*> IsInt32PairSub(const Matcher<Node*>& a_matcher,
                              const Matcher<Node*>& b_matcher,
                              const Matcher<Node*>& c_matcher,
479 480 481 482
                              const Matcher<Node*>& d_matcher);
Matcher<Node*> IsInt32PairMul(const Matcher<Node*>& a_matcher,
                              const Matcher<Node*>& b_matcher,
                              const Matcher<Node*>& c_matcher,
483 484
                              const Matcher<Node*>& d_matcher);

485 486 487
Matcher<Node*> IsWord32PairShl(const Matcher<Node*>& lhs_matcher,
                               const Matcher<Node*>& mid_matcher,
                               const Matcher<Node*>& rhs_matcher);
488 489 490 491 492 493 494
Matcher<Node*> IsWord32PairShr(const Matcher<Node*>& lhs_matcher,
                               const Matcher<Node*>& mid_matcher,
                               const Matcher<Node*>& rhs_matcher);

Matcher<Node*> IsWord32PairSar(const Matcher<Node*>& lhs_matcher,
                               const Matcher<Node*>& mid_matcher,
                               const Matcher<Node*>& rhs_matcher);
495
Matcher<Node*> IsWord32ReverseBytes(const Matcher<Node*>& value_matcher);
496

497 498
Matcher<Node*> IsStackSlot();

499 500
Matcher<Node*> IsSpeculativeToNumber(const Matcher<Node*>& value_matcher);

501 502
// Helpers
static inline Matcher<Node*> IsIntPtrConstant(const intptr_t value) {
503 504
  return kSystemPointerSize == 8 ? IsInt64Constant(static_cast<int64_t>(value))
                                 : IsInt32Constant(static_cast<int32_t>(value));
505 506 507 508
}

static inline Matcher<Node*> IsIntPtrAdd(const Matcher<Node*>& lhs_matcher,
                                         const Matcher<Node*>& rhs_matcher) {
509 510
  return kSystemPointerSize == 8 ? IsInt64Add(lhs_matcher, rhs_matcher)
                                 : IsInt32Add(lhs_matcher, rhs_matcher);
511 512 513 514
}

static inline Matcher<Node*> IsIntPtrSub(const Matcher<Node*>& lhs_matcher,
                                         const Matcher<Node*>& rhs_matcher) {
515 516
  return kSystemPointerSize == 8 ? IsInt64Sub(lhs_matcher, rhs_matcher)
                                 : IsInt32Sub(lhs_matcher, rhs_matcher);
517 518 519 520
}

static inline Matcher<Node*> IsIntPtrMul(const Matcher<Node*>& lhs_matcher,
                                         const Matcher<Node*>& rhs_matcher) {
521 522
  return kSystemPointerSize == 8 ? IsInt64Mul(lhs_matcher, rhs_matcher)
                                 : IsInt32Mul(lhs_matcher, rhs_matcher);
523 524
}

525 526
static inline Matcher<Node*> IsIntPtrDiv(const Matcher<Node*>& lhs_matcher,
                                         const Matcher<Node*>& rhs_matcher) {
527 528
  return kSystemPointerSize == 8 ? IsInt64Div(lhs_matcher, rhs_matcher)
                                 : IsInt32Div(lhs_matcher, rhs_matcher);
529 530
}

531 532
static inline Matcher<Node*> IsWordShl(const Matcher<Node*>& lhs_matcher,
                                       const Matcher<Node*>& rhs_matcher) {
533 534
  return kSystemPointerSize == 8 ? IsWord64Shl(lhs_matcher, rhs_matcher)
                                 : IsWord32Shl(lhs_matcher, rhs_matcher);
535 536 537 538
}

static inline Matcher<Node*> IsWordShr(const Matcher<Node*>& lhs_matcher,
                                       const Matcher<Node*>& rhs_matcher) {
539 540
  return kSystemPointerSize == 8 ? IsWord64Shr(lhs_matcher, rhs_matcher)
                                 : IsWord32Shr(lhs_matcher, rhs_matcher);
541 542 543 544
}

static inline Matcher<Node*> IsWordSar(const Matcher<Node*>& lhs_matcher,
                                       const Matcher<Node*>& rhs_matcher) {
545 546
  return kSystemPointerSize == 8 ? IsWord64Sar(lhs_matcher, rhs_matcher)
                                 : IsWord32Sar(lhs_matcher, rhs_matcher);
547 548 549 550
}

static inline Matcher<Node*> IsWordAnd(const Matcher<Node*>& lhs_matcher,
                                       const Matcher<Node*>& rhs_matcher) {
551 552
  return kSystemPointerSize == 8 ? IsWord64And(lhs_matcher, rhs_matcher)
                                 : IsWord32And(lhs_matcher, rhs_matcher);
553 554 555 556
}

static inline Matcher<Node*> IsWordOr(const Matcher<Node*>& lhs_matcher,
                                      const Matcher<Node*>& rhs_matcher) {
557 558
  return kSystemPointerSize == 8 ? IsWord64Or(lhs_matcher, rhs_matcher)
                                 : IsWord32Or(lhs_matcher, rhs_matcher);
559 560 561 562
}

static inline Matcher<Node*> IsWordXor(const Matcher<Node*>& lhs_matcher,
                                       const Matcher<Node*>& rhs_matcher) {
563 564
  return kSystemPointerSize == 8 ? IsWord64Xor(lhs_matcher, rhs_matcher)
                                 : IsWord32Xor(lhs_matcher, rhs_matcher);
565 566 567 568
}

static inline Matcher<Node*> IsChangeInt32ToIntPtr(
    const Matcher<Node*>& matcher) {
569
  return kSystemPointerSize == 8 ? IsChangeInt32ToInt64(matcher) : matcher;
570 571 572 573
}

static inline Matcher<Node*> IsChangeUint32ToWord(
    const Matcher<Node*>& matcher) {
574
  return kSystemPointerSize == 8 ? IsChangeUint32ToUint64(matcher) : matcher;
575 576
}

577
static inline Matcher<Node*> IsTruncateIntPtrToInt32(
578
    const Matcher<Node*>& matcher) {
579
  return kSystemPointerSize == 8 ? IsTruncateInt64ToInt32(matcher) : matcher;
580 581
}

582 583 584 585 586
}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_