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

Side by Side Diff: src/compiler.cc

Issue 1372513003: [turbofan] Rename --context-specialization to --function-context-specialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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.h ('k') | src/compiler/pipeline.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 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 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 : CompilationInfo(parse_info, nullptr, nullptr, BASE, parse_info->isolate(), 123 : CompilationInfo(parse_info, nullptr, nullptr, BASE, parse_info->isolate(),
124 parse_info->zone()) { 124 parse_info->zone()) {
125 // Compiling for the snapshot typically results in different code than 125 // Compiling for the snapshot typically results in different code than
126 // compiling later on. This means that code recompiled with deoptimization 126 // compiling later on. This means that code recompiled with deoptimization
127 // support won't be "equivalent" (as defined by SharedFunctionInfo:: 127 // support won't be "equivalent" (as defined by SharedFunctionInfo::
128 // EnableDeoptimizationSupport), so it will replace the old code and all 128 // EnableDeoptimizationSupport), so it will replace the old code and all
129 // its type feedback. To avoid this, always compile functions in the snapshot 129 // its type feedback. To avoid this, always compile functions in the snapshot
130 // with deoptimization support. 130 // with deoptimization support.
131 if (isolate_->serializer_enabled()) EnableDeoptimizationSupport(); 131 if (isolate_->serializer_enabled()) EnableDeoptimizationSupport();
132 132
133 if (FLAG_context_specialization) MarkAsContextSpecializing(); 133 if (FLAG_function_context_specialization) MarkAsFunctionContextSpecializing();
134 if (FLAG_turbo_inlining) MarkAsInliningEnabled(); 134 if (FLAG_turbo_inlining) MarkAsInliningEnabled();
135 if (FLAG_turbo_source_positions) MarkAsSourcePositionsEnabled(); 135 if (FLAG_turbo_source_positions) MarkAsSourcePositionsEnabled();
136 if (FLAG_turbo_splitting) MarkAsSplittingEnabled(); 136 if (FLAG_turbo_splitting) MarkAsSplittingEnabled();
137 if (FLAG_turbo_types) MarkAsTypingEnabled(); 137 if (FLAG_turbo_types) MarkAsTypingEnabled();
138 138
139 if (has_shared_info()) { 139 if (has_shared_info()) {
140 if (shared_info()->is_compiled()) { 140 if (shared_info()->is_compiled()) {
141 // We should initialize the CompilationInfo feedback vector from the 141 // We should initialize the CompilationInfo feedback vector from the
142 // passed in shared info, rather than creating a new one. 142 // passed in shared info, rather than creating a new one.
143 feedback_vector_ = Handle<TypeFeedbackVector>( 143 feedback_vector_ = Handle<TypeFeedbackVector>(
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 if (FLAG_trace_opt) { 433 if (FLAG_trace_opt) {
434 OFStream os(stdout); 434 OFStream os(stdout);
435 os << "[compiling method " << Brief(*info()->closure()) 435 os << "[compiling method " << Brief(*info()->closure())
436 << " using TurboFan"; 436 << " using TurboFan";
437 if (info()->is_osr()) os << " OSR"; 437 if (info()->is_osr()) os << " OSR";
438 os << "]" << std::endl; 438 os << "]" << std::endl;
439 } 439 }
440 440
441 if (info()->shared_info()->asm_function()) { 441 if (info()->shared_info()->asm_function()) {
442 if (info()->osr_frame()) info()->MarkAsFrameSpecializing(); 442 if (info()->osr_frame()) info()->MarkAsFrameSpecializing();
443 info()->MarkAsContextSpecializing(); 443 info()->MarkAsFunctionContextSpecializing();
444 } else if (FLAG_turbo_type_feedback) { 444 } else if (FLAG_turbo_type_feedback) {
445 info()->MarkAsTypeFeedbackEnabled(); 445 info()->MarkAsTypeFeedbackEnabled();
446 info()->EnsureFeedbackVector(); 446 info()->EnsureFeedbackVector();
447 } 447 }
448 if (!info()->shared_info()->asm_function() || 448 if (!info()->shared_info()->asm_function() ||
449 FLAG_turbo_asm_deoptimization) { 449 FLAG_turbo_asm_deoptimization) {
450 info()->MarkAsDeoptimizationEnabled(); 450 info()->MarkAsDeoptimizationEnabled();
451 } 451 }
452 452
453 Timer t(this, &time_taken_to_create_graph_); 453 Timer t(this, &time_taken_to_create_graph_);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 770 }
771 return MaybeHandle<Code>(); 771 return MaybeHandle<Code>();
772 } 772 }
773 773
774 774
775 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { 775 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
776 Handle<Code> code = info->code(); 776 Handle<Code> code = info->code();
777 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do. 777 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do.
778 778
779 // Context specialization folds-in the context, so no sharing can occur. 779 // Context specialization folds-in the context, so no sharing can occur.
780 if (info->is_context_specializing()) return; 780 if (info->is_function_context_specializing()) return;
781 // Frame specialization implies context specialization. 781 // Frame specialization implies function context specialization.
782 DCHECK(!info->is_frame_specializing()); 782 DCHECK(!info->is_frame_specializing());
783 783
784 // Do not cache bound functions. 784 // Do not cache bound functions.
785 Handle<JSFunction> function = info->closure(); 785 Handle<JSFunction> function = info->closure();
786 if (function->shared()->bound()) return; 786 if (function->shared()->bound()) return;
787 787
788 // Cache optimized context-specific code. 788 // Cache optimized context-specific code.
789 if (FLAG_cache_optimized_code) { 789 if (FLAG_cache_optimized_code) {
790 Handle<SharedFunctionInfo> shared(function->shared()); 790 Handle<SharedFunctionInfo> shared(function->shared());
791 Handle<FixedArray> literals(function->literals()); 791 Handle<FixedArray> literals(function->literals());
792 Handle<Context> native_context(function->context()->native_context()); 792 Handle<Context> native_context(function->context()->native_context());
793 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 793 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
794 literals, info->osr_ast_id()); 794 literals, info->osr_ast_id());
795 } 795 }
796 796
797 // Do not cache context-independent code compiled for OSR. 797 // Do not cache context-independent code compiled for OSR.
798 if (code->is_turbofanned() && info->is_osr()) return; 798 if (code->is_turbofanned() && info->is_osr()) return;
799 799
800 // Cache optimized context-independent code. 800 // Cache optimized context-independent code.
801 if (FLAG_turbo_cache_shared_code && code->is_turbofanned()) { 801 if (FLAG_turbo_cache_shared_code && code->is_turbofanned()) {
802 DCHECK(!info->is_context_specializing()); 802 DCHECK(!info->is_function_context_specializing());
803 DCHECK(info->osr_ast_id().IsNone()); 803 DCHECK(info->osr_ast_id().IsNone());
804 Handle<SharedFunctionInfo> shared(function->shared()); 804 Handle<SharedFunctionInfo> shared(function->shared());
805 SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(shared, code); 805 SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(shared, code);
806 } 806 }
807 } 807 }
808 808
809 809
810 static bool Renumber(ParseInfo* parse_info) { 810 static bool Renumber(ParseInfo* parse_info) {
811 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), 811 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(),
812 parse_info->literal())) { 812 parse_info->literal())) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 } 968 }
969 969
970 970
971 MaybeHandle<Code> Compiler::GetStubCode(Handle<JSFunction> function, 971 MaybeHandle<Code> Compiler::GetStubCode(Handle<JSFunction> function,
972 CodeStub* stub) { 972 CodeStub* stub) {
973 // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair. 973 // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair.
974 Zone zone; 974 Zone zone;
975 ParseInfo parse_info(&zone, function); 975 ParseInfo parse_info(&zone, function);
976 CompilationInfo info(&parse_info); 976 CompilationInfo info(&parse_info);
977 info.SetFunctionType(stub->GetCallInterfaceDescriptor().GetFunctionType()); 977 info.SetFunctionType(stub->GetCallInterfaceDescriptor().GetFunctionType());
978 info.MarkAsContextSpecializing(); 978 info.MarkAsFunctionContextSpecializing();
979 info.MarkAsDeoptimizationEnabled(); 979 info.MarkAsDeoptimizationEnabled();
980 info.SetStub(stub); 980 info.SetStub(stub);
981 981
982 // Run a "mini pipeline", extracted from compiler.cc. 982 // Run a "mini pipeline", extracted from compiler.cc.
983 if (!ParseAndAnalyze(&parse_info)) return MaybeHandle<Code>(); 983 if (!ParseAndAnalyze(&parse_info)) return MaybeHandle<Code>();
984 return compiler::Pipeline(&info).GenerateCode(); 984 return compiler::Pipeline(&info).GenerateCode();
985 } 985 }
986 986
987 987
988 bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag) { 988 bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag) {
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 } 1761 }
1762 1762
1763 #if DEBUG 1763 #if DEBUG
1764 void CompilationInfo::PrintAstForTesting() { 1764 void CompilationInfo::PrintAstForTesting() {
1765 PrintF("--- Source from AST ---\n%s\n", 1765 PrintF("--- Source from AST ---\n%s\n",
1766 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); 1766 PrettyPrinter(isolate(), zone()).PrintProgram(literal()));
1767 } 1767 }
1768 #endif 1768 #endif
1769 } // namespace internal 1769 } // namespace internal
1770 } // namespace v8 1770 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698