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/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { | 808 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
809 Handle<Code> code = info->code(); | 809 Handle<Code> code = info->code(); |
810 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do. | 810 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do. |
811 | 811 |
812 // Function context specialization folds-in the function context, | 812 // Function context specialization folds-in the function context, |
813 // so no sharing can occur. | 813 // so no sharing can occur. |
814 if (info->is_function_context_specializing()) return; | 814 if (info->is_function_context_specializing()) return; |
815 // Frame specialization implies function context specialization. | 815 // Frame specialization implies function context specialization. |
816 DCHECK(!info->is_frame_specializing()); | 816 DCHECK(!info->is_frame_specializing()); |
817 | 817 |
818 // Do not cache bound functions. | 818 // Cache optimized context-specific code. |
819 Handle<JSFunction> function = info->closure(); | 819 Handle<JSFunction> function = info->closure(); |
820 if (function->shared()->bound()) return; | |
821 | |
822 // Cache optimized context-specific code. | |
823 Handle<SharedFunctionInfo> shared(function->shared()); | 820 Handle<SharedFunctionInfo> shared(function->shared()); |
824 Handle<LiteralsArray> literals(function->literals()); | 821 Handle<LiteralsArray> literals(function->literals()); |
825 Handle<Context> native_context(function->context()->native_context()); | 822 Handle<Context> native_context(function->context()->native_context()); |
826 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 823 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
827 literals, info->osr_ast_id()); | 824 literals, info->osr_ast_id()); |
828 | 825 |
829 // Do not cache (native) context-independent code compiled for OSR. | 826 // Do not cache (native) context-independent code compiled for OSR. |
830 if (code->is_turbofanned() && info->is_osr()) return; | 827 if (code->is_turbofanned() && info->is_osr()) return; |
831 | 828 |
832 // Cache optimized (native) context-independent code. | 829 // Cache optimized (native) context-independent code. |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 } | 1781 } |
1785 | 1782 |
1786 #if DEBUG | 1783 #if DEBUG |
1787 void CompilationInfo::PrintAstForTesting() { | 1784 void CompilationInfo::PrintAstForTesting() { |
1788 PrintF("--- Source from AST ---\n%s\n", | 1785 PrintF("--- Source from AST ---\n%s\n", |
1789 PrettyPrinter(isolate()).PrintProgram(literal())); | 1786 PrettyPrinter(isolate()).PrintProgram(literal())); |
1790 } | 1787 } |
1791 #endif | 1788 #endif |
1792 } // namespace internal | 1789 } // namespace internal |
1793 } // namespace v8 | 1790 } // namespace v8 |
OLD | NEW |