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/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 profiler_data->SetCode(&os); | 997 profiler_data->SetCode(&os); |
998 #endif | 998 #endif |
999 } | 999 } |
1000 } | 1000 } |
1001 | 1001 |
1002 | 1002 |
1003 void Pipeline::AllocateRegisters(const RegisterConfiguration* config, | 1003 void Pipeline::AllocateRegisters(const RegisterConfiguration* config, |
1004 bool run_verifier) { | 1004 bool run_verifier) { |
1005 PipelineData* data = this->data_; | 1005 PipelineData* data = this->data_; |
1006 | 1006 |
1007 int node_count = data->sequence()->VirtualRegisterCount(); | |
1008 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { | |
1009 data->set_compilation_failed(); | |
1010 return; | |
1011 } | |
1012 | |
1013 // Don't track usage for this zone in compiler stats. | 1007 // Don't track usage for this zone in compiler stats. |
1014 SmartPointer<Zone> verifier_zone; | 1008 SmartPointer<Zone> verifier_zone; |
1015 RegisterAllocatorVerifier* verifier = nullptr; | 1009 RegisterAllocatorVerifier* verifier = nullptr; |
1016 if (run_verifier) { | 1010 if (run_verifier) { |
1017 verifier_zone.Reset(new Zone(info()->isolate())); | 1011 verifier_zone.Reset(new Zone(info()->isolate())); |
1018 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( | 1012 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( |
1019 verifier_zone.get(), config, data->sequence()); | 1013 verifier_zone.get(), config, data->sequence()); |
1020 } | 1014 } |
1021 | 1015 |
1022 SmartArrayPointer<char> debug_name; | 1016 SmartArrayPointer<char> debug_name; |
(...skipping 11 matching lines...) Expand all Loading... |
1034 if (FLAG_trace_turbo_graph) { | 1028 if (FLAG_trace_turbo_graph) { |
1035 OFStream os(stdout); | 1029 OFStream os(stdout); |
1036 PrintableInstructionSequence printable = {config, data->sequence()}; | 1030 PrintableInstructionSequence printable = {config, data->sequence()}; |
1037 os << "----- Instruction sequence before register allocation -----\n" | 1031 os << "----- Instruction sequence before register allocation -----\n" |
1038 << printable; | 1032 << printable; |
1039 } | 1033 } |
1040 if (verifier != nullptr) { | 1034 if (verifier != nullptr) { |
1041 CHECK(!data->register_allocator()->ExistsUseWithoutDefinition()); | 1035 CHECK(!data->register_allocator()->ExistsUseWithoutDefinition()); |
1042 } | 1036 } |
1043 Run<AllocateGeneralRegistersPhase>(); | 1037 Run<AllocateGeneralRegistersPhase>(); |
1044 if (!data->register_allocator()->AllocationOk()) { | |
1045 data->set_compilation_failed(); | |
1046 return; | |
1047 } | |
1048 Run<AllocateDoubleRegistersPhase>(); | 1038 Run<AllocateDoubleRegistersPhase>(); |
1049 if (!data->register_allocator()->AllocationOk()) { | |
1050 data->set_compilation_failed(); | |
1051 return; | |
1052 } | |
1053 if (FLAG_turbo_reuse_spill_slots) { | 1039 if (FLAG_turbo_reuse_spill_slots) { |
1054 Run<ReuseSpillSlotsPhase>(); | 1040 Run<ReuseSpillSlotsPhase>(); |
1055 } | 1041 } |
1056 Run<CommitAssignmentPhase>(); | 1042 Run<CommitAssignmentPhase>(); |
1057 Run<PopulatePointerMapsPhase>(); | 1043 Run<PopulatePointerMapsPhase>(); |
1058 Run<ConnectRangesPhase>(); | 1044 Run<ConnectRangesPhase>(); |
1059 Run<ResolveControlFlowPhase>(); | 1045 Run<ResolveControlFlowPhase>(); |
1060 if (FLAG_turbo_move_optimization) { | 1046 if (FLAG_turbo_move_optimization) { |
1061 Run<OptimizeMovesPhase>(); | 1047 Run<OptimizeMovesPhase>(); |
1062 } | 1048 } |
(...skipping 22 matching lines...) Expand all Loading... |
1085 } | 1071 } |
1086 | 1072 |
1087 | 1073 |
1088 void Pipeline::TearDown() { | 1074 void Pipeline::TearDown() { |
1089 InstructionOperand::TearDownCaches(); | 1075 InstructionOperand::TearDownCaches(); |
1090 } | 1076 } |
1091 | 1077 |
1092 } // namespace compiler | 1078 } // namespace compiler |
1093 } // namespace internal | 1079 } // namespace internal |
1094 } // namespace v8 | 1080 } // namespace v8 |
OLD | NEW |