Index: src/allocation.h |
diff --git a/src/allocation.h b/src/allocation.h |
index 45bde4c4cb07068a05e301d2124990637d82609d..62a336f8990719be10a2eeda09a65474def6480e 100644 |
--- a/src/allocation.h |
+++ b/src/allocation.h |
@@ -30,6 +30,21 @@ |
#include "globals.h" |
+/* Round up n to be a multiple of sz, where sz is a power of 2. */ |
+#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) |
+ |
+// Specify memory alignment for structs, classes, etc. |
Benedikt Meurer
2013/08/14 11:38:09
Please move the ALIGN_AT definition to globals.h,
yurys
2013/08/14 13:19:01
Done.
|
+// Use like: |
+// class ALIGN_AT(16) MyClass { ... } |
+// ALIGN_AT(16) int array[4]; |
+#if defined(_MSC_VER) |
+#define ALIGN_AT(byte_alignment) __declspec(align(byte_alignment)) |
+#elif defined(__GNUC__) || defined(__APPLE__) |
Benedikt Meurer
2013/08/14 11:38:09
Why __APPLE__ here? This is actually a compiler th
yurys
2013/08/14 13:19:01
Done. Removed __APPLE__.
|
+#define ALIGN_AT(byte_alignment) __attribute__((aligned(byte_alignment))) |
+#else |
+#error "ALIGN_AT is not supported for your compiler" |
Benedikt Meurer
2013/08/14 11:38:09
Since the alignment is an optimization, I think it
yurys
2013/08/14 13:19:01
Done.
|
+#endif |
+ |
namespace v8 { |
namespace internal { |