Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 155045: X64: Exit frame should use x64 ABI callee-save registers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 movq(rsp, rbp); 742 movq(rsp, rbp);
743 pop(rbp); 743 pop(rbp);
744 } 744 }
745 745
746 746
747 747
748 void MacroAssembler::EnterExitFrame(StackFrame::Type type) { 748 void MacroAssembler::EnterExitFrame(StackFrame::Type type) {
749 ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); 749 ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG);
750 750
751 // Setup the frame structure on the stack. 751 // Setup the frame structure on the stack.
752 // All constants are relative to the frame pointer of the exit frame.
752 ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize); 753 ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize);
753 ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); 754 ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize);
754 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); 755 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize);
755 push(rbp); 756 push(rbp);
756 movq(rbp, rsp); 757 movq(rbp, rsp);
757 758
758 // Reserve room for entry stack pointer and push the debug marker. 759 // Reserve room for entry stack pointer and push the debug marker.
759 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); 760 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize);
760 push(Immediate(0)); // saved entry sp, patched before call 761 push(Immediate(0)); // saved entry sp, patched before call
761 push(Immediate(type == StackFrame::EXIT_DEBUG ? 1 : 0)); 762 push(Immediate(type == StackFrame::EXIT_DEBUG ? 1 : 0));
762 763
763 // Save the frame pointer and the context in top. 764 // Save the frame pointer and the context in top.
764 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); 765 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
765 ExternalReference context_address(Top::k_context_address); 766 ExternalReference context_address(Top::k_context_address);
766 movq(rdi, rax); // Backup rax before we use it. 767 movq(r14, rax); // Backup rax before we use it.
767 768
768 movq(rax, rbp); 769 movq(rax, rbp);
769 store_rax(c_entry_fp_address); 770 store_rax(c_entry_fp_address);
770 movq(rax, rsi); 771 movq(rax, rsi);
771 store_rax(context_address); 772 store_rax(context_address);
772 773
773 // Setup argv in callee-saved register r15. It is reused in LeaveExitFrame, 774 // Setup argv in callee-saved register r15. It is reused in LeaveExitFrame,
774 // so it must be retained across the C-call. 775 // so it must be retained across the C-call.
775 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize; 776 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize;
776 lea(r15, Operand(rbp, rdi, times_pointer_size, offset)); 777 lea(r15, Operand(rbp, r14, times_pointer_size, offset));
777 778
778 #ifdef ENABLE_DEBUGGER_SUPPORT 779 #ifdef ENABLE_DEBUGGER_SUPPORT
779 // Save the state of all registers to the stack from the memory 780 // Save the state of all registers to the stack from the memory
780 // location. This is needed to allow nested break points. 781 // location. This is needed to allow nested break points.
781 if (type == StackFrame::EXIT_DEBUG) { 782 if (type == StackFrame::EXIT_DEBUG) {
782 // TODO(1243899): This should be symmetric to 783 // TODO(1243899): This should be symmetric to
783 // CopyRegistersFromStackToMemory() but it isn't! esp is assumed 784 // CopyRegistersFromStackToMemory() but it isn't! esp is assumed
784 // correct here, but computed for the other call. Very error 785 // correct here, but computed for the other call. Very error
785 // prone! FIX THIS. Actually there are deeper problems with 786 // prone! FIX THIS. Actually there are deeper problems with
786 // register saving than this asymmetry (see the bug report 787 // register saving than this asymmetry (see the bug report
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 push(rcx); 841 push(rcx);
841 842
842 // Clear the top frame. 843 // Clear the top frame.
843 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); 844 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
844 movq(kScratchRegister, c_entry_fp_address); 845 movq(kScratchRegister, c_entry_fp_address);
845 movq(Operand(kScratchRegister, 0), Immediate(0)); 846 movq(Operand(kScratchRegister, 0), Immediate(0));
846 } 847 }
847 848
848 849
849 } } // namespace v8::internal 850 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698