Reviewers: titzer,
Message:
This is the follow-on from https://codereview.chromium.org/1297203002/.
PTAL,
thanks.
Description:
[interpreter] Allow verification and trace-turbo for bytecode handlers.
BUG=v8:4280
LOG=N
Please review this at https://codereview.chromium.org/1308863004/
Base URL: https://chromium.googlesource.com/v8/v8.git@ignition-visualize
Affected files (+43, -4 lines):
M src/compiler/interpreter-assembler.cc
M src/compiler/pipeline.h
M src/compiler/pipeline.cc
M src/compiler/raw-machine-assembler.cc
Index: src/compiler/interpreter-assembler.cc
diff --git a/src/compiler/interpreter-assembler.cc
b/src/compiler/interpreter-assembler.cc
index
47e014ba3992b3aa2e1b1ce4b191b0f76b15930c..8c2de42aa5297e7481c64f3a7ffbd89eedc96324
100644
--- a/src/compiler/interpreter-assembler.cc
+++ b/src/compiler/interpreter-assembler.cc
@@ -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
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index
b627f25ed6259aecd7ab53a52c7be2fb9197fee0..ffeec468c07285cc36d25be8457901854287c201
100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -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) {
Index: src/compiler/pipeline.h
diff --git a/src/compiler/pipeline.h b/src/compiler/pipeline.h
index
ea8b7e9b4bd0ccc5b4467c3da094b23e71b856e2..4e3635d0f69c5b98009b1f3063c4a61c421a1958
100644
--- a/src/compiler/pipeline.h
+++ b/src/compiler/pipeline.h
@@ -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,
Index: src/compiler/raw-machine-assembler.cc
diff --git a/src/compiler/raw-machine-assembler.cc
b/src/compiler/raw-machine-assembler.cc
index
f437922fa6aa3363b1b908d2ada508624c5ae002..71c79eb9da6e768243a3a1f9f453411edb3846a0
100644
--- a/src/compiler/raw-machine-assembler.cc
+++ b/src/compiler/raw-machine-assembler.cc
@@ -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);
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.