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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/spaces.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 // Desired alignment for maps. 208 // Desired alignment for maps.
209 #if V8_HOST_ARCH_64_BIT 209 #if V8_HOST_ARCH_64_BIT
210 const intptr_t kMapAlignmentBits = kObjectAlignmentBits; 210 const intptr_t kMapAlignmentBits = kObjectAlignmentBits;
211 #else 211 #else
212 const intptr_t kMapAlignmentBits = kObjectAlignmentBits + 3; 212 const intptr_t kMapAlignmentBits = kObjectAlignmentBits + 3;
213 #endif 213 #endif
214 const intptr_t kMapAlignment = (1 << kMapAlignmentBits); 214 const intptr_t kMapAlignment = (1 << kMapAlignmentBits);
215 const intptr_t kMapAlignmentMask = kMapAlignment - 1; 215 const intptr_t kMapAlignmentMask = kMapAlignment - 1;
216 216
217 // Desired alignment for generated code.
218 // 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.
219 const int kCodeAlignmentBits = 5;
220 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
221 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1;
222
217 // Tag information for Failure. 223 // Tag information for Failure.
218 const int kFailureTag = 3; 224 const int kFailureTag = 3;
219 const int kFailureTagSize = 2; 225 const int kFailureTagSize = 2;
220 const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1; 226 const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1;
221 227
222 228
223 const int kBitsPerByte = 8; 229 const int kBitsPerByte = 8;
224 const int kBitsPerByteLog2 = 3; 230 const int kBitsPerByteLog2 = 3;
225 const int kBitsPerPointer = kPointerSize * kBitsPerByte; 231 const int kBitsPerPointer = kPointerSize * kBitsPerByte;
226 const int kBitsPerInt = kIntSize * kBitsPerByte; 232 const int kBitsPerInt = kIntSize * kBitsPerByte;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask) 587 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask)
582 588
583 // POINTER_SIZE_ALIGN returns the value aligned as a pointer. 589 // POINTER_SIZE_ALIGN returns the value aligned as a pointer.
584 #define POINTER_SIZE_ALIGN(value) \ 590 #define POINTER_SIZE_ALIGN(value) \
585 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) 591 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask)
586 592
587 // MAP_POINTER_ALIGN returns the value aligned as a map pointer. 593 // MAP_POINTER_ALIGN returns the value aligned as a map pointer.
588 #define MAP_POINTER_ALIGN(value) \ 594 #define MAP_POINTER_ALIGN(value) \
589 (((value) + kMapAlignmentMask) & ~kMapAlignmentMask) 595 (((value) + kMapAlignmentMask) & ~kMapAlignmentMask)
590 596
597 // CODE_POINTER_ALIGN returns the value aligned as a generated code segment.
598 #define CODE_POINTER_ALIGN(value) \
599 (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask)
600
591 // The expression OFFSET_OF(type, field) computes the byte-offset 601 // The expression OFFSET_OF(type, field) computes the byte-offset
592 // of the specified field relative to the containing type. This 602 // of the specified field relative to the containing type. This
593 // corresponds to 'offsetof' (in stddef.h), except that it doesn't 603 // corresponds to 'offsetof' (in stddef.h), except that it doesn't
594 // use 0 or NULL, which causes a problem with the compiler warnings 604 // use 0 or NULL, which causes a problem with the compiler warnings
595 // we have enabled (which is also why 'offsetof' doesn't seem to work). 605 // we have enabled (which is also why 'offsetof' doesn't seem to work).
596 // Here we simply use the non-zero value 4, which seems to work. 606 // Here we simply use the non-zero value 4, which seems to work.
597 #define OFFSET_OF(type, field) \ 607 #define OFFSET_OF(type, field) \
598 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) 608 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
599 609
600 610
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 CMOV = 15, // x86 708 CMOV = 15, // x86
699 RDTSC = 4, // x86 709 RDTSC = 4, // x86
700 CPUID = 10, // x86 710 CPUID = 10, // x86
701 VFP3 = 1, // ARM 711 VFP3 = 1, // ARM
702 ARMv7 = 2, // ARM 712 ARMv7 = 2, // ARM
703 SAHF = 0}; // x86 713 SAHF = 0}; // x86
704 714
705 } } // namespace v8::internal 715 } } // namespace v8::internal
706 716
707 #endif // V8_GLOBALS_H_ 717 #endif // V8_GLOBALS_H_
OLDNEW
« 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