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

Side by Side Diff: src/compiler.cc

Issue 2437103002: [turbofan] Remove deprecated --turbo-from-bytecode flag. (Closed)
Patch Set: Rebased. Created 4 years, 1 month 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/ast/ast-numbering.cc ('k') | src/flag-definitions.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 Isolate* isolate = function->GetIsolate(); 612 Isolate* isolate = function->GetIsolate();
613 Handle<SharedFunctionInfo> shared(function->shared(), isolate); 613 Handle<SharedFunctionInfo> shared(function->shared(), isolate);
614 614
615 bool ignition_osr = osr_frame && osr_frame->is_interpreted(); 615 bool ignition_osr = osr_frame && osr_frame->is_interpreted();
616 DCHECK_IMPLIES(ignition_osr, !osr_ast_id.IsNone()); 616 DCHECK_IMPLIES(ignition_osr, !osr_ast_id.IsNone());
617 DCHECK_IMPLIES(ignition_osr, FLAG_ignition_osr); 617 DCHECK_IMPLIES(ignition_osr, FLAG_ignition_osr);
618 618
619 // Shared function no longer needs to be tiered up 619 // Shared function no longer needs to be tiered up
620 shared->set_marked_for_tier_up(false); 620 shared->set_marked_for_tier_up(false);
621 621
622 // Flag combination --ignition-osr --no-turbo-from-bytecode is unsupported.
623 if (ignition_osr && !FLAG_turbo_from_bytecode) return MaybeHandle<Code>();
624
625 Handle<Code> cached_code; 622 Handle<Code> cached_code;
626 // TODO(4764): When compiling for OSR from bytecode, BailoutId might derive 623 // TODO(4764): When compiling for OSR from bytecode, BailoutId might derive
627 // from bytecode offset and overlap with actual BailoutId. No lookup! 624 // from bytecode offset and overlap with actual BailoutId. No lookup!
628 if (!ignition_osr && 625 if (!ignition_osr &&
629 GetCodeFromOptimizedCodeMap(function, osr_ast_id) 626 GetCodeFromOptimizedCodeMap(function, osr_ast_id)
630 .ToHandle(&cached_code)) { 627 .ToHandle(&cached_code)) {
631 if (FLAG_trace_opt) { 628 if (FLAG_trace_opt) {
632 PrintF("[found optimized code for "); 629 PrintF("[found optimized code for ");
633 function->ShortPrint(); 630 function->ShortPrint();
634 if (!osr_ast_id.IsNone()) { 631 if (!osr_ast_id.IsNone()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 if (info->shared_info()->opt_count() > kMaxOptCount) { 665 if (info->shared_info()->opt_count() > kMaxOptCount) {
669 info->AbortOptimization(kOptimizedTooManyTimes); 666 info->AbortOptimization(kOptimizedTooManyTimes);
670 return MaybeHandle<Code>(); 667 return MaybeHandle<Code>();
671 } 668 }
672 669
673 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); 670 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
674 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); 671 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode);
675 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); 672 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
676 673
677 // TurboFan can optimize directly from existing bytecode. 674 // TurboFan can optimize directly from existing bytecode.
678 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { 675 if (use_turbofan && ShouldUseIgnition(info)) {
679 if (info->is_osr() && !ignition_osr) return MaybeHandle<Code>(); 676 if (info->is_osr() && !ignition_osr) return MaybeHandle<Code>();
680 if (!Compiler::EnsureBytecode(info)) { 677 if (!Compiler::EnsureBytecode(info)) {
681 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); 678 if (isolate->has_pending_exception()) isolate->clear_pending_exception();
682 return MaybeHandle<Code>(); 679 return MaybeHandle<Code>();
683 } 680 }
684 info->MarkAsOptimizeFromBytecode(); 681 info->MarkAsOptimizeFromBytecode();
685 } 682 }
686 683
687 // Verify that OSR compilations are delegated to the correct graph builder. 684 // Verify that OSR compilations are delegated to the correct graph builder.
688 // Depending on the underlying frame the semantics of the {BailoutId} differ 685 // Depending on the underlying frame the semantics of the {BailoutId} differ
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 public OptimizedFunctionVisitor { 778 public OptimizedFunctionVisitor {
782 public: 779 public:
783 explicit InterpreterActivationsFinder(SharedFunctionInfo* shared) 780 explicit InterpreterActivationsFinder(SharedFunctionInfo* shared)
784 : shared_(shared), has_activations_(false) {} 781 : shared_(shared), has_activations_(false) {}
785 782
786 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { 783 void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
787 Address* activation_pc_address = nullptr; 784 Address* activation_pc_address = nullptr;
788 JavaScriptFrameIterator it(isolate, top); 785 JavaScriptFrameIterator it(isolate, top);
789 for (; !it.done(); it.Advance()) { 786 for (; !it.done(); it.Advance()) {
790 JavaScriptFrame* frame = it.frame(); 787 JavaScriptFrame* frame = it.frame();
791 if (FLAG_turbo_from_bytecode && FLAG_ignition_osr && 788 if (FLAG_ignition_osr && frame->is_optimized() &&
792 frame->is_optimized() && frame->function()->shared() == shared_) { 789 frame->function()->shared() == shared_) {
793 // If we are able to optimize functions directly from bytecode, then 790 // There might be optimized OSR code active on the stack that is not
794 // there might be optimized OSR code active on the stack that is not
795 // reachable through a function. We count this as an activation. 791 // reachable through a function. We count this as an activation.
796 has_activations_ = true; 792 has_activations_ = true;
797 } 793 }
798 if (frame->is_interpreted() && frame->function()->shared() == shared_) { 794 if (frame->is_interpreted() && frame->function()->shared() == shared_) {
799 has_activations_ = true; 795 has_activations_ = true;
800 activation_pc_address = frame->pc_address(); 796 activation_pc_address = frame->pc_address();
801 } 797 }
802 } 798 }
803 799
804 if (activation_pc_address) { 800 if (activation_pc_address) {
(...skipping 26 matching lines...) Expand all
831 private: 827 private:
832 SharedFunctionInfo* shared_; 828 SharedFunctionInfo* shared_;
833 bool has_activations_; 829 bool has_activations_;
834 std::vector<Address*> activation_pc_addresses_; 830 std::vector<Address*> activation_pc_addresses_;
835 }; 831 };
836 832
837 bool HasInterpreterActivations( 833 bool HasInterpreterActivations(
838 Isolate* isolate, InterpreterActivationsFinder* activations_finder) { 834 Isolate* isolate, InterpreterActivationsFinder* activations_finder) {
839 activations_finder->VisitThread(isolate, isolate->thread_local_top()); 835 activations_finder->VisitThread(isolate, isolate->thread_local_top());
840 isolate->thread_manager()->IterateArchivedThreads(activations_finder); 836 isolate->thread_manager()->IterateArchivedThreads(activations_finder);
841 if (FLAG_turbo_from_bytecode) { 837 // There might be optimized functions that rely on bytecode being around. We
842 // If we are able to optimize functions directly from bytecode, then there 838 // need to prevent switching the given function to baseline code.
843 // might be optimized functions that rely on bytecode being around. We need 839 Deoptimizer::VisitAllOptimizedFunctions(isolate, activations_finder);
844 // to prevent switching the given function to baseline code in those cases.
845 Deoptimizer::VisitAllOptimizedFunctions(isolate, activations_finder);
846 }
847 return activations_finder->has_activations(); 840 return activations_finder->has_activations();
848 } 841 }
849 842
850 MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) { 843 MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
851 Isolate* isolate = function->GetIsolate(); 844 Isolate* isolate = function->GetIsolate();
852 VMState<COMPILER> state(isolate); 845 VMState<COMPILER> state(isolate);
853 PostponeInterruptsScope postpone(isolate); 846 PostponeInterruptsScope postpone(isolate);
854 Zone zone(isolate->allocator(), ZONE_NAME); 847 Zone zone(isolate->allocator(), ZONE_NAME);
855 ParseInfo parse_info(&zone, handle(function->shared())); 848 ParseInfo parse_info(&zone, handle(function->shared()));
856 CompilationInfo info(&parse_info, function); 849 CompilationInfo info(&parse_info, function);
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, 1358 RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG,
1366 &unoptimized); 1359 &unoptimized);
1367 } 1360 }
1368 return true; 1361 return true;
1369 } 1362 }
1370 1363
1371 // static 1364 // static
1372 Compiler::CompilationTier Compiler::NextCompilationTier(JSFunction* function) { 1365 Compiler::CompilationTier Compiler::NextCompilationTier(JSFunction* function) {
1373 Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate()); 1366 Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate());
1374 if (shared->code()->is_interpreter_trampoline_builtin()) { 1367 if (shared->code()->is_interpreter_trampoline_builtin()) {
1375 if (FLAG_turbo_from_bytecode && UseTurboFan(shared)) { 1368 if (UseTurboFan(shared)) {
1376 return OPTIMIZED; 1369 return OPTIMIZED;
1377 } else { 1370 } else {
1378 return BASELINE; 1371 return BASELINE;
1379 } 1372 }
1380 } else { 1373 } else {
1381 return OPTIMIZED; 1374 return OPTIMIZED;
1382 } 1375 }
1383 } 1376 }
1384 1377
1385 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( 1378 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 DCHECK(shared->is_compiled()); 1820 DCHECK(shared->is_compiled());
1828 function->set_literals(cached.literals); 1821 function->set_literals(cached.literals);
1829 } else if (shared->is_compiled()) { 1822 } else if (shared->is_compiled()) {
1830 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1823 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1831 JSFunction::EnsureLiterals(function); 1824 JSFunction::EnsureLiterals(function);
1832 } 1825 }
1833 } 1826 }
1834 1827
1835 } // namespace internal 1828 } // namespace internal
1836 } // namespace v8 1829 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-numbering.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698