Commit 9aed0c43 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[csa] Remove double pointer load in Allocation with kDoubleAlignment.

AllocateRawAligned called into AllocateRawUnaligned, which expected
the address of the pointer to the top of the stack, not the pointer
itself. Instead, the pointer itself was passed, causing segfaults
if this code is actually run.

Also do some drive-by clean up of the branching/labels and unused
vars etc. in AllocateRawAligned.

BUG=v8:6075

Change-Id: If71db4b61d777b6543e5246e92bb5b9e6c02c81f
Reviewed-on: https://chromium-review.googlesource.com/452374Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43722}
parent 3d3de007
......@@ -747,33 +747,28 @@ Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes,
Node* top_address,
Node* limit_address) {
Node* top = Load(MachineType::Pointer(), top_address);
Node* limit = Load(MachineType::Pointer(), limit_address);
Variable adjusted_size(this, MachineType::PointerRepresentation(),
size_in_bytes);
if (flags & kDoubleAlignment) {
Label aligned(this), not_aligned(this), merge(this, &adjusted_size);
Label not_aligned(this), done_alignment(this, &adjusted_size);
Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask)), &not_aligned,
&aligned);
&done_alignment);
Bind(&not_aligned);
Node* not_aligned_size =
IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize));
adjusted_size.Bind(not_aligned_size);
Goto(&merge);
Bind(&aligned);
Goto(&merge);
Goto(&done_alignment);
Bind(&merge);
Bind(&done_alignment);
}
Variable address(
this, MachineRepresentation::kTagged,
AllocateRawUnaligned(adjusted_size.value(), kNone, top, limit));
Variable address(this, MachineRepresentation::kTagged,
AllocateRawUnaligned(adjusted_size.value(), kNone,
top_address, limit_address));
Label needs_filler(this), doesnt_need_filler(this),
merge_address(this, &address);
Branch(IntPtrEqual(adjusted_size.value(), size_in_bytes), &doesnt_need_filler,
Label needs_filler(this), done_filling(this, &address);
Branch(IntPtrEqual(adjusted_size.value(), size_in_bytes), &done_filling,
&needs_filler);
Bind(&needs_filler);
......@@ -782,12 +777,9 @@ Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes,
LoadRoot(Heap::kOnePointerFillerMapRootIndex));
address.Bind(BitcastWordToTagged(
IntPtrAdd(address.value(), IntPtrConstant(kPointerSize))));
Goto(&merge_address);
Bind(&doesnt_need_filler);
Goto(&merge_address);
Goto(&done_filling);
Bind(&merge_address);
Bind(&done_filling);
// Update the top.
StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address,
IntPtrAdd(top, adjusted_size.value()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment