Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: src/compiler/pipeline.cc

Issue 1948443002: [turbofan] Make Pipeline an all-static class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-pipeline-2
Patch Set: Fix preventing construction. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/pipeline.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 return descriptor->IsCFunctionCall() 353 return descriptor->IsCFunctionCall()
354 ? (CommonFrameConstants::kFixedSlotCountAboveFp + 354 ? (CommonFrameConstants::kFixedSlotCountAboveFp +
355 CommonFrameConstants::kCPSlotCount) 355 CommonFrameConstants::kCPSlotCount)
356 : TypedFrameConstants::kFixedSlotCount; 356 : TypedFrameConstants::kFixedSlotCount;
357 } 357 }
358 358
359 DISALLOW_COPY_AND_ASSIGN(PipelineData); 359 DISALLOW_COPY_AND_ASSIGN(PipelineData);
360 }; 360 };
361 361
362 class PipelineImpl final {
363 public:
364 explicit PipelineImpl(PipelineData* data) : data_(data) {}
365
366 // Helpers for executing pipeline phases.
367 template <typename Phase>
368 void Run();
369 template <typename Phase, typename Arg0>
370 void Run(Arg0 arg_0);
371 template <typename Phase, typename Arg0, typename Arg1>
372 void Run(Arg0 arg_0, Arg1 arg_1);
373
374 // Run the graph creation and initial optimization passes.
375 bool CreateGraph();
376
377 // Run the concurrent optimization passes.
378 bool OptimizeGraph(Linkage* linkage);
379
380 // Perform the actual code generation and return handle to a code object.
381 Handle<Code> GenerateCode(Linkage* linkage);
382
383 bool ScheduleAndSelectInstructions(Linkage* linkage);
384 void RunPrintAndVerify(const char* phase, bool untyped = false);
385 Handle<Code> ScheduleAndGenerateCode(CallDescriptor* call_descriptor);
386 void AllocateRegisters(const RegisterConfiguration* config,
387 CallDescriptor* descriptor, bool run_verifier);
388
389 CompilationInfo* info() const;
390 Isolate* isolate() const;
391
392 PipelineData* const data_;
393 };
362 394
363 namespace { 395 namespace {
364 396
365 struct TurboCfgFile : public std::ofstream { 397 struct TurboCfgFile : public std::ofstream {
366 explicit TurboCfgFile(Isolate* isolate) 398 explicit TurboCfgFile(Isolate* isolate)
367 : std::ofstream(isolate->GetTurboCfgFileName().c_str(), 399 : std::ofstream(isolate->GetTurboCfgFileName().c_str(),
368 std::ios_base::app) {} 400 std::ios_base::app) {}
369 }; 401 };
370 402
371 403
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 Status OptimizeGraphImpl() final; 571 Status OptimizeGraphImpl() final;
540 Status GenerateCodeImpl() final; 572 Status GenerateCodeImpl() final;
541 573
542 private: 574 private:
543 Zone zone_; 575 Zone zone_;
544 ZonePool zone_pool_; 576 ZonePool zone_pool_;
545 ParseInfo parse_info_; 577 ParseInfo parse_info_;
546 CompilationInfo info_; 578 CompilationInfo info_;
547 base::SmartPointer<PipelineStatistics> pipeline_statistics_; 579 base::SmartPointer<PipelineStatistics> pipeline_statistics_;
548 PipelineData data_; 580 PipelineData data_;
549 Pipeline pipeline_; 581 PipelineImpl pipeline_;
550 Linkage* linkage_; 582 Linkage* linkage_;
551 }; 583 };
552 584
553 PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() { 585 PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() {
554 if (info()->shared_info()->asm_function()) { 586 if (info()->shared_info()->asm_function()) {
555 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); 587 if (info()->osr_frame()) info()->MarkAsFrameSpecializing();
556 info()->MarkAsFunctionContextSpecializing(); 588 info()->MarkAsFunctionContextSpecializing();
557 } else { 589 } else {
558 if (!FLAG_always_opt) { 590 if (!FLAG_always_opt) {
559 info()->MarkAsBailoutOnUninitialized(); 591 info()->MarkAsBailoutOnUninitialized();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 linkage_(descriptor) {} 645 linkage_(descriptor) {}
614 646
615 protected: 647 protected:
616 Status CreateGraphImpl() final; 648 Status CreateGraphImpl() final;
617 Status OptimizeGraphImpl() final; 649 Status OptimizeGraphImpl() final;
618 Status GenerateCodeImpl() final; 650 Status GenerateCodeImpl() final;
619 651
620 private: 652 private:
621 ZonePool zone_pool_; 653 ZonePool zone_pool_;
622 PipelineData data_; 654 PipelineData data_;
623 Pipeline pipeline_; 655 PipelineImpl pipeline_;
624 Linkage linkage_; 656 Linkage linkage_;
625 }; 657 };
626 658
627 PipelineWasmCompilationJob::Status 659 PipelineWasmCompilationJob::Status
628 PipelineWasmCompilationJob::CreateGraphImpl() { 660 PipelineWasmCompilationJob::CreateGraphImpl() {
629 return SUCCEEDED; 661 return SUCCEEDED;
630 } 662 }
631 663
632 PipelineWasmCompilationJob::Status 664 PipelineWasmCompilationJob::Status
633 PipelineWasmCompilationJob::OptimizeGraphImpl() { 665 PipelineWasmCompilationJob::OptimizeGraphImpl() {
(...skipping 12 matching lines...) Expand all
646 if (!pipeline_.ScheduleAndSelectInstructions(&linkage_)) return FAILED; 678 if (!pipeline_.ScheduleAndSelectInstructions(&linkage_)) return FAILED;
647 return SUCCEEDED; 679 return SUCCEEDED;
648 } 680 }
649 681
650 PipelineWasmCompilationJob::Status 682 PipelineWasmCompilationJob::Status
651 PipelineWasmCompilationJob::GenerateCodeImpl() { 683 PipelineWasmCompilationJob::GenerateCodeImpl() {
652 pipeline_.GenerateCode(&linkage_); 684 pipeline_.GenerateCode(&linkage_);
653 return SUCCEEDED; 685 return SUCCEEDED;
654 } 686 }
655 687
656
657 template <typename Phase> 688 template <typename Phase>
658 void Pipeline::Run() { 689 void PipelineImpl::Run() {
659 PipelineRunScope scope(this->data_, Phase::phase_name()); 690 PipelineRunScope scope(this->data_, Phase::phase_name());
660 Phase phase; 691 Phase phase;
661 phase.Run(this->data_, scope.zone()); 692 phase.Run(this->data_, scope.zone());
662 } 693 }
663 694
664
665 template <typename Phase, typename Arg0> 695 template <typename Phase, typename Arg0>
666 void Pipeline::Run(Arg0 arg_0) { 696 void PipelineImpl::Run(Arg0 arg_0) {
667 PipelineRunScope scope(this->data_, Phase::phase_name()); 697 PipelineRunScope scope(this->data_, Phase::phase_name());
668 Phase phase; 698 Phase phase;
669 phase.Run(this->data_, scope.zone(), arg_0); 699 phase.Run(this->data_, scope.zone(), arg_0);
670 } 700 }
671 701
672 template <typename Phase, typename Arg0, typename Arg1> 702 template <typename Phase, typename Arg0, typename Arg1>
673 void Pipeline::Run(Arg0 arg_0, Arg1 arg_1) { 703 void PipelineImpl::Run(Arg0 arg_0, Arg1 arg_1) {
674 PipelineRunScope scope(this->data_, Phase::phase_name()); 704 PipelineRunScope scope(this->data_, Phase::phase_name());
675 Phase phase; 705 Phase phase;
676 phase.Run(this->data_, scope.zone(), arg_0, arg_1); 706 phase.Run(this->data_, scope.zone(), arg_0, arg_1);
677 } 707 }
678 708
679 struct LoopAssignmentAnalysisPhase { 709 struct LoopAssignmentAnalysisPhase {
680 static const char* phase_name() { return "loop assignment analysis"; } 710 static const char* phase_name() { return "loop assignment analysis"; }
681 711
682 void Run(PipelineData* data, Zone* temp_zone) { 712 void Run(PipelineData* data, Zone* temp_zone) {
683 if (!data->info()->is_optimizing_from_bytecode()) { 713 if (!data->info()->is_optimizing_from_bytecode()) {
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 struct VerifyGraphPhase { 1318 struct VerifyGraphPhase {
1289 static const char* phase_name() { return nullptr; } 1319 static const char* phase_name() { return nullptr; }
1290 1320
1291 void Run(PipelineData* data, Zone* temp_zone, const bool untyped, 1321 void Run(PipelineData* data, Zone* temp_zone, const bool untyped,
1292 bool values_only = false) { 1322 bool values_only = false) {
1293 Verifier::Run(data->graph(), !untyped ? Verifier::TYPED : Verifier::UNTYPED, 1323 Verifier::Run(data->graph(), !untyped ? Verifier::TYPED : Verifier::UNTYPED,
1294 values_only ? Verifier::kValuesOnly : Verifier::kAll); 1324 values_only ? Verifier::kValuesOnly : Verifier::kAll);
1295 } 1325 }
1296 }; 1326 };
1297 1327
1298 1328 void PipelineImpl::RunPrintAndVerify(const char* phase, bool untyped) {
1299 void Pipeline::RunPrintAndVerify(const char* phase, bool untyped) {
1300 if (FLAG_trace_turbo) { 1329 if (FLAG_trace_turbo) {
1301 Run<PrintGraphPhase>(phase); 1330 Run<PrintGraphPhase>(phase);
1302 } 1331 }
1303 if (FLAG_turbo_verify) { 1332 if (FLAG_turbo_verify) {
1304 Run<VerifyGraphPhase>(untyped); 1333 Run<VerifyGraphPhase>(untyped);
1305 } 1334 }
1306 } 1335 }
1307 1336
1308 bool Pipeline::CreateGraph() { 1337 bool PipelineImpl::CreateGraph() {
1309 PipelineData* data = this->data_; 1338 PipelineData* data = this->data_;
1310 1339
1311 data->BeginPhaseKind("graph creation"); 1340 data->BeginPhaseKind("graph creation");
1312 1341
1313 if (FLAG_trace_turbo) { 1342 if (FLAG_trace_turbo) {
1314 OFStream os(stdout); 1343 OFStream os(stdout);
1315 os << "---------------------------------------------------\n" 1344 os << "---------------------------------------------------\n"
1316 << "Begin compiling method " << info()->GetDebugName().get() 1345 << "Begin compiling method " << info()->GetDebugName().get()
1317 << " using Turbofan" << std::endl; 1346 << " using Turbofan" << std::endl;
1318 TurboCfgFile tcf(isolate()); 1347 TurboCfgFile tcf(isolate());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 // the types from the nodes at this point (currently only in Debug builds). 1434 // the types from the nodes at this point (currently only in Debug builds).
1406 Run<UntyperPhase>(); 1435 Run<UntyperPhase>();
1407 RunPrintAndVerify("Untyped", true); 1436 RunPrintAndVerify("Untyped", true);
1408 #endif 1437 #endif
1409 1438
1410 data->EndPhaseKind(); 1439 data->EndPhaseKind();
1411 1440
1412 return true; 1441 return true;
1413 } 1442 }
1414 1443
1415 bool Pipeline::OptimizeGraph(Linkage* linkage) { 1444 bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
1416 PipelineData* data = this->data_; 1445 PipelineData* data = this->data_;
1417 1446
1418 data->BeginPhaseKind("block building"); 1447 data->BeginPhaseKind("block building");
1419 1448
1420 Run<EffectControlLinearizationPhase>(); 1449 Run<EffectControlLinearizationPhase>();
1421 RunPrintAndVerify("Effect and control linearized", true); 1450 RunPrintAndVerify("Effect and control linearized", true);
1422 1451
1423 Run<BranchEliminationPhase>(); 1452 Run<BranchEliminationPhase>();
1424 RunPrintAndVerify("Branch conditions eliminated", true); 1453 RunPrintAndVerify("Branch conditions eliminated", true);
1425 1454
(...skipping 26 matching lines...) Expand all
1452 1481
1453 // Construct a pipeline for scheduling and code generation. 1482 // Construct a pipeline for scheduling and code generation.
1454 ZonePool zone_pool(isolate->allocator()); 1483 ZonePool zone_pool(isolate->allocator());
1455 PipelineData data(&zone_pool, &info, graph, schedule); 1484 PipelineData data(&zone_pool, &info, graph, schedule);
1456 base::SmartPointer<PipelineStatistics> pipeline_statistics; 1485 base::SmartPointer<PipelineStatistics> pipeline_statistics;
1457 if (FLAG_turbo_stats) { 1486 if (FLAG_turbo_stats) {
1458 pipeline_statistics.Reset(new PipelineStatistics(&info, &zone_pool)); 1487 pipeline_statistics.Reset(new PipelineStatistics(&info, &zone_pool));
1459 pipeline_statistics->BeginPhaseKind("stub codegen"); 1488 pipeline_statistics->BeginPhaseKind("stub codegen");
1460 } 1489 }
1461 1490
1462 Pipeline pipeline(&data); 1491 PipelineImpl pipeline(&data);
1463 DCHECK_NOT_NULL(data.schedule()); 1492 DCHECK_NOT_NULL(data.schedule());
1464 1493
1465 if (FLAG_trace_turbo) { 1494 if (FLAG_trace_turbo) {
1466 FILE* json_file = OpenVisualizerLogFile(&info, nullptr, "json", "w+"); 1495 FILE* json_file = OpenVisualizerLogFile(&info, nullptr, "json", "w+");
1467 if (json_file != nullptr) { 1496 if (json_file != nullptr) {
1468 OFStream json_of(json_file); 1497 OFStream json_of(json_file);
1469 json_of << "{\"function\":\"" << info.GetDebugName().get() 1498 json_of << "{\"function\":\"" << info.GetDebugName().get()
1470 << "\", \"source\":\"\",\n\"phases\":["; 1499 << "\", \"source\":\"\",\n\"phases\":[";
1471 fclose(json_file); 1500 fclose(json_file);
1472 } 1501 }
1473 pipeline.Run<PrintGraphPhase>("Machine"); 1502 pipeline.Run<PrintGraphPhase>("Machine");
1474 } 1503 }
1475 1504
1476 pipeline.Run<VerifyGraphPhase>(false, true); 1505 pipeline.Run<VerifyGraphPhase>(false, true);
1477 return pipeline.ScheduleAndGenerateCode(call_descriptor); 1506 return pipeline.ScheduleAndGenerateCode(call_descriptor);
1478 } 1507 }
1479 1508
1480 // static 1509 // static
1481 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info) { 1510 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info) {
1482 ZonePool zone_pool(info->isolate()->allocator()); 1511 ZonePool zone_pool(info->isolate()->allocator());
1483 base::SmartPointer<PipelineStatistics> pipeline_statistics( 1512 base::SmartPointer<PipelineStatistics> pipeline_statistics(
1484 CreatePipelineStatistics(info, &zone_pool)); 1513 CreatePipelineStatistics(info, &zone_pool));
1485 PipelineData data(&zone_pool, info, pipeline_statistics.get()); 1514 PipelineData data(&zone_pool, info, pipeline_statistics.get());
1486 Pipeline pipeline(&data); 1515 PipelineImpl pipeline(&data);
1487 1516
1488 Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info)); 1517 Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info));
1489 1518
1490 if (!pipeline.CreateGraph()) return Handle<Code>::null(); 1519 if (!pipeline.CreateGraph()) return Handle<Code>::null();
1491 if (!pipeline.OptimizeGraph(&linkage)) return Handle<Code>::null(); 1520 if (!pipeline.OptimizeGraph(&linkage)) return Handle<Code>::null();
1492 return pipeline.GenerateCode(&linkage); 1521 return pipeline.GenerateCode(&linkage);
1493 } 1522 }
1494 1523
1495 // static 1524 // static
1496 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, 1525 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
(...skipping 11 matching lines...) Expand all
1508 Schedule* schedule) { 1537 Schedule* schedule) {
1509 // Construct a pipeline for scheduling and code generation. 1538 // Construct a pipeline for scheduling and code generation.
1510 ZonePool zone_pool(info->isolate()->allocator()); 1539 ZonePool zone_pool(info->isolate()->allocator());
1511 PipelineData data(&zone_pool, info, graph, schedule); 1540 PipelineData data(&zone_pool, info, graph, schedule);
1512 base::SmartPointer<PipelineStatistics> pipeline_statistics; 1541 base::SmartPointer<PipelineStatistics> pipeline_statistics;
1513 if (FLAG_turbo_stats) { 1542 if (FLAG_turbo_stats) {
1514 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); 1543 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool));
1515 pipeline_statistics->BeginPhaseKind("test codegen"); 1544 pipeline_statistics->BeginPhaseKind("test codegen");
1516 } 1545 }
1517 1546
1518 Pipeline pipeline(&data); 1547 PipelineImpl pipeline(&data);
1519 1548
1520 if (FLAG_trace_turbo) { 1549 if (FLAG_trace_turbo) {
1521 FILE* json_file = OpenVisualizerLogFile(info, nullptr, "json", "w+"); 1550 FILE* json_file = OpenVisualizerLogFile(info, nullptr, "json", "w+");
1522 if (json_file != nullptr) { 1551 if (json_file != nullptr) {
1523 OFStream json_of(json_file); 1552 OFStream json_of(json_file);
1524 json_of << "{\"function\":\"" << info->GetDebugName().get() 1553 json_of << "{\"function\":\"" << info->GetDebugName().get()
1525 << "\", \"source\":\"\",\n\"phases\":["; 1554 << "\", \"source\":\"\",\n\"phases\":[";
1526 fclose(json_file); 1555 fclose(json_file);
1527 } 1556 }
1528 } 1557 }
(...skipping 16 matching lines...) Expand all
1545 source_positions); 1574 source_positions);
1546 } 1575 }
1547 1576
1548 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, 1577 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
1549 InstructionSequence* sequence, 1578 InstructionSequence* sequence,
1550 bool run_verifier) { 1579 bool run_verifier) {
1551 CompilationInfo info(ArrayVector("testing"), sequence->isolate(), 1580 CompilationInfo info(ArrayVector("testing"), sequence->isolate(),
1552 sequence->zone()); 1581 sequence->zone());
1553 ZonePool zone_pool(sequence->isolate()->allocator()); 1582 ZonePool zone_pool(sequence->isolate()->allocator());
1554 PipelineData data(&zone_pool, &info, sequence); 1583 PipelineData data(&zone_pool, &info, sequence);
1555 Pipeline pipeline(&data); 1584 PipelineImpl pipeline(&data);
1556 pipeline.data_->InitializeFrameData(nullptr); 1585 pipeline.data_->InitializeFrameData(nullptr);
1557 pipeline.AllocateRegisters(config, nullptr, run_verifier); 1586 pipeline.AllocateRegisters(config, nullptr, run_verifier);
1558 return !data.compilation_failed(); 1587 return !data.compilation_failed();
1559 } 1588 }
1560 1589
1561 bool Pipeline::ScheduleAndSelectInstructions(Linkage* linkage) { 1590 bool PipelineImpl::ScheduleAndSelectInstructions(Linkage* linkage) {
1562 CallDescriptor* call_descriptor = linkage->GetIncomingDescriptor(); 1591 CallDescriptor* call_descriptor = linkage->GetIncomingDescriptor();
1563 PipelineData* data = this->data_; 1592 PipelineData* data = this->data_;
1564 1593
1565 DCHECK_NOT_NULL(data->graph()); 1594 DCHECK_NOT_NULL(data->graph());
1566 1595
1567 if (data->schedule() == nullptr) Run<ComputeSchedulePhase>(); 1596 if (data->schedule() == nullptr) Run<ComputeSchedulePhase>();
1568 TraceSchedule(data->info(), data->schedule()); 1597 TraceSchedule(data->info(), data->schedule());
1569 1598
1570 if (FLAG_turbo_profiling) { 1599 if (FLAG_turbo_profiling) {
1571 data->set_profiler_data(BasicBlockInstrumentor::Instrument( 1600 data->set_profiler_data(BasicBlockInstrumentor::Instrument(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 // Optimimize jumps. 1643 // Optimimize jumps.
1615 if (FLAG_turbo_jt) { 1644 if (FLAG_turbo_jt) {
1616 Run<JumpThreadingPhase>(generate_frame_at_start); 1645 Run<JumpThreadingPhase>(generate_frame_at_start);
1617 } 1646 }
1618 1647
1619 data->EndPhaseKind(); 1648 data->EndPhaseKind();
1620 1649
1621 return true; 1650 return true;
1622 } 1651 }
1623 1652
1624 Handle<Code> Pipeline::GenerateCode(Linkage* linkage) { 1653 Handle<Code> PipelineImpl::GenerateCode(Linkage* linkage) {
1625 PipelineData* data = this->data_; 1654 PipelineData* data = this->data_;
1626 1655
1627 data->BeginPhaseKind("code generation"); 1656 data->BeginPhaseKind("code generation");
1628 1657
1629 // Generate final machine code. 1658 // Generate final machine code.
1630 Run<GenerateCodePhase>(linkage); 1659 Run<GenerateCodePhase>(linkage);
1631 1660
1632 Handle<Code> code = data->code(); 1661 Handle<Code> code = data->code();
1633 if (data->profiler_data()) { 1662 if (data->profiler_data()) {
1634 #if ENABLE_DISASSEMBLER 1663 #if ENABLE_DISASSEMBLER
(...skipping 28 matching lines...) Expand all
1663 } 1692 }
1664 OFStream os(stdout); 1693 OFStream os(stdout);
1665 os << "---------------------------------------------------\n" 1694 os << "---------------------------------------------------\n"
1666 << "Finished compiling method " << info()->GetDebugName().get() 1695 << "Finished compiling method " << info()->GetDebugName().get()
1667 << " using Turbofan" << std::endl; 1696 << " using Turbofan" << std::endl;
1668 } 1697 }
1669 1698
1670 return code; 1699 return code;
1671 } 1700 }
1672 1701
1673 Handle<Code> Pipeline::ScheduleAndGenerateCode( 1702 Handle<Code> PipelineImpl::ScheduleAndGenerateCode(
1674 CallDescriptor* call_descriptor) { 1703 CallDescriptor* call_descriptor) {
1675 Linkage linkage(call_descriptor); 1704 Linkage linkage(call_descriptor);
1676 1705
1677 // Schedule the graph, perform instruction selection and register allocation. 1706 // Schedule the graph, perform instruction selection and register allocation.
1678 if (!ScheduleAndSelectInstructions(&linkage)) return Handle<Code>(); 1707 if (!ScheduleAndSelectInstructions(&linkage)) return Handle<Code>();
1679 1708
1680 // Generate the final machine code. 1709 // Generate the final machine code.
1681 return GenerateCode(&linkage); 1710 return GenerateCode(&linkage);
1682 } 1711 }
1683 1712
1684 void Pipeline::AllocateRegisters(const RegisterConfiguration* config, 1713 void PipelineImpl::AllocateRegisters(const RegisterConfiguration* config,
1685 CallDescriptor* descriptor, 1714 CallDescriptor* descriptor,
1686 bool run_verifier) { 1715 bool run_verifier) {
1687 PipelineData* data = this->data_; 1716 PipelineData* data = this->data_;
1688 // Don't track usage for this zone in compiler stats. 1717 // Don't track usage for this zone in compiler stats.
1689 base::SmartPointer<Zone> verifier_zone; 1718 base::SmartPointer<Zone> verifier_zone;
1690 RegisterAllocatorVerifier* verifier = nullptr; 1719 RegisterAllocatorVerifier* verifier = nullptr;
1691 if (run_verifier) { 1720 if (run_verifier) {
1692 verifier_zone.Reset(new Zone(isolate()->allocator())); 1721 verifier_zone.Reset(new Zone(isolate()->allocator()));
1693 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( 1722 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier(
1694 verifier_zone.get(), config, data->sequence()); 1723 verifier_zone.get(), config, data->sequence());
1695 } 1724 }
1696 1725
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 1792
1764 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { 1793 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) {
1765 TurboCfgFile tcf(data->isolate()); 1794 TurboCfgFile tcf(data->isolate());
1766 tcf << AsC1VRegisterAllocationData("CodeGen", 1795 tcf << AsC1VRegisterAllocationData("CodeGen",
1767 data->register_allocation_data()); 1796 data->register_allocation_data());
1768 } 1797 }
1769 1798
1770 data->DeleteRegisterAllocationZone(); 1799 data->DeleteRegisterAllocationZone();
1771 } 1800 }
1772 1801
1773 CompilationInfo* Pipeline::info() const { return data_->info(); } 1802 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1774 1803
1775 Isolate* Pipeline::isolate() const { return info()->isolate(); } 1804 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1776 1805
1777 } // namespace compiler 1806 } // namespace compiler
1778 } // namespace internal 1807 } // namespace internal
1779 } // namespace v8 1808 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/pipeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698