| Index: src/x64/macro-assembler-x64.cc
|
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
|
| index 0cfec36156d1b4d13622289b8dd3882dc62f3e98..2279f03089fb22f7dfdd7871cabb73c4becc8326 100644
|
| --- a/src/x64/macro-assembler-x64.cc
|
| +++ b/src/x64/macro-assembler-x64.cc
|
| @@ -2780,11 +2780,26 @@ void MacroAssembler::DebugBreak() {
|
| #endif // ENABLE_DEBUGGER_SUPPORT
|
|
|
|
|
| +void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) {
|
| + // This macro takes the dst register to make the code more readable
|
| + // at the call sites. However, the dst register has to be rcx to
|
| + // follow the calling convention which requires the call type to be
|
| + // in rcx.
|
| + ASSERT(dst.is(rcx));
|
| + if (call_kind == CALL_AS_FUNCTION) {
|
| + LoadSmiConstant(dst, Smi::FromInt(1));
|
| + } else {
|
| + LoadSmiConstant(dst, Smi::FromInt(0));
|
| + }
|
| +}
|
| +
|
| +
|
| void MacroAssembler::InvokeCode(Register code,
|
| const ParameterCount& expected,
|
| const ParameterCount& actual,
|
| InvokeFlag flag,
|
| - const CallWrapper& call_wrapper) {
|
| + const CallWrapper& call_wrapper,
|
| + CallKind call_kind) {
|
| Label done;
|
| InvokePrologue(expected,
|
| actual,
|
| @@ -2792,14 +2807,17 @@ void MacroAssembler::InvokeCode(Register code,
|
| code,
|
| &done,
|
| flag,
|
| + Label::kNear,
|
| call_wrapper,
|
| - Label::kNear);
|
| + 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);
|
| }
|
| bind(&done);
|
| @@ -2811,7 +2829,8 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
|
| const ParameterCount& actual,
|
| RelocInfo::Mode rmode,
|
| InvokeFlag flag,
|
| - const CallWrapper& call_wrapper) {
|
| + const CallWrapper& call_wrapper,
|
| + CallKind call_kind) {
|
| Label done;
|
| Register dummy = rax;
|
| InvokePrologue(expected,
|
| @@ -2820,14 +2839,17 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
|
| dummy,
|
| &done,
|
| flag,
|
| + Label::kNear,
|
| call_wrapper,
|
| - Label::kNear);
|
| + 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);
|
| }
|
| bind(&done);
|
| @@ -2837,7 +2859,8 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
|
| void MacroAssembler::InvokeFunction(Register function,
|
| const ParameterCount& actual,
|
| InvokeFlag flag,
|
| - const CallWrapper& call_wrapper) {
|
| + const CallWrapper& call_wrapper,
|
| + CallKind call_kind) {
|
| ASSERT(function.is(rdi));
|
| movq(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
|
| movq(rsi, FieldOperand(function, JSFunction::kContextOffset));
|
| @@ -2848,7 +2871,7 @@ void MacroAssembler::InvokeFunction(Register function,
|
| movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
|
|
|
| ParameterCount expected(rbx);
|
| - InvokeCode(rdx, expected, actual, flag, call_wrapper);
|
| + InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind);
|
| }
|
|
|
|
|
| @@ -2887,8 +2910,9 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
| Register code_register,
|
| Label* done,
|
| InvokeFlag flag,
|
| + Label::Distance near_jump,
|
| const CallWrapper& call_wrapper,
|
| - Label::Distance near_jump) {
|
| + CallKind call_kind) {
|
| bool definitely_matches = false;
|
| Label invoke;
|
| if (expected.is_immediate()) {
|
| @@ -2938,10 +2962,12 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
|
|
| if (flag == CALL_FUNCTION) {
|
| call_wrapper.BeforeCall(CallSize(adaptor));
|
| + SetCallKind(rcx, call_kind);
|
| Call(adaptor, RelocInfo::CODE_TARGET);
|
| call_wrapper.AfterCall();
|
| jmp(done, near_jump);
|
| } else {
|
| + SetCallKind(rcx, call_kind);
|
| Jump(adaptor, RelocInfo::CODE_TARGET);
|
| }
|
| bind(&invoke);
|
|
|