Commit 5bb49631 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] TryAllocatLinearlyAligned doesn't need to take pointer

We don't use the updated size anywhere.

Bug: v8:10315
Change-Id: Iba1fd484fef062d109aa4e5a2c1b40d0a838f80b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2317320Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69048}
parent 93b2105f
......@@ -1337,8 +1337,9 @@ class Heap {
// ===========================================================================
// Creates a filler object and returns a heap object immediately after it.
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT HeapObject
PrecedeWithFiller(ReadOnlyRoots roots, HeapObject object, int filler_size);
V8_EXPORT_PRIVATE static HeapObject PrecedeWithFiller(ReadOnlyRoots roots,
HeapObject object,
int filler_size);
// Creates a filler object if needed for alignment and returns a heap object
// immediately after it. If any space is left after the returned object,
......
......@@ -107,24 +107,21 @@ AllocationResult PagedSpace::AllocateLinearly(int size_in_bytes) {
}
AllocationResult PagedSpace::TryAllocateLinearlyAligned(
int* size_in_bytes, AllocationAlignment alignment) {
int size_in_bytes, AllocationAlignment alignment) {
Address current_top = allocation_info_.top();
int filler_size = Heap::GetFillToAlign(current_top, alignment);
Address new_top = current_top + filler_size + *size_in_bytes;
Address new_top = current_top + filler_size + size_in_bytes;
if (new_top > allocation_info_.limit())
return AllocationResult::Retry(identity());
allocation_info_.set_top(new_top);
if (filler_size > 0) {
*size_in_bytes += filler_size;
HeapObject object = Heap::PrecedeWithFiller(
ReadOnlyRoots(heap()), HeapObject::FromAddress(current_top),
filler_size);
return AllocationResult(object);
Heap::PrecedeWithFiller(ReadOnlyRoots(heap()),
HeapObject::FromAddress(current_top), filler_size);
}
return AllocationResult(HeapObject::FromAddress(current_top));
return AllocationResult(HeapObject::FromAddress(current_top + filler_size));
}
AllocationResult PagedSpace::AllocateRawUnaligned(int size_in_bytes,
......@@ -156,9 +153,8 @@ AllocationResult PagedSpace::AllocateRawAligned(int size_in_bytes,
if (!EnsureLabMain(allocation_size, origin)) {
return AllocationResult::Retry(identity());
}
allocation_size = size_in_bytes;
AllocationResult result =
TryAllocateLinearlyAligned(&allocation_size, alignment);
TryAllocateLinearlyAligned(size_in_bytes, alignment);
DCHECK(!result.IsRetry());
MSAN_ALLOCATED_UNINITIALIZED_MEMORY(result.ToObjectChecked().address(),
size_in_bytes);
......@@ -176,8 +172,7 @@ AllocationResult PagedSpace::AllocateRaw(int size_in_bytes,
AllocationResult result;
if (alignment != kWordAligned) {
int allocation_size = size_in_bytes;
result = TryAllocateLinearlyAligned(&allocation_size, alignment);
result = TryAllocateLinearlyAligned(size_in_bytes, alignment);
} else {
result = AllocateLinearly(size_in_bytes);
}
......
......@@ -361,7 +361,7 @@ class V8_EXPORT_PRIVATE PagedSpace
// Otherwise, returns the object pointer and writes the allocation size
// (object size + alignment filler size) to the size_in_bytes.
inline AllocationResult TryAllocateLinearlyAligned(
int* size_in_bytes, AllocationAlignment alignment);
int size_in_bytes, AllocationAlignment alignment);
V8_WARN_UNUSED_RESULT bool TryAllocationFromFreeListMain(
size_t size_in_bytes, AllocationOrigin origin);
......
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