OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2752 | 2752 |
2753 | 2753 |
2754 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { | 2754 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { |
2755 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 2755 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
2756 } | 2756 } |
2757 | 2757 |
2758 | 2758 |
2759 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 2759 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
2760 int handler_index) { | 2760 int handler_index) { |
2761 // Adjust this code if not the case. | 2761 // Adjust this code if not the case. |
2762 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 2762 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize + |
| 2763 kFPOnStackSize); |
2763 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 2764 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
2764 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 2765 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
2765 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 2766 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
2766 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 2767 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
2767 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 2768 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
2768 | 2769 |
2769 // We will build up the handler from the bottom by pushing on the stack. | 2770 // We will build up the handler from the bottom by pushing on the stack. |
2770 // First push the frame pointer and context. | 2771 // First push the frame pointer and context. |
2771 if (kind == StackHandler::JS_ENTRY) { | 2772 if (kind == StackHandler::JS_ENTRY) { |
2772 // The frame pointer does not point to a JS frame so we save NULL for | 2773 // The frame pointer does not point to a JS frame so we save NULL for |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2811 movq(rdx, | 2812 movq(rdx, |
2812 FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize)); | 2813 FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize)); |
2813 SmiToInteger64(rdx, rdx); | 2814 SmiToInteger64(rdx, rdx); |
2814 lea(rdi, FieldOperand(rdi, rdx, times_1, Code::kHeaderSize)); | 2815 lea(rdi, FieldOperand(rdi, rdx, times_1, Code::kHeaderSize)); |
2815 jmp(rdi); | 2816 jmp(rdi); |
2816 } | 2817 } |
2817 | 2818 |
2818 | 2819 |
2819 void MacroAssembler::Throw(Register value) { | 2820 void MacroAssembler::Throw(Register value) { |
2820 // Adjust this code if not the case. | 2821 // Adjust this code if not the case. |
2821 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 2822 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize + |
| 2823 kFPOnStackSize); |
2822 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 2824 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
2823 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 2825 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
2824 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 2826 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
2825 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 2827 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
2826 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 2828 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
2827 | 2829 |
2828 // The exception is expected in rax. | 2830 // The exception is expected in rax. |
2829 if (!value.is(rax)) { | 2831 if (!value.is(rax)) { |
2830 movq(rax, value); | 2832 movq(rax, value); |
2831 } | 2833 } |
(...skipping 19 matching lines...) Expand all Loading... |
2851 j(zero, &skip, Label::kNear); | 2853 j(zero, &skip, Label::kNear); |
2852 movq(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); | 2854 movq(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); |
2853 bind(&skip); | 2855 bind(&skip); |
2854 | 2856 |
2855 JumpToHandlerEntry(); | 2857 JumpToHandlerEntry(); |
2856 } | 2858 } |
2857 | 2859 |
2858 | 2860 |
2859 void MacroAssembler::ThrowUncatchable(Register value) { | 2861 void MacroAssembler::ThrowUncatchable(Register value) { |
2860 // Adjust this code if not the case. | 2862 // Adjust this code if not the case. |
2861 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 2863 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize + |
| 2864 kFPOnStackSize); |
2862 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 2865 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
2863 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 2866 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
2864 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 2867 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
2865 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 2868 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
2866 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 2869 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
2867 | 2870 |
2868 // The exception is expected in rax. | 2871 // The exception is expected in rax. |
2869 if (!value.is(rax)) { | 2872 if (!value.is(rax)) { |
2870 movq(rax, value); | 2873 movq(rax, value); |
2871 } | 2874 } |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3691 Check(equal, kStackFrameTypesMustMatch); | 3694 Check(equal, kStackFrameTypesMustMatch); |
3692 } | 3695 } |
3693 movq(rsp, rbp); | 3696 movq(rsp, rbp); |
3694 pop(rbp); | 3697 pop(rbp); |
3695 } | 3698 } |
3696 | 3699 |
3697 | 3700 |
3698 void MacroAssembler::EnterExitFramePrologue(bool save_rax) { | 3701 void MacroAssembler::EnterExitFramePrologue(bool save_rax) { |
3699 // Set up the frame structure on the stack. | 3702 // Set up the frame structure on the stack. |
3700 // All constants are relative to the frame pointer of the exit frame. | 3703 // All constants are relative to the frame pointer of the exit frame. |
3701 ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize); | 3704 ASSERT(ExitFrameConstants::kCallerSPDisplacement == |
3702 ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); | 3705 kFPOnStackSize + kPCOnStackSize); |
3703 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); | 3706 ASSERT(ExitFrameConstants::kCallerPCOffset == kFPOnStackSize); |
| 3707 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); |
3704 push(rbp); | 3708 push(rbp); |
3705 movq(rbp, rsp); | 3709 movq(rbp, rsp); |
3706 | 3710 |
3707 // Reserve room for entry stack pointer and push the code object. | 3711 // Reserve room for entry stack pointer and push the code object. |
3708 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); | 3712 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); |
3709 push(Immediate(0)); // Saved entry sp, patched before call. | 3713 push(Immediate(0)); // Saved entry sp, patched before call. |
3710 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); | 3714 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); |
3711 push(kScratchRegister); // Accessed from EditFrame::code_slot. | 3715 push(kScratchRegister); // Accessed from EditFrame::code_slot. |
3712 | 3716 |
3713 // Save the frame pointer and the context in top. | 3717 // Save the frame pointer and the context in top. |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4917 j(greater, &no_memento_available); | 4921 j(greater, &no_memento_available); |
4918 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), | 4922 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), |
4919 Heap::kAllocationMementoMapRootIndex); | 4923 Heap::kAllocationMementoMapRootIndex); |
4920 bind(&no_memento_available); | 4924 bind(&no_memento_available); |
4921 } | 4925 } |
4922 | 4926 |
4923 | 4927 |
4924 } } // namespace v8::internal | 4928 } } // namespace v8::internal |
4925 | 4929 |
4926 #endif // V8_TARGET_ARCH_X64 | 4930 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |