| 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_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ |
| 6 #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class MachineCallHelper : public CallHelper { | 38 class MachineCallHelper : public CallHelper { |
| 39 public: | 39 public: |
| 40 MachineCallHelper(Zone* zone, MachineCallDescriptorBuilder* builder); | 40 MachineCallHelper(Zone* zone, MachineCallDescriptorBuilder* builder); |
| 41 | 41 |
| 42 Node* Parameter(int offset); | 42 Node* Parameter(int offset); |
| 43 | 43 |
| 44 void GenerateCode() { Generate(); } | 44 void GenerateCode() { Generate(); } |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual byte* Generate(); | 47 virtual byte* Generate(); |
| 48 virtual void VerifyParameters(int parameter_count, | 48 virtual void VerifyParameters(int parameter_count, MachineType* parameters); |
| 49 MachineRepresentation* parameters); | |
| 50 void InitParameters(GraphBuilder* builder, CommonOperatorBuilder* common); | 49 void InitParameters(GraphBuilder* builder, CommonOperatorBuilder* common); |
| 51 | 50 |
| 52 protected: | 51 protected: |
| 53 int parameter_count() const { | 52 int parameter_count() const { |
| 54 return call_descriptor_builder_->parameter_count(); | 53 return call_descriptor_builder_->parameter_count(); |
| 55 } | 54 } |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 MachineCallDescriptorBuilder* call_descriptor_builder_; | 57 MachineCallDescriptorBuilder* call_descriptor_builder_; |
| 59 Node** parameters_; | 58 Node** parameters_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 81 | 80 |
| 82 | 81 |
| 83 template <typename ReturnType> | 82 template <typename ReturnType> |
| 84 class GraphBuilderTester | 83 class GraphBuilderTester |
| 85 : public HandleAndZoneScope, | 84 : public HandleAndZoneScope, |
| 86 private GraphAndBuilders, | 85 private GraphAndBuilders, |
| 87 public MachineCallHelper, | 86 public MachineCallHelper, |
| 88 public SimplifiedGraphBuilder, | 87 public SimplifiedGraphBuilder, |
| 89 public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > { | 88 public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > { |
| 90 public: | 89 public: |
| 91 explicit GraphBuilderTester(MachineRepresentation p0 = kMachineLast, | 90 explicit GraphBuilderTester(MachineType p0 = kMachineLast, |
| 92 MachineRepresentation p1 = kMachineLast, | 91 MachineType p1 = kMachineLast, |
| 93 MachineRepresentation p2 = kMachineLast, | 92 MachineType p2 = kMachineLast, |
| 94 MachineRepresentation p3 = kMachineLast, | 93 MachineType p3 = kMachineLast, |
| 95 MachineRepresentation p4 = kMachineLast) | 94 MachineType p4 = kMachineLast) |
| 96 : GraphAndBuilders(main_zone()), | 95 : GraphAndBuilders(main_zone()), |
| 97 MachineCallHelper( | 96 MachineCallHelper( |
| 98 main_zone(), | 97 main_zone(), |
| 99 ToCallDescriptorBuilder( | 98 ToCallDescriptorBuilder( |
| 100 main_zone(), ReturnValueTraits<ReturnType>::Representation(), | 99 main_zone(), ReturnValueTraits<ReturnType>::Representation(), |
| 101 p0, p1, p2, p3, p4)), | 100 p0, p1, p2, p3, p4)), |
| 102 SimplifiedGraphBuilder(main_graph_, &main_common_, &main_machine_, | 101 SimplifiedGraphBuilder(main_graph_, &main_common_, &main_machine_, |
| 103 &main_simplified_) { | 102 &main_simplified_) { |
| 104 Begin(parameter_count()); | 103 Begin(parameter_count()); |
| 105 InitParameters(this, &main_common_); | 104 InitParameters(this, &main_common_); |
| 106 } | 105 } |
| 107 virtual ~GraphBuilderTester() {} | 106 virtual ~GraphBuilderTester() {} |
| 108 | 107 |
| 109 Factory* factory() const { return isolate()->factory(); } | 108 Factory* factory() const { return isolate()->factory(); } |
| 110 }; | 109 }; |
| 111 } // namespace compiler | 110 } // namespace compiler |
| 112 } // namespace internal | 111 } // namespace internal |
| 113 } // namespace v8 | 112 } // namespace v8 |
| 114 | 113 |
| 115 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ | 114 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ |
| OLD | NEW |