Skip to content

Commit 7f08e02

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: #26207 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Backport-PR-URL: #26302 Reviewed-By: Michaël Zasso <[email protected]>
1 parent 68accb5 commit 7f08e02

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

deps/v8/include/v8.h

+3
Original file line numberDiff line numberDiff line change
@@ -7717,6 +7717,9 @@ class V8_EXPORT Isolate {
77177717
*/
77187718
void SetIdle(bool is_idle);
77197719

7720+
/** Returns the ArrayBuffer::Allocator used in this isolate. */
7721+
ArrayBuffer::Allocator* GetArrayBufferAllocator();
7722+
77207723
/** Returns true if this isolate has a current context. */
77217724
bool InContext();
77227725

deps/v8/src/api.cc

+5
Original file line numberDiff line numberDiff line change
@@ -8084,6 +8084,11 @@ void Isolate::SetIdle(bool is_idle) {
80848084
isolate->SetIdle(is_idle);
80858085
}
80868086

8087+
ArrayBuffer::Allocator* Isolate::GetArrayBufferAllocator() {
8088+
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8089+
return isolate->array_buffer_allocator();
8090+
}
8091+
80878092
bool Isolate::InContext() {
80888093
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
80898094
return isolate->context() != nullptr;

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

+1
Original file line numberDiff line numberDiff line change
@@ -20773,6 +20773,7 @@ TEST(IsolateNewDispose) {
2077320773
CHECK_NOT_NULL(isolate);
2077420774
CHECK(current_isolate != isolate);
2077520775
CHECK(current_isolate == CcTest::isolate());
20776+
CHECK(isolate->GetArrayBufferAllocator() == CcTest::array_buffer_allocator());
2077620777

2077720778
isolate->SetFatalErrorHandler(StoringErrorCallback);
2077820779
last_location = last_message = nullptr;

0 commit comments

Comments
 (0)