Commit 9568cea8 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

[API] Remove ArrayBuffer::Allocator virtual memory methods.

- Removes Reserve, Free (overload) and SetProtection methods.
- Updates comment on enum which we still need to distinguish
  between allocated and reserved ArrayBuffers.

Bug: chromium:799573
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I1b4e08f97c22ae6b6af847fbcdde047be62fecf8
Reviewed-on: https://chromium-review.googlesource.com/924603Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarEric Holk <eholk@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51714}
parent 8abd973b
......@@ -4293,41 +4293,18 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
virtual void* AllocateUninitialized(size_t length) = 0;
/**
* Reserved |length| bytes, but do not commit the memory. Must call
* |SetProtection| to make memory accessible.
*/
// TODO(eholk): make this pure virtual once blink implements this.
virtual void* Reserve(size_t length);
/**
* Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate|.
*/
virtual void Free(void* data, size_t length) = 0;
enum class AllocationMode { kNormal, kReservation };
/**
* Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate| or
* |Reserve|, depending on |mode|.
*/
// TODO(eholk): make this pure virtual once blink implements this.
virtual void Free(void* data, size_t length, AllocationMode mode);
enum class Protection { kNoAccess, kReadWrite };
/**
* Change the protection on a region of memory.
*
* On platforms that make a distinction between reserving and committing
* memory, changing the protection to kReadWrite must also ensure the memory
* is committed.
* ArrayBuffer allocation mode. kNormal is a malloc/free style allocation,
* while kReservation is for larger allocations with the ability to set
* access permissions.
*/
// TODO(eholk): make this pure virtual once blink implements this.
virtual void SetProtection(void* data, size_t length,
Protection protection);
enum class AllocationMode { kNormal, kReservation };
/**
* malloc/free based convenience allocator.
......
......@@ -456,19 +456,6 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
i::V8::SetSnapshotBlob(snapshot_blob);
}
void* v8::ArrayBuffer::Allocator::Reserve(size_t length) { UNIMPLEMENTED(); }
void v8::ArrayBuffer::Allocator::Free(void* data, size_t length,
AllocationMode mode) {
UNIMPLEMENTED();
}
void v8::ArrayBuffer::Allocator::SetProtection(
void* data, size_t length,
v8::ArrayBuffer::Allocator::Protection protection) {
UNIMPLEMENTED();
}
namespace {
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
......
......@@ -84,20 +84,6 @@ class ArrayBufferAllocatorBase : public v8::ArrayBuffer::Allocator {
allocator_->Free(data, length);
}
void* Reserve(size_t length) override {
UNIMPLEMENTED();
return nullptr;
}
void Free(void* data, size_t length, AllocationMode mode) override {
UNIMPLEMENTED();
}
void SetProtection(void* data, size_t length,
Protection protection) override {
UNIMPLEMENTED();
}
private:
std::unique_ptr<Allocator> allocator_ =
std::unique_ptr<Allocator>(NewDefaultAllocator());
......
......@@ -37,11 +37,7 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
void* Allocate(size_t length) override { return nullptr; }
void* AllocateUninitialized(size_t length) override { return nullptr; }
void* Reserve(size_t length) override { return nullptr; }
void Free(void* data, size_t length, AllocationMode mode) override {}
void Free(void* p, size_t) override {}
void SetProtection(void* data, size_t length,
Protection protection) override {}
};
static int DumpHeapConstants(const char* argv0) {
......
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