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 // The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by | 4664 static unsigned int GetProfileEntryHookCallSize(MacroAssembler* masm) { |
4665 // a "Push lr" instruction, followed by a call. | 4665 // The entry hook is a "BumpSystemStackPointer" instruction (sub), |
4666 static const unsigned int kProfileEntryHookCallSize = | 4666 // followed by a "Push lr" instruction, followed by a call. |
4667 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize); | 4667 unsigned int size = |
| 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 } |
4668 | 4676 |
4669 | 4677 |
4670 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 4678 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
4671 if (masm->isolate()->function_entry_hook() != NULL) { | 4679 if (masm->isolate()->function_entry_hook() != NULL) { |
4672 ProfileEntryHookStub stub(masm->isolate()); | 4680 ProfileEntryHookStub stub(masm->isolate()); |
4673 Assembler::BlockConstPoolScope no_const_pools(masm); | 4681 Assembler::BlockConstPoolScope no_const_pools(masm); |
| 4682 DontEmitDebugCodeScope no_debug_code(masm); |
4674 Label entry_hook_call_start; | 4683 Label entry_hook_call_start; |
4675 __ Bind(&entry_hook_call_start); | 4684 __ Bind(&entry_hook_call_start); |
4676 __ Push(lr); | 4685 __ Push(lr); |
4677 __ CallStub(&stub); | 4686 __ CallStub(&stub); |
4678 ASSERT(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) == | 4687 ASSERT(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) == |
4679 kProfileEntryHookCallSize); | 4688 GetProfileEntryHookCallSize(masm)); |
4680 | 4689 |
4681 __ Pop(lr); | 4690 __ Pop(lr); |
4682 } | 4691 } |
4683 } | 4692 } |
4684 | 4693 |
4685 | 4694 |
4686 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 4695 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
4687 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); | 4696 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); |
4688 | 4697 |
4689 // Save all kCallerSaved registers (including lr), since this can be called | 4698 // Save all kCallerSaved registers (including lr), since this can be called |
4690 // from anywhere. | 4699 // from anywhere. |
4691 // TODO(jbramley): What about FP registers? | 4700 // TODO(jbramley): What about FP registers? |
4692 __ PushCPURegList(kCallerSaved); | 4701 __ PushCPURegList(kCallerSaved); |
4693 ASSERT(kCallerSaved.IncludesAliasOf(lr)); | 4702 ASSERT(kCallerSaved.IncludesAliasOf(lr)); |
4694 const int kNumSavedRegs = kCallerSaved.Count(); | 4703 const int kNumSavedRegs = kCallerSaved.Count(); |
4695 | 4704 |
4696 // Compute the function's address as the first argument. | 4705 // Compute the function's address as the first argument. |
4697 __ Sub(x0, lr, kProfileEntryHookCallSize); | 4706 __ Sub(x0, lr, GetProfileEntryHookCallSize(masm)); |
4698 | 4707 |
4699 #if V8_HOST_ARCH_ARM64 | 4708 #if V8_HOST_ARCH_ARM64 |
4700 uintptr_t entry_hook = | 4709 uintptr_t entry_hook = |
4701 reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); | 4710 reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); |
4702 __ Mov(x10, entry_hook); | 4711 __ Mov(x10, entry_hook); |
4703 #else | 4712 #else |
4704 // Under the simulator we need to indirect the entry hook through a trampoline | 4713 // Under the simulator we need to indirect the entry hook through a trampoline |
4705 // function at a known address. | 4714 // function at a known address. |
4706 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); | 4715 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); |
4707 __ Mov(x10, Operand(ExternalReference(&dispatcher, | 4716 __ Mov(x10, Operand(ExternalReference(&dispatcher, |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5475 MemOperand(fp, 6 * kPointerSize), | 5484 MemOperand(fp, 6 * kPointerSize), |
5476 NULL); | 5485 NULL); |
5477 } | 5486 } |
5478 | 5487 |
5479 | 5488 |
5480 #undef __ | 5489 #undef __ |
5481 | 5490 |
5482 } } // namespace v8::internal | 5491 } } // namespace v8::internal |
5483 | 5492 |
5484 #endif // V8_TARGET_ARCH_ARM64 | 5493 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |