| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4286 } | 4286 } |
| 4287 | 4287 |
| 4288 | 4288 |
| 4289 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 4289 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
| 4290 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); | 4290 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); |
| 4291 VectorKeyedLoadStub stub(isolate()); | 4291 VectorKeyedLoadStub stub(isolate()); |
| 4292 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 4292 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 4293 } | 4293 } |
| 4294 | 4294 |
| 4295 | 4295 |
| 4296 static unsigned int GetProfileEntryHookCallSize(MacroAssembler* masm) { | 4296 // The entry hook is a "BumpSystemStackPointer" instruction (sub), followed by |
| 4297 // The entry hook is a "BumpSystemStackPointer" instruction (sub), | 4297 // a "Push lr" instruction, followed by a call. |
| 4298 // followed by a "Push lr" instruction, followed by a call. | 4298 static const unsigned int kProfileEntryHookCallSize = |
| 4299 unsigned int size = | 4299 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize); |
| 4300 Assembler::kCallSizeWithRelocation + (2 * kInstructionSize); | |
| 4301 if (CpuFeatures::IsSupported(ALWAYS_ALIGN_CSP)) { | |
| 4302 // If ALWAYS_ALIGN_CSP then there will be an extra bic instruction in | |
| 4303 // "BumpSystemStackPointer". | |
| 4304 size += kInstructionSize; | |
| 4305 } | |
| 4306 return size; | |
| 4307 } | |
| 4308 | 4300 |
| 4309 | 4301 |
| 4310 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 4302 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 4311 if (masm->isolate()->function_entry_hook() != NULL) { | 4303 if (masm->isolate()->function_entry_hook() != NULL) { |
| 4312 ProfileEntryHookStub stub(masm->isolate()); | 4304 ProfileEntryHookStub stub(masm->isolate()); |
| 4313 Assembler::BlockConstPoolScope no_const_pools(masm); | 4305 Assembler::BlockConstPoolScope no_const_pools(masm); |
| 4314 DontEmitDebugCodeScope no_debug_code(masm); | 4306 DontEmitDebugCodeScope no_debug_code(masm); |
| 4315 Label entry_hook_call_start; | 4307 Label entry_hook_call_start; |
| 4316 __ Bind(&entry_hook_call_start); | 4308 __ Bind(&entry_hook_call_start); |
| 4317 __ Push(lr); | 4309 __ Push(lr); |
| 4318 __ CallStub(&stub); | 4310 __ CallStub(&stub); |
| 4319 DCHECK(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) == | 4311 DCHECK(masm->SizeOfCodeGeneratedSince(&entry_hook_call_start) == |
| 4320 GetProfileEntryHookCallSize(masm)); | 4312 kProfileEntryHookCallSize); |
| 4321 | 4313 |
| 4322 __ Pop(lr); | 4314 __ Pop(lr); |
| 4323 } | 4315 } |
| 4324 } | 4316 } |
| 4325 | 4317 |
| 4326 | 4318 |
| 4327 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 4319 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
| 4328 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); | 4320 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); |
| 4329 | 4321 |
| 4330 // Save all kCallerSaved registers (including lr), since this can be called | 4322 // Save all kCallerSaved registers (including lr), since this can be called |
| 4331 // from anywhere. | 4323 // from anywhere. |
| 4332 // TODO(jbramley): What about FP registers? | 4324 // TODO(jbramley): What about FP registers? |
| 4333 __ PushCPURegList(kCallerSaved); | 4325 __ PushCPURegList(kCallerSaved); |
| 4334 DCHECK(kCallerSaved.IncludesAliasOf(lr)); | 4326 DCHECK(kCallerSaved.IncludesAliasOf(lr)); |
| 4335 const int kNumSavedRegs = kCallerSaved.Count(); | 4327 const int kNumSavedRegs = kCallerSaved.Count(); |
| 4336 | 4328 |
| 4337 // Compute the function's address as the first argument. | 4329 // Compute the function's address as the first argument. |
| 4338 __ Sub(x0, lr, GetProfileEntryHookCallSize(masm)); | 4330 __ Sub(x0, lr, kProfileEntryHookCallSize); |
| 4339 | 4331 |
| 4340 #if V8_HOST_ARCH_ARM64 | 4332 #if V8_HOST_ARCH_ARM64 |
| 4341 uintptr_t entry_hook = | 4333 uintptr_t entry_hook = |
| 4342 reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); | 4334 reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); |
| 4343 __ Mov(x10, entry_hook); | 4335 __ Mov(x10, entry_hook); |
| 4344 #else | 4336 #else |
| 4345 // Under the simulator we need to indirect the entry hook through a trampoline | 4337 // Under the simulator we need to indirect the entry hook through a trampoline |
| 4346 // function at a known address. | 4338 // function at a known address. |
| 4347 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); | 4339 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); |
| 4348 __ Mov(x10, Operand(ExternalReference(&dispatcher, | 4340 __ Mov(x10, Operand(ExternalReference(&dispatcher, |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5117 MemOperand(fp, 6 * kPointerSize), | 5109 MemOperand(fp, 6 * kPointerSize), |
| 5118 NULL); | 5110 NULL); |
| 5119 } | 5111 } |
| 5120 | 5112 |
| 5121 | 5113 |
| 5122 #undef __ | 5114 #undef __ |
| 5123 | 5115 |
| 5124 } } // namespace v8::internal | 5116 } } // namespace v8::internal |
| 5125 | 5117 |
| 5126 #endif // V8_TARGET_ARCH_ARM64 | 5118 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |