Author: [EMAIL PROTECTED]
Date: Tue Sep 23 03:06:58 2008
New Revision: 361
Modified:
branches/bleeding_edge/src/codegen-ia32.cc
branches/bleeding_edge/src/platform-linux.cc
branches/bleeding_edge/src/platform-macos.cc
branches/bleeding_edge/src/platform-win32.cc
branches/bleeding_edge/src/platform.h
Log:
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
Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc Tue Sep 23 03:06:58 2008
@@ -5209,11 +5209,11 @@
if (num_parameters > 0) {
__ sub(Operand(esp), Immediate(num_parameters * kPointerSize));
}
- // OS X activation frames are 16 byte-aligned
- // (see "Mac OS X ABI Function Call Guide").
- const int kFrameAlignment = 16;
- ASSERT(IsPowerOf2(kFrameAlignment));
- __ and_(esp, -kFrameAlignment);
+ static const int kFrameAlignment = OS::ActivationFrameAlignment();
+ if (kFrameAlignment > 0) {
+ ASSERT(IsPowerOf2(kFrameAlignment));
+ __ and_(esp, -kFrameAlignment);
+ }
}
Modified: branches/bleeding_edge/src/platform-linux.cc
==============================================================================
--- branches/bleeding_edge/src/platform-linux.cc (original)
+++ branches/bleeding_edge/src/platform-linux.cc Tue Sep 23 03:06:58 2008
@@ -195,7 +195,16 @@
}
-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
// determining that pointers are outside the heap (used mostly in
assertions
Modified: branches/bleeding_edge/src/platform-macos.cc
==============================================================================
--- branches/bleeding_edge/src/platform-macos.cc (original)
+++ branches/bleeding_edge/src/platform-macos.cc Tue Sep 23 03:06:58 2008
@@ -300,7 +300,16 @@
}
-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) {
Modified: branches/bleeding_edge/src/platform-win32.cc
==============================================================================
--- branches/bleeding_edge/src/platform-win32.cc (original)
+++ branches/bleeding_edge/src/platform-win32.cc Tue Sep 23 03:06:58 2008
@@ -1206,6 +1206,13 @@
return *reinterpret_cast<const double*>(&nanval);
}
+
+int OS::ActivationFrameAlignment() {
+ // No constraint on Windows.
+ return 0;
+}
+
+
bool VirtualMemory::IsReserved() {
return address_ != NULL;
}
Modified: branches/bleeding_edge/src/platform.h
==============================================================================
--- branches/bleeding_edge/src/platform.h (original)
+++ branches/bleeding_edge/src/platform.h Tue Sep 23 03:06:58 2008
@@ -217,6 +217,10 @@
// Returns the double constant NAN
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:
static const int msPerSecond = 1000;
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---