| 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_GRAPH_UNITTEST_H_ | 5 #ifndef V8_COMPILER_GRAPH_UNITTEST_H_ |
| 6 #define V8_COMPILER_GRAPH_UNITTEST_H_ | 6 #define V8_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 "src/test/test-utils.h" | 11 #include "src/test/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 class HeapObject; | 18 class HeapObject; |
| 19 template <class T> | 19 template <class T> |
| 20 class PrintableUnique; | 20 class Unique; |
| 21 | 21 |
| 22 namespace compiler { | 22 namespace compiler { |
| 23 | 23 |
| 24 using ::testing::Matcher; | 24 using ::testing::Matcher; |
| 25 | 25 |
| 26 | 26 |
| 27 class GraphTest : public TestWithContext, public TestWithZone { | 27 class GraphTest : public TestWithContext, public TestWithZone { |
| 28 public: | 28 public: |
| 29 explicit GraphTest(int parameters = 1); | 29 explicit GraphTest(int parameters = 1); |
| 30 virtual ~GraphTest(); | 30 virtual ~GraphTest(); |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 Node* Parameter(int32_t index); | 33 Node* Parameter(int32_t index); |
| 34 Node* Float64Constant(double value); | 34 Node* Float64Constant(double value); |
| 35 Node* Int32Constant(int32_t value); | 35 Node* Int32Constant(int32_t value); |
| 36 Node* Int64Constant(int64_t value); | 36 Node* Int64Constant(int64_t value); |
| 37 Node* NumberConstant(double value); | 37 Node* NumberConstant(double value); |
| 38 Node* HeapConstant(const PrintableUnique<HeapObject>& value); | 38 Node* HeapConstant(const Unique<HeapObject>& value); |
| 39 Node* FalseConstant(); | 39 Node* FalseConstant(); |
| 40 Node* TrueConstant(); | 40 Node* TrueConstant(); |
| 41 | 41 |
| 42 Matcher<Node*> IsFalseConstant(); | 42 Matcher<Node*> IsFalseConstant(); |
| 43 Matcher<Node*> IsTrueConstant(); | 43 Matcher<Node*> IsTrueConstant(); |
| 44 | 44 |
| 45 CommonOperatorBuilder* common() { return &common_; } | 45 CommonOperatorBuilder* common() { return &common_; } |
| 46 Graph* graph() { return &graph_; } | 46 Graph* graph() { return &graph_; } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 CommonOperatorBuilder common_; | 49 CommonOperatorBuilder common_; |
| 50 Graph graph_; | 50 Graph graph_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 | 53 |
| 54 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, | 54 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
| 55 const Matcher<Node*>& control_matcher); | 55 const Matcher<Node*>& control_matcher); |
| 56 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, | 56 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, |
| 57 const Matcher<Node*>& control1_matcher); | 57 const Matcher<Node*>& control1_matcher); |
| 58 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); | 58 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); |
| 59 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); | 59 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); |
| 60 Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher); | 60 Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher); |
| 61 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher); | 61 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher); |
| 62 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, | 62 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, |
| 63 const Matcher<Node*>& effect_matcher); | 63 const Matcher<Node*>& effect_matcher); |
| 64 Matcher<Node*> IsExternalConstant( | 64 Matcher<Node*> IsExternalConstant( |
| 65 const Matcher<ExternalReference>& value_matcher); | 65 const Matcher<ExternalReference>& value_matcher); |
| 66 Matcher<Node*> IsHeapConstant( | 66 Matcher<Node*> IsHeapConstant( |
| 67 const Matcher<PrintableUnique<HeapObject> >& value_matcher); | 67 const Matcher<Unique<HeapObject> >& value_matcher); |
| 68 Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher); | 68 Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher); |
| 69 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); | 69 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); |
| 70 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher); | 70 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher); |
| 71 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher); | 71 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher); |
| 72 Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, | 72 Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, |
| 73 const Matcher<Node*>& value1_matcher, | 73 const Matcher<Node*>& value1_matcher, |
| 74 const Matcher<Node*>& merge_matcher); | 74 const Matcher<Node*>& merge_matcher); |
| 75 Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, | 75 Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, |
| 76 const Matcher<Node*>& base_matcher); | 76 const Matcher<Node*>& base_matcher); |
| 77 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, | 77 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); | 122 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); |
| 123 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); | 123 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); |
| 124 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); | 124 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); |
| 125 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); | 125 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); |
| 126 | 126 |
| 127 } // namespace compiler | 127 } // namespace compiler |
| 128 } // namespace internal | 128 } // namespace internal |
| 129 } // namespace v8 | 129 } // namespace v8 |
| 130 | 130 |
| 131 #endif // V8_COMPILER_GRAPH_UNITTEST_H_ | 131 #endif // V8_COMPILER_GRAPH_UNITTEST_H_ |
| OLD | NEW |