OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | 5 #ifndef V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ |
6 #define V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | 6 #define V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ |
7 | 7 |
8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "test/compiler-unittests/common-operator-unittest.h" | 10 #include "test/compiler-unittests/common-operator-unittest.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // Forward declarations. | 16 // Forward declarations. |
17 class HeapObject; | 17 class HeapObject; |
18 template <class T> | 18 template <class T> |
19 class PrintableUnique; | 19 class PrintableUnique; |
20 | 20 |
21 namespace compiler { | 21 namespace compiler { |
22 | 22 |
| 23 using ::testing::Matcher; |
| 24 |
| 25 |
23 class GraphTest : public CommonOperatorTest { | 26 class GraphTest : public CommonOperatorTest { |
24 public: | 27 public: |
25 explicit GraphTest(int parameters = 1); | 28 explicit GraphTest(int parameters = 1); |
26 virtual ~GraphTest(); | 29 virtual ~GraphTest(); |
27 | 30 |
28 protected: | 31 protected: |
| 32 Node* Parameter(int32_t index); |
| 33 Node* Float64Constant(double value); |
| 34 Node* Int32Constant(int32_t value); |
| 35 Node* NumberConstant(double value); |
| 36 Node* HeapConstant(const PrintableUnique<HeapObject>& value); |
| 37 Node* FalseConstant(); |
| 38 Node* TrueConstant(); |
| 39 |
| 40 Matcher<Node*> IsFalseConstant(); |
| 41 Matcher<Node*> IsTrueConstant(); |
| 42 |
29 Graph* graph() { return &graph_; } | 43 Graph* graph() { return &graph_; } |
30 | 44 |
31 private: | 45 private: |
32 Graph graph_; | 46 Graph graph_; |
33 }; | 47 }; |
34 | 48 |
35 | 49 |
36 using ::testing::Matcher; | |
37 | |
38 | |
39 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, | 50 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
40 const Matcher<Node*>& control_matcher); | 51 const Matcher<Node*>& control_matcher); |
41 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, | 52 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, |
42 const Matcher<Node*>& control1_matcher); | 53 const Matcher<Node*>& control1_matcher); |
43 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); | 54 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); |
44 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); | 55 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); |
45 Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher); | 56 Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher); |
46 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher); | 57 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher); |
47 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, | 58 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, |
48 const Matcher<Node*>& effect_matcher); | 59 const Matcher<Node*>& effect_matcher); |
49 Matcher<Node*> IsExternalConstant( | 60 Matcher<Node*> IsExternalConstant( |
50 const Matcher<ExternalReference>& value_matcher); | 61 const Matcher<ExternalReference>& value_matcher); |
51 Matcher<Node*> IsHeapConstant( | 62 Matcher<Node*> IsHeapConstant( |
52 const Matcher<PrintableUnique<HeapObject> >& value_matcher); | 63 const Matcher<PrintableUnique<HeapObject> >& value_matcher); |
| 64 Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher); |
53 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); | 65 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); |
54 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher); | 66 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher); |
55 Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, | 67 Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, |
56 const Matcher<Node*>& value1_matcher, | 68 const Matcher<Node*>& value1_matcher, |
57 const Matcher<Node*>& merge_matcher); | 69 const Matcher<Node*>& merge_matcher); |
58 Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, | 70 Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, |
59 const Matcher<Node*>& base_matcher); | 71 const Matcher<Node*>& base_matcher); |
60 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, | 72 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
61 const Matcher<Node*>& value0_matcher, | 73 const Matcher<Node*>& value0_matcher, |
62 const Matcher<Node*>& value1_matcher, | 74 const Matcher<Node*>& value1_matcher, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); | 116 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); |
105 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); | 117 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); |
106 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); | 118 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); |
107 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); | 119 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); |
108 | 120 |
109 } // namespace compiler | 121 } // namespace compiler |
110 } // namespace internal | 122 } // namespace internal |
111 } // namespace v8 | 123 } // namespace v8 |
112 | 124 |
113 #endif // V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | 125 #endif // V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ |
OLD | NEW |