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

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: correctly upload stuff 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
« no previous file with comments | « src/optimizing-compiler-thread.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..c469a57dbff9de81e4a24b61e8d39c1964325dd4 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8680,11 +8680,23 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
ASSERT(!function->shared()->uses_arguments());
Handle<Code> result = Handle<Code>::null();
- BailoutId ast_id = BailoutId::None();
+ BailoutId ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset);
+ ASSERT(!ast_id.IsNone());
- if (isolate->concurrent_osr_enabled()) {
+ int cached_index = function->shared()->SearchOptimizedCodeMap(
+ function->context()->native_context(), ast_id);
+ if (cached_index != -1) {
+ if (FLAG_trace_osr) {
+ PrintF("[OSR - found cached code for ");
+ function->PrintName();
+ PrintF(" with OSR ast id %d]\n", ast_id.ToInt());
+ }
+ // TODO(titzer): don't install the OSR code into the function.
+ function->shared()->InstallFromOptimizedCodeMap(*function, cached_index);
Toon Verwaest 2013/12/04 13:06:25 I'd prefer to have a single choke-point that sets
+ result = Handle<Code>(function->code());
+ } else if (isolate->concurrent_osr_enabled()) {
if (isolate->optimizing_compiler_thread()->
- IsQueuedForOSR(function, pc_offset)) {
+ IsQueuedForOSR(function, ast_id)) {
// Still waiting for the optimizing compiler thread to finish. Carry on.
if (FLAG_trace_osr) {
PrintF("[COSR - polling recompile tasks for ");
@@ -8695,11 +8707,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
}
RecompileJob* job = isolate->optimizing_compiler_thread()->
- FindReadyOSRCandidate(function, pc_offset);
+ FindReadyOSRCandidate(function, ast_id);
if (job == NULL) {
if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) &&
- Compiler::RecompileConcurrent(function, pc_offset)) {
+ Compiler::RecompileConcurrent(function, ast_id)) {
if (function->IsMarkedForLazyRecompilation() ||
function->IsMarkedForConcurrentRecompilation()) {
// Prevent regular recompilation if we queue this for OSR.
@@ -8715,8 +8727,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
result = Compiler::InstallOptimizedCode(job);
}
} else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) {
- ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset);
- ASSERT(!ast_id.IsNone());
if (FLAG_trace_osr) {
PrintF("[OSR - replacing at AST id %d in ", ast_id.ToInt());
function->PrintName();
« no previous file with comments | « src/optimizing-compiler-thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698