| 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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 } | 1704 } |
| 1705 return false; | 1705 return false; |
| 1706 } | 1706 } |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 void Compiler::PostInstantiation(Handle<JSFunction> function, | 1709 void Compiler::PostInstantiation(Handle<JSFunction> function, |
| 1710 PretenureFlag pretenure) { | 1710 PretenureFlag pretenure) { |
| 1711 Handle<SharedFunctionInfo> shared(function->shared()); | 1711 Handle<SharedFunctionInfo> shared(function->shared()); |
| 1712 | 1712 |
| 1713 if (FLAG_always_opt && shared->allows_lazy_compilation() && | 1713 if (FLAG_always_opt && shared->allows_lazy_compilation() && |
| 1714 !function->shared()->HasAsmWasmData() && |
| 1714 function->shared()->is_compiled()) { | 1715 function->shared()->is_compiled()) { |
| 1715 function->MarkForOptimization(); | 1716 function->MarkForOptimization(); |
| 1716 } | 1717 } |
| 1717 | 1718 |
| 1718 CodeAndLiterals cached = shared->SearchOptimizedCodeMap( | 1719 CodeAndLiterals cached = shared->SearchOptimizedCodeMap( |
| 1719 function->context()->native_context(), BailoutId::None()); | 1720 function->context()->native_context(), BailoutId::None()); |
| 1720 if (cached.code != nullptr) { | 1721 if (cached.code != nullptr) { |
| 1721 // Caching of optimized code enabled and optimized code found. | 1722 // Caching of optimized code enabled and optimized code found. |
| 1722 DCHECK(!cached.code->marked_for_deoptimization()); | 1723 DCHECK(!cached.code->marked_for_deoptimization()); |
| 1723 DCHECK(function->shared()->is_compiled()); | 1724 DCHECK(function->shared()->is_compiled()); |
| 1724 function->ReplaceCode(cached.code); | 1725 function->ReplaceCode(cached.code); |
| 1725 } | 1726 } |
| 1726 | 1727 |
| 1727 if (cached.literals != nullptr) { | 1728 if (cached.literals != nullptr) { |
| 1728 DCHECK(shared->is_compiled()); | 1729 DCHECK(shared->is_compiled()); |
| 1729 function->set_literals(cached.literals); | 1730 function->set_literals(cached.literals); |
| 1730 } else if (shared->is_compiled()) { | 1731 } else if (shared->is_compiled()) { |
| 1731 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1732 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1732 JSFunction::EnsureLiterals(function); | 1733 JSFunction::EnsureLiterals(function); |
| 1733 } | 1734 } |
| 1734 } | 1735 } |
| 1735 | 1736 |
| 1736 } // namespace internal | 1737 } // namespace internal |
| 1737 } // namespace v8 | 1738 } // namespace v8 |
| OLD | NEW |