Commit 4f53c5b7 authored by akos.palfi's avatar akos.palfi Committed by Commit bot

MIPS: Fix 'MIPS: [es6] implement Reflect.apply() & Reflect.construct()'

Port d21fd154

TEST=mjsunit/harmony/reflect-construct
BUG=

Review URL: https://codereview.chromium.org/1022053002

Cr-Commit-Position: refs/heads/master@{#27347}
parent 0f573464
...@@ -1432,6 +1432,7 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { ...@@ -1432,6 +1432,7 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
__ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
} }
// Returns the result in v0.
Generate_CheckStackOverflow(masm, kFunctionOffset); Generate_CheckStackOverflow(masm, kFunctionOffset);
// Push current limit and index. // Push current limit and index.
...@@ -1536,7 +1537,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1536,7 +1537,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
const int kStackSize = kFormalParameters + 1; const int kStackSize = kFormalParameters + 1;
{ {
FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); FrameScope frame_scope(masm, StackFrame::INTERNAL);
const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize;
const int kArgumentsOffset = kNewTargetOffset + kPointerSize; const int kArgumentsOffset = kNewTargetOffset + kPointerSize;
const int kFunctionOffset = kArgumentsOffset + kPointerSize; const int kFunctionOffset = kArgumentsOffset + kPointerSize;
...@@ -1557,8 +1558,10 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1557,8 +1558,10 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
__ push(a0); __ push(a0);
__ lw(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target __ lw(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target
__ push(a0); __ push(a0);
// Returns argument count in v0.
__ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION);
// Returns result in v0.
Generate_CheckStackOverflow(masm, kFunctionOffset); Generate_CheckStackOverflow(masm, kFunctionOffset);
// Push current limit and index. // Push current limit and index.
...@@ -1591,8 +1594,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1591,8 +1594,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
// Leave internal frame. // Leave internal frame.
} }
__ Addu(sp, sp, Operand(kStackSize * kPointerSize)); __ jr(ra);
__ Jump(ra); __ Addu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot.
} }
......
...@@ -1440,6 +1440,7 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { ...@@ -1440,6 +1440,7 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
__ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
} }
// Returns the result in v0.
Generate_CheckStackOverflow(masm, kFunctionOffset); Generate_CheckStackOverflow(masm, kFunctionOffset);
// Push current limit and index. // Push current limit and index.
...@@ -1544,7 +1545,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1544,7 +1545,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
const int kStackSize = kFormalParameters + 1; const int kStackSize = kFormalParameters + 1;
{ {
FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); FrameScope frame_scope(masm, StackFrame::INTERNAL);
const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize;
const int kArgumentsOffset = kNewTargetOffset + kPointerSize; const int kArgumentsOffset = kNewTargetOffset + kPointerSize;
const int kFunctionOffset = kArgumentsOffset + kPointerSize; const int kFunctionOffset = kArgumentsOffset + kPointerSize;
...@@ -1565,8 +1566,10 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1565,8 +1566,10 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
__ push(a0); __ push(a0);
__ ld(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target __ ld(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target
__ push(a0); __ push(a0);
// Returns argument count in v0.
__ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION);
// Returns result in v0.
Generate_CheckStackOverflow(masm, kFunctionOffset); Generate_CheckStackOverflow(masm, kFunctionOffset);
// Push current limit and index. // Push current limit and index.
...@@ -1599,8 +1602,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1599,8 +1602,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
// Leave internal frame. // Leave internal frame.
} }
__ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); __ jr(ra);
__ Jump(ra); __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot.
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment