 Chromium Code Reviews
 Chromium Code Reviews Issue 2399833002:
  Teach Scopes whether they will end up being lazily compiled or not  (Closed)
    
  
    Issue 2399833002:
  Teach Scopes whether they will end up being lazily compiled or not  (Closed) 
  | 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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 InstallSharedScopeInfo(info, shared); | 1424 InstallSharedScopeInfo(info, shared); | 
| 1425 } | 1425 } | 
| 1426 | 1426 | 
| 1427 // Install compilation result on the shared function info | 1427 // Install compilation result on the shared function info | 
| 1428 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 1428 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 
| 1429 | 1429 | 
| 1430 // The existing unoptimized code was replaced with the new one. | 1430 // The existing unoptimized code was replaced with the new one. | 
| 1431 RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, | 1431 RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, | 
| 1432 &unoptimized); | 1432 &unoptimized); | 
| 1433 } | 1433 } | 
| 1434 info->parse_info()->set_will_serialize(false); | |
| 
marja
2016/10/06 11:53:06
Why is this needed, shouldn't there be a default t
 
jochen (gone - plz use gerrit)
2016/10/06 15:05:04
In EnsureDeoptimizationSupport we might recompile
 
marja
2016/10/07 08:25:59
Offline discussion: this code for resetting the fl
 | |
| 1434 return true; | 1435 return true; | 
| 1435 } | 1436 } | 
| 1436 | 1437 | 
| 1437 // static | 1438 // static | 
| 1438 Compiler::CompilationTier Compiler::NextCompilationTier(JSFunction* function) { | 1439 Compiler::CompilationTier Compiler::NextCompilationTier(JSFunction* function) { | 
| 1439 Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate()); | 1440 Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate()); | 
| 1440 if (shared->code()->is_interpreter_trampoline_builtin()) { | 1441 if (shared->code()->is_interpreter_trampoline_builtin()) { | 
| 1441 if (FLAG_turbo_from_bytecode && UseTurboFan(shared)) { | 1442 if (FLAG_turbo_from_bytecode && UseTurboFan(shared)) { | 
| 1442 return OPTIMIZED; | 1443 return OPTIMIZED; | 
| 1443 } else { | 1444 } else { | 
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1787 bool allow_lazy = literal->AllowsLazyCompilation() && !info.is_debug(); | 1788 bool allow_lazy = literal->AllowsLazyCompilation() && !info.is_debug(); | 
| 1788 bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile(); | 1789 bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile(); | 
| 1789 | 1790 | 
| 1790 // Consider compiling eagerly when targeting the code cache. | 1791 // Consider compiling eagerly when targeting the code cache. | 
| 1791 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1792 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 
| 1792 | 1793 | 
| 1793 // Consider compiling eagerly when compiling bytecode for Ignition. | 1794 // Consider compiling eagerly when compiling bytecode for Ignition. | 
| 1794 lazy &= | 1795 lazy &= | 
| 1795 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1796 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 
| 1796 | 1797 | 
| 1798 DCHECK_EQ(lazy, literal->scope()->should_compile_lazily()); | |
| 1799 | |
| 1797 // Generate code | 1800 // Generate code | 
| 1798 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1801 TimerEventScope<TimerEventCompileCode> timer(isolate); | 
| 1799 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1802 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 
| 1800 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1803 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 
| 1801 | 1804 | 
| 1802 if (lazy) { | 1805 if (lazy) { | 
| 1803 info.SetCode(isolate->builtins()->CompileLazy()); | 1806 info.SetCode(isolate->builtins()->CompileLazy()); | 
| 1804 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext(); | 1807 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext(); | 
| 1805 if (outer_scope) { | 1808 if (outer_scope) { | 
| 1806 result->set_outer_scope_info(*outer_scope->scope_info()); | 1809 result->set_outer_scope_info(*outer_scope->scope_info()); | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1913 DCHECK(shared->is_compiled()); | 1916 DCHECK(shared->is_compiled()); | 
| 1914 function->set_literals(cached.literals); | 1917 function->set_literals(cached.literals); | 
| 1915 } else if (shared->is_compiled()) { | 1918 } else if (shared->is_compiled()) { | 
| 1916 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1919 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 
| 1917 JSFunction::EnsureLiterals(function); | 1920 JSFunction::EnsureLiterals(function); | 
| 1918 } | 1921 } | 
| 1919 } | 1922 } | 
| 1920 | 1923 | 
| 1921 } // namespace internal | 1924 } // namespace internal | 
| 1922 } // namespace v8 | 1925 } // namespace v8 | 
| OLD | NEW |