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 <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
psmarshall authored and addaleax committed Jul 18, 2017
1 parent 4e4c179 commit 02e63ce
Show file tree
Hide file tree
Showing 2 changed files with 20 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 @@ -4176,12 +4176,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
12 changes: 12 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,18 @@ 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 {

Expand Down

0 comments on commit 02e63ce

Please sign in to comment.