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

Unified Diff: src/globals.h

Issue 3461021: Add CODE_POINTER_ALIGN, use it in Page to align generated code. (Closed)
Patch Set: use CODE_POINTER_ALIGN in one more place Created 10 years, 3 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/heap.cc » ('j') | src/spaces.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index f168d6eb14ebef213928a5145017bc3196b42d1e..ff712f9e6a3c5d0d2f0f32111b0eb074446d232f 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -214,6 +214,12 @@ const intptr_t kMapAlignmentBits = kObjectAlignmentBits + 3;
const intptr_t kMapAlignment = (1 << kMapAlignmentBits);
const intptr_t kMapAlignmentMask = kMapAlignment - 1;
+// Desired alignment for generated code.
+// Code entry points are aligned to 32 bytes (cache line size in some CPUs).
Vitaly Repeshko 2010/09/24 15:45:38 In most of the CPUs we deal with it's actually 64.
+const int kCodeAlignmentBits = 5;
+const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
+const intptr_t kCodeAlignmentMask = kCodeAlignment - 1;
+
// Tag information for Failure.
const int kFailureTag = 3;
const int kFailureTagSize = 2;
@@ -588,6 +594,10 @@ enum StateTag {
#define MAP_POINTER_ALIGN(value) \
(((value) + kMapAlignmentMask) & ~kMapAlignmentMask)
+// CODE_POINTER_ALIGN returns the value aligned as a generated code segment.
+#define CODE_POINTER_ALIGN(value) \
+ (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask)
+
// The expression OFFSET_OF(type, field) computes the byte-offset
// of the specified field relative to the containing type. This
// corresponds to 'offsetof' (in stddef.h), except that it doesn't
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698