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

Side by Side Diff: src/compiler.cc

Issue 1878063004: Revert of Visit the Optimized Code Map on first call rather than closure creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/code-stubs-hydrogen.cc ('k') | src/ia32/builtins-ia32.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/ast-numbering.h" 9 #include "src/ast/ast-numbering.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 return MaybeHandle<Code>(); 913 return MaybeHandle<Code>();
914 } 914 }
915 915
916 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { 916 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
917 Isolate* isolate = function->GetIsolate(); 917 Isolate* isolate = function->GetIsolate();
918 DCHECK(!isolate->has_pending_exception()); 918 DCHECK(!isolate->has_pending_exception());
919 DCHECK(!function->is_compiled()); 919 DCHECK(!function->is_compiled());
920 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); 920 TimerEventScope<TimerEventCompileCode> compile_timer(isolate);
921 TRACE_EVENT0("v8", "V8.CompileCode"); 921 TRACE_EVENT0("v8", "V8.CompileCode");
922 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); 922 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy());
923
924 if (FLAG_turbo_cache_shared_code) {
925 CodeAndLiterals result;
926 result = function->shared()->SearchOptimizedCodeMap(
927 *isolate->native_context(), BailoutId::None());
928 if (result.code != nullptr) {
929 return Handle<Code>(result.code);
930 }
931 }
932
933 // If the debugger is active, do not compile with turbofan unless we can 923 // If the debugger is active, do not compile with turbofan unless we can
934 // deopt from turbofan code. 924 // deopt from turbofan code.
935 if (FLAG_turbo_asm && function->shared()->asm_function() && 925 if (FLAG_turbo_asm && function->shared()->asm_function() &&
936 (FLAG_turbo_asm_deoptimization || !isolate->debug()->is_active()) && 926 (FLAG_turbo_asm_deoptimization || !isolate->debug()->is_active()) &&
937 !FLAG_turbo_osr) { 927 !FLAG_turbo_osr) {
938 Handle<Code> code; 928 Handle<Code> code;
939 if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT).ToHandle(&code)) { 929 if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT).ToHandle(&code)) {
940 DCHECK(function->shared()->is_compiled()); 930 DCHECK(function->shared()->is_compiled());
941 return code; 931 return code;
942 } 932 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 return true; 1149 return true;
1160 } 1150 }
1161 1151
1162 bool Compiler::ParseAndAnalyze(ParseInfo* info) { 1152 bool Compiler::ParseAndAnalyze(ParseInfo* info) {
1163 if (!Parser::ParseStatic(info)) return false; 1153 if (!Parser::ParseStatic(info)) return false;
1164 return Compiler::Analyze(info); 1154 return Compiler::Analyze(info);
1165 } 1155 }
1166 1156
1167 bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag) { 1157 bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag) {
1168 if (function->is_compiled()) return true; 1158 if (function->is_compiled()) return true;
1169
1170 MaybeHandle<Code> maybe_code = GetLazyCode(function); 1159 MaybeHandle<Code> maybe_code = GetLazyCode(function);
1171 Handle<Code> code; 1160 Handle<Code> code;
1172 if (!maybe_code.ToHandle(&code)) { 1161 if (!maybe_code.ToHandle(&code)) {
1173 if (flag == CLEAR_EXCEPTION) { 1162 if (flag == CLEAR_EXCEPTION) {
1174 function->GetIsolate()->clear_pending_exception(); 1163 function->GetIsolate()->clear_pending_exception();
1175 } 1164 }
1176 return false; 1165 return false;
1177 } 1166 }
1178 DCHECK(code->IsJavaScriptCode()); 1167 DCHECK(code->IsJavaScriptCode());
1179 function->ReplaceCode(*code); 1168 function->ReplaceCode(*code);
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 MaybeHandle<Code> code; 1740 MaybeHandle<Code> code;
1752 if (cached.code != nullptr) code = handle(cached.code); 1741 if (cached.code != nullptr) code = handle(cached.code);
1753 Handle<Context> native_context(function->context()->native_context()); 1742 Handle<Context> native_context(function->context()->native_context());
1754 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 1743 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
1755 literals, BailoutId::None()); 1744 literals, BailoutId::None());
1756 } 1745 }
1757 } 1746 }
1758 1747
1759 } // namespace internal 1748 } // namespace internal
1760 } // namespace v8 1749 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698