 Chromium Code Reviews
 Chromium Code Reviews Issue 1670143002:
  Visit the Optimized Code Map on first call rather than closure creation.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1670143002:
  Visit the Optimized Code Map on first call rather than closure creation.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/compiler.cc | 
| diff --git a/src/compiler.cc b/src/compiler.cc | 
| index 7977bd04d3da23c6ef018fd343906bd241a27e86..dcf11f4a836c3f85aac4e9180e598a648217c847 100644 | 
| --- a/src/compiler.cc | 
| +++ b/src/compiler.cc | 
| @@ -1079,6 +1079,17 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 
| TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 
| TRACE_EVENT0("v8", "V8.CompileCode"); | 
| AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 
| + | 
| + if (FLAG_turbo_cache_shared_code) { | 
| + SharedFunctionInfo* shared = function->shared(); | 
| + CodeAndLiterals result; | 
| + result = shared->SearchOptimizedCodeMap( | 
| 
Michael Starzinger
2016/04/08 12:44:02
nit: Just use "function->shared()" directly here,
 
mvstanton
2016/04/11 13:36:14
Done.
 | 
| + *function->GetIsolate()->native_context(), BailoutId::None()); | 
| 
Michael Starzinger
2016/04/08 12:44:02
nit: The "isolate" variable is available, let's us
 
mvstanton
2016/04/11 13:36:14
Done.
 | 
| + if (result.code != nullptr) { | 
| + return Handle<Code>(result.code); | 
| + } | 
| + } | 
| + | 
| // If the debugger is active, do not compile with turbofan unless we can | 
| // deopt from turbofan code. | 
| if (FLAG_turbo_asm && function->shared()->asm_function() && | 
| @@ -1315,6 +1326,7 @@ bool Compiler::ParseAndAnalyze(ParseInfo* info) { | 
| bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag) { | 
| if (function->is_compiled()) return true; | 
| + | 
| MaybeHandle<Code> maybe_code = GetLazyCode(function); | 
| Handle<Code> code; | 
| if (!maybe_code.ToHandle(&code)) { |