// 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_ #include "src/compiler/machine-operator.h" #include "src/compiler/type-hints.h" #include "src/machine-type.h" #include "testing/gmock/include/gmock/gmock.h" namespace v8 { namespace internal { // Forward declarations. class ExternalReference; template class Handle; class HeapObject; class Type; enum TypeofMode : int; namespace compiler { // Forward declarations. class BufferAccess; class CallDescriptor; class ContextAccess; struct ElementAccess; struct FieldAccess; class Node; using ::testing::Matcher; Matcher IsDead(); Matcher IsEnd(const Matcher& control0_matcher); Matcher IsEnd(const Matcher& control0_matcher, const Matcher& control1_matcher); Matcher IsEnd(const Matcher& control0_matcher, const Matcher& control1_matcher, const Matcher& control2_matcher); Matcher IsBranch(const Matcher& value_matcher, const Matcher& control_matcher); Matcher IsMerge(const Matcher& control0_matcher, const Matcher& control1_matcher); Matcher IsMerge(const Matcher& control0_matcher, const Matcher& control1_matcher, const Matcher& control2_matcher); Matcher IsLoop(const Matcher& control0_matcher, const Matcher& control1_matcher); Matcher IsLoop(const Matcher& control0_matcher, const Matcher& control1_matcher, const Matcher& control2_matcher); Matcher IsIfTrue(const Matcher& control_matcher); Matcher IsIfFalse(const Matcher& control_matcher); Matcher IsIfSuccess(const Matcher& control_matcher); Matcher IsSwitch(const Matcher& value_matcher, const Matcher& control_matcher); Matcher IsIfValue(const Matcher& value_matcher, const Matcher& control_matcher); Matcher IsIfDefault(const Matcher& control_matcher); Matcher IsBeginRegion(const Matcher& effect_matcher); Matcher IsFinishRegion(const Matcher& value_matcher, const Matcher& effect_matcher); Matcher IsReturn(const Matcher& value_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsReturn2(const Matcher& value_matcher, const Matcher& value2_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTerminate(const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsExternalConstant( const Matcher& value_matcher); Matcher IsHeapConstant(Handle value); Matcher IsFloat32Constant(const Matcher& value_matcher); Matcher IsFloat64Constant(const Matcher& value_matcher); Matcher IsInt32Constant(const Matcher& value_matcher); Matcher IsInt64Constant(const Matcher& value_matcher); Matcher IsNumberConstant(const Matcher& value_matcher); Matcher IsSelect(const Matcher& type_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher); Matcher IsPhi(const Matcher& type_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& merge_matcher); Matcher IsPhi(const Matcher& type_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& merge_matcher); Matcher IsEffectPhi(const Matcher& effect0_matcher, const Matcher& effect1_matcher, const Matcher& merge_matcher); Matcher IsProjection(const Matcher& index_matcher, const Matcher& base_matcher); Matcher IsCall(const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsCall(const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsCall(const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsCall(const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsCall(const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsCall(const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& value5_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& value5_matcher, const Matcher& value6_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& value5_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& value5_matcher, const Matcher& value6_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsTailCall( const Matcher& descriptor_matcher, const Matcher& value0_matcher, const Matcher& value1_matcher, const Matcher& value2_matcher, const Matcher& value3_matcher, const Matcher& value4_matcher, const Matcher& value5_matcher, const Matcher& value6_matcher, const Matcher& value7_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsBooleanNot(const Matcher& value_matcher); Matcher IsReferenceEqual(const Matcher& type_matcher, const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberEqual(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberLessThan(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberAdd(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsSpeculativeNumberAdd( const Matcher& hint_matcher, const Matcher& lhs_matcher, const Matcher& rhs_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsSpeculativeNumberSubtract( const Matcher& hint_matcher, const Matcher& lhs_matcher, const Matcher& rhs_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsNumberSubtract(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberMultiply(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberShiftLeft(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberShiftRight(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberShiftRightLogical(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberImul(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberAbs(const Matcher& value_matcher); Matcher IsNumberAtan(const Matcher& value_matcher); Matcher IsNumberAtan2(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsNumberAtanh(const Matcher& value_matcher); Matcher IsNumberCeil(const Matcher& value_matcher); Matcher IsNumberClz32(const Matcher& value_matcher); Matcher IsNumberCos(const Matcher& value_matcher); Matcher IsNumberExp(const Matcher& value_matcher); Matcher IsNumberExpm1(const Matcher& value_matcher); Matcher IsNumberFloor(const Matcher& value_matcher); Matcher IsNumberFround(const Matcher& value_matcher); Matcher IsNumberLog(const Matcher& value_matcher); Matcher IsNumberLog1p(const Matcher& value_matcher); Matcher IsNumberLog2(const Matcher& value_matcher); Matcher IsNumberLog10(const Matcher& value_matcher); Matcher IsNumberRound(const Matcher& value_matcher); Matcher IsNumberCbrt(const Matcher& value_matcher); Matcher IsNumberSin(const Matcher& value_matcher); Matcher IsNumberSqrt(const Matcher& value_matcher); Matcher IsNumberTan(const Matcher& value_matcher); Matcher IsNumberTrunc(const Matcher& value_matcher); Matcher IsStringFromCharCode(const Matcher& value_matcher); Matcher IsAllocate(const Matcher& size_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsLoadField(const Matcher& access_matcher, const Matcher& base_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsStoreField(const Matcher& access_matcher, const Matcher& base_matcher, const Matcher& value_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsLoadBuffer(const Matcher& access_matcher, const Matcher& buffer_matcher, const Matcher& offset_matcher, const Matcher& length_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsStoreBuffer(const Matcher& access_matcher, const Matcher& buffer_matcher, const Matcher& offset_matcher, const Matcher& length_matcher, const Matcher& value_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsLoadElement(const Matcher& access_matcher, const Matcher& base_matcher, const Matcher& index_matcher, const Matcher& control_matcher, const Matcher& effect_matcher); Matcher IsStoreElement(const Matcher& access_matcher, const Matcher& base_matcher, const Matcher& index_matcher, const Matcher& value_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsObjectIsReceiver(const Matcher& value_matcher); Matcher IsObjectIsSmi(const Matcher& value_matcher); Matcher IsLoad(const Matcher& rep_matcher, const Matcher& base_matcher, const Matcher& index_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsStore(const Matcher& rep_matcher, const Matcher& base_matcher, const Matcher& index_matcher, const Matcher& value_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsStackSlot(const Matcher& rep_matcher); Matcher IsWord32And(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Or(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Xor(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Sar(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Shl(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Shr(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Ror(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Equal(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord32Clz(const Matcher& value_matcher); Matcher IsWord32Ctz(const Matcher& value_matcher); Matcher IsWord32Popcnt(const Matcher& value_matcher); Matcher IsWord64And(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord64Or(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord64Shl(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord64Sar(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsWord64Equal(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt32AddWithOverflow(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt32Add(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt32Sub(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt32Mul(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt32MulHigh(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt32LessThan(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsUint32LessThan(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsUint32LessThanOrEqual(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt64Add(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsInt64Sub(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsJSAdd(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsTruncateFloat64ToWord32(const Matcher& input_matcher); Matcher IsChangeFloat64ToInt32(const Matcher& input_matcher); Matcher IsChangeFloat64ToUint32(const Matcher& input_matcher); Matcher IsChangeInt32ToFloat64(const Matcher& input_matcher); Matcher IsChangeInt32ToInt64(const Matcher& input_matcher); Matcher IsChangeUint32ToFloat64(const Matcher& input_matcher); Matcher IsChangeUint32ToUint64(const Matcher& input_matcher); Matcher IsTruncateFloat64ToFloat32(const Matcher& input_matcher); Matcher IsTruncateInt64ToInt32(const Matcher& input_matcher); Matcher IsFloat32Max(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat32Min(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat32Abs(const Matcher& input_matcher); Matcher IsFloat32Equal(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat32LessThan(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat32LessThanOrEqual(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat64Max(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat64Min(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat64Sub(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat64Abs(const Matcher& input_matcher); Matcher IsFloat64Sqrt(const Matcher& input_matcher); Matcher IsFloat64RoundDown(const Matcher& input_matcher); Matcher IsFloat64RoundTruncate(const Matcher& input_matcher); Matcher IsFloat64RoundTiesAway(const Matcher& input_matcher); Matcher IsFloat64ExtractLowWord32(const Matcher& input_matcher); Matcher IsFloat64ExtractHighWord32(const Matcher& input_matcher); Matcher IsFloat64InsertLowWord32(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsFloat64InsertHighWord32(const Matcher& lhs_matcher, const Matcher& rhs_matcher); Matcher IsToNumber(const Matcher& base_matcher, const Matcher& context_matcher, const Matcher& effect_matcher, const Matcher& control_matcher); Matcher IsLoadContext(const Matcher& access_matcher, const Matcher& context_matcher); Matcher IsNumberToInt32(const Matcher& input_matcher); Matcher IsNumberToUint32(const Matcher& input_matcher); Matcher IsParameter(const Matcher index_matcher); Matcher IsLoadFramePointer(); Matcher IsLoadParentFramePointer(); Matcher IsPlainPrimitiveToNumber(const Matcher& input_matcher); Matcher IsInt32PairAdd(const Matcher& a_matcher, const Matcher& b_matcher, const Matcher& c_matcher, const Matcher& d_matcher); Matcher IsInt32PairSub(const Matcher& a_matcher, const Matcher& b_matcher, const Matcher& c_matcher, const Matcher& d_matcher); Matcher IsInt32PairMul(const Matcher& a_matcher, const Matcher& b_matcher, const Matcher& c_matcher, const Matcher& d_matcher); Matcher IsWord32PairShl(const Matcher& lhs_matcher, const Matcher& mid_matcher, const Matcher& rhs_matcher); Matcher IsWord32PairShr(const Matcher& lhs_matcher, const Matcher& mid_matcher, const Matcher& rhs_matcher); Matcher IsWord32PairSar(const Matcher& lhs_matcher, const Matcher& mid_matcher, const Matcher& rhs_matcher); Matcher IsStackSlot(); Matcher IsTypeGuard(const Matcher& type_matcher, const Matcher& value_matcher, const Matcher& control_matcher); } // namespace compiler } // namespace internal } // namespace v8 #endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_