Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index 4730ed14d59142c9fd3d532de071ccd4a1a8c99b..1960c3c10824c0f17c0cf486938c0d266cc8bb5e 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -1408,14 +1408,21 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
+ // Lookup the function in the JavaScript frame. |
__ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
- |
- // Pass the function to optimize as the argument to the on-stack |
- // replacement runtime function. |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Lookup and calculate pc offset. |
+ __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerPCOffset)); |
+ __ movq(rbx, FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset)); |
+ __ subq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
+ __ subq(rdx, FieldOperand(rbx, SharedFunctionInfo::kCodeOffset)); |
+ __ Integer32ToSmi(rdx, rdx); |
+ |
+ // Pass both function and pc offset as arguments. |
__ push(rax); |
- __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
+ __ push(rdx); |
+ __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); |
} |
Label skip; |