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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 | 975 |
976 void Run(PipelineData* data, Zone* temp_zone) { | 976 void Run(PipelineData* data, Zone* temp_zone) { |
977 FrameElider(data->sequence()).Run(); | 977 FrameElider(data->sequence()).Run(); |
978 } | 978 } |
979 }; | 979 }; |
980 | 980 |
981 | 981 |
982 struct JumpThreadingPhase { | 982 struct JumpThreadingPhase { |
983 static const char* phase_name() { return "jump threading"; } | 983 static const char* phase_name() { return "jump threading"; } |
984 | 984 |
985 void Run(PipelineData* data, Zone* temp_zone) { | 985 void Run(PipelineData* data, Zone* temp_zone, bool frame_at_start) { |
986 ZoneVector<RpoNumber> result(temp_zone); | 986 ZoneVector<RpoNumber> result(temp_zone); |
987 if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence())) { | 987 if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence(), |
988 frame_at_start)) { | |
988 JumpThreading::ApplyForwarding(result, data->sequence()); | 989 JumpThreading::ApplyForwarding(result, data->sequence()); |
989 } | 990 } |
990 } | 991 } |
991 }; | 992 }; |
992 | 993 |
993 | 994 |
994 struct GenerateCodePhase { | 995 struct GenerateCodePhase { |
995 static const char* phase_name() { return "generate code"; } | 996 static const char* phase_name() { return "generate code"; } |
996 | 997 |
997 void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) { | 998 void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1327 // Allocate registers. | 1328 // Allocate registers. |
1328 AllocateRegisters( | 1329 AllocateRegisters( |
1329 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), | 1330 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), |
1330 call_descriptor, run_verifier); | 1331 call_descriptor, run_verifier); |
1331 if (data->compilation_failed()) { | 1332 if (data->compilation_failed()) { |
1332 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); | 1333 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); |
1333 return Handle<Code>(); | 1334 return Handle<Code>(); |
1334 } | 1335 } |
1335 | 1336 |
1336 BeginPhaseKind("code generation"); | 1337 BeginPhaseKind("code generation"); |
1337 | 1338 // TODO(mtrofin): move this off to the register allocator. |
Jarin
2016/01/28 05:26:58
Yes, please do.
| |
1339 bool generate_frame_at_start = | |
1340 !FLAG_turbo_frame_elision || !data_->info()->IsStub() || | |
1341 !data_->frame()->needs_frame() || | |
1342 data_->sequence()->instruction_blocks().front()->needs_frame() || | |
1343 linkage.GetIncomingDescriptor()->CalleeSavedFPRegisters() != 0 || | |
1344 linkage.GetIncomingDescriptor()->CalleeSavedRegisters() != 0; | |
1338 // Optimimize jumps. | 1345 // Optimimize jumps. |
1339 if (FLAG_turbo_jt) { | 1346 if (FLAG_turbo_jt) { |
1340 Run<JumpThreadingPhase>(); | 1347 Run<JumpThreadingPhase>(generate_frame_at_start); |
1341 } | 1348 } |
1342 | 1349 |
1343 // Generate final machine code. | 1350 // Generate final machine code. |
1344 Run<GenerateCodePhase>(&linkage); | 1351 Run<GenerateCodePhase>(&linkage); |
1345 | 1352 |
1346 Handle<Code> code = data->code(); | 1353 Handle<Code> code = data->code(); |
1347 if (profiler_data != nullptr) { | 1354 if (profiler_data != nullptr) { |
1348 #if ENABLE_DISASSEMBLER | 1355 #if ENABLE_DISASSEMBLER |
1349 std::ostringstream os; | 1356 std::ostringstream os; |
1350 code->Disassemble(nullptr, os); | 1357 code->Disassemble(nullptr, os); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1473 tcf << AsC1VRegisterAllocationData("CodeGen", | 1480 tcf << AsC1VRegisterAllocationData("CodeGen", |
1474 data->register_allocation_data()); | 1481 data->register_allocation_data()); |
1475 } | 1482 } |
1476 | 1483 |
1477 data->DeleteRegisterAllocationZone(); | 1484 data->DeleteRegisterAllocationZone(); |
1478 } | 1485 } |
1479 | 1486 |
1480 } // namespace compiler | 1487 } // namespace compiler |
1481 } // namespace internal | 1488 } // namespace internal |
1482 } // namespace v8 | 1489 } // namespace v8 |
OLD | NEW |