2014-10-20 11:26:23 +00:00
|
|
|
// 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;
|
|
|
|
class HeapObject;
|
|
|
|
template <class T>
|
|
|
|
class Unique;
|
|
|
|
|
|
|
|
namespace compiler {
|
|
|
|
|
|
|
|
// Forward declarations.
|
2014-12-02 04:48:57 +00:00
|
|
|
class BufferAccess;
|
2014-10-20 11:26:23 +00:00
|
|
|
class CallDescriptor;
|
|
|
|
struct ElementAccess;
|
|
|
|
struct FieldAccess;
|
|
|
|
class Node;
|
|
|
|
|
|
|
|
|
|
|
|
using ::testing::Matcher;
|
|
|
|
|
|
|
|
|
2015-01-27 14:02:21 +00:00
|
|
|
Matcher<Node*> IsAlways();
|
|
|
|
Matcher<Node*> IsEnd(const Matcher<Node*>& control_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
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);
|
2015-02-17 13:29:31 +00:00
|
|
|
Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher,
|
|
|
|
const Matcher<Node*>& control2_matcher);
|
2015-01-20 09:45:02 +00:00
|
|
|
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);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
|
|
|
|
Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
|
2015-03-03 06:11:37 +00:00
|
|
|
Matcher<Node*> IsIfSuccess(const Matcher<Node*>& control_matcher);
|
2015-02-17 13:29:31 +00:00
|
|
|
Matcher<Node*> IsSwitch(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
|
|
|
Matcher<Node*> IsIfValue(const Matcher<int32_t>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
|
|
|
Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher);
|
|
|
|
Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher);
|
2015-01-20 09:45:02 +00:00
|
|
|
Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsExternalConstant(
|
|
|
|
const Matcher<ExternalReference>& value_matcher);
|
|
|
|
Matcher<Node*> IsHeapConstant(
|
|
|
|
const Matcher<Unique<HeapObject> >& value_matcher);
|
|
|
|
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);
|
2014-10-29 14:16:32 +00:00
|
|
|
Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher);
|
2015-01-20 09:45:02 +00:00
|
|
|
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher);
|
2014-11-04 14:37:22 +00:00
|
|
|
Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
|
|
|
|
const Matcher<Node*>& effect1_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher);
|
2015-01-27 14:02:21 +00:00
|
|
|
Matcher<Node*> IsEffectSet(const Matcher<Node*>& effect0_matcher,
|
|
|
|
const Matcher<Node*>& effect1_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher);
|
2014-11-04 12:58:17 +00:00
|
|
|
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& 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);
|
|
|
|
|
2015-01-05 13:44:13 +00:00
|
|
|
Matcher<Node*> IsAnyToBoolean(const Matcher<Node*>& value_matcher);
|
2014-10-28 08:33:52 +00:00
|
|
|
Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
|
|
|
|
Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
|
|
|
Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-10-29 14:16:32 +00:00
|
|
|
Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
2014-10-28 08:33:52 +00:00
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
2014-12-04 10:50:43 +00:00
|
|
|
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);
|
2014-12-02 04:48:57 +00:00
|
|
|
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);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
2014-12-02 04:48:57 +00:00
|
|
|
const Matcher<Node*>& control_matcher,
|
2014-10-28 13:00:11 +00:00
|
|
|
const Matcher<Node*>& effect_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
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);
|
2015-01-26 09:05:47 +00:00
|
|
|
Matcher<Node*> IsObjectIsSmi(const Matcher<Node*>& value_matcher);
|
|
|
|
Matcher<Node*> IsObjectIsNonNegativeSmi(const Matcher<Node*>& value_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
|
|
|
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);
|
|
|
|
Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
|
|
|
Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
|
|
|
|
Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher);
|
|
|
|
Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
|
2014-11-06 06:13:10 +00:00
|
|
|
Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
|
Add floor, ceil, round (truncate) instructions for ia32, x64 (if SSE4.1) and
add floor, ceil, round (truncate and away from zero) for arm64.
R=bmeurer@chromium.org, dcarney@chromium.org, mstarzinger@chromium.org, rodolph.perfetta@arm.com
TEST=test/mjsunit/asm/math-floor.js,test/mjsunit/asm/math-ceil.js,test/unittest/compiler/js-builtin-reducer-unittest.cc
Review URL: https://codereview.chromium.org/677433002
Cr-Commit-Position: refs/heads/master@{#25018}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25018 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-30 14:15:20 +00:00
|
|
|
Matcher<Node*> IsFloat64Floor(const Matcher<Node*>& input_matcher);
|
|
|
|
Matcher<Node*> IsFloat64Ceil(const Matcher<Node*>& input_matcher);
|
|
|
|
Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
|
|
|
|
Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
|
2015-03-05 09:22:26 +00:00
|
|
|
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);
|
2014-11-25 08:40:18 +00:00
|
|
|
Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& context_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
|
|
|
Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
|
|
|
|
Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher);
|
2014-10-20 11:26:23 +00:00
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
|