| Index: src/arm/code-stubs-arm.cc
|
| diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
|
| index af86e47a35f44bbca7559429624caa40e2af2242..f504b72fef7a3791c5ad590ddd25dbfc28fade25 100644
|
| --- a/src/arm/code-stubs-arm.cc
|
| +++ b/src/arm/code-stubs-arm.cc
|
| @@ -2395,9 +2395,31 @@
|
| }
|
|
|
|
|
| -static void EmitSlowCase(MacroAssembler* masm, int argc) {
|
| - __ mov(r0, Operand(argc));
|
| - __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
| +static void EmitSlowCase(MacroAssembler* masm,
|
| + int argc,
|
| + Label* non_function) {
|
| + // Check for function proxy.
|
| + __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE));
|
| + __ b(ne, non_function);
|
| + __ push(r1); // put proxy as additional argument
|
| + __ mov(r0, Operand(argc + 1, RelocInfo::NONE32));
|
| + __ mov(r2, Operand::Zero());
|
| + __ GetBuiltinFunction(r1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX);
|
| + {
|
| + Handle<Code> adaptor =
|
| + masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
|
| + __ Jump(adaptor, RelocInfo::CODE_TARGET);
|
| + }
|
| +
|
| + // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
|
| + // of the original receiver from the call site).
|
| + __ bind(non_function);
|
| + __ str(r1, MemOperand(sp, argc * kPointerSize));
|
| + __ mov(r0, Operand(argc)); // Set up the number of arguments.
|
| + __ mov(r2, Operand::Zero());
|
| + __ GetBuiltinFunction(r1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX);
|
| + __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
|
| + RelocInfo::CODE_TARGET);
|
| }
|
|
|
|
|
| @@ -2419,12 +2441,12 @@
|
| int argc, bool needs_checks,
|
| bool call_as_method) {
|
| // r1 : the function to call
|
| - Label slow, wrap, cont;
|
| + Label slow, non_function, wrap, cont;
|
|
|
| if (needs_checks) {
|
| // Check that the function is really a JavaScript function.
|
| // r1: pushed function (to be verified)
|
| - __ JumpIfSmi(r1, &slow);
|
| + __ JumpIfSmi(r1, &non_function);
|
|
|
| // Goto slow case if we do not have a function.
|
| __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
|
| @@ -2459,7 +2481,7 @@
|
| if (needs_checks) {
|
| // Slow-case: Non-function called.
|
| __ bind(&slow);
|
| - EmitSlowCase(masm, argc);
|
| + EmitSlowCase(masm, argc, &non_function);
|
| }
|
|
|
| if (call_as_method) {
|
| @@ -2593,8 +2615,13 @@
|
| GenerateMiss(masm);
|
|
|
| // The slow case, we need this no matter what to complete a call after a miss.
|
| - __ mov(r0, Operand(arg_count()));
|
| - __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
| + CallFunctionNoFeedback(masm,
|
| + arg_count(),
|
| + true,
|
| + CallAsMethod());
|
| +
|
| + // Unreachable.
|
| + __ stop("Unexpected code address");
|
| }
|
|
|
|
|
| @@ -2607,7 +2634,7 @@
|
| const int generic_offset =
|
| FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
|
| Label extra_checks_or_miss, slow_start;
|
| - Label slow, wrap, cont;
|
| + Label slow, non_function, wrap, cont;
|
| Label have_js_function;
|
| int argc = arg_count();
|
| ParameterCount actual(argc);
|
| @@ -2661,7 +2688,7 @@
|
| __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper());
|
|
|
| __ bind(&slow);
|
| - EmitSlowCase(masm, argc);
|
| + EmitSlowCase(masm, argc, &non_function);
|
|
|
| if (CallAsMethod()) {
|
| __ bind(&wrap);
|
| @@ -2748,7 +2775,7 @@
|
| __ bind(&slow_start);
|
| // Check that the function is really a JavaScript function.
|
| // r1: pushed function (to be verified)
|
| - __ JumpIfSmi(r1, &slow);
|
| + __ JumpIfSmi(r1, &non_function);
|
|
|
| // Goto slow case if we do not have a function.
|
| __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
|
|
|