Skip to content
Permalink
Browse files

v8: backport pieces from 18a26cfe174 from upstream v8

Backport new virtual methods from 18a26cfe174
("Add memory protection API to ArrayBuffer::Allocator")

PR-URL: #13217
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
psmarshall authored and jasnell committed May 26, 2017
1 parent cfdcd6c commit c8be7187491fc77358b0bdbd630491ca50fa21ac
Showing with 21 additions and 0 deletions.
  1. +8 −0 deps/v8/include/v8.h
  2. +13 −0 deps/v8/src/api.cc
@@ -4008,12 +4008,20 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
virtual void* AllocateUninitialized(size_t length) = 0;

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 };
virtual void Free(void* data, size_t length, AllocationMode mode);
enum class Protection { kNoAccess, kReadWrite };
virtual void SetProtection(void* data, size_t length,
Protection protection);

/**
* malloc/free based convenience allocator.
*
@@ -437,6 +437,19 @@ 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 {

0 comments on commit c8be718

Please sign in to comment.
You can’t perform that action at this time.