Skip to content

Commit cec8eda

Browse files
psmarshalladdaleax
authored andcommitted
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>
1 parent a793585 commit cec8eda

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

deps/v8/include/v8.h

+8
Original file line numberDiff line numberDiff line change
@@ -4176,12 +4176,20 @@ class V8_EXPORT ArrayBuffer : public Object {
41764176
*/
41774177
virtual void* AllocateUninitialized(size_t length) = 0;
41784178

4179+
virtual void* Reserve(size_t length);
4180+
41794181
/**
41804182
* Free the memory block of size |length|, pointed to by |data|.
41814183
* That memory is guaranteed to be previously allocated by |Allocate|.
41824184
*/
41834185
virtual void Free(void* data, size_t length) = 0;
41844186

4187+
enum class AllocationMode { kNormal, kReservation };
4188+
virtual void Free(void* data, size_t length, AllocationMode mode);
4189+
enum class Protection { kNoAccess, kReadWrite };
4190+
virtual void SetProtection(void* data, size_t length,
4191+
Protection protection);
4192+
41854193
/**
41864194
* malloc/free based convenience allocator.
41874195
*

deps/v8/src/api.cc

+12
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,18 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
437437
i::V8::SetSnapshotBlob(snapshot_blob);
438438
}
439439

440+
void* v8::ArrayBuffer::Allocator::Reserve(size_t length) { UNIMPLEMENTED(); }
441+
442+
void v8::ArrayBuffer::Allocator::Free(void* data, size_t length,
443+
AllocationMode mode) {
444+
UNIMPLEMENTED();
445+
}
446+
447+
void v8::ArrayBuffer::Allocator::SetProtection(
448+
void* data, size_t length,
449+
v8::ArrayBuffer::Allocator::Protection protection) {
450+
UNIMPLEMENTED();
451+
}
440452

441453
namespace {
442454

0 commit comments

Comments
 (0)