| 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 <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/adapters.h" | 10 #include "src/base/adapters.h" |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 if (!FLAG_always_opt) { | 590 if (!FLAG_always_opt) { |
| 591 info()->MarkAsBailoutOnUninitialized(); | 591 info()->MarkAsBailoutOnUninitialized(); |
| 592 } | 592 } |
| 593 if (FLAG_native_context_specialization) { | 593 if (FLAG_native_context_specialization) { |
| 594 info()->MarkAsNativeContextSpecializing(); | 594 info()->MarkAsNativeContextSpecializing(); |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 if (!info()->shared_info()->asm_function() || FLAG_turbo_asm_deoptimization) { | 597 if (!info()->shared_info()->asm_function() || FLAG_turbo_asm_deoptimization) { |
| 598 info()->MarkAsDeoptimizationEnabled(); | 598 info()->MarkAsDeoptimizationEnabled(); |
| 599 } | 599 } |
| 600 if (info()->is_deoptimization_enabled() && FLAG_turbo_type_feedback) { |
| 601 info()->MarkAsTypeFeedbackEnabled(); |
| 602 } |
| 600 if (!info()->is_optimizing_from_bytecode()) { | 603 if (!info()->is_optimizing_from_bytecode()) { |
| 601 if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED; | 604 if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED; |
| 602 } | 605 } |
| 603 | 606 |
| 604 linkage_ = new (&zone_) Linkage(Linkage::ComputeIncoming(&zone_, info())); | 607 linkage_ = new (&zone_) Linkage(Linkage::ComputeIncoming(&zone_, info())); |
| 605 | 608 |
| 606 if (!pipeline_.CreateGraph()) { | 609 if (!pipeline_.CreateGraph()) { |
| 607 if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed. | 610 if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed. |
| 608 return AbortOptimization(kGraphBuildingFailed); | 611 return AbortOptimization(kGraphBuildingFailed); |
| 609 } | 612 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 JSCreateLowering create_lowering( | 879 JSCreateLowering create_lowering( |
| 877 &graph_reducer, data->info()->dependencies(), data->jsgraph(), | 880 &graph_reducer, data->info()->dependencies(), data->jsgraph(), |
| 878 literals_array, temp_zone); | 881 literals_array, temp_zone); |
| 879 JSTypedLowering::Flags typed_lowering_flags = JSTypedLowering::kNoFlags; | 882 JSTypedLowering::Flags typed_lowering_flags = JSTypedLowering::kNoFlags; |
| 880 if (data->info()->is_deoptimization_enabled()) { | 883 if (data->info()->is_deoptimization_enabled()) { |
| 881 typed_lowering_flags |= JSTypedLowering::kDeoptimizationEnabled; | 884 typed_lowering_flags |= JSTypedLowering::kDeoptimizationEnabled; |
| 882 } | 885 } |
| 883 if (data->info()->shared_info()->HasBytecodeArray()) { | 886 if (data->info()->shared_info()->HasBytecodeArray()) { |
| 884 typed_lowering_flags |= JSTypedLowering::kDisableBinaryOpReduction; | 887 typed_lowering_flags |= JSTypedLowering::kDisableBinaryOpReduction; |
| 885 } | 888 } |
| 889 if (data->info()->is_type_feedback_enabled()) { |
| 890 typed_lowering_flags |= JSTypedLowering::kTypeFeedbackEnabled; |
| 891 } |
| 886 JSTypedLowering typed_lowering(&graph_reducer, data->info()->dependencies(), | 892 JSTypedLowering typed_lowering(&graph_reducer, data->info()->dependencies(), |
| 887 typed_lowering_flags, data->jsgraph(), | 893 typed_lowering_flags, data->jsgraph(), |
| 888 temp_zone); | 894 temp_zone); |
| 889 JSIntrinsicLowering intrinsic_lowering( | 895 JSIntrinsicLowering intrinsic_lowering( |
| 890 &graph_reducer, data->jsgraph(), | 896 &graph_reducer, data->jsgraph(), |
| 891 data->info()->is_deoptimization_enabled() | 897 data->info()->is_deoptimization_enabled() |
| 892 ? JSIntrinsicLowering::kDeoptimizationEnabled | 898 ? JSIntrinsicLowering::kDeoptimizationEnabled |
| 893 : JSIntrinsicLowering::kDeoptimizationDisabled); | 899 : JSIntrinsicLowering::kDeoptimizationDisabled); |
| 894 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); | 900 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); |
| 895 CheckpointElimination checkpoint_elimination(&graph_reducer); | 901 CheckpointElimination checkpoint_elimination(&graph_reducer); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 AddReducer(data, &graph_reducer, &escape_reducer); | 946 AddReducer(data, &graph_reducer, &escape_reducer); |
| 941 graph_reducer.ReduceGraph(); | 947 graph_reducer.ReduceGraph(); |
| 942 escape_reducer.VerifyReplacement(); | 948 escape_reducer.VerifyReplacement(); |
| 943 } | 949 } |
| 944 }; | 950 }; |
| 945 | 951 |
| 946 struct RepresentationSelectionPhase { | 952 struct RepresentationSelectionPhase { |
| 947 static const char* phase_name() { return "representation selection"; } | 953 static const char* phase_name() { return "representation selection"; } |
| 948 | 954 |
| 949 void Run(PipelineData* data, Zone* temp_zone) { | 955 void Run(PipelineData* data, Zone* temp_zone) { |
| 956 SimplifiedLowering::Flags flags = |
| 957 data->info()->is_type_feedback_enabled() |
| 958 ? SimplifiedLowering::kTypeFeedbackEnabled |
| 959 : SimplifiedLowering::kNoFlag; |
| 950 SimplifiedLowering lowering(data->jsgraph(), temp_zone, | 960 SimplifiedLowering lowering(data->jsgraph(), temp_zone, |
| 951 data->source_positions()); | 961 data->source_positions(), flags); |
| 952 lowering.LowerAllNodes(); | 962 lowering.LowerAllNodes(); |
| 953 } | 963 } |
| 954 }; | 964 }; |
| 955 | 965 |
| 956 struct EarlyOptimizationPhase { | 966 struct EarlyOptimizationPhase { |
| 957 static const char* phase_name() { return "early optimization"; } | 967 static const char* phase_name() { return "early optimization"; } |
| 958 | 968 |
| 959 void Run(PipelineData* data, Zone* temp_zone) { | 969 void Run(PipelineData* data, Zone* temp_zone) { |
| 960 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 970 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 961 JSGenericLowering generic_lowering(data->jsgraph()); | 971 JSGenericLowering generic_lowering(data->jsgraph()); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 RunPrintAndVerify("Loop peeled"); | 1419 RunPrintAndVerify("Loop peeled"); |
| 1410 } | 1420 } |
| 1411 | 1421 |
| 1412 if (FLAG_turbo_escape) { | 1422 if (FLAG_turbo_escape) { |
| 1413 Run<EscapeAnalysisPhase>(); | 1423 Run<EscapeAnalysisPhase>(); |
| 1414 RunPrintAndVerify("Escape Analysed"); | 1424 RunPrintAndVerify("Escape Analysed"); |
| 1415 } | 1425 } |
| 1416 | 1426 |
| 1417 // Select representations. | 1427 // Select representations. |
| 1418 Run<RepresentationSelectionPhase>(); | 1428 Run<RepresentationSelectionPhase>(); |
| 1419 RunPrintAndVerify("Representations selected"); | 1429 RunPrintAndVerify("Representations selected", true); |
| 1420 } | 1430 } |
| 1421 | 1431 |
| 1422 #ifdef DEBUG | 1432 #ifdef DEBUG |
| 1423 // From now on it is invalid to look at types on the nodes, because: | 1433 // From now on it is invalid to look at types on the nodes, because: |
| 1424 // | 1434 // |
| 1425 // (a) The remaining passes (might) run concurrent to the main thread and | 1435 // (a) The remaining passes (might) run concurrent to the main thread and |
| 1426 // therefore must not access the Heap or the Isolate in an uncontrolled | 1436 // therefore must not access the Heap or the Isolate in an uncontrolled |
| 1427 // way (as done by the type system), and | 1437 // way (as done by the type system), and |
| 1428 // (b) the types on the nodes might not make sense after representation | 1438 // (b) the types on the nodes might not make sense after representation |
| 1429 // selection due to the way we handle truncations; if we'd want to look | 1439 // selection due to the way we handle truncations; if we'd want to look |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 data->DeleteRegisterAllocationZone(); | 1809 data->DeleteRegisterAllocationZone(); |
| 1800 } | 1810 } |
| 1801 | 1811 |
| 1802 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1812 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 1803 | 1813 |
| 1804 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1814 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 1805 | 1815 |
| 1806 } // namespace compiler | 1816 } // namespace compiler |
| 1807 } // namespace internal | 1817 } // namespace internal |
| 1808 } // namespace v8 | 1818 } // namespace v8 |
| OLD | NEW |