| Index: src/arm/macro-assembler-arm.cc
|
| diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
|
| index d3d85dbcd43250e5930fc7c7ced1b4516c7c4f50..9894ff202e6d1b87e98b20ce60268ff336ae3273 100644
|
| --- a/src/arm/macro-assembler-arm.cc
|
| +++ b/src/arm/macro-assembler-arm.cc
|
| @@ -957,10 +957,12 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
| Handle<Code> code_constant,
|
| Register code_reg,
|
| Label* done,
|
| + bool* definitely_mismatches,
|
| InvokeFlag flag,
|
| const CallWrapper& call_wrapper,
|
| CallKind call_kind) {
|
| bool definitely_matches = false;
|
| + *definitely_mismatches = false;
|
| Label regular_invoke;
|
|
|
| // Check whether the expected and actual arguments count match. If not,
|
| @@ -991,6 +993,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
| // arguments.
|
| definitely_matches = true;
|
| } else {
|
| + *definitely_mismatches = true;
|
| mov(r2, Operand(expected.immediate()));
|
| }
|
| }
|
| @@ -1018,7 +1021,9 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
| SetCallKind(r5, call_kind);
|
| Call(adaptor);
|
| call_wrapper.AfterCall();
|
| - b(done);
|
| + if (!*definitely_mismatches) {
|
| + b(done);
|
| + }
|
| } else {
|
| SetCallKind(r5, call_kind);
|
| Jump(adaptor, RelocInfo::CODE_TARGET);
|
| @@ -1038,23 +1043,26 @@ void MacroAssembler::InvokeCode(Register code,
|
| ASSERT(flag == JUMP_FUNCTION || has_frame());
|
|
|
| Label done;
|
| -
|
| - InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag,
|
| + bool definitely_mismatches = false;
|
| + InvokePrologue(expected, actual, Handle<Code>::null(), code,
|
| + &done, &definitely_mismatches, flag,
|
| call_wrapper, call_kind);
|
| - if (flag == CALL_FUNCTION) {
|
| - call_wrapper.BeforeCall(CallSize(code));
|
| - SetCallKind(r5, call_kind);
|
| - Call(code);
|
| - call_wrapper.AfterCall();
|
| - } else {
|
| - ASSERT(flag == JUMP_FUNCTION);
|
| - SetCallKind(r5, call_kind);
|
| - Jump(code);
|
| - }
|
| + if (!definitely_mismatches) {
|
| + if (flag == CALL_FUNCTION) {
|
| + call_wrapper.BeforeCall(CallSize(code));
|
| + SetCallKind(r5, call_kind);
|
| + Call(code);
|
| + call_wrapper.AfterCall();
|
| + } else {
|
| + ASSERT(flag == JUMP_FUNCTION);
|
| + SetCallKind(r5, call_kind);
|
| + Jump(code);
|
| + }
|
|
|
| - // Continue here if InvokePrologue does handle the invocation due to
|
| - // mismatched parameter counts.
|
| - bind(&done);
|
| + // Continue here if InvokePrologue does handle the invocation due to
|
| + // mismatched parameter counts.
|
| + bind(&done);
|
| + }
|
| }
|
|
|
|
|
| @@ -1068,20 +1076,23 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
|
| ASSERT(flag == JUMP_FUNCTION || has_frame());
|
|
|
| Label done;
|
| -
|
| - InvokePrologue(expected, actual, code, no_reg, &done, flag,
|
| + bool definitely_mismatches = false;
|
| + InvokePrologue(expected, actual, code, no_reg,
|
| + &done, &definitely_mismatches, flag,
|
| NullCallWrapper(), call_kind);
|
| - if (flag == CALL_FUNCTION) {
|
| - SetCallKind(r5, call_kind);
|
| - Call(code, rmode);
|
| - } else {
|
| - SetCallKind(r5, call_kind);
|
| - Jump(code, rmode);
|
| - }
|
| + if (!definitely_mismatches) {
|
| + if (flag == CALL_FUNCTION) {
|
| + SetCallKind(r5, call_kind);
|
| + Call(code, rmode);
|
| + } else {
|
| + SetCallKind(r5, call_kind);
|
| + Jump(code, rmode);
|
| + }
|
|
|
| - // Continue here if InvokePrologue does handle the invocation due to
|
| - // mismatched parameter counts.
|
| - bind(&done);
|
| + // Continue here if InvokePrologue does handle the invocation due to
|
| + // mismatched parameter counts.
|
| + bind(&done);
|
| + }
|
| }
|
|
|
|
|
| @@ -1116,6 +1127,7 @@ void MacroAssembler::InvokeFunction(Register fun,
|
| void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
|
| const ParameterCount& actual,
|
| InvokeFlag flag,
|
| + const CallWrapper& call_wrapper,
|
| CallKind call_kind) {
|
| // You can't call a function without a valid frame.
|
| ASSERT(flag == JUMP_FUNCTION || has_frame());
|
| @@ -1129,7 +1141,7 @@ void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
|
| // allow recompilation to take effect without changing any of the
|
| // call sites.
|
| ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
|
| - InvokeCode(r3, expected, actual, flag, NullCallWrapper(), call_kind);
|
| + InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind);
|
| }
|
|
|
|
|
|
|