| Index: src/arm/code-stubs-arm.cc
|
| diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
|
| old mode 100644
|
| new mode 100755
|
| index b26bf7ede2b6c150b6e8e4fdf171c8f40b156886..7c653fc9208cd88dd95392612d407ba093326c9a
|
| --- a/src/arm/code-stubs-arm.cc
|
| +++ b/src/arm/code-stubs-arm.cc
|
| @@ -3179,6 +3179,8 @@ void CEntryStub::Generate(MacroAssembler* masm) {
|
| // sp: stack pointer (restored as callee's sp after C call)
|
| // cp: current context (C callee-saved)
|
|
|
| + ProfileEntryHookStub::MaybeCallEntryHook(masm);
|
| +
|
| // Result returned in r0 or r0+r1 by default.
|
|
|
| // NOTE: Invocations of builtins may return failure objects
|
| @@ -3269,6 +3271,8 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
|
|
|
| Label invoke, handler_entry, exit;
|
|
|
| + ProfileEntryHookStub::MaybeCallEntryHook(masm);
|
| +
|
| // Called from C, so do not pop argc and args on exit (preserve sp)
|
| // No need to save register-passed args
|
| // Save callee-saved registers (incl. cp and fp), sp, and lr
|
| @@ -7133,8 +7137,9 @@ void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
|
|
|
|
|
| void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
|
| - if (entry_hook_ != NULL) {
|
| + if (masm->isolate()->function_entry_hook() != NULL) {
|
| PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize);
|
| + AllowStubCallsScope allow_stub_calls(masm, true);
|
| ProfileEntryHookStub stub;
|
| __ push(lr);
|
| __ CallStub(&stub);
|
| @@ -7148,9 +7153,21 @@ void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
|
| const int32_t kReturnAddressDistanceFromFunctionStart =
|
| 3 * Assembler::kInstrSize;
|
|
|
| - // Save live volatile registers.
|
| - __ Push(lr, r5, r1);
|
| - const int32_t kNumSavedRegs = 3;
|
| + // This should contain all kCallerSaved registers.
|
| + const RegList kSavedRegs =
|
| + 1 << 0 | // r0
|
| + 1 << 1 | // r1
|
| + 1 << 2 | // r2
|
| + 1 << 3 | // r3
|
| + 1 << 5 | // r5
|
| + 1 << 9; // r9
|
| + // We also save lr, so the count here is one higher than the mask indicates.
|
| + const int32_t kNumSavedRegs = 7;
|
| +
|
| + ASSERT((kCallerSaved & kSavedRegs) == kCallerSaved);
|
| +
|
| + // Save all caller-save registers as this may be called from anywhere.
|
| + __ stm(db_w, sp, kSavedRegs | lr.bit());
|
|
|
| // Compute the function's address for the first argument.
|
| __ sub(r0, lr, Operand(kReturnAddressDistanceFromFunctionStart));
|
| @@ -7168,14 +7185,12 @@ void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
|
| }
|
|
|
| #if defined(V8_HOST_ARCH_ARM)
|
| - __ mov(ip, Operand(reinterpret_cast<int32_t>(&entry_hook_)));
|
| - __ ldr(ip, MemOperand(ip));
|
| + __ mov(ip, FUNCTION_ADDR(masm->isolate()->function_entry_hook()),
|
| + RelocInfo::NONE));
|
| #else
|
| // Under the simulator we need to indirect the entry hook through a
|
| // trampoline function at a known address.
|
| - Address trampoline_address = reinterpret_cast<Address>(
|
| - reinterpret_cast<intptr_t>(EntryHookTrampoline));
|
| - ApiFunction dispatcher(trampoline_address);
|
| + ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline));
|
| __ mov(ip, Operand(ExternalReference(&dispatcher,
|
| ExternalReference::BUILTIN_CALL,
|
| masm->isolate())));
|
| @@ -7187,8 +7202,8 @@ void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
|
| __ mov(sp, r5);
|
| }
|
|
|
| - __ Pop(lr, r5, r1);
|
| - __ Ret();
|
| + // Also pop pc to get Ret(0).
|
| + __ ldm(ia_w, sp, kSavedRegs | pc.bit());
|
| }
|
|
|
|
|
|
|