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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 return result; | 267 return result; |
268 } | 268 } |
269 | 269 |
270 virtual byte* Generate() { | 270 virtual byte* Generate() { |
271 if (!Pipeline::SupportedBackend()) return NULL; | 271 if (!Pipeline::SupportedBackend()) return NULL; |
272 if (code_.is_null()) { | 272 if (code_.is_null()) { |
273 Zone* zone = graph()->zone(); | 273 Zone* zone = graph()->zone(); |
274 CallDescriptor* desc = | 274 CallDescriptor* desc = |
275 Linkage::GetSimplifiedCDescriptor(zone, this->csig_); | 275 Linkage::GetSimplifiedCDescriptor(zone, this->csig_); |
276 code_ = Pipeline::GenerateCodeForTesting(main_isolate(), desc, graph()); | 276 code_ = Pipeline::GenerateCodeForTesting(main_isolate(), desc, graph()); |
| 277 #ifdef ENABLE_DISASSEMBLER |
| 278 if (!code_.is_null() && FLAG_print_opt_code) { |
| 279 OFStream os(stdout); |
| 280 code_.ToHandleChecked()->Disassemble("test code", os); |
| 281 } |
| 282 #endif |
277 } | 283 } |
278 return code_.ToHandleChecked()->entry(); | 284 return code_.ToHandleChecked()->entry(); |
279 } | 285 } |
280 | 286 |
281 void InitParameters() { | 287 void InitParameters() { |
282 int param_count = static_cast<int>(parameter_count()); | 288 int param_count = static_cast<int>(parameter_count()); |
283 for (int i = 0; i < param_count; ++i) { | 289 for (int i = 0; i < param_count; ++i) { |
284 parameters_[i] = this->NewNode(common()->Parameter(i), graph()->start()); | 290 parameters_[i] = this->NewNode(common()->Parameter(i), graph()->start()); |
285 } | 291 } |
286 } | 292 } |
287 | 293 |
288 size_t parameter_count() const { return this->csig_->parameter_count(); } | 294 size_t parameter_count() const { return this->csig_->parameter_count(); } |
289 | 295 |
290 private: | 296 private: |
291 Node* effect_; | 297 Node* effect_; |
292 Node* return_; | 298 Node* return_; |
293 Node** parameters_; | 299 Node** parameters_; |
294 MaybeHandle<Code> code_; | 300 MaybeHandle<Code> code_; |
295 }; | 301 }; |
296 | 302 |
297 } // namespace compiler | 303 } // namespace compiler |
298 } // namespace internal | 304 } // namespace internal |
299 } // namespace v8 | 305 } // namespace v8 |
300 | 306 |
301 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ | 307 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ |
OLD | NEW |