From c8be7187491fc77358b0bdbd630491ca50fa21ac Mon Sep 17 00:00:00 2001
From: Peter Marshall
Date: Fri, 26 May 2017 14:08:06 +0200
Subject: [PATCH] v8: backport pieces from 18a26cfe174 from upstream v8
Backport new virtual methods from 18a26cfe174
("Add memory protection API to ArrayBuffer::Allocator")
PR-URL: https://github.com/nodejs/node/pull/13217
Reviewed-By: Franziska Hinkelmann
Reviewed-By: Ben Noordhuis
Reviewed-By: Anna Henningsen
Reviewed-By: James M Snell
---
deps/v8/include/v8.h | 8 ++++++++
deps/v8/src/api.cc | 13 +++++++++++++
2 files changed, 21 insertions(+)
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index b65c78483e6bc9..95023ae1c910bc 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -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.
*
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc
index beeec065a96bdf..f7f30217dd3be2 100644
--- a/deps/v8/src/api.cc
+++ b/deps/v8/src/api.cc
@@ -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 {