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

Unified Diff: src/runtime.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
« src/code-stubs-hydrogen.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 7dc96f201970eec90466b79f20fa2823271fe737..3d447ae28040492507a86337c9554d66a949c097 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8705,8 +8705,20 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
// Prevent regular recompilation if we queue this for OSR.
// TODO(yangguo): remove this as soon as OSR becomes one-shot.
function->ReplaceCode(*unoptimized);
+ } else if (function->IsOptimized() &&
+ !isolate->optimizing_compiler_thread()->
+ IsQueuedForOSR(function, pc_offset)) {
+ // Function has already been optimized and no OSR job has been queued.
+ // This means that we have found cached code.
+ result = Handle<Code>(function->code());
+ ast_id = result->OsrAstId();
+ ASSERT(!ast_id.IsNone());
+ ASSERT_EQ(ast_id.ToInt(),
+ unoptimized->TranslatePcOffsetToAstId(pc_offset).ToInt());
+ // Fall through to the part where we use the OSR code.
+ } else {
+ return NULL;
}
- return NULL;
}
// Fall through to the end in case of failure.
} else {
« src/code-stubs-hydrogen.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698