OLD | NEW |
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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 984 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
985 Isolate* isolate = function->GetIsolate(); | 985 Isolate* isolate = function->GetIsolate(); |
986 DCHECK(!isolate->has_pending_exception()); | 986 DCHECK(!isolate->has_pending_exception()); |
987 DCHECK(!function->is_compiled()); | 987 DCHECK(!function->is_compiled()); |
988 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 988 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
989 RuntimeCallTimerScope runtimeTimer(isolate, | 989 RuntimeCallTimerScope runtimeTimer(isolate, |
990 &RuntimeCallStats::CompileCodeLazy); | 990 &RuntimeCallStats::CompileCodeLazy); |
991 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 991 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
992 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 992 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
993 | 993 |
994 if (FLAG_turbo_cache_shared_code) { | 994 Handle<Code> cached_code; |
995 Handle<Code> cached_code; | 995 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) |
996 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) | 996 .ToHandle(&cached_code)) { |
997 .ToHandle(&cached_code)) { | 997 if (FLAG_trace_opt) { |
998 if (FLAG_trace_opt) { | 998 PrintF("[found optimized code for "); |
999 PrintF("[found optimized code for "); | 999 function->ShortPrint(); |
1000 function->ShortPrint(); | 1000 PrintF(" during unoptimized compile]\n"); |
1001 PrintF(" during unoptimized compile]\n"); | |
1002 } | |
1003 DCHECK(function->shared()->is_compiled()); | |
1004 return cached_code; | |
1005 } | 1001 } |
| 1002 DCHECK(function->shared()->is_compiled()); |
| 1003 return cached_code; |
1006 } | 1004 } |
1007 | 1005 |
1008 if (function->shared()->is_compiled()) { | 1006 if (function->shared()->is_compiled()) { |
1009 return Handle<Code>(function->shared()->code()); | 1007 return Handle<Code>(function->shared()->code()); |
1010 } | 1008 } |
1011 | 1009 |
1012 if (function->shared()->HasBytecodeArray()) { | 1010 if (function->shared()->HasBytecodeArray()) { |
1013 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline(); | 1011 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline(); |
1014 function->shared()->ReplaceCode(*entry); | 1012 function->shared()->ReplaceCode(*entry); |
1015 return entry; | 1013 return entry; |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 DCHECK(shared->is_compiled()); | 1913 DCHECK(shared->is_compiled()); |
1916 function->set_literals(cached.literals); | 1914 function->set_literals(cached.literals); |
1917 } else if (shared->is_compiled()) { | 1915 } else if (shared->is_compiled()) { |
1918 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1916 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1919 JSFunction::EnsureLiterals(function); | 1917 JSFunction::EnsureLiterals(function); |
1920 } | 1918 } |
1921 } | 1919 } |
1922 | 1920 |
1923 } // namespace internal | 1921 } // namespace internal |
1924 } // namespace v8 | 1922 } // namespace v8 |
OLD | NEW |