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

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

Issue 1297203002: Add CompileInfo::GetDebugName() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@interpreter_immed_bytecodes
Patch Set: Add CompilationInfo::ShouldEnsureSpaceForLazyDeopt() Created 5 years, 4 months 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
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/adapters.h" 10 #include "src/base/adapters.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 fclose(json_file); 343 fclose(json_file);
344 } 344 }
345 } 345 }
346 if (!FLAG_trace_turbo_graph && !FLAG_trace_turbo_scheduler) return; 346 if (!FLAG_trace_turbo_graph && !FLAG_trace_turbo_scheduler) return;
347 OFStream os(stdout); 347 OFStream os(stdout);
348 os << "-- Schedule --------------------------------------\n" << *schedule; 348 os << "-- Schedule --------------------------------------\n" << *schedule;
349 } 349 }
350 350
351 351
352 base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) { 352 base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
353 if (info->code_stub() != NULL) { 353 if (info->IsBytecodeHandler()) {
354 const char* bytecode_name =
355 interpreter::Bytecodes::ToString(info->bytecode());
356 size_t len = strlen(bytecode_name) + 1;
357 base::SmartArrayPointer<char> name(new char[len]);
358 memcpy(name.get(), bytecode_name, len);
359 return name;
360 } else if (info->code_stub() != NULL) {
354 CodeStub::Major major_key = info->code_stub()->MajorKey(); 361 CodeStub::Major major_key = info->code_stub()->MajorKey();
355 const char* major_name = CodeStub::MajorName(major_key, false); 362 const char* major_name = CodeStub::MajorName(major_key, false);
356 size_t len = strlen(major_name) + 1; 363 size_t len = strlen(major_name) + 1;
357 base::SmartArrayPointer<char> name(new char[len]); 364 base::SmartArrayPointer<char> name(new char[len]);
358 memcpy(name.get(), major_name, len); 365 memcpy(name.get(), major_name, len);
359 return name; 366 return name;
360 } else { 367 } else {
361 AllowHandleDereference allow_deref; 368 AllowHandleDereference allow_deref;
362 return info->literal()->debug_name()->ToCString(); 369 return info->literal()->debug_name()->ToCString();
363 } 370 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 }; 489 };
483 490
484 491
485 struct GraphBuilderPhase { 492 struct GraphBuilderPhase {
486 static const char* phase_name() { return "graph builder"; } 493 static const char* phase_name() { return "graph builder"; }
487 494
488 void Run(PipelineData* data, Zone* temp_zone) { 495 void Run(PipelineData* data, Zone* temp_zone) {
489 AstGraphBuilderWithPositions graph_builder( 496 AstGraphBuilderWithPositions graph_builder(
490 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), 497 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(),
491 data->js_type_feedback(), data->source_positions()); 498 data->js_type_feedback(), data->source_positions());
492 bool stack_check = !data->info()->IsStub(); 499 bool stack_check = !data->info()->IsStub() && !data->info()->IsStub();
493 if (!graph_builder.CreateGraph(stack_check)) { 500 if (!graph_builder.CreateGraph(stack_check)) {
494 data->set_compilation_failed(); 501 data->set_compilation_failed();
495 } 502 }
496 } 503 }
497 }; 504 };
498 505
499 506
500 struct InliningPhase { 507 struct InliningPhase {
501 static const char* phase_name() { return "inlining"; } 508 static const char* phase_name() { return "inlining"; }
502 509
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 data.source_positions()->RemoveDecorator(); 1145 data.source_positions()->RemoveDecorator();
1139 1146
1140 // Kill the Typer and thereby uninstall the decorator (if any). 1147 // Kill the Typer and thereby uninstall the decorator (if any).
1141 typer.Reset(nullptr); 1148 typer.Reset(nullptr);
1142 1149
1143 return ScheduleAndGenerateCode( 1150 return ScheduleAndGenerateCode(
1144 Linkage::ComputeIncoming(data.instruction_zone(), info())); 1151 Linkage::ComputeIncoming(data.instruction_zone(), info()));
1145 } 1152 }
1146 1153
1147 1154
1155 Handle<Code> Pipeline::GenerateCodeForInterpreter(
1156 Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
1157 Schedule* schedule, interpreter::Bytecode bytecode) {
1158 CompilationInfo info(bytecode, isolate, graph->zone());
1159 return GenerateCodeFromMachineGraph(&info, call_descriptor, graph, schedule);
1160 }
1161
1162
1148 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, 1163 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
1149 Graph* graph, 1164 Graph* graph,
1150 Schedule* schedule) { 1165 Schedule* schedule) {
1151 CallDescriptor* call_descriptor = 1166 CallDescriptor* call_descriptor =
1152 Linkage::ComputeIncoming(info->zone(), info); 1167 Linkage::ComputeIncoming(info->zone(), info);
1153 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); 1168 return GenerateCodeFromMachineGraph(info, call_descriptor, graph, schedule);
1154 } 1169 }
1155 1170
1156 1171
1157 Handle<Code> Pipeline::GenerateCodeForTesting(Isolate* isolate, 1172 Handle<Code> Pipeline::GenerateCodeForTesting(Isolate* isolate,
1158 CallDescriptor* call_descriptor, 1173 CallDescriptor* call_descriptor,
1159 Graph* graph, 1174 Graph* graph,
1160 Schedule* schedule) { 1175 Schedule* schedule) {
1161 FakeStubForTesting stub(isolate); 1176 FakeStubForTesting stub(isolate);
1162 CompilationInfo info(&stub, isolate, graph->zone()); 1177 CompilationInfo info(&stub, isolate, graph->zone());
1163 return GenerateCodeForTesting(&info, call_descriptor, graph, schedule); 1178 return GenerateCodeFromMachineGraph(&info, call_descriptor, graph, schedule);
1164 } 1179 }
1165 1180
1166 1181
1167 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, 1182 Handle<Code> Pipeline::GenerateCodeFromMachineGraph(
1168 CallDescriptor* call_descriptor, 1183 CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph,
1169 Graph* graph, 1184 Schedule* schedule) {
1170 Schedule* schedule) {
1171 // Construct a pipeline for scheduling and code generation. 1185 // Construct a pipeline for scheduling and code generation.
1172 ZonePool zone_pool; 1186 ZonePool zone_pool;
1173 PipelineData data(&zone_pool, info, graph, schedule); 1187 PipelineData data(&zone_pool, info, graph, schedule);
1174 base::SmartPointer<PipelineStatistics> pipeline_statistics; 1188 base::SmartPointer<PipelineStatistics> pipeline_statistics;
1175 if (FLAG_turbo_stats) { 1189 if (FLAG_turbo_stats) {
1176 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); 1190 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool));
1177 pipeline_statistics->BeginPhaseKind("test codegen"); 1191 pipeline_statistics->BeginPhaseKind("machine graph codegen");
1192 }
1193 if (FLAG_trace_turbo) {
1194 FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "w+");
1195 if (json_file != nullptr) {
1196 OFStream json_of(json_file);
1197 json_of << "{\"function\":\"" << GetDebugName(info).get()
1198 << "\", \"source\":\"\",\n\"phases\":[";
1199 fclose(json_file);
1200 }
1178 } 1201 }
1179 1202
1180 Pipeline pipeline(info); 1203 Pipeline pipeline(info);
1181 pipeline.data_ = &data; 1204 pipeline.data_ = &data;
1182 if (data.schedule() == nullptr) { 1205 if (data.schedule() == nullptr || info->IsBytecodeHandler()) {
1183 // TODO(rossberg): Should this really be untyped? 1206 // TODO(rossberg): Should this really be untyped?
1184 pipeline.RunPrintAndVerify("Machine", true); 1207 pipeline.RunPrintAndVerify("Machine", true);
1185 } 1208 }
1186 1209
1187 return pipeline.ScheduleAndGenerateCode(call_descriptor); 1210 return pipeline.ScheduleAndGenerateCode(call_descriptor);
1188 } 1211 }
1189 1212
1190 1213
1191 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, 1214 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
1192 InstructionSequence* sequence, 1215 InstructionSequence* sequence,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 tcf << AsC1VRegisterAllocationData("CodeGen", 1401 tcf << AsC1VRegisterAllocationData("CodeGen",
1379 data->register_allocation_data()); 1402 data->register_allocation_data());
1380 } 1403 }
1381 1404
1382 data->DeleteRegisterAllocationZone(); 1405 data->DeleteRegisterAllocationZone();
1383 } 1406 }
1384 1407
1385 } // namespace compiler 1408 } // namespace compiler
1386 } // namespace internal 1409 } // namespace internal
1387 } // namespace v8 1410 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698