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

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

Issue 182027: X64: Obey WIN64 ABI more exactly, in WIN64 build. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 // TODO(1243899): This should be symmetric to 1003 // TODO(1243899): This should be symmetric to
1004 // CopyRegistersFromStackToMemory() but it isn't! esp is assumed 1004 // CopyRegistersFromStackToMemory() but it isn't! esp is assumed
1005 // correct here, but computed for the other call. Very error 1005 // correct here, but computed for the other call. Very error
1006 // prone! FIX THIS. Actually there are deeper problems with 1006 // prone! FIX THIS. Actually there are deeper problems with
1007 // register saving than this asymmetry (see the bug report 1007 // register saving than this asymmetry (see the bug report
1008 // associated with this issue). 1008 // associated with this issue).
1009 PushRegistersFromMemory(kJSCallerSaved); 1009 PushRegistersFromMemory(kJSCallerSaved);
1010 } 1010 }
1011 #endif 1011 #endif
1012 1012
1013 // Reserve space for the Arguments object. The Windows 64-bit ABI
1014 // requires us to pass this structure as a pointer to its location on
1015 // the stack. We also need backing space for the pointer, even though
1016 // it is passed in a register.
1017 subq(rsp, Immediate(3 * kPointerSize));
1018
1019 // Get the required frame alignment for the OS. 1013 // Get the required frame alignment for the OS.
1020 static const int kFrameAlignment = OS::ActivationFrameAlignment(); 1014 static const int kFrameAlignment = OS::ActivationFrameAlignment();
1021 if (kFrameAlignment > 0) { 1015 if (kFrameAlignment > 0) {
1022 ASSERT(IsPowerOf2(kFrameAlignment)); 1016 ASSERT(IsPowerOf2(kFrameAlignment));
1023 movq(kScratchRegister, Immediate(-kFrameAlignment)); 1017 movq(kScratchRegister, Immediate(-kFrameAlignment));
1024 and_(rsp, kScratchRegister); 1018 and_(rsp, kScratchRegister);
1025 } 1019 }
1026 1020
1021 #ifdef _WIN64
1022 // Reserve space for the Arguments object. The Windows 64-bit ABI
1023 // requires us to pass this structure as a pointer to its location on
1024 // the stack. The structure contains 2 pointers.
1025 // The structure on the stack must be 16-byte aligned.
1026 // We also need backing space for 4 parameters, even though
1027 // we only pass one parameter, and it is in a register.
1028 subq(rsp, Immediate(6 * kPointerSize));
1029 ASSERT(kFrameAlignment == 2 * kPointerSize); // Change the padding if needed.
1030 #endif
1031
1027 // Patch the saved entry sp. 1032 // Patch the saved entry sp.
1028 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); 1033 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp);
1029 } 1034 }
1030 1035
1031 1036
1032 void MacroAssembler::LeaveExitFrame(StackFrame::Type type) { 1037 void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
1033 // Registers: 1038 // Registers:
1034 // r15 : argv 1039 // r15 : argv
1035 #ifdef ENABLE_DEBUGGER_SUPPORT 1040 #ifdef ENABLE_DEBUGGER_SUPPORT
1036 // Restore the memory copy of the registers by digging them out from 1041 // Restore the memory copy of the registers by digging them out from
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 movq(kScratchRegister, new_space_allocation_top); 1371 movq(kScratchRegister, new_space_allocation_top);
1367 #ifdef DEBUG 1372 #ifdef DEBUG
1368 cmpq(object, Operand(kScratchRegister, 0)); 1373 cmpq(object, Operand(kScratchRegister, 0));
1369 Check(below, "Undo allocation of non allocated memory"); 1374 Check(below, "Undo allocation of non allocated memory");
1370 #endif 1375 #endif
1371 movq(Operand(kScratchRegister, 0), object); 1376 movq(Operand(kScratchRegister, 0), object);
1372 } 1377 }
1373 1378
1374 1379
1375 } } // namespace v8::internal 1380 } } // 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