 Chromium Code Reviews
 Chromium Code Reviews Issue 3461021:
  Add CODE_POINTER_ALIGN, use it in Page to align generated code.  (Closed)
    
  
    Issue 3461021:
  Add CODE_POINTER_ALIGN, use it in Page to align generated code.  (Closed) 
  | 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 |