OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 4643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4654 if (function_mode_ == JS_FUNCTION_STUB_MODE) { | 4654 if (function_mode_ == JS_FUNCTION_STUB_MODE) { |
4655 __ Add(x1, x1, 1); | 4655 __ Add(x1, x1, 1); |
4656 } | 4656 } |
4657 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4657 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
4658 __ Drop(x1); | 4658 __ Drop(x1); |
4659 // Return to IC Miss stub, continuation still on stack. | 4659 // Return to IC Miss stub, continuation still on stack. |
4660 __ Ret(); | 4660 __ Ret(); |
4661 } | 4661 } |
4662 | 4662 |
4663 | 4663 |
4664 static unsigned int GetProfileEntryHookCallSize(MacroAssembler* masm) { | 4664 // The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by |
4665 // The entry hook is a "BumpSystemStackPointer" instruction (sub), | 4665 // a "Push lr" instruction, followed by a call. |
4666 // followed by a "Push lr" instruction, followed by a call. | 4666 static const unsigned int kProfileEntryHookCallSize = |
4667 unsigned int size = | 4667 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize); |
4668 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize); | |
4669 if (CpuFeatures::IsSupported(ALWAYS_ALIGN_CSP)) { | |
4670 // If ALWAYS_ALIGN_CSP then there will be an extra bic instruction in | |
4671 // "BumpSystemStackPointer". | |
4672 size += kInstructionSize; | |
4673 } | |
4674 return size; | |
4675 } | |
4676 | 4668 |
4677 | 4669 |
4678 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 4670 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
4679 if (masm->isolate()->function_entry_hook() != NULL) { | 4671 if (masm->isolate()->function_entry_hook() != NULL) { |
4680 ProfileEntryHookStub stub(masm->isolate()); | 4672 ProfileEntryHookStub stub(masm->isolate()); |
4681 Assembler::BlockConstPoolScope no_const_pools(masm); | 4673 Assembler::BlockConstPoolScope no_const_pools(masm); |
4682 DontEmitDebugCodeScope no_debug_code(masm); | |
4683 Label entry_hook_call_start; | 4674 Label entry_hook_call_start; |
4684 __ Bind(&entry_hook_call_start); | 4675 __ Bind(&entry_hook_call_start); |
4685 __ Push(lr); | 4676 __ Push(lr); |
4686 __ CallStub(&stub); | 4677 __ CallStub(&stub); |
4687 ASSERT(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) == | 4678 ASSERT(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) == |
4688 GetProfileEntryHookCallSize(masm)); | 4679 kProfileEntryHookCallSize); |
4689 | 4680 |
4690 __ Pop(lr); | 4681 __ Pop(lr); |
4691 } | 4682 } |
4692 } | 4683 } |
4693 | 4684 |
4694 | 4685 |
4695 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 4686 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
4696 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); | 4687 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); |
4697 | 4688 |
4698 // Save all kCallerSaved registers (including lr), since this can be called | 4689 // Save all kCallerSaved registers (including lr), since this can be called |
4699 // from anywhere. | 4690 // from anywhere. |
4700 // TODO(jbramley): What about FP registers? | 4691 // TODO(jbramley): What about FP registers? |
4701 __ PushCPURegList(kCallerSaved); | 4692 __ PushCPURegList(kCallerSaved); |
4702 ASSERT(kCallerSaved.IncludesAliasOf(lr)); | 4693 ASSERT(kCallerSaved.IncludesAliasOf(lr)); |
4703 const int kNumSavedRegs = kCallerSaved.Count(); | 4694 const int kNumSavedRegs = kCallerSaved.Count(); |
4704 | 4695 |
4705 // Compute the function's address as the first argument. | 4696 // Compute the function's address as the first argument. |
4706 __ Sub(x0, lr, GetProfileEntryHookCallSize(masm)); | 4697 __ Sub(x0, lr, kProfileEntryHookCallSize); |
4707 | 4698 |
4708 #if V8_HOST_ARCH_ARM64 | 4699 #if V8_HOST_ARCH_ARM64 |
4709 uintptr_t entry_hook = | 4700 uintptr_t entry_hook = |
4710 reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); | 4701 reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); |
4711 __ Mov(x10, entry_hook); | 4702 __ Mov(x10, entry_hook); |
4712 #else | 4703 #else |
4713 // Under the simulator we need to indirect the entry hook through a trampoline | 4704 // Under the simulator we need to indirect the entry hook through a trampoline |
4714 // function at a known address. | 4705 // function at a known address. |
4715 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); | 4706 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); |
4716 __ Mov(x10, Operand(ExternalReference(&dispatcher, | 4707 __ Mov(x10, Operand(ExternalReference(&dispatcher, |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5484 MemOperand(fp, 6 * kPointerSize), | 5475 MemOperand(fp, 6 * kPointerSize), |
5485 NULL); | 5476 NULL); |
5486 } | 5477 } |
5487 | 5478 |
5488 | 5479 |
5489 #undef __ | 5480 #undef __ |
5490 | 5481 |
5491 } } // namespace v8::internal | 5482 } } // namespace v8::internal |
5492 | 5483 |
5493 #endif // V8_TARGET_ARCH_ARM64 | 5484 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |