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 <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 struct InstructionSelectionPhase { | 1226 struct InstructionSelectionPhase { |
1227 static const char* phase_name() { return "select instructions"; } | 1227 static const char* phase_name() { return "select instructions"; } |
1228 | 1228 |
1229 void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) { | 1229 void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) { |
1230 InstructionSelector selector( | 1230 InstructionSelector selector( |
1231 temp_zone, data->graph()->NodeCount(), linkage, data->sequence(), | 1231 temp_zone, data->graph()->NodeCount(), linkage, data->sequence(), |
1232 data->schedule(), data->source_positions(), data->frame(), | 1232 data->schedule(), data->source_positions(), data->frame(), |
1233 data->info()->is_source_positions_enabled() | 1233 data->info()->is_source_positions_enabled() |
1234 ? InstructionSelector::kAllSourcePositions | 1234 ? InstructionSelector::kAllSourcePositions |
1235 : InstructionSelector::kCallSourcePositions); | 1235 : InstructionSelector::kCallSourcePositions); |
1236 selector.SelectInstructions(); | 1236 if (!selector.SelectInstructions()) { |
| 1237 data->set_compilation_failed(); |
| 1238 } |
1237 } | 1239 } |
1238 }; | 1240 }; |
1239 | 1241 |
1240 | 1242 |
1241 struct MeetRegisterConstraintsPhase { | 1243 struct MeetRegisterConstraintsPhase { |
1242 static const char* phase_name() { return "meet register constraints"; } | 1244 static const char* phase_name() { return "meet register constraints"; } |
1243 | 1245 |
1244 void Run(PipelineData* data, Zone* temp_zone) { | 1246 void Run(PipelineData* data, Zone* temp_zone) { |
1245 ConstraintBuilder builder(data->register_allocation_data()); | 1247 ConstraintBuilder builder(data->register_allocation_data()); |
1246 builder.MeetRegisterConstraints(); | 1248 builder.MeetRegisterConstraints(); |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 if (FLAG_turbo_profiling) { | 1749 if (FLAG_turbo_profiling) { |
1748 data->set_profiler_data(BasicBlockInstrumentor::Instrument( | 1750 data->set_profiler_data(BasicBlockInstrumentor::Instrument( |
1749 info(), data->graph(), data->schedule())); | 1751 info(), data->graph(), data->schedule())); |
1750 } | 1752 } |
1751 | 1753 |
1752 data->InitializeInstructionSequence(call_descriptor); | 1754 data->InitializeInstructionSequence(call_descriptor); |
1753 | 1755 |
1754 data->InitializeFrameData(call_descriptor); | 1756 data->InitializeFrameData(call_descriptor); |
1755 // Select and schedule instructions covering the scheduled graph. | 1757 // Select and schedule instructions covering the scheduled graph. |
1756 Run<InstructionSelectionPhase>(linkage); | 1758 Run<InstructionSelectionPhase>(linkage); |
| 1759 if (data->compilation_failed()) { |
| 1760 info()->AbortOptimization(kCodeGenerationFailed); |
| 1761 data->EndPhaseKind(); |
| 1762 return false; |
| 1763 } |
1757 | 1764 |
1758 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { | 1765 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { |
1759 AllowHandleDereference allow_deref; | 1766 AllowHandleDereference allow_deref; |
1760 TurboCfgFile tcf(isolate()); | 1767 TurboCfgFile tcf(isolate()); |
1761 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(), | 1768 tcf << AsC1V("CodeGen", data->schedule(), data->source_positions(), |
1762 data->sequence()); | 1769 data->sequence()); |
1763 } | 1770 } |
1764 | 1771 |
1765 if (FLAG_trace_turbo) { | 1772 if (FLAG_trace_turbo) { |
1766 std::ostringstream source_position_output; | 1773 std::ostringstream source_position_output; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 data->DeleteRegisterAllocationZone(); | 1949 data->DeleteRegisterAllocationZone(); |
1943 } | 1950 } |
1944 | 1951 |
1945 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1952 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1946 | 1953 |
1947 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1954 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1948 | 1955 |
1949 } // namespace compiler | 1956 } // namespace compiler |
1950 } // namespace internal | 1957 } // namespace internal |
1951 } // namespace v8 | 1958 } // namespace v8 |
OLD | NEW |