| 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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 void Run(PipelineData* data, Zone* temp_zone) { | 995 void Run(PipelineData* data, Zone* temp_zone) { |
| 996 MoveOptimizer move_optimizer(temp_zone, data->sequence()); | 996 MoveOptimizer move_optimizer(temp_zone, data->sequence()); |
| 997 move_optimizer.Run(); | 997 move_optimizer.Run(); |
| 998 } | 998 } |
| 999 }; | 999 }; |
| 1000 | 1000 |
| 1001 | 1001 |
| 1002 struct FrameElisionPhase { | 1002 struct FrameElisionPhase { |
| 1003 static const char* phase_name() { return "frame elision"; } | 1003 static const char* phase_name() { return "frame elision"; } |
| 1004 | 1004 |
| 1005 void Run(PipelineData* data, Zone* temp_zone) { | 1005 void Run(PipelineData* data, Zone* temp_zone, |
| 1006 FrameElider(data->sequence()).Run(); | 1006 const CallDescriptor* descriptor) { |
| 1007 FrameElider(data->sequence()).Run(descriptor); |
| 1007 } | 1008 } |
| 1008 }; | 1009 }; |
| 1009 | 1010 |
| 1010 | 1011 |
| 1011 struct JumpThreadingPhase { | 1012 struct JumpThreadingPhase { |
| 1012 static const char* phase_name() { return "jump threading"; } | 1013 static const char* phase_name() { return "jump threading"; } |
| 1013 | 1014 |
| 1014 void Run(PipelineData* data, Zone* temp_zone, bool frame_at_start) { | 1015 void Run(PipelineData* data, Zone* temp_zone, bool frame_at_start) { |
| 1015 ZoneVector<RpoNumber> result(temp_zone); | 1016 ZoneVector<RpoNumber> result(temp_zone); |
| 1016 if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence(), | 1017 if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence(), |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), | 1367 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), |
| 1367 call_descriptor, run_verifier); | 1368 call_descriptor, run_verifier); |
| 1368 if (data->compilation_failed()) { | 1369 if (data->compilation_failed()) { |
| 1369 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); | 1370 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); |
| 1370 return Handle<Code>(); | 1371 return Handle<Code>(); |
| 1371 } | 1372 } |
| 1372 | 1373 |
| 1373 BeginPhaseKind("code generation"); | 1374 BeginPhaseKind("code generation"); |
| 1374 // TODO(mtrofin): move this off to the register allocator. | 1375 // TODO(mtrofin): move this off to the register allocator. |
| 1375 bool generate_frame_at_start = | 1376 bool generate_frame_at_start = |
| 1376 !FLAG_turbo_frame_elision || !data_->info()->IsStub() || | 1377 data_->sequence()->instruction_blocks().front()->must_construct_frame(); |
| 1377 !data_->frame()->needs_frame() || | |
| 1378 data_->sequence()->instruction_blocks().front()->needs_frame() || | |
| 1379 linkage.GetIncomingDescriptor()->CalleeSavedFPRegisters() != 0 || | |
| 1380 linkage.GetIncomingDescriptor()->CalleeSavedRegisters() != 0; | |
| 1381 // Optimimize jumps. | 1378 // Optimimize jumps. |
| 1382 if (FLAG_turbo_jt) { | 1379 if (FLAG_turbo_jt) { |
| 1383 Run<JumpThreadingPhase>(generate_frame_at_start); | 1380 Run<JumpThreadingPhase>(generate_frame_at_start); |
| 1384 } | 1381 } |
| 1385 | 1382 |
| 1386 // Generate final machine code. | 1383 // Generate final machine code. |
| 1387 Run<GenerateCodePhase>(&linkage); | 1384 Run<GenerateCodePhase>(&linkage); |
| 1388 | 1385 |
| 1389 Handle<Code> code = data->code(); | 1386 Handle<Code> code = data->code(); |
| 1390 if (profiler_data != nullptr) { | 1387 if (profiler_data != nullptr) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 } else { | 1475 } else { |
| 1479 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); | 1476 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); |
| 1480 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); | 1477 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); |
| 1481 } | 1478 } |
| 1482 | 1479 |
| 1483 if (FLAG_turbo_preprocess_ranges) { | 1480 if (FLAG_turbo_preprocess_ranges) { |
| 1484 Run<MergeSplintersPhase>(); | 1481 Run<MergeSplintersPhase>(); |
| 1485 } | 1482 } |
| 1486 | 1483 |
| 1487 // We plan to enable frame elision only for stubs and bytecode handlers. | 1484 // We plan to enable frame elision only for stubs and bytecode handlers. |
| 1488 if (FLAG_turbo_frame_elision && info()->IsStub()) { | 1485 |
| 1489 Run<LocateSpillSlotsPhase>(); | 1486 Run<LocateSpillSlotsPhase>(); |
| 1490 Run<FrameElisionPhase>(); | 1487 Run<FrameElisionPhase>(descriptor); |
| 1491 } | |
| 1492 | 1488 |
| 1493 Run<AssignSpillSlotsPhase>(); | 1489 Run<AssignSpillSlotsPhase>(); |
| 1494 | 1490 |
| 1495 Run<CommitAssignmentPhase>(); | 1491 Run<CommitAssignmentPhase>(); |
| 1496 Run<PopulateReferenceMapsPhase>(); | 1492 Run<PopulateReferenceMapsPhase>(); |
| 1497 Run<ConnectRangesPhase>(); | 1493 Run<ConnectRangesPhase>(); |
| 1498 Run<ResolveControlFlowPhase>(); | 1494 Run<ResolveControlFlowPhase>(); |
| 1499 if (FLAG_turbo_move_optimization) { | 1495 if (FLAG_turbo_move_optimization) { |
| 1500 Run<OptimizeMovesPhase>(); | 1496 Run<OptimizeMovesPhase>(); |
| 1501 } | 1497 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1519 } | 1515 } |
| 1520 | 1516 |
| 1521 data->DeleteRegisterAllocationZone(); | 1517 data->DeleteRegisterAllocationZone(); |
| 1522 } | 1518 } |
| 1523 | 1519 |
| 1524 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1520 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
| 1525 | 1521 |
| 1526 } // namespace compiler | 1522 } // namespace compiler |
| 1527 } // namespace internal | 1523 } // namespace internal |
| 1528 } // namespace v8 | 1524 } // namespace v8 |
| OLD | NEW |