Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index 2f1c3fea8543e12e0aaf58975f2bb728ba018e1c..2d6bd08139884c9980fd1c61d74675b95dc81c55 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -3030,26 +3030,30 @@ void MacroAssembler::InvokeCode(Register code, |
ASSERT(flag == JUMP_FUNCTION || has_frame()); |
Label done; |
+ bool definitely_mismatches = false; |
InvokePrologue(expected, |
actual, |
Handle<Code>::null(), |
code, |
&done, |
+ &definitely_mismatches, |
flag, |
Label::kNear, |
call_wrapper, |
call_kind); |
- if (flag == CALL_FUNCTION) { |
- call_wrapper.BeforeCall(CallSize(code)); |
- SetCallKind(rcx, call_kind); |
- call(code); |
- call_wrapper.AfterCall(); |
- } else { |
- ASSERT(flag == JUMP_FUNCTION); |
- SetCallKind(rcx, call_kind); |
- jmp(code); |
+ if (!definitely_mismatches) { |
+ if (flag == CALL_FUNCTION) { |
+ call_wrapper.BeforeCall(CallSize(code)); |
+ SetCallKind(rcx, call_kind); |
+ call(code); |
+ call_wrapper.AfterCall(); |
+ } else { |
+ ASSERT(flag == JUMP_FUNCTION); |
+ SetCallKind(rcx, call_kind); |
+ jmp(code); |
+ } |
+ bind(&done); |
} |
- bind(&done); |
} |
@@ -3064,27 +3068,31 @@ void MacroAssembler::InvokeCode(Handle<Code> code, |
ASSERT(flag == JUMP_FUNCTION || has_frame()); |
Label done; |
+ bool definitely_mismatches = false; |
Register dummy = rax; |
InvokePrologue(expected, |
actual, |
code, |
dummy, |
&done, |
+ &definitely_mismatches, |
flag, |
Label::kNear, |
call_wrapper, |
call_kind); |
- if (flag == CALL_FUNCTION) { |
- call_wrapper.BeforeCall(CallSize(code)); |
- SetCallKind(rcx, call_kind); |
- Call(code, rmode); |
- call_wrapper.AfterCall(); |
- } else { |
- ASSERT(flag == JUMP_FUNCTION); |
- SetCallKind(rcx, call_kind); |
- Jump(code, rmode); |
+ if (!definitely_mismatches) { |
+ if (flag == CALL_FUNCTION) { |
+ call_wrapper.BeforeCall(CallSize(code)); |
+ SetCallKind(rcx, call_kind); |
+ Call(code, rmode); |
+ call_wrapper.AfterCall(); |
+ } else { |
+ ASSERT(flag == JUMP_FUNCTION); |
+ SetCallKind(rcx, call_kind); |
+ Jump(code, rmode); |
+ } |
+ bind(&done); |
} |
- bind(&done); |
} |
@@ -3136,11 +3144,13 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
Handle<Code> code_constant, |
Register code_register, |
Label* done, |
+ bool* definitely_mismatches, |
InvokeFlag flag, |
Label::Distance near_jump, |
const CallWrapper& call_wrapper, |
CallKind call_kind) { |
bool definitely_matches = false; |
+ *definitely_mismatches = false; |
Label invoke; |
if (expected.is_immediate()) { |
ASSERT(actual.is_immediate()); |
@@ -3156,6 +3166,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
// arguments. |
definitely_matches = true; |
} else { |
+ *definitely_mismatches = true; |
Set(rbx, expected.immediate()); |
} |
} |
@@ -3192,7 +3203,9 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
SetCallKind(rcx, call_kind); |
Call(adaptor, RelocInfo::CODE_TARGET); |
call_wrapper.AfterCall(); |
- jmp(done, near_jump); |
+ if (!*definitely_mismatches) { |
+ jmp(done, near_jump); |
+ } |
} else { |
SetCallKind(rcx, call_kind); |
Jump(adaptor, RelocInfo::CODE_TARGET); |