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 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 __ Peek(target, 3 * kPointerSize); | 1570 __ Peek(target, 3 * kPointerSize); |
1571 | 1571 |
1572 __ LeaveExitFrame(save_doubles_, x10, true); | 1572 __ LeaveExitFrame(save_doubles_, x10, true); |
1573 ASSERT(jssp.Is(__ StackPointer())); | 1573 ASSERT(jssp.Is(__ StackPointer())); |
1574 // Pop or drop the remaining stack slots and return from the stub. | 1574 // Pop or drop the remaining stack slots and return from the stub. |
1575 // jssp[24]: Arguments array (of size argc), including receiver. | 1575 // jssp[24]: Arguments array (of size argc), including receiver. |
1576 // jssp[16]: Preserved x23 (used for target). | 1576 // jssp[16]: Preserved x23 (used for target). |
1577 // jssp[8]: Preserved x22 (used for argc). | 1577 // jssp[8]: Preserved x22 (used for argc). |
1578 // jssp[0]: Preserved x21 (used for argv). | 1578 // jssp[0]: Preserved x21 (used for argv). |
1579 __ Drop(x11); | 1579 __ Drop(x11); |
| 1580 __ AssertFPCRState(); |
1580 __ Ret(); | 1581 __ Ret(); |
1581 | 1582 |
1582 // The stack pointer is still csp if we aren't returning, and the frame | 1583 // The stack pointer is still csp if we aren't returning, and the frame |
1583 // hasn't changed (except for the return address). | 1584 // hasn't changed (except for the return address). |
1584 __ SetStackPointer(csp); | 1585 __ SetStackPointer(csp); |
1585 | 1586 |
1586 // Handling of exception. | 1587 // Handling of exception. |
1587 __ Bind(&exception_returned); | 1588 __ Bind(&exception_returned); |
1588 | 1589 |
1589 // Retrieve the pending exception. | 1590 // Retrieve the pending exception. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 // Push callee-saved registers and synchronize the system stack pointer (csp) | 1654 // Push callee-saved registers and synchronize the system stack pointer (csp) |
1654 // and the JavaScript stack pointer (jssp). | 1655 // and the JavaScript stack pointer (jssp). |
1655 // | 1656 // |
1656 // We must not write to jssp until after the PushCalleeSavedRegisters() | 1657 // We must not write to jssp until after the PushCalleeSavedRegisters() |
1657 // call, since jssp is itself a callee-saved register. | 1658 // call, since jssp is itself a callee-saved register. |
1658 __ SetStackPointer(csp); | 1659 __ SetStackPointer(csp); |
1659 __ PushCalleeSavedRegisters(); | 1660 __ PushCalleeSavedRegisters(); |
1660 __ Mov(jssp, csp); | 1661 __ Mov(jssp, csp); |
1661 __ SetStackPointer(jssp); | 1662 __ SetStackPointer(jssp); |
1662 | 1663 |
| 1664 // Configure the FPCR. We don't restore it, so this is technically not allowed |
| 1665 // according to AAPCS64. However, we only set default-NaN mode and this will |
| 1666 // be harmless for most C code. Also, it works for ARM. |
| 1667 __ ConfigureFPCR(); |
| 1668 |
1663 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1669 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1664 | 1670 |
1665 // Set up the reserved register for 0.0. | 1671 // Set up the reserved register for 0.0. |
1666 __ Fmov(fp_zero, 0.0); | 1672 __ Fmov(fp_zero, 0.0); |
1667 | 1673 |
1668 // Build an entry frame (see layout below). | 1674 // Build an entry frame (see layout below). |
1669 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 1675 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
1670 int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used. | 1676 int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used. |
1671 __ Mov(x13, bad_frame_pointer); | 1677 __ Mov(x13, bad_frame_pointer); |
1672 __ Mov(x12, Smi::FromInt(marker)); | 1678 __ Mov(x12, Smi::FromInt(marker)); |
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4626 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, | 4632 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, |
4627 // and value is Smi. | 4633 // and value is Smi. |
4628 __ Bind(&smi_element); | 4634 __ Bind(&smi_element); |
4629 __ Ldr(x10, FieldMemOperand(array, JSObject::kElementsOffset)); | 4635 __ Ldr(x10, FieldMemOperand(array, JSObject::kElementsOffset)); |
4630 __ Add(x11, x10, Operand::UntagSmiAndScale(index_smi, kPointerSizeLog2)); | 4636 __ Add(x11, x10, Operand::UntagSmiAndScale(index_smi, kPointerSizeLog2)); |
4631 __ Str(value, FieldMemOperand(x11, FixedArray::kHeaderSize)); | 4637 __ Str(value, FieldMemOperand(x11, FixedArray::kHeaderSize)); |
4632 __ Ret(); | 4638 __ Ret(); |
4633 | 4639 |
4634 __ Bind(&double_elements); | 4640 __ Bind(&double_elements); |
4635 __ Ldr(x10, FieldMemOperand(array, JSObject::kElementsOffset)); | 4641 __ Ldr(x10, FieldMemOperand(array, JSObject::kElementsOffset)); |
4636 __ StoreNumberToDoubleElements(value, index_smi, x10, x11, d0, d1, | 4642 __ StoreNumberToDoubleElements(value, index_smi, x10, x11, d0, |
4637 &slow_elements); | 4643 &slow_elements); |
4638 __ Ret(); | 4644 __ Ret(); |
4639 } | 4645 } |
4640 | 4646 |
4641 | 4647 |
4642 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 4648 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
4643 CEntryStub ces(isolate(), 1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); | 4649 CEntryStub ces(isolate(), 1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); |
4644 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 4650 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
4645 int parameter_count_offset = | 4651 int parameter_count_offset = |
4646 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 4652 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4728 // and configure the stack pointer *before* doing the call. | 4734 // and configure the stack pointer *before* doing the call. |
4729 const Register old_stack_pointer = __ StackPointer(); | 4735 const Register old_stack_pointer = __ StackPointer(); |
4730 __ SetStackPointer(csp); | 4736 __ SetStackPointer(csp); |
4731 | 4737 |
4732 // Put return address on the stack (accessible to GC through exit frame pc). | 4738 // Put return address on the stack (accessible to GC through exit frame pc). |
4733 __ Poke(lr, 0); | 4739 __ Poke(lr, 0); |
4734 // Call the C++ function. | 4740 // Call the C++ function. |
4735 __ Blr(x10); | 4741 __ Blr(x10); |
4736 // Return to calling code. | 4742 // Return to calling code. |
4737 __ Peek(lr, 0); | 4743 __ Peek(lr, 0); |
| 4744 __ AssertFPCRState(); |
4738 __ Ret(); | 4745 __ Ret(); |
4739 | 4746 |
4740 __ SetStackPointer(old_stack_pointer); | 4747 __ SetStackPointer(old_stack_pointer); |
4741 } | 4748 } |
4742 | 4749 |
4743 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, | 4750 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, |
4744 Register target) { | 4751 Register target) { |
4745 // Make sure the caller configured the stack pointer (see comment in | 4752 // Make sure the caller configured the stack pointer (see comment in |
4746 // DirectCEntryStub::Generate). | 4753 // DirectCEntryStub::Generate). |
4747 ASSERT(csp.Is(__ StackPointer())); | 4754 ASSERT(csp.Is(__ StackPointer())); |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5468 MemOperand(fp, 6 * kPointerSize), | 5475 MemOperand(fp, 6 * kPointerSize), |
5469 NULL); | 5476 NULL); |
5470 } | 5477 } |
5471 | 5478 |
5472 | 5479 |
5473 #undef __ | 5480 #undef __ |
5474 | 5481 |
5475 } } // namespace v8::internal | 5482 } } // namespace v8::internal |
5476 | 5483 |
5477 #endif // V8_TARGET_ARCH_ARM64 | 5484 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |