Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index f8c037dedda9b51ad7007393403527e46ff90c43..517344857fbbab147bfa9665f1ddc4b3d3c7b7da 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -3872,8 +3872,7 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
void MacroAssembler::CallApiFunctionAndReturn( |
- ExternalReference function, |
- Address function_address, |
+ Register function_address, |
ExternalReference thunk_ref, |
Register thunk_last_arg, |
int stack_space, |
@@ -3889,6 +3888,26 @@ void MacroAssembler::CallApiFunctionAndReturn( |
ExternalReference::handle_scope_level_address(isolate()), |
next_address); |
+ ASSERT(function_address.is(a3)); |
+ ASSERT(thunk_last_arg.is(a1) || thunk_last_arg.is(a2)); |
+ |
+ Label profiler_disabled; |
+ Label end_profiler_check; |
+ bool* is_profiling_flag = |
+ isolate()->cpu_profiler()->is_profiling_address(); |
+ STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
+ li(t9, reinterpret_cast<int32_t>(is_profiling_flag)); |
+ lb(t9, MemOperand(t9, 0)); |
+ Branch(&profiler_disabled, eq, t9, Operand(zero_reg)); |
+ |
+ // Additional parameter is the address of the actual callback. |
+ li(t9, Operand(thunk_ref)); |
+ jmp(&end_profiler_check); |
+ |
+ bind(&profiler_disabled); |
+ mov(t9, function_address); |
+ bind(&end_profiler_check); |
+ |
// Allocate HandleScope in callee-save registers. |
li(s3, Operand(next_address)); |
lw(s0, MemOperand(s3, kNextOffset)); |
@@ -3906,25 +3925,6 @@ void MacroAssembler::CallApiFunctionAndReturn( |
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); |
- li(t9, reinterpret_cast<int32_t>(is_profiling_flag)); |
- lb(t9, MemOperand(t9, 0)); |
- beq(t9, zero_reg, &profiler_disabled); |
- |
- // Third parameter is the address of the actual getter function. |
- li(thunk_last_arg, reinterpret_cast<int32_t>(function_address)); |
- li(t9, Operand(thunk_ref)); |
- jmp(&end_profiler_check); |
- |
- bind(&profiler_disabled); |
- li(t9, Operand(function)); |
- |
- bind(&end_profiler_check); |
- |
// Native call returns to the DirectCEntry stub which redirects to the |
// return address pushed on stack (could have moved after GC). |
// DirectCEntry stub itself is generated early and never moves. |