| 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // from bytecode offset and overlap with actual BailoutId. No caching! | 488 // from bytecode offset and overlap with actual BailoutId. No caching! |
| 489 if (info->is_osr() && info->is_optimizing_from_bytecode()) return; | 489 if (info->is_osr() && info->is_optimizing_from_bytecode()) return; |
| 490 | 490 |
| 491 // Cache optimized context-specific code. | 491 // Cache optimized context-specific code. |
| 492 Handle<JSFunction> function = info->closure(); | 492 Handle<JSFunction> function = info->closure(); |
| 493 Handle<SharedFunctionInfo> shared(function->shared()); | 493 Handle<SharedFunctionInfo> shared(function->shared()); |
| 494 Handle<LiteralsArray> literals(function->literals()); | 494 Handle<LiteralsArray> literals(function->literals()); |
| 495 Handle<Context> native_context(function->context()->native_context()); | 495 Handle<Context> native_context(function->context()->native_context()); |
| 496 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 496 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
| 497 literals, info->osr_ast_id()); | 497 literals, info->osr_ast_id()); |
| 498 | |
| 499 // Do not cache (native) context-independent code compiled for OSR. | |
| 500 if (code->is_turbofanned() && info->is_osr()) return; | |
| 501 | |
| 502 // Cache optimized (native) context-independent code. | |
| 503 if (FLAG_turbo_cache_shared_code && code->is_turbofanned() && | |
| 504 !info->is_native_context_specializing()) { | |
| 505 DCHECK(!info->is_function_context_specializing()); | |
| 506 DCHECK(info->osr_ast_id().IsNone()); | |
| 507 Handle<SharedFunctionInfo> shared(function->shared()); | |
| 508 SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(shared, code); | |
| 509 } | |
| 510 } | 498 } |
| 511 | 499 |
| 512 bool Renumber(ParseInfo* parse_info) { | 500 bool Renumber(ParseInfo* parse_info) { |
| 513 // Create a canonical handle scope if compiling ignition bytecode. This is | 501 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 514 // required by the constant array builder to de-duplicate objects without | 502 // required by the constant array builder to de-duplicate objects without |
| 515 // dereferencing handles. | 503 // dereferencing handles. |
| 516 std::unique_ptr<CanonicalHandleScope> canonical; | 504 std::unique_ptr<CanonicalHandleScope> canonical; |
| 517 if (FLAG_ignition) { | 505 if (FLAG_ignition) { |
| 518 canonical.reset(new CanonicalHandleScope(parse_info->isolate())); | 506 canonical.reset(new CanonicalHandleScope(parse_info->isolate())); |
| 519 } | 507 } |
| (...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 DCHECK(shared->is_compiled()); | 1876 DCHECK(shared->is_compiled()); |
| 1889 function->set_literals(cached.literals); | 1877 function->set_literals(cached.literals); |
| 1890 } else if (shared->is_compiled()) { | 1878 } else if (shared->is_compiled()) { |
| 1891 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1879 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1892 JSFunction::EnsureLiterals(function); | 1880 JSFunction::EnsureLiterals(function); |
| 1893 } | 1881 } |
| 1894 } | 1882 } |
| 1895 | 1883 |
| 1896 } // namespace internal | 1884 } // namespace internal |
| 1897 } // namespace v8 | 1885 } // namespace v8 |
| OLD | NEW |