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

Side by Side Diff: src/globals.h

Issue 1159453004: Add SIMD 128 alignment support to Heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Only mark aligned object memory as MSAN uninitialized. Created 5 years, 6 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/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
200 202
201 // Round up n to be a multiple of sz, where sz is a power of 2. 203 // Round up n to be a multiple of sz, where sz is a power of 2.
202 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) 204 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
203 205
204 206
205 // FUNCTION_ADDR(f) gets the address of a C function f. 207 // FUNCTION_ADDR(f) gets the address of a C function f.
206 #define FUNCTION_ADDR(f) \ 208 #define FUNCTION_ADDR(f) \
207 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f))) 209 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f)))
208 210
209 211
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; 304 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1;
303 305
304 // Desired alignment for pointers. 306 // Desired alignment for pointers.
305 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); 307 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2);
306 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; 308 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1;
307 309
308 // Desired alignment for double values. 310 // Desired alignment for double values.
309 const intptr_t kDoubleAlignment = 8; 311 const intptr_t kDoubleAlignment = 8;
310 const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1; 312 const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1;
311 313
314 // Desired alignment for 128 bit SIMD values.
315 const intptr_t kSimd128Alignment = 16;
316 const intptr_t kSimd128AlignmentMask = kSimd128Alignment - 1;
317
312 // Desired alignment for generated code is 32 bytes (to improve cache line 318 // Desired alignment for generated code is 32 bytes (to improve cache line
313 // utilization). 319 // utilization).
314 const int kCodeAlignmentBits = 5; 320 const int kCodeAlignmentBits = 5;
315 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits; 321 const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
316 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1; 322 const intptr_t kCodeAlignmentMask = kCodeAlignment - 1;
317 323
318 // The owner field of a page is tagged with the page header tag. We need that 324 // The owner field of a page is tagged with the page header tag. We need that
319 // to find out if a slot is part of a large object. If we mask out the lower 325 // to find out if a slot is part of a large object. If we mask out the lower
320 // 0xfffff bits (1M pages), go to the owner offset, and see that this field 326 // 0xfffff bits (1M pages), go to the owner offset, and see that this field
321 // is tagged with the page header tag, we can just look up the owner. 327 // is tagged with the page header tag, we can just look up the owner.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 LO_SPACE, // Promoted large objects. 448 LO_SPACE, // Promoted large objects.
443 449
444 FIRST_SPACE = NEW_SPACE, 450 FIRST_SPACE = NEW_SPACE,
445 LAST_SPACE = LO_SPACE, 451 LAST_SPACE = LO_SPACE,
446 FIRST_PAGED_SPACE = OLD_SPACE, 452 FIRST_PAGED_SPACE = OLD_SPACE,
447 LAST_PAGED_SPACE = MAP_SPACE 453 LAST_PAGED_SPACE = MAP_SPACE
448 }; 454 };
449 const int kSpaceTagSize = 3; 455 const int kSpaceTagSize = 3;
450 const int kSpaceTagMask = (1 << kSpaceTagSize) - 1; 456 const int kSpaceTagMask = (1 << kSpaceTagSize) - 1;
451 457
452 enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned }; 458 enum AllocationAlignment {
459 kWordAligned,
460 kDoubleAligned,
461 kDoubleUnaligned,
462 kSimd128Unaligned
463 };
453 464
454 // A flag that indicates whether objects should be pretenured when 465 // A flag that indicates whether objects should be pretenured when
455 // allocated (allocated directly into the old generation) or not 466 // allocated (allocated directly into the old generation) or not
456 // (allocated in the young generation if the object size and type 467 // (allocated in the young generation if the object size and type
457 // allows). 468 // allows).
458 enum PretenureFlag { NOT_TENURED, TENURED }; 469 enum PretenureFlag { NOT_TENURED, TENURED };
459 470
460 inline std::ostream& operator<<(std::ostream& os, const PretenureFlag& flag) { 471 inline std::ostream& operator<<(std::ostream& os, const PretenureFlag& flag) {
461 switch (flag) { 472 switch (flag) {
462 case NOT_TENURED: 473 case NOT_TENURED:
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { 961 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) {
951 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); 962 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral);
952 DCHECK(IsValidFunctionKind(kind)); 963 DCHECK(IsValidFunctionKind(kind));
953 return kind; 964 return kind;
954 } 965 }
955 } } // namespace v8::internal 966 } } // namespace v8::internal
956 967
957 namespace i = v8::internal; 968 namespace i = v8::internal;
958 969
959 #endif // V8_GLOBALS_H_ 970 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698