Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 #include "src/compiler/simplified-operator-reducer.h" | 58 #include "src/compiler/simplified-operator-reducer.h" |
| 59 #include "src/compiler/simplified-operator.h" | 59 #include "src/compiler/simplified-operator.h" |
| 60 #include "src/compiler/tail-call-optimization.h" | 60 #include "src/compiler/tail-call-optimization.h" |
| 61 #include "src/compiler/type-hint-analyzer.h" | 61 #include "src/compiler/type-hint-analyzer.h" |
| 62 #include "src/compiler/typer.h" | 62 #include "src/compiler/typer.h" |
| 63 #include "src/compiler/value-numbering-reducer.h" | 63 #include "src/compiler/value-numbering-reducer.h" |
| 64 #include "src/compiler/verifier.h" | 64 #include "src/compiler/verifier.h" |
| 65 #include "src/compiler/zone-pool.h" | 65 #include "src/compiler/zone-pool.h" |
| 66 #include "src/isolate-inl.h" | 66 #include "src/isolate-inl.h" |
| 67 #include "src/ostreams.h" | 67 #include "src/ostreams.h" |
| 68 #include "src/parsing/parser.h" | |
| 68 #include "src/register-configuration.h" | 69 #include "src/register-configuration.h" |
| 69 #include "src/type-info.h" | 70 #include "src/type-info.h" |
| 70 #include "src/utils.h" | 71 #include "src/utils.h" |
| 71 | 72 |
| 72 namespace v8 { | 73 namespace v8 { |
| 73 namespace internal { | 74 namespace internal { |
| 74 namespace compiler { | 75 namespace compiler { |
| 75 | 76 |
| 76 class PipelineData { | 77 class PipelineData { |
| 77 public: | 78 public: |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 } | 496 } |
| 496 json_of << "\",\n\"phases\":["; | 497 json_of << "\",\n\"phases\":["; |
| 497 fclose(json_file); | 498 fclose(json_file); |
| 498 } | 499 } |
| 499 | 500 |
| 500 return pipeline_statistics; | 501 return pipeline_statistics; |
| 501 } | 502 } |
| 502 | 503 |
| 503 class PipelineCompilationJob final : public CompilationJob { | 504 class PipelineCompilationJob final : public CompilationJob { |
| 504 public: | 505 public: |
| 505 explicit PipelineCompilationJob(CompilationInfo* info) | 506 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function) |
| 506 : CompilationJob(info, "TurboFan"), | 507 : CompilationJob(&info_, "TurboFan"), |
|
Benedikt Meurer
2016/04/28 10:23:02
Hm, info_ is uninitialized memory at this point. A
Michael Starzinger
2016/05/02 12:35:05
Done.
| |
| 507 zone_pool_(info->isolate()->allocator()), | 508 zone_(isolate->allocator()), |
| 508 pipeline_statistics_(CreatePipelineStatistics(info, &zone_pool_)), | 509 zone_pool_(isolate->allocator()), |
| 509 data_(&zone_pool_, info, pipeline_statistics_.get()), | 510 parse_info_(&zone_, function), |
| 511 info_(&parse_info_, function), | |
| 512 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_pool_)), | |
| 513 data_(&zone_pool_, info(), pipeline_statistics_.get()), | |
| 510 pipeline_(&data_), | 514 pipeline_(&data_), |
| 511 linkage_(Linkage::ComputeIncoming(info->zone(), info)) {} | 515 linkage_(Linkage::ComputeIncoming(info()->zone(), info())) {} |
| 512 | 516 |
| 513 protected: | 517 protected: |
| 514 Status CreateGraphImpl() final; | 518 Status CreateGraphImpl() final; |
| 515 Status OptimizeGraphImpl() final; | 519 Status OptimizeGraphImpl() final; |
| 516 Status GenerateCodeImpl() final; | 520 Status GenerateCodeImpl() final; |
| 517 | 521 |
| 518 private: | 522 private: |
| 523 Zone zone_; | |
| 519 ZonePool zone_pool_; | 524 ZonePool zone_pool_; |
| 525 ParseInfo parse_info_; | |
| 526 CompilationInfo info_; | |
| 520 base::SmartPointer<PipelineStatistics> pipeline_statistics_; | 527 base::SmartPointer<PipelineStatistics> pipeline_statistics_; |
| 521 PipelineData data_; | 528 PipelineData data_; |
| 522 Pipeline pipeline_; | 529 Pipeline pipeline_; |
| 523 Linkage linkage_; | 530 Linkage linkage_; |
| 524 }; | 531 }; |
| 525 | 532 |
| 526 PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() { | 533 PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() { |
| 527 if (info()->shared_info()->asm_function()) { | 534 if (info()->shared_info()->asm_function()) { |
| 528 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); | 535 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); |
| 529 info()->MarkAsFunctionContextSpecializing(); | 536 info()->MarkAsFunctionContextSpecializing(); |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1454 Pipeline pipeline(&data); | 1461 Pipeline pipeline(&data); |
| 1455 if (data.schedule() == nullptr) { | 1462 if (data.schedule() == nullptr) { |
| 1456 // TODO(rossberg): Should this really be untyped? | 1463 // TODO(rossberg): Should this really be untyped? |
| 1457 pipeline.RunPrintAndVerify("Machine", true); | 1464 pipeline.RunPrintAndVerify("Machine", true); |
| 1458 } | 1465 } |
| 1459 | 1466 |
| 1460 return pipeline.ScheduleAndGenerateCode(call_descriptor); | 1467 return pipeline.ScheduleAndGenerateCode(call_descriptor); |
| 1461 } | 1468 } |
| 1462 | 1469 |
| 1463 // static | 1470 // static |
| 1464 CompilationJob* Pipeline::NewCompilationJob(CompilationInfo* info) { | 1471 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function) { |
| 1465 return new PipelineCompilationJob(info); | 1472 return new PipelineCompilationJob(function->GetIsolate(), function); |
| 1466 } | 1473 } |
| 1467 | 1474 |
| 1468 // static | 1475 // static |
| 1469 CompilationJob* Pipeline::NewWasmCompilationJob( | 1476 CompilationJob* Pipeline::NewWasmCompilationJob( |
| 1470 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, | 1477 CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, |
| 1471 SourcePositionTable* source_positions) { | 1478 SourcePositionTable* source_positions) { |
| 1472 return new PipelineWasmCompilationJob(info, graph, descriptor, | 1479 return new PipelineWasmCompilationJob(info, graph, descriptor, |
| 1473 source_positions); | 1480 source_positions); |
| 1474 } | 1481 } |
| 1475 | 1482 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 data->DeleteRegisterAllocationZone(); | 1705 data->DeleteRegisterAllocationZone(); |
| 1699 } | 1706 } |
| 1700 | 1707 |
| 1701 CompilationInfo* Pipeline::info() const { return data_->info(); } | 1708 CompilationInfo* Pipeline::info() const { return data_->info(); } |
| 1702 | 1709 |
| 1703 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1710 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
| 1704 | 1711 |
| 1705 } // namespace compiler | 1712 } // namespace compiler |
| 1706 } // namespace internal | 1713 } // namespace internal |
| 1707 } // namespace v8 | 1714 } // namespace v8 |
| OLD | NEW |