}
// For machine graph testing entry point.
- void Initialize(Graph* graph, Schedule* schedule) {
+ void InitializeTorTesting(Graph* graph, Schedule* schedule) {
graph_ = graph;
source_positions_.Reset(new SourcePositionTable(graph));
schedule_ = schedule;
instruction_zone_ = instruction_zone_scope_.zone();
}
- // For register allocation entry point.
- void Initialize(InstructionSequence* sequence) {
+ // For register allocation testing entry point.
+ void InitializeTorTesting(InstructionSequence* sequence) {
instruction_zone_ = sequence->zone();
sequence_ = sequence;
}
}
-Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage,
- Graph* graph,
- Schedule* schedule) {
- ZonePool zone_pool(isolate());
+Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
+ Graph* graph,
+ Schedule* schedule) {
+ CallDescriptor* call_descriptor =
+ Linkage::ComputeIncoming(info->zone(), info);
+ return GenerateCodeForTesting(info, call_descriptor, graph, schedule);
+}
+
+
+Handle<Code> Pipeline::GenerateCodeForTesting(CallDescriptor* call_descriptor,
+ Graph* graph,
+ Schedule* schedule) {
+ CompilationInfo info(graph->zone()->isolate(), graph->zone());
+ return GenerateCodeForTesting(&info, call_descriptor, graph, schedule);
+}
+
+
+Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
+ CallDescriptor* call_descriptor,
+ Graph* graph,
+ Schedule* schedule) {
CHECK(SupportedBackend());
- PipelineData data(&zone_pool, info());
- data.Initialize(graph, schedule);
- this->data_ = &data;
+ ZonePool zone_pool(info->isolate());
+ Pipeline pipeline(info);
+ PipelineData data(&zone_pool, info);
+ pipeline.data_ = &data;
+ data.InitializeTorTesting(graph, schedule);
if (schedule == NULL) {
// TODO(rossberg): Should this really be untyped?
- RunPrintAndVerify("Machine", true);
- Run<ComputeSchedulePhase>();
+ pipeline.RunPrintAndVerify("Machine", true);
+ pipeline.Run<ComputeSchedulePhase>();
} else {
TraceSchedule(schedule);
}
- GenerateCode(linkage);
+ Linkage linkage(info->zone(), call_descriptor);
+ pipeline.GenerateCode(&linkage);
Handle<Code> code = data.code();
#if ENABLE_DISASSEMBLER
if (!code.is_null() && FLAG_print_opt_code) {
- CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
+ CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer());
OFStream os(tracing_scope.file());
code->Disassemble("test code", os);
}
}
-bool Pipeline::AllocateRegisters(const RegisterConfiguration* config,
- InstructionSequence* sequence,
- bool run_verifier) {
+bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
+ InstructionSequence* sequence,
+ bool run_verifier) {
CompilationInfo info(sequence->zone()->isolate(), sequence->zone());
ZonePool zone_pool(sequence->zone()->isolate());
PipelineData data(&zone_pool, &info);
- data.Initialize(sequence);
+ data.InitializeTorTesting(sequence);
Pipeline pipeline(&info);
pipeline.data_ = &data;
pipeline.AllocateRegisters(config, run_verifier);
namespace compiler {
// Clients of this interface shouldn't depend on lots of compiler internals.
+class CallDescriptor;
class Graph;
class InstructionSequence;
class Linkage;
// Run the entire pipeline and generate a handle to a code object.
Handle<Code> GenerateCode();
- // Run the pipeline on a machine graph and generate code. If {schedule}
- // is {NULL}, then compute a new schedule for code generation.
- Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph,
- Schedule* schedule = NULL);
+ // Run the pipeline on a machine graph and generate code. If {schedule} is
+ // {nullptr}, then compute a new schedule for code generation.
+ static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
+ Graph* graph,
+ Schedule* schedule = nullptr);
- static bool AllocateRegisters(const RegisterConfiguration* config,
- InstructionSequence* sequence,
- bool run_verifier);
+ // Run the pipeline on a machine graph and generate code. If {schedule} is
+ // {nullptr}, then compute a new schedule for code generation.
+ static Handle<Code> GenerateCodeForTesting(CallDescriptor* call_descriptor,
+ Graph* graph,
+ Schedule* schedule = nullptr);
+
+ // Run just the register allocator phases.
+ static bool AllocateRegistersForTesting(const RegisterConfiguration* config,
+ InstructionSequence* sequence,
+ bool run_verifier);
static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; }
static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; }
static void TearDown();
private:
+ static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
+ CallDescriptor* call_descriptor,
+ Graph* graph, Schedule* schedule);
+
CompilationInfo* info_;
PipelineData* data_;
Schedule* schedule = this->Export();
CallDescriptor* call_descriptor = this->call_descriptor();
Graph* graph = this->graph();
- CompilationInfo info(graph->zone()->isolate(), graph->zone());
- Linkage linkage(graph->zone(), call_descriptor);
- Pipeline pipeline(&info);
- code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph, schedule);
+ code_ =
+ Pipeline::GenerateCodeForTesting(call_descriptor, graph, schedule);
}
return this->code_.ToHandleChecked()->entry();
}
CHECK(Compiler::Analyze(&info));
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
- Pipeline pipeline(&info);
- Linkage linkage(info.zone(), &info);
- Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph);
+ Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph);
CHECK(!code.is_null());
function->ReplaceCode(*code);
return function;
if (!Pipeline::SupportedBackend()) return NULL;
if (code_.is_null()) {
Zone* zone = graph_->zone();
- CompilationInfo info(zone->isolate(), zone);
- Linkage linkage(zone,
- Linkage::GetSimplifiedCDescriptor(zone, machine_sig_));
- Pipeline pipeline(&info);
- code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph_);
+ CallDescriptor* desc =
+ Linkage::GetSimplifiedCDescriptor(zone, machine_sig_);
+ code_ = Pipeline::GenerateCodeForTesting(desc, graph_);
}
return code_.ToHandleChecked()->entry();
}
if (FLAG_trace_turbo) {
os << *schedule;
}
-
- Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info);
- Pipeline pipeline(&info);
- result_code =
- pipeline.GenerateCodeForMachineGraph(linkage, graph, schedule);
-
+ result_code = Pipeline::GenerateCodeForTesting(&info, graph, schedule);
#ifdef OBJECT_PRINT
if (FLAG_print_opt_code || FLAG_trace_turbo) {
result_code->Print();
void Allocate() {
CHECK_EQ(nullptr, current_block_);
WireBlocks();
- Pipeline::AllocateRegisters(config(), sequence(), true);
+ Pipeline::AllocateRegistersForTesting(config(), sequence(), true);
}
TestOperand Imm(int32_t imm = 0) {