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/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 }; | 517 }; |
518 | 518 |
519 | 519 |
520 struct OsrDeconstructionPhase { | 520 struct OsrDeconstructionPhase { |
521 static const char* phase_name() { return "OSR deconstruction"; } | 521 static const char* phase_name() { return "OSR deconstruction"; } |
522 | 522 |
523 void Run(PipelineData* data, Zone* temp_zone) { | 523 void Run(PipelineData* data, Zone* temp_zone) { |
524 SourcePositionTable::Scope pos(data->source_positions(), | 524 SourcePositionTable::Scope pos(data->source_positions(), |
525 SourcePosition::Unknown()); | 525 SourcePosition::Unknown()); |
526 OsrHelper osr_helper(data->info()); | 526 OsrHelper osr_helper(data->info()); |
527 bool success = | 527 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); |
528 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); | |
529 if (!success) data->info()->RetryOptimization(kOsrCompileFailed); | |
530 } | 528 } |
531 }; | 529 }; |
532 | 530 |
533 | 531 |
534 struct JSTypeFeedbackPhase { | 532 struct JSTypeFeedbackPhase { |
535 static const char* phase_name() { return "type feedback specializing"; } | 533 static const char* phase_name() { return "type feedback specializing"; } |
536 | 534 |
537 void Run(PipelineData* data, Zone* temp_zone) { | 535 void Run(PipelineData* data, Zone* temp_zone) { |
538 SourcePositionTable::Scope pos(data->source_positions(), | 536 SourcePositionTable::Scope pos(data->source_positions(), |
539 SourcePosition::Unknown()); | 537 SourcePosition::Unknown()); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 if (FLAG_trace_turbo) { | 910 if (FLAG_trace_turbo) { |
913 Run<PrintGraphPhase>(phase); | 911 Run<PrintGraphPhase>(phase); |
914 } | 912 } |
915 if (FLAG_turbo_verify) { | 913 if (FLAG_turbo_verify) { |
916 Run<VerifyGraphPhase>(untyped); | 914 Run<VerifyGraphPhase>(untyped); |
917 } | 915 } |
918 } | 916 } |
919 | 917 |
920 | 918 |
921 Handle<Code> Pipeline::GenerateCode() { | 919 Handle<Code> Pipeline::GenerateCode() { |
922 if (info()->is_osr() && !FLAG_turbo_osr) { | |
923 // TODO(turbofan): remove this flag and always handle OSR | |
924 info()->RetryOptimization(kOsrCompileFailed); | |
925 return Handle<Code>::null(); | |
926 } | |
927 | |
928 // TODO(mstarzinger): This is just a temporary hack to make TurboFan work, | 920 // TODO(mstarzinger): This is just a temporary hack to make TurboFan work, |
929 // the correct solution is to restore the context register after invoking | 921 // the correct solution is to restore the context register after invoking |
930 // builtins from full-codegen. | 922 // builtins from full-codegen. |
931 Handle<SharedFunctionInfo> shared = info()->shared_info(); | 923 Handle<SharedFunctionInfo> shared = info()->shared_info(); |
932 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { | 924 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { |
933 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); | 925 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); |
934 Object* builtin = isolate()->js_builtins_object()->javascript_builtin(id); | 926 Object* builtin = isolate()->js_builtins_object()->javascript_builtin(id); |
935 if (*info()->closure() == builtin) return Handle<Code>::null(); | 927 if (*info()->closure() == builtin) return Handle<Code>::null(); |
936 } | 928 } |
937 | 929 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 Run<TypedLoweringPhase>(); | 1031 Run<TypedLoweringPhase>(); |
1040 RunPrintAndVerify("Lowered typed"); | 1032 RunPrintAndVerify("Lowered typed"); |
1041 | 1033 |
1042 if (FLAG_turbo_stress_loop_peeling) { | 1034 if (FLAG_turbo_stress_loop_peeling) { |
1043 Run<StressLoopPeelingPhase>(); | 1035 Run<StressLoopPeelingPhase>(); |
1044 RunPrintAndVerify("Loop peeled", true); | 1036 RunPrintAndVerify("Loop peeled", true); |
1045 } | 1037 } |
1046 | 1038 |
1047 if (info()->is_osr()) { | 1039 if (info()->is_osr()) { |
1048 Run<OsrDeconstructionPhase>(); | 1040 Run<OsrDeconstructionPhase>(); |
1049 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); | |
1050 RunPrintAndVerify("OSR deconstruction"); | 1041 RunPrintAndVerify("OSR deconstruction"); |
1051 } | 1042 } |
1052 | 1043 |
1053 // TODO(turbofan): Type feedback currently requires deoptimization. | 1044 // TODO(turbofan): Type feedback currently requires deoptimization. |
1054 if (info()->is_deoptimization_enabled() && | 1045 if (info()->is_deoptimization_enabled() && |
1055 info()->is_type_feedback_enabled()) { | 1046 info()->is_type_feedback_enabled()) { |
1056 Run<JSTypeFeedbackPhase>(); | 1047 Run<JSTypeFeedbackPhase>(); |
1057 RunPrintAndVerify("JSType feedback"); | 1048 RunPrintAndVerify("JSType feedback"); |
1058 } | 1049 } |
1059 | 1050 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 tcf << AsC1VRegisterAllocationData("CodeGen", | 1306 tcf << AsC1VRegisterAllocationData("CodeGen", |
1316 data->register_allocation_data()); | 1307 data->register_allocation_data()); |
1317 } | 1308 } |
1318 | 1309 |
1319 data->DeleteRegisterAllocationZone(); | 1310 data->DeleteRegisterAllocationZone(); |
1320 } | 1311 } |
1321 | 1312 |
1322 } // namespace compiler | 1313 } // namespace compiler |
1323 } // namespace internal | 1314 } // namespace internal |
1324 } // namespace v8 | 1315 } // namespace v8 |
OLD | NEW |