Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 7079dc9f775aed5079812e44e94203827066916f..148a53d1505daeefcdc532e863a80fd90d0792e6 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2144,11 +2144,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. |
@@ -2181,7 +2185,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); |
@@ -2198,6 +2202,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); |
@@ -2208,6 +2213,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 = |