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 137443004: Use kRegisterSize when passing arguments to the C++ runtime for X64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 6 years, 11 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/deoptimizer-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 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 3759 matching lines...) Expand 10 before | Expand all | Expand 10 after
3770 3770
3771 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space, 3771 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space,
3772 bool save_doubles) { 3772 bool save_doubles) {
3773 #ifdef _WIN64 3773 #ifdef _WIN64
3774 const int kShadowSpace = 4; 3774 const int kShadowSpace = 4;
3775 arg_stack_space += kShadowSpace; 3775 arg_stack_space += kShadowSpace;
3776 #endif 3776 #endif
3777 // Optionally save all XMM registers. 3777 // Optionally save all XMM registers.
3778 if (save_doubles) { 3778 if (save_doubles) {
3779 int space = XMMRegister::kMaxNumAllocatableRegisters * kDoubleSize + 3779 int space = XMMRegister::kMaxNumAllocatableRegisters * kDoubleSize +
3780 arg_stack_space * kPointerSize; 3780 arg_stack_space * kRegisterSize;
3781 subq(rsp, Immediate(space)); 3781 subq(rsp, Immediate(space));
3782 int offset = -2 * kPointerSize; 3782 int offset = -2 * kPointerSize;
3783 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { 3783 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
3784 XMMRegister reg = XMMRegister::FromAllocationIndex(i); 3784 XMMRegister reg = XMMRegister::FromAllocationIndex(i);
3785 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); 3785 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg);
3786 } 3786 }
3787 } else if (arg_stack_space > 0) { 3787 } else if (arg_stack_space > 0) {
3788 subq(rsp, Immediate(arg_stack_space * kPointerSize)); 3788 subq(rsp, Immediate(arg_stack_space * kRegisterSize));
3789 } 3789 }
3790 3790
3791 // Get the required frame alignment for the OS. 3791 // Get the required frame alignment for the OS.
3792 const int kFrameAlignment = OS::ActivationFrameAlignment(); 3792 const int kFrameAlignment = OS::ActivationFrameAlignment();
3793 if (kFrameAlignment > 0) { 3793 if (kFrameAlignment > 0) {
3794 ASSERT(IsPowerOf2(kFrameAlignment)); 3794 ASSERT(IsPowerOf2(kFrameAlignment));
3795 ASSERT(is_int8(kFrameAlignment)); 3795 ASSERT(is_int8(kFrameAlignment));
3796 and_(rsp, Immediate(-kFrameAlignment)); 3796 and_(rsp, Immediate(-kFrameAlignment));
3797 } 3797 }
3798 3798
(...skipping 24 matching lines...) Expand all
3823 // Registers: 3823 // Registers:
3824 // r15 : argv 3824 // r15 : argv
3825 if (save_doubles) { 3825 if (save_doubles) {
3826 int offset = -2 * kPointerSize; 3826 int offset = -2 * kPointerSize;
3827 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { 3827 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
3828 XMMRegister reg = XMMRegister::FromAllocationIndex(i); 3828 XMMRegister reg = XMMRegister::FromAllocationIndex(i);
3829 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); 3829 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize)));
3830 } 3830 }
3831 } 3831 }
3832 // Get the return address from the stack and restore the frame pointer. 3832 // Get the return address from the stack and restore the frame pointer.
3833 movq(rcx, Operand(rbp, 1 * kPointerSize)); 3833 movq(rcx, Operand(rbp, kFPOnStackSize));
3834 movq(rbp, Operand(rbp, 0 * kPointerSize)); 3834 movq(rbp, Operand(rbp, 0 * kPointerSize));
3835 3835
3836 // Drop everything up to and including the arguments and the receiver 3836 // Drop everything up to and including the arguments and the receiver
3837 // from the caller stack. 3837 // from the caller stack.
3838 lea(rsp, Operand(r15, 1 * kPointerSize)); 3838 lea(rsp, Operand(r15, 1 * kPointerSize));
3839 3839
3840 PushReturnAddressFrom(rcx); 3840 PushReturnAddressFrom(rcx);
3841 3841
3842 LeaveExitFrameEpilogue(true); 3842 LeaveExitFrameEpilogue(true);
3843 } 3843 }
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
4696 void MacroAssembler::PrepareCallCFunction(int num_arguments) { 4696 void MacroAssembler::PrepareCallCFunction(int num_arguments) {
4697 int frame_alignment = OS::ActivationFrameAlignment(); 4697 int frame_alignment = OS::ActivationFrameAlignment();
4698 ASSERT(frame_alignment != 0); 4698 ASSERT(frame_alignment != 0);
4699 ASSERT(num_arguments >= 0); 4699 ASSERT(num_arguments >= 0);
4700 4700
4701 // Make stack end at alignment and allocate space for arguments and old rsp. 4701 // Make stack end at alignment and allocate space for arguments and old rsp.
4702 movq(kScratchRegister, rsp); 4702 movq(kScratchRegister, rsp);
4703 ASSERT(IsPowerOf2(frame_alignment)); 4703 ASSERT(IsPowerOf2(frame_alignment));
4704 int argument_slots_on_stack = 4704 int argument_slots_on_stack =
4705 ArgumentStackSlotsForCFunctionCall(num_arguments); 4705 ArgumentStackSlotsForCFunctionCall(num_arguments);
4706 subq(rsp, Immediate((argument_slots_on_stack + 1) * kPointerSize)); 4706 subq(rsp, Immediate((argument_slots_on_stack + 1) * kRegisterSize));
4707 and_(rsp, Immediate(-frame_alignment)); 4707 and_(rsp, Immediate(-frame_alignment));
4708 movq(Operand(rsp, argument_slots_on_stack * kPointerSize), kScratchRegister); 4708 movq(Operand(rsp, argument_slots_on_stack * kRegisterSize), kScratchRegister);
4709 } 4709 }
4710 4710
4711 4711
4712 void MacroAssembler::CallCFunction(ExternalReference function, 4712 void MacroAssembler::CallCFunction(ExternalReference function,
4713 int num_arguments) { 4713 int num_arguments) {
4714 LoadAddress(rax, function); 4714 LoadAddress(rax, function);
4715 CallCFunction(rax, num_arguments); 4715 CallCFunction(rax, num_arguments);
4716 } 4716 }
4717 4717
4718 4718
4719 void MacroAssembler::CallCFunction(Register function, int num_arguments) { 4719 void MacroAssembler::CallCFunction(Register function, int num_arguments) {
4720 ASSERT(has_frame()); 4720 ASSERT(has_frame());
4721 // Check stack alignment. 4721 // Check stack alignment.
4722 if (emit_debug_code()) { 4722 if (emit_debug_code()) {
4723 CheckStackAlignment(); 4723 CheckStackAlignment();
4724 } 4724 }
4725 4725
4726 call(function); 4726 call(function);
4727 ASSERT(OS::ActivationFrameAlignment() != 0); 4727 ASSERT(OS::ActivationFrameAlignment() != 0);
4728 ASSERT(num_arguments >= 0); 4728 ASSERT(num_arguments >= 0);
4729 int argument_slots_on_stack = 4729 int argument_slots_on_stack =
4730 ArgumentStackSlotsForCFunctionCall(num_arguments); 4730 ArgumentStackSlotsForCFunctionCall(num_arguments);
4731 movq(rsp, Operand(rsp, argument_slots_on_stack * kPointerSize)); 4731 movq(rsp, Operand(rsp, argument_slots_on_stack * kRegisterSize));
4732 } 4732 }
4733 4733
4734 4734
4735 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { 4735 bool AreAliased(Register r1, Register r2, Register r3, Register r4) {
4736 if (r1.is(r2)) return true; 4736 if (r1.is(r2)) return true;
4737 if (r1.is(r3)) return true; 4737 if (r1.is(r3)) return true;
4738 if (r1.is(r4)) return true; 4738 if (r1.is(r4)) return true;
4739 if (r2.is(r3)) return true; 4739 if (r2.is(r3)) return true;
4740 if (r2.is(r4)) return true; 4740 if (r2.is(r4)) return true;
4741 if (r3.is(r4)) return true; 4741 if (r3.is(r4)) return true;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5047 j(equal, found); 5047 j(equal, found);
5048 movq(current, FieldOperand(current, Map::kPrototypeOffset)); 5048 movq(current, FieldOperand(current, Map::kPrototypeOffset));
5049 CompareRoot(current, Heap::kNullValueRootIndex); 5049 CompareRoot(current, Heap::kNullValueRootIndex);
5050 j(not_equal, &loop_again); 5050 j(not_equal, &loop_again);
5051 } 5051 }
5052 5052
5053 5053
5054 } } // namespace v8::internal 5054 } } // namespace v8::internal
5055 5055
5056 #endif // V8_TARGET_ARCH_X64 5056 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698