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_GRAPH_UNITTEST_H_ |
6 #define V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | 6 #define V8_COMPILER_GRAPH_UNITTEST_H_ |
7 | 7 |
| 8 #include "src/compiler/common-operator.h" |
| 9 #include "src/compiler/compiler-unittests.h" |
8 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
9 #include "src/compiler/machine-operator.h" | 11 #include "src/compiler/machine-operator.h" |
10 #include "test/compiler-unittests/common-operator-unittest.h" | |
11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 // Forward declarations. | 17 // Forward declarations. |
17 class HeapObject; | 18 class HeapObject; |
18 template <class T> | 19 template <class T> |
19 class PrintableUnique; | 20 class PrintableUnique; |
20 | 21 |
21 namespace compiler { | 22 namespace compiler { |
22 | 23 |
23 using ::testing::Matcher; | 24 using ::testing::Matcher; |
24 | 25 |
25 | 26 |
26 class GraphTest : public CommonOperatorTest { | 27 class GraphTest : public CompilerTest { |
27 public: | 28 public: |
28 explicit GraphTest(int parameters = 1); | 29 explicit GraphTest(int parameters = 1); |
29 virtual ~GraphTest(); | 30 virtual ~GraphTest(); |
30 | 31 |
31 protected: | 32 protected: |
32 Node* Parameter(int32_t index); | 33 Node* Parameter(int32_t index); |
33 Node* Float64Constant(double value); | 34 Node* Float64Constant(double value); |
34 Node* Int32Constant(int32_t value); | 35 Node* Int32Constant(int32_t value); |
35 Node* Int64Constant(int64_t value); | 36 Node* Int64Constant(int64_t value); |
36 Node* NumberConstant(double value); | 37 Node* NumberConstant(double value); |
37 Node* HeapConstant(const PrintableUnique<HeapObject>& value); | 38 Node* HeapConstant(const PrintableUnique<HeapObject>& value); |
38 Node* FalseConstant(); | 39 Node* FalseConstant(); |
39 Node* TrueConstant(); | 40 Node* TrueConstant(); |
40 | 41 |
41 Matcher<Node*> IsFalseConstant(); | 42 Matcher<Node*> IsFalseConstant(); |
42 Matcher<Node*> IsTrueConstant(); | 43 Matcher<Node*> IsTrueConstant(); |
43 | 44 |
| 45 CommonOperatorBuilder* common() { return &common_; } |
44 Graph* graph() { return &graph_; } | 46 Graph* graph() { return &graph_; } |
45 | 47 |
46 private: | 48 private: |
| 49 CommonOperatorBuilder common_; |
47 Graph graph_; | 50 Graph graph_; |
48 }; | 51 }; |
49 | 52 |
50 | 53 |
51 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, | 54 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
52 const Matcher<Node*>& control_matcher); | 55 const Matcher<Node*>& control_matcher); |
53 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, | 56 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, |
54 const Matcher<Node*>& control1_matcher); | 57 const Matcher<Node*>& control1_matcher); |
55 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); | 58 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); |
56 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); | 59 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher); | 121 Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher); |
119 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); | 122 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); |
120 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); | 123 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); |
121 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); | 124 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); |
122 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); | 125 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); |
123 | 126 |
124 } // namespace compiler | 127 } // namespace compiler |
125 } // namespace internal | 128 } // namespace internal |
126 } // namespace v8 | 129 } // namespace v8 |
127 | 130 |
128 #endif // V8_COMPILER_UNITTESTS_GRAPH_UNITTEST_H_ | 131 #endif // V8_COMPILER_GRAPH_UNITTEST_H_ |
OLD | NEW |