| Index: src/ia32/code-stubs-ia32.cc
|
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
|
| index 9d7a66850ece98ef11976ce2771ffe4d0782e542..7228d438f3220096466b582857fb6ba365f54fa7 100644
|
| --- a/src/ia32/code-stubs-ia32.cc
|
| +++ b/src/ia32/code-stubs-ia32.cc
|
| @@ -2178,26 +2178,39 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
|
| // eax: number of arguments
|
| // ecx: object map
|
| // esp[0]: original receiver (for IsSuperConstructorCall)
|
| - Label do_call;
|
| __ bind(&slow);
|
| - __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
|
| - __ j(not_equal, &non_function_call);
|
| - __ GetBuiltinEntry(edx,
|
| - Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
|
| - __ jmp(&do_call);
|
| -
|
| - __ bind(&non_function_call);
|
| - __ GetBuiltinEntry(edx,
|
| - Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
|
| - __ bind(&do_call);
|
| - if (IsSuperConstructorCall()) {
|
| - __ Drop(1);
|
| + {
|
| + // Overwrite the original receiver with the (original) target (not necessary
|
| + // in case of rdi being smi, when we jump directly to non_function_call
|
| + // below).
|
| + __ mov(Operand(esp, eax, times_pointer_size,
|
| + (IsSuperConstructorCall() ? 2 : 1) * kPointerSize),
|
| + edi);
|
| +
|
| + __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
|
| + __ j(not_equal, &non_function_call, Label::kNear);
|
| + if (IsSuperConstructorCall()) __ Drop(1);
|
| + // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
| + __ mov(edi, FieldOperand(edi, JSFunctionProxy::kConstructTrapOffset));
|
| + __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
| +
|
| + __ bind(&non_function_call);
|
| + if (IsSuperConstructorCall()) __ Drop(1);
|
| + {
|
| + // Determine the delegate for the target (if any).
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| + __ SmiTag(eax);
|
| + __ Push(eax);
|
| + __ Push(edi);
|
| + __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
|
| + __ mov(edi, eax);
|
| + __ Pop(eax);
|
| + __ SmiUntag(eax);
|
| + }
|
| + // The delegate is always a regular function.
|
| + __ AssertFunction(edi);
|
| + __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
|
| }
|
| - // Set expected number of arguments to zero (not changing eax).
|
| - __ Move(ebx, Immediate(0));
|
| - Handle<Code> arguments_adaptor =
|
| - isolate()->builtins()->ArgumentsAdaptorTrampoline();
|
| - __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET);
|
| }
|
|
|
|
|
|
|