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_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ | 5 #ifndef V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ |
6 #define V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ | 6 #define V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
11 #include "test/unittests/test-utils.h" | 11 #include "test/unittests/test-utils.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // Forward declarations. | 17 // Forward declarations. |
| 18 template <class T> |
| 19 class Handle; |
18 class HeapObject; | 20 class HeapObject; |
19 template <class T> | 21 template <class T> |
20 class Unique; | 22 class Unique; |
21 | 23 |
22 namespace compiler { | 24 namespace compiler { |
23 | 25 |
| 26 // Forward declarations. |
| 27 struct ElementAccess; |
| 28 struct FieldAccess; |
| 29 |
| 30 |
24 using ::testing::Matcher; | 31 using ::testing::Matcher; |
25 | 32 |
26 | 33 |
27 class GraphTest : public TestWithContext, public TestWithZone { | 34 class GraphTest : public TestWithContext, public TestWithZone { |
28 public: | 35 public: |
29 explicit GraphTest(int parameters = 1); | 36 explicit GraphTest(int parameters = 1); |
30 virtual ~GraphTest(); | 37 virtual ~GraphTest(); |
31 | 38 |
32 protected: | 39 protected: |
33 Node* Parameter(int32_t index); | 40 Node* Parameter(int32_t index); |
34 Node* Float32Constant(volatile float value); | 41 Node* Float32Constant(volatile float value); |
35 Node* Float64Constant(volatile double value); | 42 Node* Float64Constant(volatile double value); |
36 Node* Int32Constant(int32_t value); | 43 Node* Int32Constant(int32_t value); |
37 Node* Int64Constant(int64_t value); | 44 Node* Int64Constant(int64_t value); |
38 Node* NumberConstant(volatile double value); | 45 Node* NumberConstant(volatile double value); |
| 46 Node* HeapConstant(const Handle<HeapObject>& value); |
39 Node* HeapConstant(const Unique<HeapObject>& value); | 47 Node* HeapConstant(const Unique<HeapObject>& value); |
40 Node* FalseConstant(); | 48 Node* FalseConstant(); |
41 Node* TrueConstant(); | 49 Node* TrueConstant(); |
| 50 Node* UndefinedConstant(); |
42 | 51 |
43 Matcher<Node*> IsFalseConstant(); | 52 Matcher<Node*> IsFalseConstant(); |
44 Matcher<Node*> IsTrueConstant(); | 53 Matcher<Node*> IsTrueConstant(); |
45 | 54 |
46 CommonOperatorBuilder* common() { return &common_; } | 55 CommonOperatorBuilder* common() { return &common_; } |
47 Graph* graph() { return &graph_; } | 56 Graph* graph() { return &graph_; } |
48 | 57 |
49 private: | 58 private: |
50 CommonOperatorBuilder common_; | 59 CommonOperatorBuilder common_; |
51 Graph graph_; | 60 Graph graph_; |
(...skipping 29 matching lines...) Expand all Loading... |
81 const Matcher<Node*>& value1_matcher, | 90 const Matcher<Node*>& value1_matcher, |
82 const Matcher<Node*>& value2_matcher, | 91 const Matcher<Node*>& value2_matcher, |
83 const Matcher<Node*>& value3_matcher, | 92 const Matcher<Node*>& value3_matcher, |
84 const Matcher<Node*>& effect_matcher, | 93 const Matcher<Node*>& effect_matcher, |
85 const Matcher<Node*>& control_matcher); | 94 const Matcher<Node*>& control_matcher); |
86 | 95 |
87 Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher, | 96 Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher, |
88 const Matcher<Node*>& rhs_matcher); | 97 const Matcher<Node*>& rhs_matcher); |
89 Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher, | 98 Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher, |
90 const Matcher<Node*>& rhs_matcher); | 99 const Matcher<Node*>& rhs_matcher); |
| 100 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
| 101 const Matcher<Node*>& base_matcher, |
| 102 const Matcher<Node*>& effect_matcher); |
| 103 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher, |
| 104 const Matcher<Node*>& base_matcher, |
| 105 const Matcher<Node*>& index_matcher, |
| 106 const Matcher<Node*>& length_matcher, |
| 107 const Matcher<Node*>& effect_matcher, |
| 108 const Matcher<Node*>& control_matcher); |
| 109 Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher, |
| 110 const Matcher<Node*>& base_matcher, |
| 111 const Matcher<Node*>& index_matcher, |
| 112 const Matcher<Node*>& length_matcher, |
| 113 const Matcher<Node*>& value_matcher, |
| 114 const Matcher<Node*>& effect_matcher, |
| 115 const Matcher<Node*>& control_matcher); |
91 | 116 |
92 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, | 117 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, |
93 const Matcher<Node*>& base_matcher, | 118 const Matcher<Node*>& base_matcher, |
94 const Matcher<Node*>& index_matcher, | 119 const Matcher<Node*>& index_matcher, |
95 const Matcher<Node*>& effect_matcher, | 120 const Matcher<Node*>& effect_matcher, |
96 const Matcher<Node*>& control_matcher); | 121 const Matcher<Node*>& control_matcher); |
97 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, | 122 Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, |
98 const Matcher<WriteBarrierKind>& write_barrier_matcher, | 123 const Matcher<WriteBarrierKind>& write_barrier_matcher, |
99 const Matcher<Node*>& base_matcher, | 124 const Matcher<Node*>& base_matcher, |
100 const Matcher<Node*>& index_matcher, | 125 const Matcher<Node*>& index_matcher, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher); | 159 Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher); |
135 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); | 160 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); |
136 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); | 161 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); |
137 Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher); | 162 Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher); |
138 | 163 |
139 } // namespace compiler | 164 } // namespace compiler |
140 } // namespace internal | 165 } // namespace internal |
141 } // namespace v8 | 166 } // namespace v8 |
142 | 167 |
143 #endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ | 168 #endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ |
OLD | NEW |