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

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

Issue 2388303006: Reland of "[turbofan] Osr value typing + dynamic type checks on entry. (patchset #5 id:80001 of htt… (Closed)
Patch Set: Tweaks Created 4 years, 2 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/osr.cc ('k') | src/compiler/simplified-lowering.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 <memory> 8 #include <memory>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 if (data->info()->is_deoptimization_enabled()) { 793 if (data->info()->is_deoptimization_enabled()) {
794 call_reducer_flags |= JSCallReducer::kDeoptimizationEnabled; 794 call_reducer_flags |= JSCallReducer::kDeoptimizationEnabled;
795 } 795 }
796 JSCallReducer call_reducer(&graph_reducer, data->jsgraph(), 796 JSCallReducer call_reducer(&graph_reducer, data->jsgraph(),
797 call_reducer_flags, data->native_context()); 797 call_reducer_flags, data->native_context());
798 JSContextSpecialization context_specialization( 798 JSContextSpecialization context_specialization(
799 &graph_reducer, data->jsgraph(), 799 &graph_reducer, data->jsgraph(),
800 data->info()->is_function_context_specializing() 800 data->info()->is_function_context_specializing()
801 ? handle(data->info()->context()) 801 ? handle(data->info()->context())
802 : MaybeHandle<Context>()); 802 : MaybeHandle<Context>());
803 JSFrameSpecialization frame_specialization(data->info()->osr_frame(), 803 JSFrameSpecialization frame_specialization(
804 data->jsgraph()); 804 &graph_reducer, data->info()->osr_frame(), data->jsgraph());
805 JSGlobalObjectSpecialization global_object_specialization( 805 JSGlobalObjectSpecialization global_object_specialization(
806 &graph_reducer, data->jsgraph(), data->native_context(), 806 &graph_reducer, data->jsgraph(), data->native_context(),
807 data->info()->dependencies()); 807 data->info()->dependencies());
808 JSNativeContextSpecialization::Flags flags = 808 JSNativeContextSpecialization::Flags flags =
809 JSNativeContextSpecialization::kNoFlags; 809 JSNativeContextSpecialization::kNoFlags;
810 if (data->info()->is_accessor_inlining_enabled()) { 810 if (data->info()->is_accessor_inlining_enabled()) {
811 flags |= JSNativeContextSpecialization::kAccessorInliningEnabled; 811 flags |= JSNativeContextSpecialization::kAccessorInliningEnabled;
812 } 812 }
813 if (data->info()->is_bailout_on_uninitialized()) { 813 if (data->info()->is_bailout_on_uninitialized()) {
814 flags |= JSNativeContextSpecialization::kBailoutOnUninitialized; 814 flags |= JSNativeContextSpecialization::kBailoutOnUninitialized;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 void Run(PipelineData* data, Zone* temp_zone, Typer* typer) { 853 void Run(PipelineData* data, Zone* temp_zone, Typer* typer) {
854 NodeVector roots(temp_zone); 854 NodeVector roots(temp_zone);
855 data->jsgraph()->GetCachedNodes(&roots); 855 data->jsgraph()->GetCachedNodes(&roots);
856 LoopVariableOptimizer induction_vars(data->jsgraph()->graph(), 856 LoopVariableOptimizer induction_vars(data->jsgraph()->graph(),
857 data->common(), temp_zone); 857 data->common(), temp_zone);
858 if (FLAG_turbo_loop_variable) induction_vars.Run(); 858 if (FLAG_turbo_loop_variable) induction_vars.Run();
859 typer->Run(roots, &induction_vars); 859 typer->Run(roots, &induction_vars);
860 } 860 }
861 }; 861 };
862 862
863 #ifdef DEBUG 863 struct OsrTyperPhase {
864 static const char* phase_name() { return "osr typer"; }
865
866 void Run(PipelineData* data, Zone* temp_zone) {
867 NodeVector roots(temp_zone);
868 data->jsgraph()->GetCachedNodes(&roots);
869 // Dummy induction variable optimizer: at the moment, we do not try
870 // to compute loop variable bounds on OSR.
871 LoopVariableOptimizer induction_vars(data->jsgraph()->graph(),
872 data->common(), temp_zone);
873 Typer typer(data->isolate(), data->graph());
874 typer.Run(roots, &induction_vars);
875 }
876 };
864 877
865 struct UntyperPhase { 878 struct UntyperPhase {
866 static const char* phase_name() { return "untyper"; } 879 static const char* phase_name() { return "untyper"; }
867 880
868 void Run(PipelineData* data, Zone* temp_zone) { 881 void Run(PipelineData* data, Zone* temp_zone) {
869 class RemoveTypeReducer final : public Reducer { 882 class RemoveTypeReducer final : public Reducer {
870 public: 883 public:
871 Reduction Reduce(Node* node) final { 884 Reduction Reduce(Node* node) final {
872 if (NodeProperties::IsTyped(node)) { 885 if (NodeProperties::IsTyped(node)) {
873 NodeProperties::RemoveType(node); 886 NodeProperties::RemoveType(node);
874 return Changed(node); 887 return Changed(node);
875 } 888 }
876 return NoChange(); 889 return NoChange();
877 } 890 }
878 }; 891 };
879 892
893 NodeVector roots(temp_zone);
894 data->jsgraph()->GetCachedNodes(&roots);
895 for (Node* node : roots) {
896 NodeProperties::RemoveType(node);
897 }
898
880 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 899 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
881 RemoveTypeReducer remove_type_reducer; 900 RemoveTypeReducer remove_type_reducer;
882 AddReducer(data, &graph_reducer, &remove_type_reducer); 901 AddReducer(data, &graph_reducer, &remove_type_reducer);
883 graph_reducer.ReduceGraph(); 902 graph_reducer.ReduceGraph();
884 } 903 }
885 }; 904 };
886 905
887 #endif // DEBUG
888
889 struct OsrDeconstructionPhase { 906 struct OsrDeconstructionPhase {
890 static const char* phase_name() { return "OSR deconstruction"; } 907 static const char* phase_name() { return "OSR deconstruction"; }
891 908
892 void Run(PipelineData* data, Zone* temp_zone) { 909 void Run(PipelineData* data, Zone* temp_zone) {
910 GraphTrimmer trimmer(temp_zone, data->graph());
911 NodeVector roots(temp_zone);
912 data->jsgraph()->GetCachedNodes(&roots);
913 trimmer.TrimGraph(roots.begin(), roots.end());
914
893 OsrHelper osr_helper(data->info()); 915 OsrHelper osr_helper(data->info());
894 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); 916 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone);
895 } 917 }
896 }; 918 };
897 919
898 920
899 struct TypedLoweringPhase { 921 struct TypedLoweringPhase {
900 static const char* phase_name() { return "typed lowering"; } 922 static const char* phase_name() { return "typed lowering"; }
901 923
902 void Run(PipelineData* data, Zone* temp_zone) { 924 void Run(PipelineData* data, Zone* temp_zone) {
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 1511
1490 Run<GraphBuilderPhase>(); 1512 Run<GraphBuilderPhase>();
1491 if (data->compilation_failed()) { 1513 if (data->compilation_failed()) {
1492 data->EndPhaseKind(); 1514 data->EndPhaseKind();
1493 return false; 1515 return false;
1494 } 1516 }
1495 RunPrintAndVerify("Initial untyped", true); 1517 RunPrintAndVerify("Initial untyped", true);
1496 1518
1497 // Perform OSR deconstruction. 1519 // Perform OSR deconstruction.
1498 if (info()->is_osr()) { 1520 if (info()->is_osr()) {
1521 Run<OsrTyperPhase>();
1522
1499 Run<OsrDeconstructionPhase>(); 1523 Run<OsrDeconstructionPhase>();
1524
1525 Run<UntyperPhase>();
1500 RunPrintAndVerify("OSR deconstruction", true); 1526 RunPrintAndVerify("OSR deconstruction", true);
1501 } 1527 }
1502 1528
1503 // Perform function context specialization and inlining (if enabled). 1529 // Perform function context specialization and inlining (if enabled).
1504 Run<InliningPhase>(); 1530 Run<InliningPhase>();
1505 RunPrintAndVerify("Inlined", true); 1531 RunPrintAndVerify("Inlined", true);
1506 1532
1507 // Remove dead->live edges from the graph. 1533 // Remove dead->live edges from the graph.
1508 Run<EarlyGraphTrimmingPhase>(); 1534 Run<EarlyGraphTrimmingPhase>();
1509 RunPrintAndVerify("Early trimmed", true); 1535 RunPrintAndVerify("Early trimmed", true);
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 data->DeleteRegisterAllocationZone(); 1982 data->DeleteRegisterAllocationZone();
1957 } 1983 }
1958 1984
1959 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1985 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1960 1986
1961 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1987 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1962 1988
1963 } // namespace compiler 1989 } // namespace compiler
1964 } // namespace internal 1990 } // namespace internal
1965 } // namespace v8 1991 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/osr.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698