From e3fcdeffcbeeb178093d7b5587c824f6a86767ec 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 | 12 ++++++++++++
2 files changed, 20 insertions(+)
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index 7988b58361e419..6257939bd93a2c 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -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.
*
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc
index 74d8768d4d5fe8..b4a9d177a7b36c 100644
--- a/deps/v8/src/api.cc
+++ b/deps/v8/src/api.cc
@@ -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 {