Make NextCodeLink pointer 8-byte aligned after GC pointer updating uses atomics.
authordusan.milosavljevic@imgtec.com <dusan.milosavljevic@imgtec.com>
Mon, 27 Oct 2014 18:24:05 +0000 (18:24 +0000)
committerdusan.milosavljevic@imgtec.com <dusan.milosavljevic@imgtec.com>
Mon, 27 Oct 2014 18:24:39 +0000 (18:24 +0000)
After r24737 pointer updating is done by atomic operations which strictly
require target address to be 8-byte alignment on MIPS64.

The alignment is broken on 64-bit arches because InstructionSize is first field
and has Int size.

Order of fields in object layout are changed to make kNextCodeLinkOffset
divisible by 8. The size of code object header remains the same.

TEST=cctest/test-debug/* on MIPS64
BUG=
R=jkummerow@chromium.org, paul.lind@imgtec.com

Review URL: https://codereview.chromium.org/682673002

Cr-Commit-Position: refs/heads/master@{#24914}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24914 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/mips64/builtins-mips64.cc
src/mips64/macro-assembler-mips64.cc
src/objects.h

index 51a1265..e5f733c 100644 (file)
@@ -1044,7 +1044,7 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
 
   // Load deoptimization data from the code object.
   // <deopt_data> = <code>[#deoptimization_data_offset]
-  __ Uld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
+  __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
 
   // Load the OSR entrypoint offset from the deoptimization data.
   // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
index d398f6f..466906a 100644 (file)
@@ -3091,7 +3091,7 @@ void MacroAssembler::JumpToHandlerEntry() {
   // Compute the handler entry address and jump to it.  The handler table is
   // a fixed array of (smi-tagged) code offsets.
   // v0 = exception, a1 = code object, a2 = state.
-  Uld(a3, FieldMemOperand(a1, Code::kHandlerTableOffset));
+  ld(a3, FieldMemOperand(a1, Code::kHandlerTableOffset));
   Daddu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
   dsrl(a2, a2, StackHandler::kKindWidth);  // Handler index.
   dsll(a2, a2, kPointerSizeLog2);
index d70e02a..fbe06c7 100644 (file)
@@ -5380,8 +5380,7 @@ class Code: public HeapObject {
   static const int kMaxLoopNestingMarker = 6;
 
   // Layout description.
-  static const int kInstructionSizeOffset = HeapObject::kHeaderSize;
-  static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize;
+  static const int kRelocationInfoOffset = HeapObject::kHeaderSize;
   static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
   static const int kDeoptimizationDataOffset =
       kHandlerTableOffset + kPointerSize;
@@ -5390,8 +5389,8 @@ class Code: public HeapObject {
       kDeoptimizationDataOffset + kPointerSize;
   static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize;
   static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize;
-  static const int kICAgeOffset =
-      kGCMetadataOffset + kPointerSize;
+  static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize;
+  static const int kICAgeOffset = kInstructionSizeOffset + kIntSize;
   static const int kFlagsOffset = kICAgeOffset + kIntSize;
   static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize;
   static const int kKindSpecificFlags2Offset =