| Index: src/x64/macro-assembler-x64.cc
|
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
|
| index a2568a400f41fa8960c61c8cda0998e03fa854f2..b6a1d34d6a5cbfc8af1a0e2dcfe1e0015860891e 100644
|
| --- a/src/x64/macro-assembler-x64.cc
|
| +++ b/src/x64/macro-assembler-x64.cc
|
| @@ -697,6 +697,8 @@ void MacroAssembler::PrepareCallApiFunction(int arg_stack_space,
|
|
|
|
|
| void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
| + Address thunk_address,
|
| + Register thunk_last_arg,
|
| int stack_space,
|
| bool returns_handle,
|
| int return_value_offset) {
|
| @@ -737,9 +739,29 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
| PopSafepointRegisters();
|
| }
|
|
|
| +
|
| + Label profiler_disabled;
|
| + Label end_profiler_check;
|
| + bool* is_profiling_flag =
|
| + isolate()->cpu_profiler()->is_profiling_address();
|
| + STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
|
| + movq(rax, is_profiling_flag, RelocInfo::EXTERNAL_REFERENCE);
|
| + cmpb(Operand(rax, 0), Immediate(0));
|
| + j(zero, &profiler_disabled);
|
| +
|
| + // Third parameter is the address of the actual getter function.
|
| + movq(thunk_last_arg, function_address, RelocInfo::EXTERNAL_REFERENCE);
|
| + movq(rax, thunk_address, RelocInfo::EXTERNAL_REFERENCE);
|
| + jmp(&end_profiler_check);
|
| +
|
| + bind(&profiler_disabled);
|
| // Call the api function!
|
| movq(rax, reinterpret_cast<int64_t>(function_address),
|
| RelocInfo::EXTERNAL_REFERENCE);
|
| +
|
| + bind(&end_profiler_check);
|
| +
|
| + // Call the api function!
|
| call(rax);
|
|
|
| if (FLAG_log_timer_events) {
|
|
|