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

Unified Diff: src/compiler.cc

Issue 100613004: Use optimized code map to cache OSR code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove extra slot per entry for osr ast id. Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 83f9ab2daffb78830e80a50e4aefe2aa171af624..d4a48b4c745fab92d66736614e4b8a37f6976177 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -964,14 +964,14 @@ static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
Handle<Code> code = info->code();
if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do.
- // Cache non-OSR optimized code.
- if (FLAG_cache_optimized_code && !info->is_osr()) {
+ // Cache optimized code.
+ if (FLAG_cache_optimized_code) {
Handle<JSFunction> function = info->closure();
Handle<SharedFunctionInfo> shared(function->shared());
Handle<FixedArray> literals(function->literals());
Handle<Context> native_context(function->context()->native_context());
SharedFunctionInfo::AddToOptimizedCodeMap(
- shared, native_context, code, literals);
+ shared, native_context, code, literals, info->osr_ast_id());
}
}
@@ -979,21 +979,26 @@ static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) {
if (!info->IsOptimizing()) return false; // Nothing to look up.
- // Lookup non-OSR optimized code.
- if (FLAG_cache_optimized_code && !info->is_osr()) {
+ // Lookup optimized code.
+ if (FLAG_cache_optimized_code) {
Handle<SharedFunctionInfo> shared = info->shared_info();
Handle<JSFunction> function = info->closure();
ASSERT(!function.is_null());
Handle<Context> native_context(function->context()->native_context());
- int index = shared->SearchOptimizedCodeMap(*native_context);
+ int index = shared->SearchOptimizedCodeMap(*native_context,
+ info->osr_ast_id());
if (index > 0) {
if (FLAG_trace_opt) {
PrintF("[found optimized code for ");
function->ShortPrint();
+ if (info->is_osr()) {
+ PrintF(" with osr ast id %d ", info->osr_ast_id().ToInt());
+ }
PrintF("]\n");
}
// Caching of optimized code enabled and optimized code found.
shared->InstallFromOptimizedCodeMap(*function, index);
+ info->SetCode(Handle<Code>(function->code()));
return true;
}
}
@@ -1102,7 +1107,7 @@ bool Compiler::RecompileConcurrent(Handle<JSFunction> closure,
{
CompilationHandleScope handle_scope(*info);
- if (!compiling_for_osr && InstallCodeFromOptimizedCodeMap(*info)) {
+ if (InstallCodeFromOptimizedCodeMap(*info)) {
return true;
}
@@ -1178,7 +1183,8 @@ Handle<Code> Compiler::InstallOptimizedCode(RecompileJob* job) {
ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate));
info->closure()->ReplaceCode(*code);
if (info->shared_info()->SearchOptimizedCodeMap(
- info->closure()->context()->native_context()) == -1) {
+ info->closure()->context()->native_context(),
+ info->osr_ast_id()) == -1) {
InsertCodeIntoOptimizedCodeMap(*info);
}
if (FLAG_trace_concurrent_recompilation) {
« src/code-stubs-hydrogen.cc ('K') | « src/code-stubs-hydrogen.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698