Skip to content

Commit

Permalink
v8: backport pieces from 18a26cfe174 from upstream v8
Browse files Browse the repository at this point in the history
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 28, 2017
1 parent cfdcd6c commit c8be718
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
13 changes: 13 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c8be718

Please sign in to comment.