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

Unified Diff: src/runtime-profiler.cc

Issue 2172583002: [interpreter] Add OSR nesting level to bytecode header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime-profiler.cc
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
index 6500b9acb83f06065a08ff6171b050c5c8973c9d..f3fad9201b6bbf444e96dac2995a2be3a4ed99f2 100644
--- a/src/runtime-profiler.cc
+++ b/src/runtime-profiler.cc
@@ -143,17 +143,29 @@ void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function,
// arguments accesses, which is unsound. Don't try OSR.
if (shared->uses_arguments()) return;
- // We're using on-stack replacement: patch the unoptimized code so that
- // any back edge in any unoptimized frame will trigger on-stack
+ // We're using on-stack replacement: modify unoptimized code so that
+ // certain back edges in any unoptimized frame will trigger on-stack
// replacement for that frame.
+ // - Ignition: Store new loop nesting level in BytecodeArray header.
+ // - FullCodegen: Patch back edges up to new level using BackEdgeTable.
if (FLAG_trace_osr) {
- PrintF("[OSR - patching back edges in ");
+ PrintF("[OSR - arming back edges in ");
function->PrintName();
PrintF("]\n");
}
- for (int i = 0; i < loop_nesting_levels; i++) {
- BackEdgeTable::Patch(isolate_, shared->code());
+ if (shared->code()->kind() == Code::FUNCTION) {
+ DCHECK(BackEdgeTable::Verify(shared->GetIsolate(), shared->code()));
+ for (int i = 0; i < loop_nesting_levels; i++) {
+ BackEdgeTable::Patch(isolate_, shared->code());
+ }
+ } else if (shared->HasBytecodeArray()) {
+ DCHECK(FLAG_ignition_osr); // Should only happen when enabled.
+ int level = shared->bytecode_array()->osr_loop_nesting_level();
+ shared->bytecode_array()->set_osr_loop_nesting_level(
+ Min(level + loop_nesting_levels, AbstractCode::kMaxLoopNestingMarker));
+ } else {
+ UNREACHABLE();
}
}
@@ -166,7 +178,7 @@ void RuntimeProfiler::MaybeOptimizeFullCodegen(JSFunction* function,
if (function->IsInOptimizationQueue()) return;
if (FLAG_always_osr) {
- AttemptOnStackReplacement(function, Code::kMaxLoopNestingMarker);
+ AttemptOnStackReplacement(function, AbstractCode::kMaxLoopNestingMarker);
// Fall through and do a normal optimized compile as well.
} else if (!frame_optimized &&
(function->IsMarkedForOptimization() ||
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698