| Index: src/builtins/s390/builtins-s390.cc
|
| diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc
|
| index 4f96de60c973ade3c9c2e33a77d951fb7f2d20db..8542cc4699291a1333c9205c8e5f1103bea72bcd 100644
|
| --- a/src/builtins/s390/builtins-s390.cc
|
| +++ b/src/builtins/s390/builtins-s390.cc
|
| @@ -1757,9 +1757,16 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
|
| __ TailCallRuntime(Runtime::kThrowIllegalInvocation);
|
| }
|
|
|
| -void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
|
| +static void Generate_OnStackReplacementHelper(MacroAssembler* masm,
|
| + bool has_handler_frame) {
|
| // Lookup the function in the JavaScript frame.
|
| - __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| + if (has_handler_frame) {
|
| + __ LoadP(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| + __ LoadP(r2, MemOperand(r2, JavaScriptFrameConstants::kFunctionOffset));
|
| + } else {
|
| + __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| + }
|
| +
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| // Pass function as argument.
|
| @@ -1767,7 +1774,7 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
|
| __ CallRuntime(Runtime::kCompileForOnStackReplacement);
|
| }
|
|
|
| - // If the code object is null, just return to the unoptimized code.
|
| + // If the code object is null, just return to the caller.
|
| Label skip;
|
| __ CmpSmiLiteral(r2, Smi::FromInt(0), r0);
|
| __ bne(&skip);
|
| @@ -1775,6 +1782,12 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
|
|
|
| __ bind(&skip);
|
|
|
| + // Drop any potential handler frame that is be sitting on top of the actual
|
| + // JavaScript frame. This is the case then OSR is triggered from bytecode.
|
| + if (has_handler_frame) {
|
| + __ LeaveFrame(StackFrame::STUB);
|
| + }
|
| +
|
| // Load deoptimization data from the code object.
|
| // <deopt_data> = <code>[#deoptimization_data_offset]
|
| __ LoadP(r3, FieldMemOperand(r2, Code::kDeoptimizationDataOffset));
|
| @@ -1796,6 +1809,14 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
|
| __ Ret();
|
| }
|
|
|
| +void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
|
| + Generate_OnStackReplacementHelper(masm, false);
|
| +}
|
| +
|
| +void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
|
| + Generate_OnStackReplacementHelper(masm, true);
|
| +}
|
| +
|
| // static
|
| void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
|
| int field_index) {
|
|
|