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 #include "src/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/adapters.h" | 10 #include "src/base/adapters.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 json_of << AsEscapedUC16ForJSON(c); | 493 json_of << AsEscapedUC16ForJSON(c); |
494 } | 494 } |
495 } | 495 } |
496 json_of << "\",\n\"phases\":["; | 496 json_of << "\",\n\"phases\":["; |
497 fclose(json_file); | 497 fclose(json_file); |
498 } | 498 } |
499 | 499 |
500 return pipeline_statistics; | 500 return pipeline_statistics; |
501 } | 501 } |
502 | 502 |
503 class PipelineCompilationJob final : public OptimizedCompileJob { | 503 class PipelineCompilationJob final : public CompilationJob { |
504 public: | 504 public: |
505 explicit PipelineCompilationJob(CompilationInfo* info) | 505 explicit PipelineCompilationJob(CompilationInfo* info) |
506 : OptimizedCompileJob(info, "TurboFan"), | 506 : CompilationJob(info, "TurboFan"), |
507 zone_pool_(info->isolate()->allocator()), | 507 zone_pool_(info->isolate()->allocator()), |
508 pipeline_statistics_(CreatePipelineStatistics(info, &zone_pool_)), | 508 pipeline_statistics_(CreatePipelineStatistics(info, &zone_pool_)), |
509 data_(&zone_pool_, info, pipeline_statistics_.get()), | 509 data_(&zone_pool_, info, pipeline_statistics_.get()), |
510 pipeline_(&data_), | 510 pipeline_(&data_), |
511 linkage_(Linkage::ComputeIncoming(info->zone(), info)) {} | 511 linkage_(Linkage::ComputeIncoming(info->zone(), info)) {} |
512 | 512 |
513 protected: | 513 protected: |
514 Status CreateGraphImpl() final; | 514 Status CreateGraphImpl() final; |
515 Status OptimizeGraphImpl() final; | 515 Status OptimizeGraphImpl() final; |
516 Status GenerateCodeImpl() final; | 516 Status GenerateCodeImpl() final; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 565 } |
566 info()->dependencies()->Commit(code); | 566 info()->dependencies()->Commit(code); |
567 info()->SetCode(code); | 567 info()->SetCode(code); |
568 if (info()->is_deoptimization_enabled()) { | 568 if (info()->is_deoptimization_enabled()) { |
569 info()->context()->native_context()->AddOptimizedCode(*code); | 569 info()->context()->native_context()->AddOptimizedCode(*code); |
570 RegisterWeakObjectsInOptimizedCode(code); | 570 RegisterWeakObjectsInOptimizedCode(code); |
571 } | 571 } |
572 return SUCCEEDED; | 572 return SUCCEEDED; |
573 } | 573 } |
574 | 574 |
575 class PipelineWasmCompilationJob final : public OptimizedCompileJob { | 575 class PipelineWasmCompilationJob final : public CompilationJob { |
576 public: | 576 public: |
577 explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph, | 577 explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph, |
578 CallDescriptor* descriptor, | 578 CallDescriptor* descriptor, |
579 SourcePositionTable* source_positions) | 579 SourcePositionTable* source_positions) |
580 : OptimizedCompileJob(info, "TurboFan"), | 580 : CompilationJob(info, "TurboFan"), |
581 zone_pool_(info->isolate()->allocator()), | 581 zone_pool_(info->isolate()->allocator()), |
582 data_(&zone_pool_, info, graph, source_positions), | 582 data_(&zone_pool_, info, graph, source_positions), |
583 pipeline_(&data_), | 583 pipeline_(&data_), |
584 linkage_(descriptor) {} | 584 linkage_(descriptor) {} |
585 | 585 |
586 protected: | 586 protected: |
587 Status CreateGraphImpl() final; | 587 Status CreateGraphImpl() final; |
588 Status OptimizeGraphImpl() final; | 588 Status OptimizeGraphImpl() final; |
589 Status GenerateCodeImpl() final; | 589 Status GenerateCodeImpl() final; |
590 | 590 |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 Pipeline pipeline(&data); | 1454 Pipeline pipeline(&data); |
1455 if (data.schedule() == nullptr) { | 1455 if (data.schedule() == nullptr) { |
1456 // TODO(rossberg): Should this really be untyped? | 1456 // TODO(rossberg): Should this really be untyped? |
1457 pipeline.RunPrintAndVerify("Machine", true); | 1457 pipeline.RunPrintAndVerify("Machine", true); |
1458 } | 1458 } |
1459 | 1459 |
1460 return pipeline.ScheduleAndGenerateCode(call_descriptor); | 1460 return pipeline.ScheduleAndGenerateCode(call_descriptor); |
1461 } | 1461 } |
1462 | 1462 |
1463 // static | 1463 // static |
1464 OptimizedCompileJob* Pipeline::NewCompilationJob(CompilationInfo* info) { | 1464 CompilationJob* Pipeline::NewCompilationJob(CompilationInfo* info) { |
1465 return new PipelineCompilationJob(info); | 1465 return new PipelineCompilationJob(info); |
1466 } | 1466 } |
1467 | 1467 |
1468 // static | 1468 // static |
1469 OptimizedCompileJob* Pipeline::NewWasmCompilationJob( | 1469 CompilationJob* Pipeline::NewWasmCompilationJob( |
1470 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, | 1470 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, |
1471 SourcePositionTable* source_positions) { | 1471 SourcePositionTable* source_positions) { |
1472 return new PipelineWasmCompilationJob(info, graph, descriptor, | 1472 return new PipelineWasmCompilationJob(info, graph, descriptor, |
1473 source_positions); | 1473 source_positions); |
1474 } | 1474 } |
1475 | 1475 |
1476 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, | 1476 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, |
1477 InstructionSequence* sequence, | 1477 InstructionSequence* sequence, |
1478 bool run_verifier) { | 1478 bool run_verifier) { |
1479 CompilationInfo info(ArrayVector("testing"), sequence->isolate(), | 1479 CompilationInfo info(ArrayVector("testing"), sequence->isolate(), |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 data->DeleteRegisterAllocationZone(); | 1698 data->DeleteRegisterAllocationZone(); |
1699 } | 1699 } |
1700 | 1700 |
1701 CompilationInfo* Pipeline::info() const { return data_->info(); } | 1701 CompilationInfo* Pipeline::info() const { return data_->info(); } |
1702 | 1702 |
1703 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1703 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
1704 | 1704 |
1705 } // namespace compiler | 1705 } // namespace compiler |
1706 } // namespace internal | 1706 } // namespace internal |
1707 } // namespace v8 | 1707 } // namespace v8 |
OLD | NEW |