From c1bfc3485d3fe104566e775f80f46afb45c3e9c5 Mon Sep 17 00:00:00 2001 From: andrew_low Date: Mon, 24 Nov 2014 02:22:09 -0800 Subject: [PATCH] Fix alignment of Code::kConstantPoolOffset. This is needed for 64bit alignment sensitive platforms (PowerPC) Exposed bugs with new GC compare and swap changes updating the field. Example failing test: out/ppc64.debug/cctest test-decls/ExistsInPrototype BUG= Review URL: https://codereview.chromium.org/740443002 Cr-Commit-Position: refs/heads/master@{#25472} --- src/objects.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/objects.h b/src/objects.h index 0ec38664da..1eab44321c 100644 --- a/src/objects.h +++ b/src/objects.h @@ -5376,7 +5376,7 @@ class Code: public HeapObject { kKindSpecificFlags1Offset + kIntSize; // Note: We might be able to squeeze this into the flags above. static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; - static const int kConstantPoolOffset = kPrologueOffset + kPointerSize; + static const int kConstantPoolOffset = kPrologueOffset + kIntSize; static const int kHeaderPaddingStart = kConstantPoolOffset + kPointerSize; @@ -5384,6 +5384,8 @@ class Code: public HeapObject { // the Code object header. static const int kHeaderSize = (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; + // Ensure that the slot for the constant pool pointer is aligned. + STATIC_ASSERT((kConstantPoolOffset & kPointerAlignmentMask) == 0); // Byte offsets within kKindSpecificFlags1Offset. static const int kOptimizableOffset = kKindSpecificFlags1Offset;