2014-08-12 08:24:20 +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.
|
|
|
|
|
2014-08-18 06:54:07 +00:00
|
|
|
#ifndef V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_
|
|
|
|
#define V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_
|
2014-08-12 08:24:20 +00:00
|
|
|
|
2014-08-18 06:54:07 +00:00
|
|
|
#include "src/compiler/graph.h"
|
2014-08-12 08:24:20 +00:00
|
|
|
#include "src/compiler/machine-operator.h"
|
2014-08-18 06:54:07 +00:00
|
|
|
#include "test/compiler-unittests/common-operator-unittest.h"
|
2014-08-12 08:24:20 +00:00
|
|
|
#include "testing/gmock/include/gmock/gmock.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
// Forward declarations.
|
|
|
|
class HeapObject;
|
|
|
|
template <class T>
|
|
|
|
class PrintableUnique;
|
|
|
|
|
|
|
|
namespace compiler {
|
|
|
|
|
2014-08-18 06:54:07 +00:00
|
|
|
class GraphTest : public CommonOperatorTest {
|
|
|
|
public:
|
|
|
|
explicit GraphTest(int parameters = 1);
|
|
|
|
virtual ~GraphTest();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Graph* graph() { return &graph_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Graph graph_;
|
|
|
|
};
|
|
|
|
|
2014-08-12 08:24:20 +00:00
|
|
|
|
2014-08-18 06:54:07 +00:00
|
|
|
using ::testing::Matcher;
|
2014-08-12 08:24:20 +00:00
|
|
|
|
2014-08-19 04:54:06 +00:00
|
|
|
|
2014-08-12 08:24:20 +00:00
|
|
|
Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher);
|
2014-08-18 06:54:07 +00:00
|
|
|
Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher);
|
|
|
|
Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
|
|
|
|
Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
|
2014-08-18 11:36:06 +00:00
|
|
|
Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher);
|
2014-08-19 04:54:06 +00:00
|
|
|
Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher);
|
2014-08-18 11:36:06 +00:00
|
|
|
Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher);
|
|
|
|
Matcher<Node*> IsExternalConstant(
|
|
|
|
const Matcher<ExternalReference>& value_matcher);
|
2014-08-12 08:24:20 +00:00
|
|
|
Matcher<Node*> IsHeapConstant(
|
|
|
|
const Matcher<PrintableUnique<HeapObject> >& value_matcher);
|
|
|
|
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
|
2014-08-18 11:36:06 +00:00
|
|
|
Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
|
2014-08-12 08:24:20 +00:00
|
|
|
Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher);
|
|
|
|
Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher);
|
2014-08-18 11:36:06 +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);
|
2014-08-12 08:24:20 +00:00
|
|
|
|
|
|
|
Matcher<Node*> IsLoad(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher);
|
|
|
|
Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<WriteBarrierKind>& write_barrier_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);
|
2014-08-20 04:01:36 +00:00
|
|
|
Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-08-14 09:07:58 +00:00
|
|
|
Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-08-12 08:24:20 +00:00
|
|
|
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);
|
2014-08-20 04:01:36 +00:00
|
|
|
Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher);
|
2014-08-19 04:54:06 +00:00
|
|
|
Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
|
2014-08-12 08:24:20 +00:00
|
|
|
Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
|
2014-08-19 08:48:41 +00:00
|
|
|
Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
|
2014-08-20 04:01:36 +00:00
|
|
|
Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
|
2014-08-19 08:48:41 +00:00
|
|
|
Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
|
2014-08-20 04:01:00 +00:00
|
|
|
Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher);
|
2014-08-19 08:48:41 +00:00
|
|
|
Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
|
2014-08-12 08:24:20 +00:00
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
2014-08-18 06:54:07 +00:00
|
|
|
#endif // V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_
|