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

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

Issue 809333002: [turbofan] Implement OSR for outer loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/register-allocator.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/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 10 matching lines...) Expand all
21 #include "src/compiler/instruction-selector.h" 21 #include "src/compiler/instruction-selector.h"
22 #include "src/compiler/js-builtin-reducer.h" 22 #include "src/compiler/js-builtin-reducer.h"
23 #include "src/compiler/js-context-specialization.h" 23 #include "src/compiler/js-context-specialization.h"
24 #include "src/compiler/js-generic-lowering.h" 24 #include "src/compiler/js-generic-lowering.h"
25 #include "src/compiler/js-inlining.h" 25 #include "src/compiler/js-inlining.h"
26 #include "src/compiler/js-typed-lowering.h" 26 #include "src/compiler/js-typed-lowering.h"
27 #include "src/compiler/jump-threading.h" 27 #include "src/compiler/jump-threading.h"
28 #include "src/compiler/load-elimination.h" 28 #include "src/compiler/load-elimination.h"
29 #include "src/compiler/machine-operator-reducer.h" 29 #include "src/compiler/machine-operator-reducer.h"
30 #include "src/compiler/move-optimizer.h" 30 #include "src/compiler/move-optimizer.h"
31 #include "src/compiler/osr.h"
31 #include "src/compiler/pipeline-statistics.h" 32 #include "src/compiler/pipeline-statistics.h"
32 #include "src/compiler/register-allocator.h" 33 #include "src/compiler/register-allocator.h"
33 #include "src/compiler/register-allocator-verifier.h" 34 #include "src/compiler/register-allocator-verifier.h"
34 #include "src/compiler/schedule.h" 35 #include "src/compiler/schedule.h"
35 #include "src/compiler/scheduler.h" 36 #include "src/compiler/scheduler.h"
36 #include "src/compiler/select-lowering.h" 37 #include "src/compiler/select-lowering.h"
37 #include "src/compiler/simplified-lowering.h" 38 #include "src/compiler/simplified-lowering.h"
38 #include "src/compiler/simplified-operator-reducer.h" 39 #include "src/compiler/simplified-operator-reducer.h"
39 #include "src/compiler/typer.h" 40 #include "src/compiler/typer.h"
40 #include "src/compiler/value-numbering-reducer.h" 41 #include "src/compiler/value-numbering-reducer.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 }; 405 };
405 406
406 407
407 struct TyperPhase { 408 struct TyperPhase {
408 static const char* phase_name() { return "typer"; } 409 static const char* phase_name() { return "typer"; }
409 410
410 void Run(PipelineData* data, Zone* temp_zone) { data->typer()->Run(); } 411 void Run(PipelineData* data, Zone* temp_zone) { data->typer()->Run(); }
411 }; 412 };
412 413
413 414
415 struct OsrDeconstructionPhase {
416 static const char* phase_name() { return "OSR deconstruction"; }
417
418 void Run(PipelineData* data, Zone* temp_zone) {
419 SourcePositionTable::Scope pos(data->source_positions(),
420 SourcePosition::Unknown());
421 OsrHelper osr_helper(data->info());
422 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone);
423 }
424 };
425
426
414 struct TypedLoweringPhase { 427 struct TypedLoweringPhase {
415 static const char* phase_name() { return "typed lowering"; } 428 static const char* phase_name() { return "typed lowering"; }
416 429
417 void Run(PipelineData* data, Zone* temp_zone) { 430 void Run(PipelineData* data, Zone* temp_zone) {
418 SourcePositionTable::Scope pos(data->source_positions(), 431 SourcePositionTable::Scope pos(data->source_positions(),
419 SourcePosition::Unknown()); 432 SourcePosition::Unknown());
420 ValueNumberingReducer vn_reducer(temp_zone); 433 ValueNumberingReducer vn_reducer(temp_zone);
421 LoadElimination load_elimination; 434 LoadElimination load_elimination;
422 JSBuiltinReducer builtin_reducer(data->jsgraph()); 435 JSBuiltinReducer builtin_reducer(data->jsgraph());
423 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone); 436 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone);
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 Handle<Code> Pipeline::GenerateCode() { 762 Handle<Code> Pipeline::GenerateCode() {
750 // This list must be kept in sync with DONT_TURBOFAN_NODE in ast.cc. 763 // This list must be kept in sync with DONT_TURBOFAN_NODE in ast.cc.
751 if (info()->function()->dont_optimize_reason() == kTryCatchStatement || 764 if (info()->function()->dont_optimize_reason() == kTryCatchStatement ||
752 info()->function()->dont_optimize_reason() == kTryFinallyStatement || 765 info()->function()->dont_optimize_reason() == kTryFinallyStatement ||
753 // TODO(turbofan): Make ES6 for-of work and remove this bailout. 766 // TODO(turbofan): Make ES6 for-of work and remove this bailout.
754 info()->function()->dont_optimize_reason() == kForOfStatement || 767 info()->function()->dont_optimize_reason() == kForOfStatement ||
755 // TODO(turbofan): Make super work and remove this bailout. 768 // TODO(turbofan): Make super work and remove this bailout.
756 info()->function()->dont_optimize_reason() == kSuperReference || 769 info()->function()->dont_optimize_reason() == kSuperReference ||
757 // TODO(turbofan): Make class literals work and remove this bailout. 770 // TODO(turbofan): Make class literals work and remove this bailout.
758 info()->function()->dont_optimize_reason() == kClassLiteral || 771 info()->function()->dont_optimize_reason() == kClassLiteral ||
759 // TODO(turbofan): Make OSR work and remove this bailout. 772 // TODO(turbofan): Make OSR work with inner loops and remove this bailout.
760 info()->is_osr()) { 773 (info()->is_osr() && !FLAG_turbo_osr)) {
761 return Handle<Code>::null(); 774 return Handle<Code>::null();
762 } 775 }
763 776
764 ZonePool zone_pool(isolate()); 777 ZonePool zone_pool(isolate());
765 SmartPointer<PipelineStatistics> pipeline_statistics; 778 SmartPointer<PipelineStatistics> pipeline_statistics;
766 779
767 if (FLAG_turbo_stats) { 780 if (FLAG_turbo_stats) {
768 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); 781 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool));
769 pipeline_statistics->BeginPhaseKind("initializing"); 782 pipeline_statistics->BeginPhaseKind("initializing");
770 } 783 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 RunPrintAndVerify("Typed"); 835 RunPrintAndVerify("Typed");
823 } 836 }
824 837
825 BeginPhaseKind("lowering"); 838 BeginPhaseKind("lowering");
826 839
827 if (info()->is_typing_enabled()) { 840 if (info()->is_typing_enabled()) {
828 // Lower JSOperators where we can determine types. 841 // Lower JSOperators where we can determine types.
829 Run<TypedLoweringPhase>(); 842 Run<TypedLoweringPhase>();
830 RunPrintAndVerify("Lowered typed"); 843 RunPrintAndVerify("Lowered typed");
831 844
845 if (info()->is_osr()) {
846 Run<OsrDeconstructionPhase>();
847 RunPrintAndVerify("OSR deconstruction");
848 }
849
832 // Lower simplified operators and insert changes. 850 // Lower simplified operators and insert changes.
833 Run<SimplifiedLoweringPhase>(); 851 Run<SimplifiedLoweringPhase>();
834 RunPrintAndVerify("Lowered simplified"); 852 RunPrintAndVerify("Lowered simplified");
835 853
836 // Lower changes that have been inserted before. 854 // Lower changes that have been inserted before.
837 Run<ChangeLoweringPhase>(); 855 Run<ChangeLoweringPhase>();
838 // // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 856 // // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
839 RunPrintAndVerify("Lowered changes", true); 857 RunPrintAndVerify("Lowered changes", true);
840 858
841 Run<LateControlReductionPhase>(); 859 Run<LateControlReductionPhase>();
842 RunPrintAndVerify("Late Control reduced"); 860 RunPrintAndVerify("Late Control reduced");
861 } else {
862 if (info()->is_osr()) {
863 Run<OsrDeconstructionPhase>();
864 RunPrintAndVerify("OSR deconstruction");
865 }
843 } 866 }
844 867
845 // Lower any remaining generic JSOperators. 868 // Lower any remaining generic JSOperators.
846 Run<GenericLoweringPhase>(); 869 Run<GenericLoweringPhase>();
847 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 870 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
848 RunPrintAndVerify("Lowered generic", true); 871 RunPrintAndVerify("Lowered generic", true);
849 872
850 BeginPhaseKind("block building"); 873 BeginPhaseKind("block building");
851 874
852 data.source_positions()->RemoveDecorator(); 875 data.source_positions()->RemoveDecorator();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 } 1037 }
1015 1038
1016 SmartArrayPointer<char> debug_name; 1039 SmartArrayPointer<char> debug_name;
1017 #ifdef DEBUG 1040 #ifdef DEBUG
1018 debug_name = GetDebugName(data->info()); 1041 debug_name = GetDebugName(data->info());
1019 #endif 1042 #endif
1020 1043
1021 ZonePool::Scope zone_scope(data->zone_pool()); 1044 ZonePool::Scope zone_scope(data->zone_pool());
1022 data->InitializeRegisterAllocator(zone_scope.zone(), config, 1045 data->InitializeRegisterAllocator(zone_scope.zone(), config,
1023 debug_name.get()); 1046 debug_name.get());
1047 if (info()->is_osr()) {
1048 OsrHelper osr_helper(info());
1049 osr_helper.SetupFrame(data->frame());
1050 }
1024 1051
1025 Run<MeetRegisterConstraintsPhase>(); 1052 Run<MeetRegisterConstraintsPhase>();
1026 Run<ResolvePhisPhase>(); 1053 Run<ResolvePhisPhase>();
1027 Run<BuildLiveRangesPhase>(); 1054 Run<BuildLiveRangesPhase>();
1028 if (FLAG_trace_turbo_graph) { 1055 if (FLAG_trace_turbo_graph) {
1029 OFStream os(stdout); 1056 OFStream os(stdout);
1030 PrintableInstructionSequence printable = {config, data->sequence()}; 1057 PrintableInstructionSequence printable = {config, data->sequence()};
1031 os << "----- Instruction sequence before register allocation -----\n" 1058 os << "----- Instruction sequence before register allocation -----\n"
1032 << printable; 1059 << printable;
1033 } 1060 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 } 1097 }
1071 1098
1072 1099
1073 void Pipeline::TearDown() { 1100 void Pipeline::TearDown() {
1074 InstructionOperand::TearDownCaches(); 1101 InstructionOperand::TearDownCaches();
1075 } 1102 }
1076 1103
1077 } // namespace compiler 1104 } // namespace compiler
1078 } // namespace internal 1105 } // namespace internal
1079 } // namespace v8 1106 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/osr.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698