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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 // free as much as possible, since some code expects the old shared function | 1186 // free as much as possible, since some code expects the old shared function |
1187 // infos to stick around. | 1187 // infos to stick around. |
1188 script->set_shared_function_infos(*old_function_infos); | 1188 script->set_shared_function_infos(*old_function_infos); |
1189 | 1189 |
1190 return infos; | 1190 return infos; |
1191 } | 1191 } |
1192 | 1192 |
1193 bool Compiler::EnsureBytecode(CompilationInfo* info) { | 1193 bool Compiler::EnsureBytecode(CompilationInfo* info) { |
1194 if (!info->shared_info()->is_compiled()) { | 1194 if (!info->shared_info()->is_compiled()) { |
1195 if (GetUnoptimizedCode(info).is_null()) return false; | 1195 if (GetUnoptimizedCode(info).is_null()) return false; |
1196 if (info->shared_info()->HasAsmWasmData()) return false; | |
1197 } | 1196 } |
1198 DCHECK(info->shared_info()->is_compiled()); | 1197 DCHECK(info->shared_info()->is_compiled()); |
| 1198 |
| 1199 if (info->shared_info()->HasAsmWasmData()) return false; |
| 1200 |
1199 DCHECK_EQ(ShouldUseIgnition(info), info->shared_info()->HasBytecodeArray()); | 1201 DCHECK_EQ(ShouldUseIgnition(info), info->shared_info()->HasBytecodeArray()); |
1200 return info->shared_info()->HasBytecodeArray(); | 1202 return info->shared_info()->HasBytecodeArray(); |
1201 } | 1203 } |
1202 | 1204 |
1203 // TODO(turbofan): In the future, unoptimized code with deopt support could | 1205 // TODO(turbofan): In the future, unoptimized code with deopt support could |
1204 // be generated lazily once deopt is triggered. | 1206 // be generated lazily once deopt is triggered. |
1205 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { | 1207 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { |
1206 DCHECK_NOT_NULL(info->literal()); | 1208 DCHECK_NOT_NULL(info->literal()); |
1207 DCHECK_NOT_NULL(info->scope()); | 1209 DCHECK_NOT_NULL(info->scope()); |
1208 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1210 Handle<SharedFunctionInfo> shared = info->shared_info(); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 } | 1706 } |
1705 return false; | 1707 return false; |
1706 } | 1708 } |
1707 } | 1709 } |
1708 | 1710 |
1709 void Compiler::PostInstantiation(Handle<JSFunction> function, | 1711 void Compiler::PostInstantiation(Handle<JSFunction> function, |
1710 PretenureFlag pretenure) { | 1712 PretenureFlag pretenure) { |
1711 Handle<SharedFunctionInfo> shared(function->shared()); | 1713 Handle<SharedFunctionInfo> shared(function->shared()); |
1712 | 1714 |
1713 if (FLAG_always_opt && shared->allows_lazy_compilation() && | 1715 if (FLAG_always_opt && shared->allows_lazy_compilation() && |
| 1716 !function->shared()->HasAsmWasmData() && |
1714 function->shared()->is_compiled()) { | 1717 function->shared()->is_compiled()) { |
1715 function->MarkForOptimization(); | 1718 function->MarkForOptimization(); |
1716 } | 1719 } |
1717 | 1720 |
1718 CodeAndLiterals cached = shared->SearchOptimizedCodeMap( | 1721 CodeAndLiterals cached = shared->SearchOptimizedCodeMap( |
1719 function->context()->native_context(), BailoutId::None()); | 1722 function->context()->native_context(), BailoutId::None()); |
1720 if (cached.code != nullptr) { | 1723 if (cached.code != nullptr) { |
1721 // Caching of optimized code enabled and optimized code found. | 1724 // Caching of optimized code enabled and optimized code found. |
1722 DCHECK(!cached.code->marked_for_deoptimization()); | 1725 DCHECK(!cached.code->marked_for_deoptimization()); |
1723 DCHECK(function->shared()->is_compiled()); | 1726 DCHECK(function->shared()->is_compiled()); |
1724 function->ReplaceCode(cached.code); | 1727 function->ReplaceCode(cached.code); |
1725 } | 1728 } |
1726 | 1729 |
1727 if (cached.literals != nullptr) { | 1730 if (cached.literals != nullptr) { |
1728 DCHECK(shared->is_compiled()); | 1731 DCHECK(shared->is_compiled()); |
1729 function->set_literals(cached.literals); | 1732 function->set_literals(cached.literals); |
1730 } else if (shared->is_compiled()) { | 1733 } else if (shared->is_compiled()) { |
1731 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1734 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1732 JSFunction::EnsureLiterals(function); | 1735 JSFunction::EnsureLiterals(function); |
1733 } | 1736 } |
1734 } | 1737 } |
1735 | 1738 |
1736 } // namespace internal | 1739 } // namespace internal |
1737 } // namespace v8 | 1740 } // namespace v8 |
OLD | NEW |