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

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

Issue 2120253002: [turbofan] Initial version of the new LoadElimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_StackCheck_NoWrite
Patch Set: Fix DCHECK. Check types on substitution. Created 4 years, 5 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
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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 }; 865 };
866 866
867 867
868 struct TypedLoweringPhase { 868 struct TypedLoweringPhase {
869 static const char* phase_name() { return "typed lowering"; } 869 static const char* phase_name() { return "typed lowering"; }
870 870
871 void Run(PipelineData* data, Zone* temp_zone) { 871 void Run(PipelineData* data, Zone* temp_zone) {
872 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 872 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
873 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 873 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
874 data->common()); 874 data->common());
875 LoadElimination load_elimination(&graph_reducer, data->graph(),
876 data->jsgraph()->simplified());
877 JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph()); 875 JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph());
878 MaybeHandle<LiteralsArray> literals_array = 876 MaybeHandle<LiteralsArray> literals_array =
879 data->info()->is_native_context_specializing() 877 data->info()->is_native_context_specializing()
880 ? handle(data->info()->closure()->literals(), data->isolate()) 878 ? handle(data->info()->closure()->literals(), data->isolate())
881 : MaybeHandle<LiteralsArray>(); 879 : MaybeHandle<LiteralsArray>();
882 JSCreateLowering create_lowering( 880 JSCreateLowering create_lowering(
883 &graph_reducer, data->info()->dependencies(), data->jsgraph(), 881 &graph_reducer, data->info()->dependencies(), data->jsgraph(),
884 literals_array, temp_zone); 882 literals_array, temp_zone);
885 JSTypedLowering::Flags typed_lowering_flags = JSTypedLowering::kNoFlags; 883 JSTypedLowering::Flags typed_lowering_flags = JSTypedLowering::kNoFlags;
886 if (data->info()->is_deoptimization_enabled()) { 884 if (data->info()->is_deoptimization_enabled()) {
(...skipping 17 matching lines...) Expand all
904 CheckpointElimination checkpoint_elimination(&graph_reducer); 902 CheckpointElimination checkpoint_elimination(&graph_reducer);
905 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 903 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
906 data->common(), data->machine()); 904 data->common(), data->machine());
907 AddReducer(data, &graph_reducer, &dead_code_elimination); 905 AddReducer(data, &graph_reducer, &dead_code_elimination);
908 AddReducer(data, &graph_reducer, &builtin_reducer); 906 AddReducer(data, &graph_reducer, &builtin_reducer);
909 if (data->info()->is_deoptimization_enabled()) { 907 if (data->info()->is_deoptimization_enabled()) {
910 AddReducer(data, &graph_reducer, &create_lowering); 908 AddReducer(data, &graph_reducer, &create_lowering);
911 } 909 }
912 AddReducer(data, &graph_reducer, &typed_lowering); 910 AddReducer(data, &graph_reducer, &typed_lowering);
913 AddReducer(data, &graph_reducer, &intrinsic_lowering); 911 AddReducer(data, &graph_reducer, &intrinsic_lowering);
914 AddReducer(data, &graph_reducer, &load_elimination);
915 AddReducer(data, &graph_reducer, &simple_reducer); 912 AddReducer(data, &graph_reducer, &simple_reducer);
916 AddReducer(data, &graph_reducer, &checkpoint_elimination); 913 AddReducer(data, &graph_reducer, &checkpoint_elimination);
917 AddReducer(data, &graph_reducer, &common_reducer); 914 AddReducer(data, &graph_reducer, &common_reducer);
918 graph_reducer.ReduceGraph(); 915 graph_reducer.ReduceGraph();
919 } 916 }
920 }; 917 };
921 918
922 919
923 struct BranchEliminationPhase { 920 struct BranchEliminationPhase {
924 static const char* phase_name() { return "branch condition elimination"; } 921 static const char* phase_name() { return "branch condition elimination"; }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1031
1035 struct StoreStoreEliminationPhase { 1032 struct StoreStoreEliminationPhase {
1036 static const char* phase_name() { return "Store-store elimination"; } 1033 static const char* phase_name() { return "Store-store elimination"; }
1037 1034
1038 void Run(PipelineData* data, Zone* temp_zone) { 1035 void Run(PipelineData* data, Zone* temp_zone) {
1039 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); 1036 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone);
1040 store_store_elimination.Run(); 1037 store_store_elimination.Run();
1041 } 1038 }
1042 }; 1039 };
1043 1040
1041 struct LoadEliminationPhase {
1042 static const char* phase_name() { return "load elimination"; }
1043
1044 void Run(PipelineData* data, Zone* temp_zone) {
1045 // The memory optimizer requires the graphs to be trimmed, so trim now.
1046 GraphTrimmer trimmer(temp_zone, data->graph());
1047 NodeVector roots(temp_zone);
1048 data->jsgraph()->GetCachedNodes(&roots);
1049 trimmer.TrimGraph(roots.begin(), roots.end());
1050
1051 // Eliminate redundant loads.
1052 LoadElimination load_elimination(data->jsgraph(), temp_zone);
1053 load_elimination.Run();
1054 }
1055 };
1056
1044 struct MemoryOptimizationPhase { 1057 struct MemoryOptimizationPhase {
1045 static const char* phase_name() { return "memory optimization"; } 1058 static const char* phase_name() { return "memory optimization"; }
1046 1059
1047 void Run(PipelineData* data, Zone* temp_zone) { 1060 void Run(PipelineData* data, Zone* temp_zone) {
1048 // The memory optimizer requires the graphs to be trimmed, so trim now. 1061 // The memory optimizer requires the graphs to be trimmed, so trim now.
1049 GraphTrimmer trimmer(temp_zone, data->graph()); 1062 GraphTrimmer trimmer(temp_zone, data->graph());
1050 NodeVector roots(temp_zone); 1063 NodeVector roots(temp_zone);
1051 data->jsgraph()->GetCachedNodes(&roots); 1064 data->jsgraph()->GetCachedNodes(&roots);
1052 trimmer.TrimGraph(roots.begin(), roots.end()); 1065 trimmer.TrimGraph(roots.begin(), roots.end());
1053 1066
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 1450
1438 if (FLAG_turbo_stress_loop_peeling) { 1451 if (FLAG_turbo_stress_loop_peeling) {
1439 Run<StressLoopPeelingPhase>(); 1452 Run<StressLoopPeelingPhase>();
1440 RunPrintAndVerify("Loop peeled"); 1453 RunPrintAndVerify("Loop peeled");
1441 } 1454 }
1442 1455
1443 if (FLAG_turbo_escape) { 1456 if (FLAG_turbo_escape) {
1444 Run<EscapeAnalysisPhase>(); 1457 Run<EscapeAnalysisPhase>();
1445 RunPrintAndVerify("Escape Analysed"); 1458 RunPrintAndVerify("Escape Analysed");
1446 } 1459 }
1460
1461 if (FLAG_turbo_load_elimination) {
1462 Run<LoadEliminationPhase>();
1463 RunPrintAndVerify("Load eliminated");
1464 }
1447 } 1465 }
1448 1466
1449 // Select representations. This has to run w/o the Typer decorator, because 1467 // Select representations. This has to run w/o the Typer decorator, because
1450 // we cannot compute meaningful types anyways, and the computed types might 1468 // we cannot compute meaningful types anyways, and the computed types might
1451 // even conflict with the representation/truncation logic. 1469 // even conflict with the representation/truncation logic.
1452 Run<RepresentationSelectionPhase>(); 1470 Run<RepresentationSelectionPhase>();
1453 RunPrintAndVerify("Representations selected", true); 1471 RunPrintAndVerify("Representations selected", true);
1454 1472
1455 #ifdef DEBUG 1473 #ifdef DEBUG
1456 // From now on it is invalid to look at types on the nodes, because: 1474 // From now on it is invalid to look at types on the nodes, because:
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 data->DeleteRegisterAllocationZone(); 1849 data->DeleteRegisterAllocationZone();
1832 } 1850 }
1833 1851
1834 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1852 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1835 1853
1836 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1854 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1837 1855
1838 } // namespace compiler 1856 } // namespace compiler
1839 } // namespace internal 1857 } // namespace internal
1840 } // namespace v8 1858 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698