Skip to content

Commit bea1a38

Browse files
committed
deps: V8: cherry-pick d3308d0
Original commit message: [api] Add `Isolate::GetArrayBufferAllocator()` This allows non-monolithic embedders to always allocate memory for ArrayBuffer instances using the right allocation method. This is based on a patch that Electron is currently using. Refs: https://github.com/electron/electron/blob/1898f9162073910c05958295c612deec6121a892/patches/common/v8/array_buffer.patch Change-Id: I39a614343118a0594aab48699a99cc2aad5b7ba9 Reviewed-on: https://chromium-review.googlesource.com/c/1462003 Reviewed-by: Yang Guo <[email protected]> Commit-Queue: Yang Guo <[email protected]> Cr-Commit-Position: refs/heads/master@{#59697} Refs: v8/v8@d3308d0 PR-URL: #25852 Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]>
1 parent cf649c9 commit bea1a38

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# Reset this number to 0 on major V8 upgrades.
3939
# Increment by one for each non-official patch applied to deps/v8.
40-
'v8_embedder_string': '-node.2',
40+
'v8_embedder_string': '-node.3',
4141

4242
##### V8 defaults for Node.js #####
4343

deps/v8/include/v8.h

+3
Original file line numberDiff line numberDiff line change
@@ -7700,6 +7700,9 @@ class V8_EXPORT Isolate {
77007700
*/
77017701
void SetIdle(bool is_idle);
77027702

7703+
/** Returns the ArrayBuffer::Allocator used in this isolate. */
7704+
ArrayBuffer::Allocator* GetArrayBufferAllocator();
7705+
77037706
/** Returns true if this isolate has a current context. */
77047707
bool InContext();
77057708

deps/v8/src/api.cc

+5
Original file line numberDiff line numberDiff line change
@@ -7970,6 +7970,11 @@ void Isolate::SetIdle(bool is_idle) {
79707970
isolate->SetIdle(is_idle);
79717971
}
79727972

7973+
ArrayBuffer::Allocator* Isolate::GetArrayBufferAllocator() {
7974+
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7975+
return isolate->array_buffer_allocator();
7976+
}
7977+
79737978
bool Isolate::InContext() {
79747979
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
79757980
return !isolate->context().is_null();

deps/v8/test/cctest/test-api.cc

+1
Original file line numberDiff line numberDiff line change
@@ -20620,6 +20620,7 @@ TEST(IsolateNewDispose) {
2062020620
CHECK_NOT_NULL(isolate);
2062120621
CHECK(current_isolate != isolate);
2062220622
CHECK(current_isolate == CcTest::isolate());
20623+
CHECK(isolate->GetArrayBufferAllocator() == CcTest::array_buffer_allocator());
2062320624

2062420625
isolate->SetFatalErrorHandler(StoringErrorCallback);
2062520626
last_location = last_message = nullptr;

0 commit comments

Comments
 (0)