OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 // function info, e.g., we might have flushed the code and must | 739 // function info, e.g., we might have flushed the code and must |
740 // reset this bit when lazy compiling the code again. | 740 // reset this bit when lazy compiling the code again. |
741 if (shared->optimization_disabled()) code->set_optimizable(false); | 741 if (shared->optimization_disabled()) code->set_optimizable(false); |
742 | 742 |
743 Compiler::RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); | 743 Compiler::RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); |
744 } | 744 } |
745 | 745 |
746 | 746 |
747 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { | 747 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
748 Handle<Code> code = info->code(); | 748 Handle<Code> code = info->code(); |
749 if (FLAG_cache_optimized_code && | 749 Handle<JSFunction> function = info->closure(); |
750 info->osr_ast_id().IsNone() && | 750 if (FLAG_cache_optimized_code && code->kind() == Code::OPTIMIZED_FUNCTION) { |
751 code->kind() == Code::OPTIMIZED_FUNCTION) { | |
752 Handle<JSFunction> function = info->closure(); | |
753 Handle<SharedFunctionInfo> shared(function->shared()); | 751 Handle<SharedFunctionInfo> shared(function->shared()); |
754 Handle<FixedArray> literals(function->literals()); | 752 Handle<FixedArray> literals(function->literals()); |
755 Handle<Context> native_context(function->context()->native_context()); | 753 Handle<Context> native_context(function->context()->native_context()); |
756 SharedFunctionInfo::AddToOptimizedCodeMap( | 754 SharedFunctionInfo::AddToOptimizedCodeMap( |
757 shared, native_context, code, literals); | 755 shared, native_context, code, literals); |
758 } | 756 } |
759 } | 757 } |
760 | 758 |
761 | 759 |
762 static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) { | 760 static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) { |
763 if (FLAG_cache_optimized_code && | 761 if (FLAG_cache_optimized_code && info->IsOptimizing()) { |
764 info->osr_ast_id().IsNone() && | |
765 info->IsOptimizing()) { | |
766 Handle<SharedFunctionInfo> shared = info->shared_info(); | 762 Handle<SharedFunctionInfo> shared = info->shared_info(); |
767 Handle<JSFunction> function = info->closure(); | 763 Handle<JSFunction> function = info->closure(); |
768 ASSERT(!function.is_null()); | 764 ASSERT(!function.is_null()); |
769 Handle<Context> native_context(function->context()->native_context()); | 765 Handle<Context> native_context(function->context()->native_context()); |
770 int index = shared->SearchOptimizedCodeMap(*native_context); | 766 int index = shared->SearchOptimizedCodeMap(*native_context); |
771 if (index > 0) { | 767 if (index > 0) { |
772 if (FLAG_trace_opt) { | 768 if (FLAG_trace_opt) { |
773 PrintF("[found optimized code for: "); | 769 PrintF("[found optimized code for: "); |
774 function->PrintName(); | 770 function->PrintName(); |
775 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(*function)); | 771 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(*function)); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 } | 1043 } |
1048 } | 1044 } |
1049 | 1045 |
1050 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1046 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
1051 Handle<Script>(info->script()), | 1047 Handle<Script>(info->script()), |
1052 Handle<Code>(info->code()), | 1048 Handle<Code>(info->code()), |
1053 info)); | 1049 info)); |
1054 } | 1050 } |
1055 | 1051 |
1056 } } // namespace v8::internal | 1052 } } // namespace v8::internal |
OLD | NEW |