Chromium Code Reviews| Index: src/arm/code-stubs-arm.cc |
| diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
| index ced550b59ad6fb2c718a96257781758e084efdb5..78afc46c6e1ea8e1dbdba592e05655a48dd58276 100644 |
| --- a/src/arm/code-stubs-arm.cc |
| +++ b/src/arm/code-stubs-arm.cc |
| @@ -2528,22 +2528,35 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
| // r0: number of arguments |
| // r1: called object |
| // r5: object type |
| - Label do_call; |
| __ bind(&slow); |
| - __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); |
| - __ b(ne, &non_function_call); |
| - __ GetBuiltinFunction( |
| - r1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX); |
| - __ jmp(&do_call); |
| - |
| - __ bind(&non_function_call); |
| - __ GetBuiltinFunction( |
| - r1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); |
| - __ bind(&do_call); |
| - // Set expected number of arguments to zero (not changing r0). |
| - __ mov(r2, Operand::Zero()); |
| - __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| - RelocInfo::CODE_TARGET); |
| + { |
| + // 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). |
| + __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
|
Michael Starzinger
2015/09/11 09:17:37
This is confusing. Why do we suddenly need to patc
Benedikt Meurer
2015/09/11 09:20:28
You're right, receiver stays the same.
|
| + |
| + __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); |
| + __ b(ne, &non_function_call); |
| + // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| + __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset)); |
| + __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| + |
| + __ bind(&non_function_call); |
| + { |
| + // Determine the delegate for the target (if any). |
| + FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| + __ SmiTag(r0); |
| + __ Push(r0, r1); |
| + __ CallRuntime(Runtime::kGetConstructorDelegate, 1); |
| + __ mov(r1, r0); |
| + __ Pop(r0); |
| + __ SmiUntag(r0); |
| + } |
| + // The delegate is always a regular function. |
| + __ AssertFunction(r1); |
| + __ Jump(masm->isolate()->builtins()->CallFunction(), |
| + RelocInfo::CODE_TARGET); |
| + } |
| } |