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

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

Issue 906243002: Make it easier to test OSR with %OptimizeOsr() runtime call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/runtime.h ('k') | test/mjsunit/compiler/optimized-for-in.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 1778401210ccda2573a3f2aa7df5898441dd265f..89e1f2a69662fee8051345cdcc86e6047990c145 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -69,13 +69,8 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
Code* unoptimized = function->shared()->code();
if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) {
CONVERT_ARG_HANDLE_CHECKED(String, type, 1);
- if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("osr")) && FLAG_use_osr) {
- // Start patching from the currently patched loop nesting level.
- DCHECK(BackEdgeTable::Verify(isolate, unoptimized));
- isolate->runtime_profiler()->AttemptOnStackReplacement(
- *function, Code::kMaxLoopNestingMarker);
- } else if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) &&
- isolate->concurrent_recompilation_enabled()) {
+ if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) &&
+ isolate->concurrent_recompilation_enabled()) {
function->AttemptConcurrentOptimization();
}
}
@@ -84,6 +79,45 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
}
+RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
+ HandleScope scope(isolate);
+ RUNTIME_ASSERT(args.length() == 0);
+ Handle<JSFunction> function = Handle<JSFunction>::null();
+
+ {
+ // Find the JavaScript function on the top of the stack.
+ JavaScriptFrameIterator it(isolate);
+ while (!it.done()) {
+ if (it.frame()->is_java_script()) {
+ function = Handle<JSFunction>(it.frame()->function());
+ break;
+ }
+ }
+ if (function.is_null()) return isolate->heap()->undefined_value();
+ }
+
+ // The following assertion was lifted from the DCHECK inside
+ // JSFunction::MarkForOptimization().
+ RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
+ (function->code()->kind() == Code::FUNCTION &&
+ function->code()->optimizable()));
+
+ if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value();
+
+ // If the function is already optimized, just return.
+ if (function->IsOptimized()) return isolate->heap()->undefined_value();
+
+ Code* unoptimized = function->shared()->code();
+ if (unoptimized->kind() == Code::FUNCTION) {
+ DCHECK(BackEdgeTable::Verify(isolate, unoptimized));
+ isolate->runtime_profiler()->AttemptOnStackReplacement(
+ *function, Code::kMaxLoopNestingMarker);
+ }
+
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/compiler/optimized-for-in.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698