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/typer.h" | 10 #include "src/compiler/typer.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> | 18 template <class T> |
19 class Handle; | 19 class Handle; |
20 class HeapObject; | 20 class HeapObject; |
21 template <class T> | |
22 class Unique; | |
23 | 21 |
24 namespace compiler { | 22 namespace compiler { |
25 | 23 |
26 using ::testing::Matcher; | 24 using ::testing::Matcher; |
27 | 25 |
28 | 26 |
29 class GraphTest : public TestWithContext, public TestWithIsolateAndZone { | 27 class GraphTest : public TestWithContext, public TestWithIsolateAndZone { |
30 public: | 28 public: |
31 explicit GraphTest(int num_parameters = 1); | 29 explicit GraphTest(int num_parameters = 1); |
32 ~GraphTest() override; | 30 ~GraphTest() override; |
33 | 31 |
34 protected: | 32 protected: |
35 Node* start() { return graph()->start(); } | 33 Node* start() { return graph()->start(); } |
36 Node* end() { return graph()->end(); } | 34 Node* end() { return graph()->end(); } |
37 | 35 |
38 Node* Parameter(int32_t index = 0); | 36 Node* Parameter(int32_t index = 0); |
39 Node* Float32Constant(volatile float value); | 37 Node* Float32Constant(volatile float value); |
40 Node* Float64Constant(volatile double value); | 38 Node* Float64Constant(volatile double value); |
41 Node* Int32Constant(int32_t value); | 39 Node* Int32Constant(int32_t value); |
42 Node* Uint32Constant(uint32_t value) { | 40 Node* Uint32Constant(uint32_t value) { |
43 return Int32Constant(bit_cast<int32_t>(value)); | 41 return Int32Constant(bit_cast<int32_t>(value)); |
44 } | 42 } |
45 Node* Int64Constant(int64_t value); | 43 Node* Int64Constant(int64_t value); |
46 Node* NumberConstant(volatile double value); | 44 Node* NumberConstant(volatile double value); |
47 Node* HeapConstant(const Handle<HeapObject>& value); | 45 Node* HeapConstant(const Handle<HeapObject>& value); |
48 Node* HeapConstant(const Unique<HeapObject>& value); | |
49 Node* FalseConstant(); | 46 Node* FalseConstant(); |
50 Node* TrueConstant(); | 47 Node* TrueConstant(); |
51 Node* UndefinedConstant(); | 48 Node* UndefinedConstant(); |
52 | 49 |
53 Node* EmptyFrameState(); | 50 Node* EmptyFrameState(); |
54 | 51 |
55 Matcher<Node*> IsFalseConstant(); | 52 Matcher<Node*> IsFalseConstant(); |
56 Matcher<Node*> IsTrueConstant(); | 53 Matcher<Node*> IsTrueConstant(); |
57 Matcher<Node*> IsUndefinedConstant(); | 54 Matcher<Node*> IsUndefinedConstant(); |
58 | 55 |
(...skipping 19 matching lines...) Loading... |
78 | 75 |
79 private: | 76 private: |
80 Typer typer_; | 77 Typer typer_; |
81 }; | 78 }; |
82 | 79 |
83 } // namespace compiler | 80 } // namespace compiler |
84 } // namespace internal | 81 } // namespace internal |
85 } // namespace v8 | 82 } // namespace v8 |
86 | 83 |
87 #endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ | 84 #endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ |
OLD | NEW |