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

Unified Diff: src/allocation.h

Issue 22849002: Rewrite SamplingCircularQueue (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 7 years, 4 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 | src/circular-queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | src/circular-queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698