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_CODEGEN_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/instruction-selector.h" | 10 #include "src/compiler/instruction-selector.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 MachineAssemblerTester(MachineType return_type, MachineType p0, | 25 MachineAssemblerTester(MachineType return_type, MachineType p0, |
26 MachineType p1, MachineType p2, MachineType p3, | 26 MachineType p1, MachineType p2, MachineType p3, |
27 MachineType p4, | 27 MachineType p4, |
28 MachineOperatorBuilder::Flags flags = | 28 MachineOperatorBuilder::Flags flags = |
29 MachineOperatorBuilder::Flag::kNoFlags) | 29 MachineOperatorBuilder::Flag::kNoFlags) |
30 : HandleAndZoneScope(), | 30 : HandleAndZoneScope(), |
31 CallHelper( | 31 CallHelper( |
32 main_isolate(), | 32 main_isolate(), |
33 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4)), | 33 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4)), |
34 MachineAssembler( | 34 MachineAssembler( |
35 new (main_zone()) Graph(main_zone()), | 35 main_isolate(), new (main_zone()) Graph(main_zone()), |
36 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4), | 36 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4), |
37 kMachPtr, flags) {} | 37 kMachPtr, flags) {} |
38 | 38 |
39 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { | 39 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { |
40 return this->Load(rep, this->PointerConstant(address), | 40 return this->Load(rep, this->PointerConstant(address), |
41 this->Int32Constant(offset)); | 41 this->Int32Constant(offset)); |
42 } | 42 } |
43 | 43 |
44 void StoreToPointer(void* address, MachineType rep, Node* node) { | 44 void StoreToPointer(void* address, MachineType rep, Node* node) { |
45 this->Store(rep, this->PointerConstant(address), node); | 45 this->Store(rep, this->PointerConstant(address), node); |
(...skipping 15 matching lines...) Expand all Loading... |
61 } | 61 } |
62 | 62 |
63 void GenerateCode() { Generate(); } | 63 void GenerateCode() { Generate(); } |
64 | 64 |
65 protected: | 65 protected: |
66 virtual byte* Generate() { | 66 virtual byte* Generate() { |
67 if (code_.is_null()) { | 67 if (code_.is_null()) { |
68 Schedule* schedule = this->Export(); | 68 Schedule* schedule = this->Export(); |
69 CallDescriptor* call_descriptor = this->call_descriptor(); | 69 CallDescriptor* call_descriptor = this->call_descriptor(); |
70 Graph* graph = this->graph(); | 70 Graph* graph = this->graph(); |
71 code_ = | 71 code_ = Pipeline::GenerateCodeForTesting(this->isolate(), call_descriptor, |
72 Pipeline::GenerateCodeForTesting(call_descriptor, graph, schedule); | 72 graph, schedule); |
73 } | 73 } |
74 return this->code_.ToHandleChecked()->entry(); | 74 return this->code_.ToHandleChecked()->entry(); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 MaybeHandle<Code> code_; | 78 MaybeHandle<Code> code_; |
79 }; | 79 }; |
80 | 80 |
81 | 81 |
82 template <typename ReturnType> | 82 template <typename ReturnType> |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 void Run(RawMachineAssemblerTester<int32_t>* m); | 331 void Run(RawMachineAssemblerTester<int32_t>* m); |
332 void RunLeft(RawMachineAssemblerTester<int32_t>* m); | 332 void RunLeft(RawMachineAssemblerTester<int32_t>* m); |
333 void RunRight(RawMachineAssemblerTester<int32_t>* m); | 333 void RunRight(RawMachineAssemblerTester<int32_t>* m); |
334 }; | 334 }; |
335 } // namespace compiler | 335 } // namespace compiler |
336 } // namespace internal | 336 } // namespace internal |
337 } // namespace v8 | 337 } // namespace v8 |
338 | 338 |
339 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 339 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
OLD | NEW |