| OLD | NEW |
| 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 if (FLAG_trace_turbo) { | 1087 if (FLAG_trace_turbo) { |
| 1088 Run<PrintGraphPhase>(phase); | 1088 Run<PrintGraphPhase>(phase); |
| 1089 } | 1089 } |
| 1090 if (FLAG_turbo_verify) { | 1090 if (FLAG_turbo_verify) { |
| 1091 Run<VerifyGraphPhase>(untyped); | 1091 Run<VerifyGraphPhase>(untyped); |
| 1092 } | 1092 } |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 | 1095 |
| 1096 Handle<Code> Pipeline::GenerateCode() { | 1096 Handle<Code> Pipeline::GenerateCode() { |
| 1097 ZonePool zone_pool; | 1097 ZonePool zone_pool(isolate()->allocator()); |
| 1098 base::SmartPointer<PipelineStatistics> pipeline_statistics; | 1098 base::SmartPointer<PipelineStatistics> pipeline_statistics; |
| 1099 | 1099 |
| 1100 if (FLAG_turbo_stats) { | 1100 if (FLAG_turbo_stats) { |
| 1101 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); | 1101 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); |
| 1102 pipeline_statistics->BeginPhaseKind("initializing"); | 1102 pipeline_statistics->BeginPhaseKind("initializing"); |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 if (FLAG_trace_turbo) { | 1105 if (FLAG_trace_turbo) { |
| 1106 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); | 1106 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); |
| 1107 if (json_file != nullptr) { | 1107 if (json_file != nullptr) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1248 |
| 1249 | 1249 |
| 1250 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, | 1250 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, |
| 1251 CallDescriptor* call_descriptor, | 1251 CallDescriptor* call_descriptor, |
| 1252 Graph* graph, Schedule* schedule, | 1252 Graph* graph, Schedule* schedule, |
| 1253 Code::Flags flags, | 1253 Code::Flags flags, |
| 1254 const char* debug_name) { | 1254 const char* debug_name) { |
| 1255 CompilationInfo info(debug_name, isolate, graph->zone(), flags); | 1255 CompilationInfo info(debug_name, isolate, graph->zone(), flags); |
| 1256 | 1256 |
| 1257 // Construct a pipeline for scheduling and code generation. | 1257 // Construct a pipeline for scheduling and code generation. |
| 1258 ZonePool zone_pool; | 1258 ZonePool zone_pool(isolate->allocator()); |
| 1259 PipelineData data(&zone_pool, &info, graph, schedule); | 1259 PipelineData data(&zone_pool, &info, graph, schedule); |
| 1260 base::SmartPointer<PipelineStatistics> pipeline_statistics; | 1260 base::SmartPointer<PipelineStatistics> pipeline_statistics; |
| 1261 if (FLAG_turbo_stats) { | 1261 if (FLAG_turbo_stats) { |
| 1262 pipeline_statistics.Reset(new PipelineStatistics(&info, &zone_pool)); | 1262 pipeline_statistics.Reset(new PipelineStatistics(&info, &zone_pool)); |
| 1263 pipeline_statistics->BeginPhaseKind("stub codegen"); | 1263 pipeline_statistics->BeginPhaseKind("stub codegen"); |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 Pipeline pipeline(&info); | 1266 Pipeline pipeline(&info); |
| 1267 pipeline.data_ = &data; | 1267 pipeline.data_ = &data; |
| 1268 DCHECK_NOT_NULL(data.schedule()); | 1268 DCHECK_NOT_NULL(data.schedule()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1289 Linkage::ComputeIncoming(info->zone(), info); | 1289 Linkage::ComputeIncoming(info->zone(), info); |
| 1290 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); | 1290 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 | 1293 |
| 1294 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, | 1294 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, |
| 1295 CallDescriptor* call_descriptor, | 1295 CallDescriptor* call_descriptor, |
| 1296 Graph* graph, | 1296 Graph* graph, |
| 1297 Schedule* schedule) { | 1297 Schedule* schedule) { |
| 1298 // Construct a pipeline for scheduling and code generation. | 1298 // Construct a pipeline for scheduling and code generation. |
| 1299 ZonePool zone_pool; | 1299 ZonePool zone_pool(info->isolate()->allocator()); |
| 1300 PipelineData data(&zone_pool, info, graph, schedule); | 1300 PipelineData data(&zone_pool, info, graph, schedule); |
| 1301 base::SmartPointer<PipelineStatistics> pipeline_statistics; | 1301 base::SmartPointer<PipelineStatistics> pipeline_statistics; |
| 1302 if (FLAG_turbo_stats) { | 1302 if (FLAG_turbo_stats) { |
| 1303 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); | 1303 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); |
| 1304 pipeline_statistics->BeginPhaseKind("test codegen"); | 1304 pipeline_statistics->BeginPhaseKind("test codegen"); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 Pipeline pipeline(info); | 1307 Pipeline pipeline(info); |
| 1308 pipeline.data_ = &data; | 1308 pipeline.data_ = &data; |
| 1309 if (data.schedule() == nullptr) { | 1309 if (data.schedule() == nullptr) { |
| 1310 // TODO(rossberg): Should this really be untyped? | 1310 // TODO(rossberg): Should this really be untyped? |
| 1311 pipeline.RunPrintAndVerify("Machine", true); | 1311 pipeline.RunPrintAndVerify("Machine", true); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 return pipeline.ScheduleAndGenerateCode(call_descriptor); | 1314 return pipeline.ScheduleAndGenerateCode(call_descriptor); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 | 1317 |
| 1318 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, | 1318 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, |
| 1319 InstructionSequence* sequence, | 1319 InstructionSequence* sequence, |
| 1320 bool run_verifier) { | 1320 bool run_verifier) { |
| 1321 CompilationInfo info("testing", sequence->isolate(), sequence->zone()); | 1321 CompilationInfo info("testing", sequence->isolate(), sequence->zone()); |
| 1322 ZonePool zone_pool; | 1322 ZonePool zone_pool(sequence->isolate()->allocator()); |
| 1323 PipelineData data(&zone_pool, &info, sequence); | 1323 PipelineData data(&zone_pool, &info, sequence); |
| 1324 Pipeline pipeline(&info); | 1324 Pipeline pipeline(&info); |
| 1325 pipeline.data_ = &data; | 1325 pipeline.data_ = &data; |
| 1326 pipeline.data_->InitializeFrameData(nullptr); | 1326 pipeline.data_->InitializeFrameData(nullptr); |
| 1327 pipeline.AllocateRegisters(config, nullptr, run_verifier); | 1327 pipeline.AllocateRegisters(config, nullptr, run_verifier); |
| 1328 return !data.compilation_failed(); | 1328 return !data.compilation_failed(); |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 | 1331 |
| 1332 Handle<Code> Pipeline::ScheduleAndGenerateCode( | 1332 Handle<Code> Pipeline::ScheduleAndGenerateCode( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 | 1435 |
| 1436 void Pipeline::AllocateRegisters(const RegisterConfiguration* config, | 1436 void Pipeline::AllocateRegisters(const RegisterConfiguration* config, |
| 1437 CallDescriptor* descriptor, | 1437 CallDescriptor* descriptor, |
| 1438 bool run_verifier) { | 1438 bool run_verifier) { |
| 1439 PipelineData* data = this->data_; | 1439 PipelineData* data = this->data_; |
| 1440 | 1440 |
| 1441 // Don't track usage for this zone in compiler stats. | 1441 // Don't track usage for this zone in compiler stats. |
| 1442 base::SmartPointer<Zone> verifier_zone; | 1442 base::SmartPointer<Zone> verifier_zone; |
| 1443 RegisterAllocatorVerifier* verifier = nullptr; | 1443 RegisterAllocatorVerifier* verifier = nullptr; |
| 1444 if (run_verifier) { | 1444 if (run_verifier) { |
| 1445 verifier_zone.Reset(new Zone()); | 1445 verifier_zone.Reset(new Zone(isolate()->allocator())); |
| 1446 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( | 1446 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( |
| 1447 verifier_zone.get(), config, data->sequence()); | 1447 verifier_zone.get(), config, data->sequence()); |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 base::SmartArrayPointer<char> debug_name; | 1450 base::SmartArrayPointer<char> debug_name; |
| 1451 #ifdef DEBUG | 1451 #ifdef DEBUG |
| 1452 debug_name = info()->GetDebugName(); | 1452 debug_name = info()->GetDebugName(); |
| 1453 data_->sequence()->ValidateEdgeSplitForm(); | 1453 data_->sequence()->ValidateEdgeSplitForm(); |
| 1454 data_->sequence()->ValidateDeferredBlockExitPaths(); | 1454 data_->sequence()->ValidateDeferredBlockExitPaths(); |
| 1455 #endif | 1455 #endif |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 } | 1522 } |
| 1523 | 1523 |
| 1524 data->DeleteRegisterAllocationZone(); | 1524 data->DeleteRegisterAllocationZone(); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1527 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
| 1528 | 1528 |
| 1529 } // namespace compiler | 1529 } // namespace compiler |
| 1530 } // namespace internal | 1530 } // namespace internal |
| 1531 } // namespace v8 | 1531 } // namespace v8 |
| OLD | NEW |