Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 39d6dd2f8cb0acf632759e3f0c413b633d228313..5bf12dd425c635c3c61a52bd0a3e53bc5f8f1d3c 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -1585,6 +1585,7 @@ void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
+ CHECK(!has_new_target()); |
// The displacement is the offset of the last parameter (if any) |
// relative to the frame pointer. |
const int kDisplacement = |
@@ -1643,6 +1644,9 @@ void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
// sp[0] : number of parameters |
// sp[4] : receiver displacement |
// sp[8] : function |
+ |
+ CHECK(!has_new_target()); |
+ |
// Check if the calling frame is an arguments adaptor frame. |
Label runtime; |
__ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
@@ -1674,6 +1678,8 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
// t2 : allocated object (tagged) |
// t5 : mapped parameter count (tagged) |
+ CHECK(!has_new_target()); |
+ |
__ lw(a1, MemOperand(sp, 0 * kPointerSize)); |
// a1 = parameter count (tagged) |
@@ -1931,6 +1937,10 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
// Patch the arguments.length and the parameters pointer. |
__ bind(&adaptor_frame); |
__ lw(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ if (has_new_target()) { |
+ // Subtract 1 from smi-tagged arguments count. |
+ __ Subu(a1, a1, Operand(2)); |
+ } |
__ sw(a1, MemOperand(sp, 0)); |
__ sll(at, a1, kPointerSizeLog2 - kSmiTagSize); |
__ Addu(a3, a2, Operand(at)); |
@@ -2705,7 +2715,15 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
} |
// Pass function as original constructor. |
- __ mov(a3, a1); |
+ if (IsSuperConstructorCall()) { |
+ __ li(t0, Operand(1 * kPointerSize)); |
+ __ sll(at, a0, kPointerSizeLog2); |
+ __ Addu(t0, t0, Operand(at)); |
+ __ Addu(at, sp, Operand(t0)); |
+ __ lw(a3, MemOperand(at, 0)); |
+ } else { |
+ __ mov(a3, a1); |
+ } |
// Jump to the function-specific construct stub. |
Register jmp_reg = t0; |