Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index 959160a4827ad9529faac3d2bbbcd29d295f3a81..9eae32ab2f122a65ec800e165ec247fc5b156b2f 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -1834,11 +1834,15 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
void CallConstructStub::Generate(MacroAssembler* masm) { |
// eax : number of arguments |
// ebx : feedback vector |
- // edx : (only if ebx is not the megamorphic symbol) slot in feedback |
- // vector (Smi) |
+ // ecx : original constructor (for IsSuperConstructorCall) |
+ // edx : slot in feedback vector (Smi, for RecordCallTarget) |
// edi : constructor function |
Label slow, non_function_call; |
+ if (IsSuperConstructorCall()) { |
+ __ push(ecx); |
+ } |
+ |
// Check that function is not a smi. |
__ JumpIfSmi(edi, &non_function_call); |
// Check that function is a JSFunction. |
@@ -1871,7 +1875,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
} |
if (IsSuperConstructorCall()) { |
- __ mov(edx, Operand(esp, eax, times_pointer_size, 2 * kPointerSize)); |
+ __ pop(edx); |
} else { |
// Pass original constructor to construct stub. |
__ mov(edx, edi); |
@@ -1888,6 +1892,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
// edi: called object |
// eax: number of arguments |
// ecx: object map |
+ // esp[0]: original receiver |
Label do_call; |
__ bind(&slow); |
__ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); |
@@ -1898,6 +1903,9 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ bind(&non_function_call); |
__ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
__ bind(&do_call); |
+ if (IsSuperConstructorCall()) { |
+ __ Drop(1); |
+ } |
// Set expected number of arguments to zero (not changing eax). |
__ Move(ebx, Immediate(0)); |
Handle<Code> arguments_adaptor = |