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. |
| 819 Handle<JSFunction> function = info->closure(); |
| 820 if (function->shared()->bound()) return; |
| 821 |
818 // Cache optimized context-specific code. | 822 // Cache optimized context-specific code. |
819 Handle<JSFunction> function = info->closure(); | |
820 Handle<SharedFunctionInfo> shared(function->shared()); | 823 Handle<SharedFunctionInfo> shared(function->shared()); |
821 Handle<LiteralsArray> literals(function->literals()); | 824 Handle<LiteralsArray> literals(function->literals()); |
822 Handle<Context> native_context(function->context()->native_context()); | 825 Handle<Context> native_context(function->context()->native_context()); |
823 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 826 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
824 literals, info->osr_ast_id()); | 827 literals, info->osr_ast_id()); |
825 | 828 |
826 // Do not cache (native) context-independent code compiled for OSR. | 829 // Do not cache (native) context-independent code compiled for OSR. |
827 if (code->is_turbofanned() && info->is_osr()) return; | 830 if (code->is_turbofanned() && info->is_osr()) return; |
828 | 831 |
829 // Cache optimized (native) context-independent code. | 832 // Cache optimized (native) context-independent code. |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 } | 1784 } |
1782 | 1785 |
1783 #if DEBUG | 1786 #if DEBUG |
1784 void CompilationInfo::PrintAstForTesting() { | 1787 void CompilationInfo::PrintAstForTesting() { |
1785 PrintF("--- Source from AST ---\n%s\n", | 1788 PrintF("--- Source from AST ---\n%s\n", |
1786 PrettyPrinter(isolate()).PrintProgram(literal())); | 1789 PrettyPrinter(isolate()).PrintProgram(literal())); |
1787 } | 1790 } |
1788 #endif | 1791 #endif |
1789 } // namespace internal | 1792 } // namespace internal |
1790 } // namespace v8 | 1793 } // namespace v8 |
OLD | NEW |