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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« src/code-stubs-hydrogen.cc ('K') | « src/objects.cc ('k') | no next file » | 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 8687 matching lines...) Expand 10 before | Expand all | Expand 10 after
8698 FindReadyOSRCandidate(function, pc_offset); 8698 FindReadyOSRCandidate(function, pc_offset);
8699 8699
8700 if (job == NULL) { 8700 if (job == NULL) {
8701 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) && 8701 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) &&
8702 Compiler::RecompileConcurrent(function, pc_offset)) { 8702 Compiler::RecompileConcurrent(function, pc_offset)) {
8703 if (function->IsMarkedForLazyRecompilation() || 8703 if (function->IsMarkedForLazyRecompilation() ||
8704 function->IsMarkedForConcurrentRecompilation()) { 8704 function->IsMarkedForConcurrentRecompilation()) {
8705 // Prevent regular recompilation if we queue this for OSR. 8705 // Prevent regular recompilation if we queue this for OSR.
8706 // TODO(yangguo): remove this as soon as OSR becomes one-shot. 8706 // TODO(yangguo): remove this as soon as OSR becomes one-shot.
8707 function->ReplaceCode(*unoptimized); 8707 function->ReplaceCode(*unoptimized);
8708 } else if (function->IsOptimized() &&
8709 !isolate->optimizing_compiler_thread()->
8710 IsQueuedForOSR(function, pc_offset)) {
8711 // Function has already been optimized and no OSR job has been queued.
8712 // This means that we have found cached code.
8713 result = Handle<Code>(function->code());
8714 ast_id = result->OsrAstId();
8715 ASSERT(!ast_id.IsNone());
8716 ASSERT_EQ(ast_id.ToInt(),
8717 unoptimized->TranslatePcOffsetToAstId(pc_offset).ToInt());
8718 // Fall through to the part where we use the OSR code.
8719 } else {
8720 return NULL;
8708 } 8721 }
8709 return NULL;
8710 } 8722 }
8711 // Fall through to the end in case of failure. 8723 // Fall through to the end in case of failure.
8712 } else { 8724 } else {
8713 // TODO(titzer): don't install the OSR code into the function. 8725 // TODO(titzer): don't install the OSR code into the function.
8714 ast_id = job->info()->osr_ast_id(); 8726 ast_id = job->info()->osr_ast_id();
8715 result = Compiler::InstallOptimizedCode(job); 8727 result = Compiler::InstallOptimizedCode(job);
8716 } 8728 }
8717 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { 8729 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) {
8718 ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset); 8730 ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset);
8719 ASSERT(!ast_id.IsNone()); 8731 ASSERT(!ast_id.IsNone());
(...skipping 6195 matching lines...) Expand 10 before | Expand all | Expand 10 after
14915 // Handle last resort GC and make sure to allow future allocations 14927 // Handle last resort GC and make sure to allow future allocations
14916 // to grow the heap without causing GCs (if possible). 14928 // to grow the heap without causing GCs (if possible).
14917 isolate->counters()->gc_last_resort_from_js()->Increment(); 14929 isolate->counters()->gc_last_resort_from_js()->Increment();
14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14930 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14919 "Runtime::PerformGC"); 14931 "Runtime::PerformGC");
14920 } 14932 }
14921 } 14933 }
14922 14934
14923 14935
14924 } } // namespace v8::internal 14936 } } // namespace v8::internal
OLDNEW
« 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