Allow platforms (linux and win32) to not force 16-byte alignment

of activation frames (needed on Mac OS X).
Review URL: http://codereview.chromium.org/4211

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@361 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kasperl@chromium.org 2008-09-23 10:06:58 +00:00
parent a9e4a68ef2
commit 88c9fa5d42
5 changed files with 36 additions and 7 deletions

View File

@ -5209,11 +5209,11 @@ void CEntryStub::GenerateReserveCParameterSpace(MacroAssembler* masm,
if (num_parameters > 0) { if (num_parameters > 0) {
__ sub(Operand(esp), Immediate(num_parameters * kPointerSize)); __ sub(Operand(esp), Immediate(num_parameters * kPointerSize));
} }
// OS X activation frames are 16 byte-aligned static const int kFrameAlignment = OS::ActivationFrameAlignment();
// (see "Mac OS X ABI Function Call Guide"). if (kFrameAlignment > 0) {
const int kFrameAlignment = 16; ASSERT(IsPowerOf2(kFrameAlignment));
ASSERT(IsPowerOf2(kFrameAlignment)); __ and_(esp, -kFrameAlignment);
__ and_(esp, -kFrameAlignment); }
} }

View File

@ -195,7 +195,16 @@ char *OS::StrDup(const char* str) {
} }
double OS::nan_value() { return NAN; } double OS::nan_value() {
return NAN;
}
int OS::ActivationFrameAlignment() {
// No constraint on Linux.
return 0;
}
// We keep the lowest and highest addresses mapped as a quick way of // We keep the lowest and highest addresses mapped as a quick way of
// determining that pointers are outside the heap (used mostly in assertions // determining that pointers are outside the heap (used mostly in assertions

View File

@ -300,7 +300,16 @@ void OS::LogSharedLibraryAddresses() {
} }
double OS::nan_value() { return NAN; } double OS::nan_value() {
return NAN;
}
int OS::ActivationFrameAlignment() {
// OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI
// Function Call Guide".
return 16;
}
int OS::StackWalk(StackFrame* frames, int frames_size) { int OS::StackWalk(StackFrame* frames, int frames_size) {

View File

@ -1206,6 +1206,13 @@ double OS::nan_value() {
return *reinterpret_cast<const double*>(&nanval); return *reinterpret_cast<const double*>(&nanval);
} }
int OS::ActivationFrameAlignment() {
// No constraint on Windows.
return 0;
}
bool VirtualMemory::IsReserved() { bool VirtualMemory::IsReserved() {
return address_ != NULL; return address_ != NULL;
} }

View File

@ -217,6 +217,10 @@ class OS {
// Returns the double constant NAN // Returns the double constant NAN
static double nan_value(); static double nan_value();
// Returns the activation frame alignment constraint or zero if
// the platform doesn't care. Guaranteed to be a power of two.
static int ActivationFrameAlignment();
private: private:
static const int msPerSecond = 1000; static const int msPerSecond = 1000;