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

Unified Diff: src/runtime/runtime-test.cc

Issue 2230783004: [interpreter] Switch profiler to use frames for OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-preserve-bytecode-1
Patch Set: Fix frame type confusion. Created 4 years, 4 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/runtime-profiler.cc ('k') | test/mjsunit/compiler/osr-infinite.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index f6393a36169a3f4dec0b9766e0aa1e14af7129c3..1f1e0f4b4663b9bbc0b7318f47d095fba0030b69 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -143,37 +143,27 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
HandleScope scope(isolate);
+ DCHECK(args.length() == 0 || args.length() == 1);
- // This function is used by fuzzers, ignore calls with bogus arguments count.
- if (args.length() != 0 && args.length() != 1) {
- return isolate->heap()->undefined_value();
- }
+ Handle<JSFunction> function;
- Handle<JSFunction> function = Handle<JSFunction>::null();
- if (args.length() == 0) {
- // Find the JavaScript function on the top of the stack.
- JavaScriptFrameIterator it(isolate);
- if (!it.done()) function = Handle<JSFunction>(it.frame()->function());
- if (function.is_null()) return isolate->heap()->undefined_value();
- } else {
- // Function was passed as an argument.
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0);
- function = arg;
- }
+ // The optional parameter determines the frame being targeted.
+ int stack_depth = args.length() == 1 ? args.smi_at(0) : 0;
- // If function is interpreted but OSR hasn't been enabled, just return.
- if (function->shared()->HasBytecodeArray() && !FLAG_ignition_osr) {
- return isolate->heap()->undefined_value();
- }
+ // Find the JavaScript function on the top of the stack.
+ JavaScriptFrameIterator it(isolate);
+ while (!it.done() && stack_depth--) it.Advance();
+ if (!it.done()) function = Handle<JSFunction>(it.frame()->function());
+ if (function.is_null()) return isolate->heap()->undefined_value();
// If the function is already optimized, just return.
if (function->IsOptimized()) return isolate->heap()->undefined_value();
// Make the profiler arm all back edges in unoptimized code.
- if (function->shared()->HasBytecodeArray() ||
- function->shared()->HasBaselineCode()) {
+ if (it.frame()->type() == StackFrame::JAVA_SCRIPT ||
+ it.frame()->type() == StackFrame::INTERPRETED) {
isolate->runtime_profiler()->AttemptOnStackReplacement(
- *function, AbstractCode::kMaxLoopNestingMarker);
+ it.frame(), AbstractCode::kMaxLoopNestingMarker);
}
return isolate->heap()->undefined_value();
« no previous file with comments | « src/runtime-profiler.cc ('k') | test/mjsunit/compiler/osr-infinite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698