OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_GLOBALS_H_ | 5 #ifndef V8_GLOBALS_H_ |
6 #define V8_GLOBALS_H_ | 6 #define V8_GLOBALS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51; | 190 const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51; |
191 | 191 |
192 // Latin1/UTF-16 constants | 192 // Latin1/UTF-16 constants |
193 // Code-point values in Unicode 4.0 are 21 bits wide. | 193 // Code-point values in Unicode 4.0 are 21 bits wide. |
194 // Code units in UTF-16 are 16 bits wide. | 194 // Code units in UTF-16 are 16 bits wide. |
195 typedef uint16_t uc16; | 195 typedef uint16_t uc16; |
196 typedef int32_t uc32; | 196 typedef int32_t uc32; |
197 const int kOneByteSize = kCharSize; | 197 const int kOneByteSize = kCharSize; |
198 const int kUC16Size = sizeof(uc16); // NOLINT | 198 const int kUC16Size = sizeof(uc16); // NOLINT |
199 | 199 |
200 // 128 bit SIMD value size. | |
201 const int kSimd128Size = 16; | |
202 | 200 |
203 // Round up n to be a multiple of sz, where sz is a power of 2. | 201 // Round up n to be a multiple of sz, where sz is a power of 2. |
204 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) | 202 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) |
205 | 203 |
206 | 204 |
207 // FUNCTION_ADDR(f) gets the address of a C function f. | 205 // FUNCTION_ADDR(f) gets the address of a C function f. |
208 #define FUNCTION_ADDR(f) \ | 206 #define FUNCTION_ADDR(f) \ |
209 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f))) | 207 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f))) |
210 | 208 |
211 | 209 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; | 292 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; |
295 | 293 |
296 // Desired alignment for pointers. | 294 // Desired alignment for pointers. |
297 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); | 295 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); |
298 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; | 296 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; |
299 | 297 |
300 // Desired alignment for double values. | 298 // Desired alignment for double values. |
301 const intptr_t kDoubleAlignment = 8; | 299 const intptr_t kDoubleAlignment = 8; |
302 const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1; | 300 const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1; |
303 | 301 |
304 // Desired alignment for 128 bit SIMD values. | |
305 const intptr_t kSimd128Alignment = 16; | |
306 const intptr_t kSimd128AlignmentMask = kSimd128Alignment - 1; | |
307 | |
308 // Desired alignment for generated code is 32 bytes (to improve cache line | 302 // Desired alignment for generated code is 32 bytes (to improve cache line |
309 // utilization). | 303 // utilization). |
310 const int kCodeAlignmentBits = 5; | 304 const int kCodeAlignmentBits = 5; |
311 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits; | 305 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits; |
312 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1; | 306 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1; |
313 | 307 |
314 // The owner field of a page is tagged with the page header tag. We need that | 308 // The owner field of a page is tagged with the page header tag. We need that |
315 // to find out if a slot is part of a large object. If we mask out the lower | 309 // to find out if a slot is part of a large object. If we mask out the lower |
316 // 0xfffff bits (1M pages), go to the owner offset, and see that this field | 310 // 0xfffff bits (1M pages), go to the owner offset, and see that this field |
317 // is tagged with the page header tag, we can just look up the owner. | 311 // is tagged with the page header tag, we can just look up the owner. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 LO_SPACE, // Promoted large objects. | 431 LO_SPACE, // Promoted large objects. |
438 | 432 |
439 FIRST_SPACE = NEW_SPACE, | 433 FIRST_SPACE = NEW_SPACE, |
440 LAST_SPACE = LO_SPACE, | 434 LAST_SPACE = LO_SPACE, |
441 FIRST_PAGED_SPACE = OLD_SPACE, | 435 FIRST_PAGED_SPACE = OLD_SPACE, |
442 LAST_PAGED_SPACE = MAP_SPACE | 436 LAST_PAGED_SPACE = MAP_SPACE |
443 }; | 437 }; |
444 const int kSpaceTagSize = 3; | 438 const int kSpaceTagSize = 3; |
445 const int kSpaceTagMask = (1 << kSpaceTagSize) - 1; | 439 const int kSpaceTagMask = (1 << kSpaceTagSize) - 1; |
446 | 440 |
447 enum AllocationAlignment { | 441 enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned }; |
448 kWordAligned, | |
449 kDoubleAligned, | |
450 kDoubleUnaligned, | |
451 kSimd128Unaligned | |
452 }; | |
453 | 442 |
454 // A flag that indicates whether objects should be pretenured when | 443 // A flag that indicates whether objects should be pretenured when |
455 // allocated (allocated directly into the old generation) or not | 444 // allocated (allocated directly into the old generation) or not |
456 // (allocated in the young generation if the object size and type | 445 // (allocated in the young generation if the object size and type |
457 // allows). | 446 // allows). |
458 enum PretenureFlag { NOT_TENURED, TENURED }; | 447 enum PretenureFlag { NOT_TENURED, TENURED }; |
459 | 448 |
460 inline std::ostream& operator<<(std::ostream& os, const PretenureFlag& flag) { | 449 inline std::ostream& operator<<(std::ostream& os, const PretenureFlag& flag) { |
461 switch (flag) { | 450 switch (flag) { |
462 case NOT_TENURED: | 451 case NOT_TENURED: |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { | 939 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
951 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 940 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
952 DCHECK(IsValidFunctionKind(kind)); | 941 DCHECK(IsValidFunctionKind(kind)); |
953 return kind; | 942 return kind; |
954 } | 943 } |
955 } } // namespace v8::internal | 944 } } // namespace v8::internal |
956 | 945 |
957 namespace i = v8::internal; | 946 namespace i = v8::internal; |
958 | 947 |
959 #endif // V8_GLOBALS_H_ | 948 #endif // V8_GLOBALS_H_ |
OLD | NEW |