Commit 8e0aaffd authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[interpreter] Allow verification and trace-turbo for bytecode handlers.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1308863004

Cr-Commit-Position: refs/heads/master@{#30354}
parent 8a278a4c
......@@ -44,15 +44,17 @@ Handle<Code> InterpreterAssembler::GenerateCode() {
End();
const char* bytecode_name = interpreter::Bytecodes::ToString(bytecode_);
Schedule* schedule = raw_assembler_->Export();
// TODO(rmcilroy): use a non-testing code generator.
Handle<Code> code = Pipeline::GenerateCodeForTesting(
isolate(), raw_assembler_->call_descriptor(), graph(), schedule);
Handle<Code> code = Pipeline::GenerateCodeForInterpreter(
isolate(), raw_assembler_->call_descriptor(), graph(), schedule,
bytecode_name);
#ifdef ENABLE_DISASSEMBLER
if (FLAG_trace_ignition_codegen) {
OFStream os(stdout);
code->Disassemble(interpreter::Bytecodes::ToString(bytecode_), os);
code->Disassemble(bytecode_name, os);
os << std::flush;
}
#endif
......
......@@ -1129,6 +1129,36 @@ Handle<Code> Pipeline::GenerateCode() {
}
Handle<Code> Pipeline::GenerateCodeForInterpreter(
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
Schedule* schedule, const char* bytecode_name) {
CompilationInfo info(bytecode_name, isolate, graph->zone());
// Construct a pipeline for scheduling and code generation.
ZonePool zone_pool;
PipelineData data(&zone_pool, &info, graph, schedule);
base::SmartPointer<PipelineStatistics> pipeline_statistics;
if (FLAG_turbo_stats) {
pipeline_statistics.Reset(new PipelineStatistics(&info, &zone_pool));
pipeline_statistics->BeginPhaseKind("interpreter handler codegen");
}
if (FLAG_trace_turbo) {
FILE* json_file = OpenVisualizerLogFile(&info, NULL, "json", "w+");
if (json_file != nullptr) {
OFStream json_of(json_file);
json_of << "{\"function\":\"" << info.GetDebugName().get()
<< "\", \"source\":\"\",\n\"phases\":[";
fclose(json_file);
}
}
Pipeline pipeline(&info);
pipeline.data_ = &data;
pipeline.RunPrintAndVerify("Machine", true);
return pipeline.ScheduleAndGenerateCode(call_descriptor);
}
Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
Graph* graph,
Schedule* schedule) {
......
......@@ -28,6 +28,12 @@ class Pipeline {
// Run the entire pipeline and generate a handle to a code object.
Handle<Code> GenerateCode();
// Run the pipeline on an interpreter bytecode handler machine graph and
// generate code.
static Handle<Code> GenerateCodeForInterpreter(
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
Schedule* schedule, const char* bytecode_name);
// 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,
......
......@@ -25,7 +25,8 @@ RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph,
parameters_(nullptr),
current_block_(schedule()->start()) {
int param_count = static_cast<int>(parameter_count());
Node* s = graph->NewNode(common_.Start(param_count));
// Add an extra input node for the JSFunction parameter to the start node.
Node* s = graph->NewNode(common_.Start(param_count + 1));
graph->SetStart(s);
if (parameter_count() == 0) return;
parameters_ = zone()->NewArray<Node*>(param_count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment