Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 819a30587a791c03a80983815f44965d8584f0ad..d42c0e4416e426407a60c866dedfb68d974f53c2 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -738,6 +738,7 @@ void LoadIndexedStringStub::Generate(MacroAssembler* masm) { |
void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
+ CHECK(!has_new_target()); |
// The key is in edx and the parameter count is in eax. |
DCHECK(edx.is(ArgumentsAccessReadDescriptor::index())); |
DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count())); |
@@ -804,6 +805,8 @@ void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
// esp[8] : receiver displacement |
// esp[12] : function |
+ CHECK(!has_new_target()); |
+ |
// Check if the calling frame is an arguments adaptor frame. |
Label runtime; |
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
@@ -832,6 +835,8 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
// ebx = parameter count (tagged) |
__ mov(ebx, Operand(esp, 1 * kPointerSize)); |
+ CHECK(!has_new_target()); |
+ |
// Check if the calling frame is an arguments adaptor frame. |
// TODO(rossberg): Factor out some of the bits that are shared with the other |
// Generate* functions. |
@@ -1071,9 +1076,15 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
// Patch the arguments.length and the parameters pointer. |
__ bind(&adaptor_frame); |
__ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
- __ mov(Operand(esp, 1 * kPointerSize), ecx); |
+ |
+ if (has_new_target()) { |
+ // Subtract 1 from smi-tagged arguments count. |
+ __ sub(ecx, Immediate(2)); |
+ } |
+ |
__ lea(edx, Operand(edx, ecx, times_2, |
StandardFrameConstants::kCallerSPOffset)); |
+ __ mov(Operand(esp, 1 * kPointerSize), ecx); |
__ mov(Operand(esp, 2 * kPointerSize), edx); |
// Try the new space allocation. Start out with computing the size of |
@@ -2149,8 +2160,12 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ AssertUndefinedOrAllocationSite(ebx); |
} |
- // Pass original constructor to construct stub. |
- __ mov(edx, edi); |
+ if (IsSuperConstructorCall()) { |
+ __ mov(edx, Operand(esp, eax, times_pointer_size, 2 * kPointerSize)); |
+ } else { |
+ // Pass original constructor to construct stub. |
+ __ mov(edx, edi); |
+ } |
// Jump to the function-specific construct stub. |
Register jmp_reg = ecx; |