Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 2c0cab0ce9f9a4aa5ed4be8cd60544d210d012ac..6a4cbd6ac76c702342fc9e1254b198e9df1604b5 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -8583,8 +8583,21 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { |
RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { |
HandleScope scope(isolate); |
- ASSERT(args.length() == 1); |
+ ASSERT(args.length() == 2); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
+ CONVERT_NUMBER_CHECKED(uint32_t, pc_offset, Uint32, args[1]); |
+ |
+#ifdef DEBUG |
+ JavaScriptFrameIterator it(isolate); |
+ JavaScriptFrame* frame = it.frame(); |
+ Handle<Code> unoptimized(function->shared()->code(), isolate); |
+ ASSERT_EQ(frame->function(), *function); |
+ ASSERT_EQ(frame->LookupCode(), *unoptimized); |
+ ASSERT(unoptimized->contains(frame->pc())); |
+ |
+ ASSERT(pc_offset == |
+ static_cast<uint32_t>(frame->pc() - unoptimized->instruction_start())); |
+#endif // DEBUG |
// We're not prepared to handle a function with arguments object. |
ASSERT(!function->shared()->uses_arguments()); |
@@ -8593,8 +8606,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { |
// the unoptimized code can jump into. |
Handle<Code> code = |
(FLAG_concurrent_recompilation && FLAG_concurrent_osr) |
- ? Compiler::CompileForConcurrentOSR(function) |
- : Compiler::CompileForOnStackReplacement(function); |
+ ? Compiler::CompileForConcurrentOSR(function, pc_offset) |
+ : Compiler::CompileForOnStackReplacement(function, pc_offset); |
if (!code.is_null()) { |
#if DEBUG |
ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); |