Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: src/compiler.cc

Issue 10933088: Fix caching of optimized code for OSR. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2326.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 Handle<JSFunction> function = info->closure(); 749 if (FLAG_cache_optimized_code &&
750 if (FLAG_cache_optimized_code && code->kind() == Code::OPTIMIZED_FUNCTION) { 750 info->osr_ast_id().IsNone() &&
751 code->kind() == Code::OPTIMIZED_FUNCTION) {
752 Handle<JSFunction> function = info->closure();
751 Handle<SharedFunctionInfo> shared(function->shared()); 753 Handle<SharedFunctionInfo> shared(function->shared());
752 Handle<FixedArray> literals(function->literals()); 754 Handle<FixedArray> literals(function->literals());
753 Handle<Context> native_context(function->context()->native_context()); 755 Handle<Context> native_context(function->context()->native_context());
754 SharedFunctionInfo::AddToOptimizedCodeMap( 756 SharedFunctionInfo::AddToOptimizedCodeMap(
755 shared, native_context, code, literals); 757 shared, native_context, code, literals);
756 } 758 }
757 } 759 }
758 760
759 761
760 static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) { 762 static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) {
761 if (FLAG_cache_optimized_code && info->IsOptimizing()) { 763 if (FLAG_cache_optimized_code &&
764 info->osr_ast_id().IsNone() &&
765 info->IsOptimizing()) {
762 Handle<SharedFunctionInfo> shared = info->shared_info(); 766 Handle<SharedFunctionInfo> shared = info->shared_info();
763 Handle<JSFunction> function = info->closure(); 767 Handle<JSFunction> function = info->closure();
764 ASSERT(!function.is_null()); 768 ASSERT(!function.is_null());
765 Handle<Context> native_context(function->context()->native_context()); 769 Handle<Context> native_context(function->context()->native_context());
766 int index = shared->SearchOptimizedCodeMap(*native_context); 770 int index = shared->SearchOptimizedCodeMap(*native_context);
767 if (index > 0) { 771 if (index > 0) {
768 if (FLAG_trace_opt) { 772 if (FLAG_trace_opt) {
769 PrintF("[found optimized code for: "); 773 PrintF("[found optimized code for: ");
770 function->PrintName(); 774 function->PrintName();
771 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(*function)); 775 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(*function));
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1047 }
1044 } 1048 }
1045 1049
1046 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1050 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1047 Handle<Script>(info->script()), 1051 Handle<Script>(info->script()),
1048 Handle<Code>(info->code()), 1052 Handle<Code>(info->code()),
1049 info)); 1053 info));
1050 } 1054 }
1051 1055
1052 } } // namespace v8::internal 1056 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2326.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698