Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: src/compiler/pipeline.cc

Issue 1872333002: [turbofan] Remove support for --turbo-types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 499
500 if (info()->shared_info()->asm_function()) { 500 if (info()->shared_info()->asm_function()) {
501 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); 501 if (info()->osr_frame()) info()->MarkAsFrameSpecializing();
502 info()->MarkAsFunctionContextSpecializing(); 502 info()->MarkAsFunctionContextSpecializing();
503 } else { 503 } else {
504 if (!FLAG_always_opt) { 504 if (!FLAG_always_opt) {
505 info()->MarkAsBailoutOnUninitialized(); 505 info()->MarkAsBailoutOnUninitialized();
506 } 506 }
507 if (FLAG_native_context_specialization) { 507 if (FLAG_native_context_specialization) {
508 info()->MarkAsNativeContextSpecializing(); 508 info()->MarkAsNativeContextSpecializing();
509 info()->MarkAsTypingEnabled();
510 } 509 }
511 } 510 }
512 if (!info()->shared_info()->asm_function() || FLAG_turbo_asm_deoptimization) { 511 if (!info()->shared_info()->asm_function() || FLAG_turbo_asm_deoptimization) {
513 info()->MarkAsDeoptimizationEnabled(); 512 info()->MarkAsDeoptimizationEnabled();
514 } 513 }
515 514
516 Pipeline pipeline(info()); 515 Pipeline pipeline(info());
517 pipeline.GenerateCode(); 516 pipeline.GenerateCode();
518 if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed. 517 if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed.
519 if (info()->code().is_null()) return AbortOptimization(kGraphBuildingFailed); 518 if (info()->code().is_null()) return AbortOptimization(kGraphBuildingFailed);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 873
875 struct GenericLoweringPhase { 874 struct GenericLoweringPhase {
876 static const char* phase_name() { return "generic lowering"; } 875 static const char* phase_name() { return "generic lowering"; }
877 876
878 void Run(PipelineData* data, Zone* temp_zone) { 877 void Run(PipelineData* data, Zone* temp_zone) {
879 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 878 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
880 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 879 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
881 data->common()); 880 data->common());
882 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 881 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
883 data->common(), data->machine()); 882 data->common(), data->machine());
884 JSGenericLowering generic_lowering(data->info()->is_typing_enabled(), 883 JSGenericLowering generic_lowering(data->jsgraph());
885 data->jsgraph());
886 SelectLowering select_lowering(data->jsgraph()->graph(), 884 SelectLowering select_lowering(data->jsgraph()->graph(),
887 data->jsgraph()->common()); 885 data->jsgraph()->common());
888 TailCallOptimization tco(data->common(), data->graph()); 886 TailCallOptimization tco(data->common(), data->graph());
889 AddReducer(data, &graph_reducer, &dead_code_elimination); 887 AddReducer(data, &graph_reducer, &dead_code_elimination);
890 AddReducer(data, &graph_reducer, &common_reducer); 888 AddReducer(data, &graph_reducer, &common_reducer);
891 AddReducer(data, &graph_reducer, &generic_lowering); 889 AddReducer(data, &graph_reducer, &generic_lowering);
892 AddReducer(data, &graph_reducer, &select_lowering); 890 AddReducer(data, &graph_reducer, &select_lowering);
893 AddReducer(data, &graph_reducer, &tco); 891 AddReducer(data, &graph_reducer, &tco);
894 graph_reducer.ReduceGraph(); 892 graph_reducer.ReduceGraph();
895 } 893 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 os << AsRPO(*graph); 1123 os << AsRPO(*graph);
1126 } 1124 }
1127 } 1125 }
1128 }; 1126 };
1129 1127
1130 1128
1131 struct VerifyGraphPhase { 1129 struct VerifyGraphPhase {
1132 static const char* phase_name() { return nullptr; } 1130 static const char* phase_name() { return nullptr; }
1133 1131
1134 void Run(PipelineData* data, Zone* temp_zone, const bool untyped) { 1132 void Run(PipelineData* data, Zone* temp_zone, const bool untyped) {
1135 Verifier::Run(data->graph(), FLAG_turbo_types && !untyped 1133 Verifier::Run(data->graph(),
1136 ? Verifier::TYPED 1134 !untyped ? Verifier::TYPED : Verifier::UNTYPED);
1137 : Verifier::UNTYPED);
1138 } 1135 }
1139 }; 1136 };
1140 1137
1141 1138
1142 void Pipeline::BeginPhaseKind(const char* phase_kind_name) { 1139 void Pipeline::BeginPhaseKind(const char* phase_kind_name) {
1143 if (data_->pipeline_statistics() != nullptr) { 1140 if (data_->pipeline_statistics() != nullptr) {
1144 data_->pipeline_statistics()->BeginPhaseKind(phase_kind_name); 1141 data_->pipeline_statistics()->BeginPhaseKind(phase_kind_name);
1145 } 1142 }
1146 } 1143 }
1147 1144
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 TurboCfgFile tcf(isolate()); 1199 TurboCfgFile tcf(isolate());
1203 tcf << AsC1VCompilation(info()); 1200 tcf << AsC1VCompilation(info());
1204 } 1201 }
1205 1202
1206 data.source_positions()->AddDecorator(); 1203 data.source_positions()->AddDecorator();
1207 1204
1208 if (FLAG_loop_assignment_analysis) { 1205 if (FLAG_loop_assignment_analysis) {
1209 Run<LoopAssignmentAnalysisPhase>(); 1206 Run<LoopAssignmentAnalysisPhase>();
1210 } 1207 }
1211 1208
1212 if (info()->is_typing_enabled()) { 1209 Run<TypeHintAnalysisPhase>();
1213 Run<TypeHintAnalysisPhase>();
1214 }
1215 1210
1216 Run<GraphBuilderPhase>(); 1211 Run<GraphBuilderPhase>();
1217 if (data.compilation_failed()) return Handle<Code>::null(); 1212 if (data.compilation_failed()) return Handle<Code>::null();
1218 RunPrintAndVerify("Initial untyped", true); 1213 RunPrintAndVerify("Initial untyped", true);
1219 1214
1220 // Perform OSR deconstruction. 1215 // Perform OSR deconstruction.
1221 if (info()->is_osr()) { 1216 if (info()->is_osr()) {
1222 Run<OsrDeconstructionPhase>(); 1217 Run<OsrDeconstructionPhase>();
1223 RunPrintAndVerify("OSR deconstruction", true); 1218 RunPrintAndVerify("OSR deconstruction", true);
1224 } 1219 }
1225 1220
1226 // Perform function context specialization and inlining (if enabled). 1221 // Perform function context specialization and inlining (if enabled).
1227 Run<InliningPhase>(); 1222 Run<InliningPhase>();
1228 RunPrintAndVerify("Inlined", true); 1223 RunPrintAndVerify("Inlined", true);
1229 1224
1230 // Remove dead->live edges from the graph. 1225 // Remove dead->live edges from the graph.
1231 Run<EarlyGraphTrimmingPhase>(); 1226 Run<EarlyGraphTrimmingPhase>();
1232 RunPrintAndVerify("Early trimmed", true); 1227 RunPrintAndVerify("Early trimmed", true);
1233 1228
1234 if (FLAG_print_turbo_replay) { 1229 if (FLAG_print_turbo_replay) {
1235 // Print a replay of the initial graph. 1230 // Print a replay of the initial graph.
1236 GraphReplayPrinter::PrintReplay(data.graph()); 1231 GraphReplayPrinter::PrintReplay(data.graph());
1237 } 1232 }
1238 1233
1234 // Type the graph.
1239 base::SmartPointer<Typer> typer; 1235 base::SmartPointer<Typer> typer;
1240 if (info()->is_typing_enabled()) { 1236 typer.Reset(new Typer(isolate(), data.graph(),
1241 // Type the graph. 1237 info()->is_deoptimization_enabled()
1242 typer.Reset(new Typer(isolate(), data.graph(), 1238 ? Typer::kDeoptimizationEnabled
1243 info()->is_deoptimization_enabled() 1239 : Typer::kNoFlags,
1244 ? Typer::kDeoptimizationEnabled 1240 info()->dependencies()));
1245 : Typer::kNoFlags, 1241 Run<TyperPhase>(typer.get());
1246 info()->dependencies())); 1242 RunPrintAndVerify("Typed");
1247 Run<TyperPhase>(typer.get());
1248 RunPrintAndVerify("Typed");
1249 }
1250 1243
1251 BeginPhaseKind("lowering"); 1244 BeginPhaseKind("lowering");
1252 1245
1253 if (info()->is_typing_enabled()) { 1246 // Lower JSOperators where we can determine types.
1254 // Lower JSOperators where we can determine types. 1247 Run<TypedLoweringPhase>();
1255 Run<TypedLoweringPhase>(); 1248 RunPrintAndVerify("Lowered typed");
1256 RunPrintAndVerify("Lowered typed");
1257 1249
1258 if (FLAG_turbo_stress_loop_peeling) { 1250 if (FLAG_turbo_stress_loop_peeling) {
1259 Run<StressLoopPeelingPhase>(); 1251 Run<StressLoopPeelingPhase>();
1260 RunPrintAndVerify("Loop peeled"); 1252 RunPrintAndVerify("Loop peeled");
1261 } 1253 }
1262 1254
1263 if (FLAG_turbo_escape) { 1255 if (FLAG_turbo_escape) {
1264 Run<EscapeAnalysisPhase>(); 1256 Run<EscapeAnalysisPhase>();
1265 RunPrintAndVerify("Escape Analysed"); 1257 RunPrintAndVerify("Escape Analysed");
1266 } 1258 }
1267 1259
1268 // Lower simplified operators and insert changes. 1260 // Lower simplified operators and insert changes.
1269 Run<SimplifiedLoweringPhase>(); 1261 Run<SimplifiedLoweringPhase>();
1270 RunPrintAndVerify("Lowered simplified"); 1262 RunPrintAndVerify("Lowered simplified");
1271 1263
1272 Run<BranchEliminationPhase>(); 1264 Run<BranchEliminationPhase>();
1273 RunPrintAndVerify("Branch conditions eliminated"); 1265 RunPrintAndVerify("Branch conditions eliminated");
1274 1266
1275 // Optimize control flow. 1267 // Optimize control flow.
1276 if (FLAG_turbo_cf_optimization) { 1268 if (FLAG_turbo_cf_optimization) {
1277 Run<ControlFlowOptimizationPhase>(); 1269 Run<ControlFlowOptimizationPhase>();
1278 RunPrintAndVerify("Control flow optimized"); 1270 RunPrintAndVerify("Control flow optimized");
1279 } 1271 }
1280 1272
1281 // Lower changes that have been inserted before. 1273 // Lower changes that have been inserted before.
1282 Run<ChangeLoweringPhase>(); 1274 Run<ChangeLoweringPhase>();
1283 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1275 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1284 RunPrintAndVerify("Lowered changes", true); 1276 RunPrintAndVerify("Lowered changes", true);
1285 }
1286 1277
1287 // Lower any remaining generic JSOperators. 1278 // Lower any remaining generic JSOperators.
1288 Run<GenericLoweringPhase>(); 1279 Run<GenericLoweringPhase>();
1289 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1280 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1290 RunPrintAndVerify("Lowered generic", true); 1281 RunPrintAndVerify("Lowered generic", true);
1291 1282
1292 Run<LateGraphTrimmingPhase>(); 1283 Run<LateGraphTrimmingPhase>();
1293 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1284 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1294 RunPrintAndVerify("Late trimmed", true); 1285 RunPrintAndVerify("Late trimmed", true);
1295 1286
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 } 1577 }
1587 1578
1588 data->DeleteRegisterAllocationZone(); 1579 data->DeleteRegisterAllocationZone();
1589 } 1580 }
1590 1581
1591 Isolate* Pipeline::isolate() const { return info()->isolate(); } 1582 Isolate* Pipeline::isolate() const { return info()->isolate(); }
1592 1583
1593 } // namespace compiler 1584 } // namespace compiler
1594 } // namespace internal 1585 } // namespace internal
1595 } // namespace v8 1586 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698