12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
- From: Shelley Vohr <[email protected]>
- Date: Mon, 22 Oct 2018 10:47:11 -0700
- Subject: add_realloc.patch
- Blink overrides ArrayBuffer's allocator with its own one, while Node simply
- uses malloc and free, so we need to use v8's allocator in Node. As part of the
- 10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator
- argument in its constructor, and override ReallocateBufferMemory and
- FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy
- when we override ReallocateBufferMemory, so we therefore need to implement
- Realloc on the v8 side.
- diff --git a/include/v8.h b/include/v8.h
- index d66f360c990d3ea22e3277558dde5958e5609573..60496de0596d8879d5a0215c25aebf1b62bb53ec 100644
- --- a/include/v8.h
- +++ b/include/v8.h
- @@ -4748,6 +4748,13 @@ class V8_EXPORT ArrayBuffer : public Object {
- */
- virtual void* AllocateUninitialized(size_t length) = 0;
-
- + /**
- + * Free the memory block of size |length|, pointed to by |data|.
- + * That memory must be previously allocated by |Allocate| and not yet freed
- + * with a call to |Free| or |Realloc|
- + */
- + virtual void* Realloc(void* data, size_t length);
- +
- /**
- * Free the memory block of size |length|, pointed to by |data|.
- * That memory is guaranteed to be previously allocated by |Allocate|.
- diff --git a/src/api/api.cc b/src/api/api.cc
- index 30eceb6223377f28fb546c0a339e66e17b01638f..2c0cfcf8ddf10baf1bd504437e5bb4fe0999683e 100644
- --- a/src/api/api.cc
- +++ b/src/api/api.cc
- @@ -513,6 +513,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
- i::V8::SetSnapshotBlob(snapshot_blob);
- }
-
- +void* v8::ArrayBuffer::Allocator::Realloc(void* data, size_t length) {
- + UNIMPLEMENTED();
- +}
- +
- namespace {
-
- class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|