| Index: src/builtins/mips/builtins-mips.cc
|
| diff --git a/src/builtins/mips/builtins-mips.cc b/src/builtins/mips/builtins-mips.cc
|
| index 63c3329e24dcc8e566b8cd738eb3f3008f21e5cb..94d0ef643d7b72a4a30bee738f67fc988405696b 100644
|
| --- a/src/builtins/mips/builtins-mips.cc
|
| +++ b/src/builtins/mips/builtins-mips.cc
|
| @@ -1723,9 +1723,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.
|
| - __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| + if (has_handler_frame) {
|
| + __ lw(a0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| + __ lw(a0, MemOperand(a0, JavaScriptFrameConstants::kFunctionOffset));
|
| + } else {
|
| + __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| + }
|
| +
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| // Pass function as argument.
|
| @@ -1733,9 +1740,15 @@ 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.
|
| __ Ret(eq, v0, Operand(Smi::FromInt(0)));
|
|
|
| + // 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]
|
| __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
|
| @@ -1756,6 +1769,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) {
|
|
|