// 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/machine-type.h" #include "testing/gmock/include/gmock/gmock.h" namespace v8 { namespace internal { // Forward declarations. class ExternalReference; template class Handle; class HeapObject; template class TypeImpl; struct ZoneTypeConfig; typedef TypeImpl Type; 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 IsValueEffect(const Matcher& value_matcher); Matcher IsFinish(const Matcher& value_matcher, const Matcher& effect_matcher); Matcher IsReturn(const Matcher& value_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 IsEffectSet(const Matcher& effect0_matcher, const Matcher& effect1_matcher); Matcher IsProjection(const Matcher& index_matcher, const Matcher& base_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 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 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 IsObjectIsSmi(const Matcher& value_matcher); Matcher IsObjectIsNonNegativeSmi(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 IsWord32And(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 IsWord64And(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 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 IsTruncateFloat64ToInt32(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(); } // namespace compiler } // namespace internal } // namespace v8 #endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_