Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index a528cceea523644bdb575f61f76958bce3e6fdcd..a39d30f770ac2718694e8d8c6f80b37c0d504fcc 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -350,7 +350,14 @@ void TraceSchedule(CompilationInfo* info, Schedule* schedule) { |
base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) { |
- if (info->code_stub() != NULL) { |
+ if (info->IsBytecodeHandler()) { |
+ const char* bytecode_name = |
+ interpreter::Bytecodes::ToString(info->bytecode()); |
+ size_t len = strlen(bytecode_name) + 1; |
+ base::SmartArrayPointer<char> name(new char[len]); |
+ memcpy(name.get(), bytecode_name, len); |
+ return name; |
+ } else if (info->code_stub() != NULL) { |
CodeStub::Major major_key = info->code_stub()->MajorKey(); |
const char* major_name = CodeStub::MajorName(major_key, false); |
size_t len = strlen(major_name) + 1; |
@@ -489,7 +496,7 @@ struct GraphBuilderPhase { |
AstGraphBuilderWithPositions graph_builder( |
temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), |
data->js_type_feedback(), data->source_positions()); |
- bool stack_check = !data->info()->IsStub(); |
+ bool stack_check = !data->info()->IsStub() && !data->info()->IsStub(); |
if (!graph_builder.CreateGraph(stack_check)) { |
data->set_compilation_failed(); |
} |
@@ -1145,12 +1152,20 @@ Handle<Code> Pipeline::GenerateCode() { |
} |
+Handle<Code> Pipeline::GenerateCodeForInterpreter( |
+ Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph, |
+ Schedule* schedule, interpreter::Bytecode bytecode) { |
+ CompilationInfo info(bytecode, isolate, graph->zone()); |
+ return GenerateCodeFromMachineGraph(&info, call_descriptor, graph, schedule); |
+} |
+ |
+ |
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); |
+ return GenerateCodeFromMachineGraph(info, call_descriptor, graph, schedule); |
} |
@@ -1160,26 +1175,34 @@ Handle<Code> Pipeline::GenerateCodeForTesting(Isolate* isolate, |
Schedule* schedule) { |
FakeStubForTesting stub(isolate); |
CompilationInfo info(&stub, isolate, graph->zone()); |
- return GenerateCodeForTesting(&info, call_descriptor, graph, schedule); |
+ return GenerateCodeFromMachineGraph(&info, call_descriptor, graph, schedule); |
} |
-Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, |
- CallDescriptor* call_descriptor, |
- Graph* graph, |
- Schedule* schedule) { |
+Handle<Code> Pipeline::GenerateCodeFromMachineGraph( |
+ CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph, |
+ Schedule* schedule) { |
// 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("test codegen"); |
+ pipeline_statistics->BeginPhaseKind("machine graph 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\":\"" << GetDebugName(info).get() |
+ << "\", \"source\":\"\",\n\"phases\":["; |
+ fclose(json_file); |
+ } |
} |
Pipeline pipeline(info); |
pipeline.data_ = &data; |
- if (data.schedule() == nullptr) { |
+ if (data.schedule() == nullptr || info->IsBytecodeHandler()) { |
// TODO(rossberg): Should this really be untyped? |
pipeline.RunPrintAndVerify("Machine", true); |
} |