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" | |
Benedikt Meurer
2015/01/16 17:55:36
Remove these two includes again.
titzer
2015/01/19 09:47:12
Done.
| |
11 #include "src/compiler/node.h" | |
10 #include "src/compiler/typer.h" | 12 #include "src/compiler/typer.h" |
11 #include "test/unittests/test-utils.h" | 13 #include "test/unittests/test-utils.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
13 | 15 |
14 namespace v8 { | 16 namespace v8 { |
15 namespace internal { | 17 namespace internal { |
16 | 18 |
17 // Forward declarations. | 19 // Forward declarations. |
18 template <class T> | 20 template <class T> |
19 class Handle; | 21 class Handle; |
20 class HeapObject; | 22 class HeapObject; |
21 template <class T> | 23 template <class T> |
22 class Unique; | 24 class Unique; |
23 | 25 |
24 namespace compiler { | 26 namespace compiler { |
25 | 27 |
26 using ::testing::Matcher; | 28 using ::testing::Matcher; |
27 | 29 |
28 | 30 |
29 class GraphTest : public TestWithContext, public TestWithZone { | 31 class GraphTest : public TestWithContext, public TestWithZone { |
30 public: | 32 public: |
31 explicit GraphTest(int num_parameters = 1); | 33 explicit GraphTest(int num_parameters = 1); |
32 ~GraphTest() OVERRIDE; | 34 ~GraphTest() OVERRIDE; |
33 | 35 |
34 protected: | |
Benedikt Meurer
2015/01/16 17:55:36
Reinsert the protected.
titzer
2015/01/19 09:47:12
Done.
| |
35 Node* Parameter(int32_t index = 0); | 36 Node* Parameter(int32_t index = 0); |
36 Node* Float32Constant(volatile float value); | 37 Node* Float32Constant(volatile float value); |
37 Node* Float64Constant(volatile double value); | 38 Node* Float64Constant(volatile double value); |
38 Node* Int32Constant(int32_t value); | 39 Node* Int32Constant(int32_t value); |
39 Node* Uint32Constant(uint32_t value) { | 40 Node* Uint32Constant(uint32_t value) { |
40 return Int32Constant(bit_cast<int32_t>(value)); | 41 return Int32Constant(bit_cast<int32_t>(value)); |
41 } | 42 } |
42 Node* Int64Constant(int64_t value); | 43 Node* Int64Constant(int64_t value); |
43 Node* NumberConstant(volatile double value); | 44 Node* NumberConstant(volatile double value); |
44 Node* HeapConstant(const Handle<HeapObject>& value); | 45 Node* HeapConstant(const Handle<HeapObject>& value); |
45 Node* HeapConstant(const Unique<HeapObject>& value); | 46 Node* HeapConstant(const Unique<HeapObject>& value); |
46 Node* FalseConstant(); | 47 Node* FalseConstant(); |
47 Node* TrueConstant(); | 48 Node* TrueConstant(); |
48 Node* UndefinedConstant(); | 49 Node* UndefinedConstant(); |
49 | 50 |
50 Matcher<Node*> IsFalseConstant(); | 51 Matcher<Node*> IsFalseConstant(); |
51 Matcher<Node*> IsTrueConstant(); | 52 Matcher<Node*> IsTrueConstant(); |
52 | 53 |
54 Node* start() { return graph()->start(); } | |
53 CommonOperatorBuilder* common() { return &common_; } | 55 CommonOperatorBuilder* common() { return &common_; } |
54 Graph* graph() { return &graph_; } | 56 Graph* graph() { return &graph_; } |
55 | 57 |
56 private: | 58 private: |
57 CommonOperatorBuilder common_; | 59 CommonOperatorBuilder common_; |
58 Graph graph_; | 60 Graph graph_; |
59 }; | 61 }; |
60 | 62 |
61 | 63 |
62 class TypedGraphTest : public GraphTest { | 64 class TypedGraphTest : public GraphTest { |
63 public: | 65 public: |
64 explicit TypedGraphTest(int num_parameters = 1); | 66 explicit TypedGraphTest(int num_parameters = 1); |
65 ~TypedGraphTest() OVERRIDE; | 67 ~TypedGraphTest() OVERRIDE; |
66 | 68 |
67 protected: | |
Benedikt Meurer
2015/01/16 17:55:36
Reinsert the protected.
titzer
2015/01/19 09:47:12
Done.
| |
68 Node* Parameter(int32_t index = 0) { return GraphTest::Parameter(index); } | 69 Node* Parameter(int32_t index = 0) { return GraphTest::Parameter(index); } |
69 Node* Parameter(Type* type, int32_t index = 0); | 70 Node* Parameter(Type* type, int32_t index = 0); |
70 | 71 |
71 Typer* typer() { return &typer_; } | 72 Typer* typer() { return &typer_; } |
72 | 73 |
73 private: | 74 private: |
74 Typer typer_; | 75 Typer typer_; |
75 }; | 76 }; |
76 | 77 |
78 | |
77 } // namespace compiler | 79 } // namespace compiler |
78 } // namespace internal | 80 } // namespace internal |
79 } // namespace v8 | 81 } // namespace v8 |
80 | 82 |
81 #endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ | 83 #endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ |
OLD | NEW |