Commit 2577c2b9 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Make IsOufOfLineBuffer an instance method

Bug: 986235
Change-Id: I90985578846a64c0da4900b0f600f5ef53720391
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106156Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751302}
parent 15e89596
......@@ -696,7 +696,7 @@ Deque<T, inlineCapacity, Allocator>::Trace(VisitorDispatcher visitor) const {
static_assert(Allocator::kIsGarbageCollected,
"Garbage collector must be enabled.");
const T* buffer = buffer_.BufferSafe();
DCHECK(!buffer || BackingBuffer::IsOutOfLineBuffer(&buffer_, buffer));
DCHECK(!buffer || buffer_.IsOutOfLineBuffer(buffer));
Allocator::TraceVectorBacking(visitor, buffer, buffer_.BufferSlot());
}
......
......@@ -602,7 +602,7 @@ class VectorBuffer<T, 0, Allocator> : protected VectorBufferBase<T, Allocator> {
bool HasOutOfLineBuffer() const {
// When inlineCapacity is 0 we have an out of line buffer if we have a
// buffer.
return IsOutOfLineBuffer(this, Buffer());
return IsOutOfLineBuffer(Buffer());
}
T** BufferSlot() { return &buffer_; }
......@@ -613,9 +613,7 @@ class VectorBuffer<T, 0, Allocator> : protected VectorBufferBase<T, Allocator> {
using Base::size_;
static bool IsOutOfLineBuffer(const VectorBuffer* vector, const T* buffer) {
return buffer;
}
bool IsOutOfLineBuffer(const T* buffer) const { return buffer; }
private:
using Base::buffer_;
......@@ -889,7 +887,7 @@ class VectorBuffer : protected VectorBufferBase<T, Allocator> {
using Base::Buffer;
using Base::capacity;
bool HasOutOfLineBuffer() const { return IsOutOfLineBuffer(this, Buffer()); }
bool HasOutOfLineBuffer() const { return IsOutOfLineBuffer(Buffer()); }
T** BufferSlot() { return &buffer_; }
const T* const* BufferSlot() const { return &buffer_; }
......@@ -899,8 +897,8 @@ class VectorBuffer : protected VectorBufferBase<T, Allocator> {
using Base::size_;
static bool IsOutOfLineBuffer(const VectorBuffer* vector, const T* buffer) {
return buffer && buffer != vector->InlineBuffer();
bool IsOutOfLineBuffer(const T* buffer) const {
return buffer && buffer != InlineBuffer();
}
private:
......@@ -2047,7 +2045,7 @@ Vector<T, inlineCapacity, Allocator>::Trace(VisitorDispatcher visitor) const {
"Garbage collector must be enabled.");
const T* buffer = BufferSafe();
if (Base::IsOutOfLineBuffer(this, buffer)) {
if (Base::IsOutOfLineBuffer(buffer)) {
Allocator::TraceVectorBacking(visitor, buffer, Base::BufferSlot());
} else {
// We should not visit inline buffers, but we still need to register the
......
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