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 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 // so no sharing can occur. | 804 // so no sharing can occur. |
805 if (info->is_function_context_specializing()) return; | 805 if (info->is_function_context_specializing()) return; |
806 // Frame specialization implies function context specialization. | 806 // Frame specialization implies function context specialization. |
807 DCHECK(!info->is_frame_specializing()); | 807 DCHECK(!info->is_frame_specializing()); |
808 | 808 |
809 // Do not cache bound functions. | 809 // Do not cache bound functions. |
810 Handle<JSFunction> function = info->closure(); | 810 Handle<JSFunction> function = info->closure(); |
811 if (function->shared()->bound()) return; | 811 if (function->shared()->bound()) return; |
812 | 812 |
813 // Cache optimized context-specific code. | 813 // Cache optimized context-specific code. |
814 if (FLAG_cache_optimized_code) { | 814 Handle<SharedFunctionInfo> shared(function->shared()); |
815 Handle<SharedFunctionInfo> shared(function->shared()); | 815 Handle<LiteralsArray> literals(function->literals()); |
816 Handle<LiteralsArray> literals(function->literals()); | 816 Handle<Context> native_context(function->context()->native_context()); |
817 Handle<Context> native_context(function->context()->native_context()); | 817 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
818 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 818 literals, info->osr_ast_id()); |
819 literals, info->osr_ast_id()); | |
820 } | |
821 | 819 |
822 // Do not cache (native) context-independent code compiled for OSR. | 820 // Do not cache (native) context-independent code compiled for OSR. |
823 if (code->is_turbofanned() && info->is_osr()) return; | 821 if (code->is_turbofanned() && info->is_osr()) return; |
824 | 822 |
825 // Cache optimized (native) context-independent code. | 823 // Cache optimized (native) context-independent code. |
826 if (FLAG_turbo_cache_shared_code && code->is_turbofanned() && | 824 if (FLAG_turbo_cache_shared_code && code->is_turbofanned() && |
827 !info->is_native_context_specializing()) { | 825 !info->is_native_context_specializing()) { |
828 DCHECK(!info->is_function_context_specializing()); | 826 DCHECK(!info->is_function_context_specializing()); |
829 DCHECK(info->osr_ast_id().IsNone()); | 827 DCHECK(info->osr_ast_id().IsNone()); |
830 Handle<SharedFunctionInfo> shared(function->shared()); | 828 Handle<SharedFunctionInfo> shared(function->shared()); |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 } | 1797 } |
1800 | 1798 |
1801 #if DEBUG | 1799 #if DEBUG |
1802 void CompilationInfo::PrintAstForTesting() { | 1800 void CompilationInfo::PrintAstForTesting() { |
1803 PrintF("--- Source from AST ---\n%s\n", | 1801 PrintF("--- Source from AST ---\n%s\n", |
1804 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); | 1802 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); |
1805 } | 1803 } |
1806 #endif | 1804 #endif |
1807 } // namespace internal | 1805 } // namespace internal |
1808 } // namespace v8 | 1806 } // namespace v8 |
OLD | NEW |