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

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: REBASE. 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
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | src/flag-definitions.h » ('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 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 18 matching lines...) Expand all
905 CheckpointElimination checkpoint_elimination(&graph_reducer); 903 CheckpointElimination checkpoint_elimination(&graph_reducer);
906 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 904 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
907 data->common(), data->machine()); 905 data->common(), data->machine());
908 AddReducer(data, &graph_reducer, &dead_code_elimination); 906 AddReducer(data, &graph_reducer, &dead_code_elimination);
909 AddReducer(data, &graph_reducer, &builtin_reducer); 907 AddReducer(data, &graph_reducer, &builtin_reducer);
910 if (data->info()->is_deoptimization_enabled()) { 908 if (data->info()->is_deoptimization_enabled()) {
911 AddReducer(data, &graph_reducer, &create_lowering); 909 AddReducer(data, &graph_reducer, &create_lowering);
912 } 910 }
913 AddReducer(data, &graph_reducer, &typed_lowering); 911 AddReducer(data, &graph_reducer, &typed_lowering);
914 AddReducer(data, &graph_reducer, &intrinsic_lowering); 912 AddReducer(data, &graph_reducer, &intrinsic_lowering);
915 AddReducer(data, &graph_reducer, &load_elimination);
916 AddReducer(data, &graph_reducer, &value_numbering); 913 AddReducer(data, &graph_reducer, &value_numbering);
917 AddReducer(data, &graph_reducer, &simple_reducer); 914 AddReducer(data, &graph_reducer, &simple_reducer);
918 AddReducer(data, &graph_reducer, &checkpoint_elimination); 915 AddReducer(data, &graph_reducer, &checkpoint_elimination);
919 AddReducer(data, &graph_reducer, &common_reducer); 916 AddReducer(data, &graph_reducer, &common_reducer);
920 graph_reducer.ReduceGraph(); 917 graph_reducer.ReduceGraph();
921 } 918 }
922 }; 919 };
923 920
924 921
925 struct BranchEliminationPhase { 922 struct BranchEliminationPhase {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1033
1037 struct StoreStoreEliminationPhase { 1034 struct StoreStoreEliminationPhase {
1038 static const char* phase_name() { return "Store-store elimination"; } 1035 static const char* phase_name() { return "Store-store elimination"; }
1039 1036
1040 void Run(PipelineData* data, Zone* temp_zone) { 1037 void Run(PipelineData* data, Zone* temp_zone) {
1041 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); 1038 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone);
1042 store_store_elimination.Run(); 1039 store_store_elimination.Run();
1043 } 1040 }
1044 }; 1041 };
1045 1042
1043 struct LoadEliminationPhase {
1044 static const char* phase_name() { return "load elimination"; }
1045
1046 void Run(PipelineData* data, Zone* temp_zone) {
1047 // The memory optimizer requires the graphs to be trimmed, so trim now.
1048 GraphTrimmer trimmer(temp_zone, data->graph());
1049 NodeVector roots(temp_zone);
1050 data->jsgraph()->GetCachedNodes(&roots);
1051 trimmer.TrimGraph(roots.begin(), roots.end());
1052
1053 // Eliminate redundant loads.
1054 LoadElimination load_elimination(data->graph(), temp_zone);
1055 load_elimination.Run();
1056 }
1057 };
1058
1046 struct MemoryOptimizationPhase { 1059 struct MemoryOptimizationPhase {
1047 static const char* phase_name() { return "memory optimization"; } 1060 static const char* phase_name() { return "memory optimization"; }
1048 1061
1049 void Run(PipelineData* data, Zone* temp_zone) { 1062 void Run(PipelineData* data, Zone* temp_zone) {
1050 // The memory optimizer requires the graphs to be trimmed, so trim now. 1063 // The memory optimizer requires the graphs to be trimmed, so trim now.
1051 GraphTrimmer trimmer(temp_zone, data->graph()); 1064 GraphTrimmer trimmer(temp_zone, data->graph());
1052 NodeVector roots(temp_zone); 1065 NodeVector roots(temp_zone);
1053 data->jsgraph()->GetCachedNodes(&roots); 1066 data->jsgraph()->GetCachedNodes(&roots);
1054 trimmer.TrimGraph(roots.begin(), roots.end()); 1067 trimmer.TrimGraph(roots.begin(), roots.end());
1055 1068
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 1452
1440 if (FLAG_turbo_stress_loop_peeling) { 1453 if (FLAG_turbo_stress_loop_peeling) {
1441 Run<StressLoopPeelingPhase>(); 1454 Run<StressLoopPeelingPhase>();
1442 RunPrintAndVerify("Loop peeled"); 1455 RunPrintAndVerify("Loop peeled");
1443 } 1456 }
1444 1457
1445 if (FLAG_turbo_escape) { 1458 if (FLAG_turbo_escape) {
1446 Run<EscapeAnalysisPhase>(); 1459 Run<EscapeAnalysisPhase>();
1447 RunPrintAndVerify("Escape Analysed"); 1460 RunPrintAndVerify("Escape Analysed");
1448 } 1461 }
1462
1463 if (FLAG_turbo_load_elimination) {
1464 Run<LoadEliminationPhase>();
1465 RunPrintAndVerify("Load eliminated");
1466 }
1449 } 1467 }
1450 1468
1451 // Select representations. This has to run w/o the Typer decorator, because 1469 // Select representations. This has to run w/o the Typer decorator, because
1452 // we cannot compute meaningful types anyways, and the computed types might 1470 // we cannot compute meaningful types anyways, and the computed types might
1453 // even conflict with the representation/truncation logic. 1471 // even conflict with the representation/truncation logic.
1454 Run<RepresentationSelectionPhase>(); 1472 Run<RepresentationSelectionPhase>();
1455 RunPrintAndVerify("Representations selected", true); 1473 RunPrintAndVerify("Representations selected", true);
1456 1474
1457 #ifdef DEBUG 1475 #ifdef DEBUG
1458 // From now on it is invalid to look at types on the nodes, because: 1476 // 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
1833 data->DeleteRegisterAllocationZone(); 1851 data->DeleteRegisterAllocationZone();
1834 } 1852 }
1835 1853
1836 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1854 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1837 1855
1838 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1856 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1839 1857
1840 } // namespace compiler 1858 } // namespace compiler
1841 } // namespace internal 1859 } // namespace internal
1842 } // namespace v8 1860 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698