| Index: src/ia32/macro-assembler-ia32.cc | 
| diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc | 
| index 60c5c2675f791a324d278cb2679b88fcdefd17db..17d4aac8add74eda4d6a69bc060427b26360b065 100644 | 
| --- a/src/ia32/macro-assembler-ia32.cc | 
| +++ b/src/ia32/macro-assembler-ia32.cc | 
| @@ -1973,6 +1973,8 @@ void MacroAssembler::PrepareCallApiFunction(int argc, bool returns_handle) { | 
|  | 
|  | 
| void MacroAssembler::CallApiFunctionAndReturn(Address function_address, | 
| +                                              Address thunk_address, | 
| +                                              Operand thunk_last_arg, | 
| int stack_space, | 
| bool returns_handle, | 
| int return_value_offset) { | 
| @@ -1998,8 +2000,26 @@ 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); | 
| +  mov(eax, Immediate(reinterpret_cast<Address>(is_profiling_flag))); | 
| +  cmpb(Operand(eax, 0), 0); | 
| +  j(zero, &profiler_disabled); | 
| + | 
| +  // Additional parameter is the address of the actual getter function. | 
| +  mov(thunk_last_arg, Immediate(function_address)); | 
| +  // Call the api function. | 
| +  call(thunk_address, RelocInfo::RUNTIME_ENTRY); | 
| +  jmp(&end_profiler_check); | 
| + | 
| +  bind(&profiler_disabled); | 
| // Call the api function. | 
| call(function_address, RelocInfo::RUNTIME_ENTRY); | 
| +  bind(&end_profiler_check); | 
|  | 
| if (FLAG_log_timer_events) { | 
| FrameScope frame(this, StackFrame::MANUAL); | 
|  |