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