| 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/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 PhaseScope phase_scope(data->pipeline_statistics(), "select instructions"); | 551 PhaseScope phase_scope(data->pipeline_statistics(), "select instructions"); |
| 552 ZonePool::Scope zone_scope(data->zone_pool()); | 552 ZonePool::Scope zone_scope(data->zone_pool()); |
| 553 InstructionSelector selector(zone_scope.zone(), data->graph(), linkage, | 553 InstructionSelector selector(zone_scope.zone(), data->graph(), linkage, |
| 554 &sequence, data->schedule(), | 554 &sequence, data->schedule(), |
| 555 data->source_positions()); | 555 data->source_positions()); |
| 556 selector.SelectInstructions(); | 556 selector.SelectInstructions(); |
| 557 } | 557 } |
| 558 | 558 |
| 559 if (FLAG_trace_turbo) { | 559 if (FLAG_trace_turbo) { |
| 560 OFStream os(stdout); | 560 OFStream os(stdout); |
| 561 PrintableInstructionSequence printable = { |
| 562 RegisterConfiguration::ArchDefault(), &sequence}; |
| 561 os << "----- Instruction sequence before register allocation -----\n" | 563 os << "----- Instruction sequence before register allocation -----\n" |
| 562 << sequence; | 564 << printable; |
| 563 TurboCfgFile tcf(isolate()); | 565 TurboCfgFile tcf(isolate()); |
| 564 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(), | 566 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(), |
| 565 &sequence); | 567 &sequence); |
| 566 } | 568 } |
| 567 | 569 |
| 568 data->DeleteGraphZone(); | 570 data->DeleteGraphZone(); |
| 569 | 571 |
| 570 if (data->pipeline_statistics() != NULL) { | 572 if (data->pipeline_statistics() != NULL) { |
| 571 data->pipeline_statistics()->BeginPhaseKind("register allocation"); | 573 data->pipeline_statistics()->BeginPhaseKind("register allocation"); |
| 572 } | 574 } |
| 573 | 575 |
| 574 // Allocate registers. | 576 // Allocate registers. |
| 575 Frame frame; | 577 Frame frame; |
| 576 { | 578 { |
| 577 int node_count = sequence.VirtualRegisterCount(); | 579 int node_count = sequence.VirtualRegisterCount(); |
| 578 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { | 580 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { |
| 579 info()->AbortOptimization(kNotEnoughVirtualRegistersForValues); | 581 info()->AbortOptimization(kNotEnoughVirtualRegistersForValues); |
| 580 return Handle<Code>::null(); | 582 return Handle<Code>::null(); |
| 581 } | 583 } |
| 582 ZonePool::Scope zone_scope(data->zone_pool()); | 584 ZonePool::Scope zone_scope(data->zone_pool()); |
| 583 | 585 |
| 584 SmartArrayPointer<char> debug_name; | 586 SmartArrayPointer<char> debug_name; |
| 585 #ifdef DEBUG | 587 #ifdef DEBUG |
| 586 debug_name = GetDebugName(info()); | 588 debug_name = GetDebugName(info()); |
| 587 #endif | 589 #endif |
| 588 | 590 |
| 589 | 591 |
| 590 RegisterAllocator allocator(RegisterAllocator::PlatformConfig(), | 592 RegisterAllocator allocator(RegisterConfiguration::ArchDefault(), |
| 591 zone_scope.zone(), &frame, &sequence, | 593 zone_scope.zone(), &frame, &sequence, |
| 592 debug_name.get()); | 594 debug_name.get()); |
| 593 if (!allocator.Allocate(data->pipeline_statistics())) { | 595 if (!allocator.Allocate(data->pipeline_statistics())) { |
| 594 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); | 596 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); |
| 595 return Handle<Code>::null(); | 597 return Handle<Code>::null(); |
| 596 } | 598 } |
| 597 if (FLAG_trace_turbo) { | 599 if (FLAG_trace_turbo) { |
| 598 TurboCfgFile tcf(isolate()); | 600 TurboCfgFile tcf(isolate()); |
| 599 tcf << AsC1VAllocator("CodeGen", &allocator); | 601 tcf << AsC1VAllocator("CodeGen", &allocator); |
| 600 } | 602 } |
| 601 } | 603 } |
| 602 | 604 |
| 603 if (FLAG_trace_turbo) { | 605 if (FLAG_trace_turbo) { |
| 604 OFStream os(stdout); | 606 OFStream os(stdout); |
| 607 PrintableInstructionSequence printable = { |
| 608 RegisterConfiguration::ArchDefault(), &sequence}; |
| 605 os << "----- Instruction sequence after register allocation -----\n" | 609 os << "----- Instruction sequence after register allocation -----\n" |
| 606 << sequence; | 610 << printable; |
| 607 } | 611 } |
| 608 | 612 |
| 609 if (data->pipeline_statistics() != NULL) { | 613 if (data->pipeline_statistics() != NULL) { |
| 610 data->pipeline_statistics()->BeginPhaseKind("code generation"); | 614 data->pipeline_statistics()->BeginPhaseKind("code generation"); |
| 611 } | 615 } |
| 612 | 616 |
| 613 // Generate native sequence. | 617 // Generate native sequence. |
| 614 Handle<Code> code; | 618 Handle<Code> code; |
| 615 { | 619 { |
| 616 PhaseScope phase_scope(data->pipeline_statistics(), "generate code"); | 620 PhaseScope phase_scope(data->pipeline_statistics(), "generate code"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 633 } | 637 } |
| 634 | 638 |
| 635 | 639 |
| 636 void Pipeline::TearDown() { | 640 void Pipeline::TearDown() { |
| 637 InstructionOperand::TearDownCaches(); | 641 InstructionOperand::TearDownCaches(); |
| 638 } | 642 } |
| 639 | 643 |
| 640 } // namespace compiler | 644 } // namespace compiler |
| 641 } // namespace internal | 645 } // namespace internal |
| 642 } // namespace v8 | 646 } // namespace v8 |
| OLD | NEW |