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

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

Issue 727373002: [turbofan] add ForTesting to pipeline entry points that are for testing only. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 6 years, 1 month 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') | test/cctest/compiler/codegen-tester.h » ('j') | 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/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 InstructionSelector::SupportedMachineOperatorFlags()); 84 InstructionSelector::SupportedMachineOperatorFlags());
85 common_ = new (graph_zone()) CommonOperatorBuilder(graph_zone()); 85 common_ = new (graph_zone()) CommonOperatorBuilder(graph_zone());
86 javascript_ = new (graph_zone()) JSOperatorBuilder(graph_zone()); 86 javascript_ = new (graph_zone()) JSOperatorBuilder(graph_zone());
87 jsgraph_ = 87 jsgraph_ =
88 new (graph_zone()) JSGraph(graph(), common(), javascript(), machine()); 88 new (graph_zone()) JSGraph(graph(), common(), javascript(), machine());
89 typer_.Reset(new Typer(graph(), info()->context())); 89 typer_.Reset(new Typer(graph(), info()->context()));
90 instruction_zone_ = instruction_zone_scope_.zone(); 90 instruction_zone_ = instruction_zone_scope_.zone();
91 } 91 }
92 92
93 // For machine graph testing entry point. 93 // For machine graph testing entry point.
94 void Initialize(Graph* graph, Schedule* schedule) { 94 void InitializeTorTesting(Graph* graph, Schedule* schedule) {
95 graph_ = graph; 95 graph_ = graph;
96 source_positions_.Reset(new SourcePositionTable(graph)); 96 source_positions_.Reset(new SourcePositionTable(graph));
97 schedule_ = schedule; 97 schedule_ = schedule;
98 instruction_zone_ = instruction_zone_scope_.zone(); 98 instruction_zone_ = instruction_zone_scope_.zone();
99 } 99 }
100 100
101 // For register allocation entry point. 101 // For register allocation testing entry point.
102 void Initialize(InstructionSequence* sequence) { 102 void InitializeTorTesting(InstructionSequence* sequence) {
103 instruction_zone_ = sequence->zone(); 103 instruction_zone_ = sequence->zone();
104 sequence_ = sequence; 104 sequence_ = sequence;
105 } 105 }
106 106
107 Isolate* isolate() const { return isolate_; } 107 Isolate* isolate() const { return isolate_; }
108 CompilationInfo* info() const { return info_; } 108 CompilationInfo* info() const { return info_; }
109 ZonePool* zone_pool() const { return zone_pool_; } 109 ZonePool* zone_pool() const { return zone_pool_; }
110 PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; } 110 PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; }
111 bool compilation_failed() const { return compilation_failed_; } 111 bool compilation_failed() const { return compilation_failed_; }
112 void set_compilation_failed() { compilation_failed_ = true; } 112 void set_compilation_failed() { compilation_failed_ = true; }
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 OFStream os(stdout); 771 OFStream os(stdout);
772 os << "--------------------------------------------------\n" 772 os << "--------------------------------------------------\n"
773 << "Finished compiling method " << GetDebugName(info()).get() 773 << "Finished compiling method " << GetDebugName(info()).get()
774 << " using Turbofan" << std::endl; 774 << " using Turbofan" << std::endl;
775 } 775 }
776 776
777 return code; 777 return code;
778 } 778 }
779 779
780 780
781 Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage, 781 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
782 Graph* graph, 782 Graph* graph,
783 Schedule* schedule) { 783 Schedule* schedule) {
784 ZonePool zone_pool(isolate()); 784 CallDescriptor* call_descriptor =
785 Linkage::ComputeIncoming(info->zone(), info);
786 return GenerateCodeForTesting(info, call_descriptor, graph, schedule);
787 }
788
789
790 Handle<Code> Pipeline::GenerateCodeForTesting(CallDescriptor* call_descriptor,
791 Graph* graph,
792 Schedule* schedule) {
793 CompilationInfo info(graph->zone()->isolate(), graph->zone());
794 return GenerateCodeForTesting(&info, call_descriptor, graph, schedule);
795 }
796
797
798 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
799 CallDescriptor* call_descriptor,
800 Graph* graph,
801 Schedule* schedule) {
785 CHECK(SupportedBackend()); 802 CHECK(SupportedBackend());
786 PipelineData data(&zone_pool, info()); 803 ZonePool zone_pool(info->isolate());
787 data.Initialize(graph, schedule); 804 Pipeline pipeline(info);
788 this->data_ = &data; 805 PipelineData data(&zone_pool, info);
806 pipeline.data_ = &data;
807 data.InitializeTorTesting(graph, schedule);
789 if (schedule == NULL) { 808 if (schedule == NULL) {
790 // TODO(rossberg): Should this really be untyped? 809 // TODO(rossberg): Should this really be untyped?
791 RunPrintAndVerify("Machine", true); 810 pipeline.RunPrintAndVerify("Machine", true);
792 Run<ComputeSchedulePhase>(); 811 pipeline.Run<ComputeSchedulePhase>();
793 } else { 812 } else {
794 TraceSchedule(schedule); 813 TraceSchedule(schedule);
795 } 814 }
796 815
797 GenerateCode(linkage); 816 Linkage linkage(info->zone(), call_descriptor);
817 pipeline.GenerateCode(&linkage);
798 Handle<Code> code = data.code(); 818 Handle<Code> code = data.code();
799 819
800 #if ENABLE_DISASSEMBLER 820 #if ENABLE_DISASSEMBLER
801 if (!code.is_null() && FLAG_print_opt_code) { 821 if (!code.is_null() && FLAG_print_opt_code) {
802 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 822 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer());
803 OFStream os(tracing_scope.file()); 823 OFStream os(tracing_scope.file());
804 code->Disassemble("test code", os); 824 code->Disassemble("test code", os);
805 } 825 }
806 #endif 826 #endif
807 return code; 827 return code;
808 } 828 }
809 829
810 830
811 bool Pipeline::AllocateRegisters(const RegisterConfiguration* config, 831 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
812 InstructionSequence* sequence, 832 InstructionSequence* sequence,
813 bool run_verifier) { 833 bool run_verifier) {
814 CompilationInfo info(sequence->zone()->isolate(), sequence->zone()); 834 CompilationInfo info(sequence->zone()->isolate(), sequence->zone());
815 ZonePool zone_pool(sequence->zone()->isolate()); 835 ZonePool zone_pool(sequence->zone()->isolate());
816 PipelineData data(&zone_pool, &info); 836 PipelineData data(&zone_pool, &info);
817 data.Initialize(sequence); 837 data.InitializeTorTesting(sequence);
818 Pipeline pipeline(&info); 838 Pipeline pipeline(&info);
819 pipeline.data_ = &data; 839 pipeline.data_ = &data;
820 pipeline.AllocateRegisters(config, run_verifier); 840 pipeline.AllocateRegisters(config, run_verifier);
821 return !data.compilation_failed(); 841 return !data.compilation_failed();
822 } 842 }
823 843
824 844
825 void Pipeline::GenerateCode(Linkage* linkage) { 845 void Pipeline::GenerateCode(Linkage* linkage) {
826 PipelineData* data = this->data_; 846 PipelineData* data = this->data_;
827 847
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 } 973 }
954 974
955 975
956 void Pipeline::TearDown() { 976 void Pipeline::TearDown() {
957 InstructionOperand::TearDownCaches(); 977 InstructionOperand::TearDownCaches();
958 } 978 }
959 979
960 } // namespace compiler 980 } // namespace compiler
961 } // namespace internal 981 } // namespace internal
962 } // namespace v8 982 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/pipeline.h ('k') | test/cctest/compiler/codegen-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698