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

Unified Diff: src/x64/macro-assembler-x64.cc

Issue 2365001: X64: Fix issue 678. Bug in some Win64 C calls from generated code. (Closed)
Patch Set: Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index b851fec68429b7cf63c50f12a2f794ba42769bc0..d82b8ecf381f9f52fe0941467a036b64c2d20013 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -2641,20 +2641,27 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
}
}
+
int MacroAssembler::ArgumentStackSlotsForCFunctionCall(int num_arguments) {
// On Windows stack slots are reserved by the caller for all arguments
- // including the ones passed in registers. On Linux 6 arguments are passed in
- // registers and the caller does not reserve stack slots for them.
+ // including the ones passed in registers, and space is alwaysallocated for
Rico 2010/05/28 08:20:02 always->allocated -> always allocated
+ // the four register arguments even if the function takes fewer than four
+ // arguments.
+ // On Linux the first six arguments are passed in registers and the caller
+ // does not reserve stack slots for them.
ASSERT(num_arguments >= 0);
#ifdef _WIN64
- static const int kArgumentsWithoutStackSlot = 0;
+ static const int kMinimumStackSlots = 4;
+ if (num_arguments < kMinimumStackSlots) return kMinimumStackSlots;
+ return num_arguments;
#else
- static const int kArgumentsWithoutStackSlot = 6;
+ static const int kRegisterPassedArguments = 6;
+ if (num_arguments < kRegisterPassedArguments) return 0;
+ return num_arguments - kRegisterPassedArguments;
#endif
- return num_arguments > kArgumentsWithoutStackSlot ?
- num_arguments - kArgumentsWithoutStackSlot : 0;
}
+
void MacroAssembler::PrepareCallCFunction(int num_arguments) {
int frame_alignment = OS::ActivationFrameAlignment();
ASSERT(frame_alignment != 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698