OLD | NEW |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // RawMachineAssembler generally produces graphs which cannot be verified. | 179 // RawMachineAssembler generally produces graphs which cannot be verified. |
180 bool MayHaveUnverifiableGraph() const { return outer_zone_ == nullptr; } | 180 bool MayHaveUnverifiableGraph() const { return outer_zone_ == nullptr; } |
181 | 181 |
182 Zone* graph_zone() const { return graph_zone_; } | 182 Zone* graph_zone() const { return graph_zone_; } |
183 Graph* graph() const { return graph_; } | 183 Graph* graph() const { return graph_; } |
184 SourcePositionTable* source_positions() const { return source_positions_; } | 184 SourcePositionTable* source_positions() const { return source_positions_; } |
185 MachineOperatorBuilder* machine() const { return machine_; } | 185 MachineOperatorBuilder* machine() const { return machine_; } |
186 CommonOperatorBuilder* common() const { return common_; } | 186 CommonOperatorBuilder* common() const { return common_; } |
187 JSOperatorBuilder* javascript() const { return javascript_; } | 187 JSOperatorBuilder* javascript() const { return javascript_; } |
188 JSGraph* jsgraph() const { return jsgraph_; } | 188 JSGraph* jsgraph() const { return jsgraph_; } |
189 MaybeHandle<Context> native_context() const { | 189 Handle<Context> native_context() const { |
190 if (info()->is_native_context_specializing()) { | 190 return handle(info()->native_context(), isolate()); |
191 return handle(info()->native_context(), isolate()); | 191 } |
192 } | 192 Handle<JSGlobalObject> global_object() const { |
193 return MaybeHandle<Context>(); | 193 return handle(info()->global_object(), isolate()); |
194 } | 194 } |
195 | 195 |
196 LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } | 196 LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } |
197 void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { | 197 void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { |
198 DCHECK(!loop_assignment_); | 198 DCHECK(!loop_assignment_); |
199 loop_assignment_ = loop_assignment; | 199 loop_assignment_ = loop_assignment; |
200 } | 200 } |
201 | 201 |
202 TypeHintAnalysis* type_hint_analysis() const { return type_hint_analysis_; } | 202 TypeHintAnalysis* type_hint_analysis() const { return type_hint_analysis_; } |
203 void set_type_hint_analysis(TypeHintAnalysis* type_hint_analysis) { | 203 void set_type_hint_analysis(TypeHintAnalysis* type_hint_analysis) { |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 }; | 596 }; |
597 | 597 |
598 PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() { | 598 PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() { |
599 if (info()->shared_info()->asm_function()) { | 599 if (info()->shared_info()->asm_function()) { |
600 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); | 600 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); |
601 info()->MarkAsFunctionContextSpecializing(); | 601 info()->MarkAsFunctionContextSpecializing(); |
602 } else { | 602 } else { |
603 if (!FLAG_always_opt) { | 603 if (!FLAG_always_opt) { |
604 info()->MarkAsBailoutOnUninitialized(); | 604 info()->MarkAsBailoutOnUninitialized(); |
605 } | 605 } |
606 if (FLAG_native_context_specialization) { | |
607 info()->MarkAsNativeContextSpecializing(); | |
608 } | |
609 if (FLAG_turbo_inlining) { | 606 if (FLAG_turbo_inlining) { |
610 info()->MarkAsInliningEnabled(); | 607 info()->MarkAsInliningEnabled(); |
611 } | 608 } |
612 } | 609 } |
613 if (!info()->shared_info()->asm_function() || FLAG_turbo_asm_deoptimization) { | 610 if (!info()->shared_info()->asm_function() || FLAG_turbo_asm_deoptimization) { |
614 info()->MarkAsDeoptimizationEnabled(); | 611 info()->MarkAsDeoptimizationEnabled(); |
615 } | 612 } |
616 if (!info()->is_optimizing_from_bytecode()) { | 613 if (!info()->is_optimizing_from_bytecode()) { |
617 if (FLAG_inline_accessors) { | 614 if (FLAG_inline_accessors) { |
618 info()->MarkAsAccessorInliningEnabled(); | 615 info()->MarkAsAccessorInliningEnabled(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 JSCallReducer call_reducer(&graph_reducer, data->jsgraph(), | 793 JSCallReducer call_reducer(&graph_reducer, data->jsgraph(), |
797 call_reducer_flags, data->native_context()); | 794 call_reducer_flags, data->native_context()); |
798 JSContextSpecialization context_specialization( | 795 JSContextSpecialization context_specialization( |
799 &graph_reducer, data->jsgraph(), | 796 &graph_reducer, data->jsgraph(), |
800 data->info()->is_function_context_specializing() | 797 data->info()->is_function_context_specializing() |
801 ? handle(data->info()->context()) | 798 ? handle(data->info()->context()) |
802 : MaybeHandle<Context>()); | 799 : MaybeHandle<Context>()); |
803 JSFrameSpecialization frame_specialization( | 800 JSFrameSpecialization frame_specialization( |
804 &graph_reducer, data->info()->osr_frame(), data->jsgraph()); | 801 &graph_reducer, data->info()->osr_frame(), data->jsgraph()); |
805 JSGlobalObjectSpecialization global_object_specialization( | 802 JSGlobalObjectSpecialization global_object_specialization( |
806 &graph_reducer, data->jsgraph(), data->native_context(), | 803 &graph_reducer, data->jsgraph(), data->global_object(), |
807 data->info()->dependencies()); | 804 data->info()->dependencies()); |
808 JSNativeContextSpecialization::Flags flags = | 805 JSNativeContextSpecialization::Flags flags = |
809 JSNativeContextSpecialization::kNoFlags; | 806 JSNativeContextSpecialization::kNoFlags; |
810 if (data->info()->is_accessor_inlining_enabled()) { | 807 if (data->info()->is_accessor_inlining_enabled()) { |
811 flags |= JSNativeContextSpecialization::kAccessorInliningEnabled; | 808 flags |= JSNativeContextSpecialization::kAccessorInliningEnabled; |
812 } | 809 } |
813 if (data->info()->is_bailout_on_uninitialized()) { | 810 if (data->info()->is_bailout_on_uninitialized()) { |
814 flags |= JSNativeContextSpecialization::kBailoutOnUninitialized; | 811 flags |= JSNativeContextSpecialization::kBailoutOnUninitialized; |
815 } | 812 } |
816 if (data->info()->is_deoptimization_enabled()) { | 813 if (data->info()->is_deoptimization_enabled()) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 void Run(PipelineData* data, Zone* temp_zone) { | 921 void Run(PipelineData* data, Zone* temp_zone) { |
925 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 922 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
926 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 923 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
927 data->common()); | 924 data->common()); |
928 JSBuiltinReducer builtin_reducer( | 925 JSBuiltinReducer builtin_reducer( |
929 &graph_reducer, data->jsgraph(), | 926 &graph_reducer, data->jsgraph(), |
930 data->info()->is_deoptimization_enabled() | 927 data->info()->is_deoptimization_enabled() |
931 ? JSBuiltinReducer::kDeoptimizationEnabled | 928 ? JSBuiltinReducer::kDeoptimizationEnabled |
932 : JSBuiltinReducer::kNoFlags, | 929 : JSBuiltinReducer::kNoFlags, |
933 data->info()->dependencies()); | 930 data->info()->dependencies()); |
934 MaybeHandle<LiteralsArray> literals_array = | 931 Handle<LiteralsArray> literals_array(data->info()->closure()->literals()); |
935 data->info()->is_native_context_specializing() | |
936 ? handle(data->info()->closure()->literals(), data->isolate()) | |
937 : MaybeHandle<LiteralsArray>(); | |
938 JSCreateLowering create_lowering( | 932 JSCreateLowering create_lowering( |
939 &graph_reducer, data->info()->dependencies(), data->jsgraph(), | 933 &graph_reducer, data->info()->dependencies(), data->jsgraph(), |
940 literals_array, data->native_context(), temp_zone); | 934 literals_array, data->native_context(), temp_zone); |
941 JSTypedLowering::Flags typed_lowering_flags = JSTypedLowering::kNoFlags; | 935 JSTypedLowering::Flags typed_lowering_flags = JSTypedLowering::kNoFlags; |
942 if (data->info()->is_deoptimization_enabled()) { | 936 if (data->info()->is_deoptimization_enabled()) { |
943 typed_lowering_flags |= JSTypedLowering::kDeoptimizationEnabled; | 937 typed_lowering_flags |= JSTypedLowering::kDeoptimizationEnabled; |
944 } | 938 } |
945 JSTypedLowering typed_lowering(&graph_reducer, data->info()->dependencies(), | 939 JSTypedLowering typed_lowering(&graph_reducer, data->info()->dependencies(), |
946 typed_lowering_flags, data->jsgraph(), | 940 typed_lowering_flags, data->jsgraph(), |
947 temp_zone); | 941 temp_zone); |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 data->DeleteRegisterAllocationZone(); | 1984 data->DeleteRegisterAllocationZone(); |
1991 } | 1985 } |
1992 | 1986 |
1993 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1987 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1994 | 1988 |
1995 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1989 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1996 | 1990 |
1997 } // namespace compiler | 1991 } // namespace compiler |
1998 } // namespace internal | 1992 } // namespace internal |
1999 } // namespace v8 | 1993 } // namespace v8 |
OLD | NEW |