mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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: 1898f91620/patches/common/v8/array_buffer.patch
Change-Id: I39a614343118a0594aab48699a99cc2aad5b7ba9
Reviewed-on: https://chromium-review.googlesource.com/c/1462003
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59697}
Refs: d3308d042c
PR-URL: https://github.com/nodejs/node/pull/26207
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
3
deps/v8/include/v8.h
vendored
3
deps/v8/include/v8.h
vendored
@@ -7642,6 +7642,9 @@ class V8_EXPORT Isolate {
|
||||
*/
|
||||
void SetIdle(bool is_idle);
|
||||
|
||||
/** Returns the ArrayBuffer::Allocator used in this isolate. */
|
||||
ArrayBuffer::Allocator* GetArrayBufferAllocator();
|
||||
|
||||
/** Returns true if this isolate has a current context. */
|
||||
bool InContext();
|
||||
|
||||
|
||||
5
deps/v8/src/api.cc
vendored
5
deps/v8/src/api.cc
vendored
@@ -8007,6 +8007,11 @@ void Isolate::SetIdle(bool is_idle) {
|
||||
isolate->SetIdle(is_idle);
|
||||
}
|
||||
|
||||
ArrayBuffer::Allocator* Isolate::GetArrayBufferAllocator() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
return isolate->array_buffer_allocator();
|
||||
}
|
||||
|
||||
bool Isolate::InContext() {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
return isolate->context() != nullptr;
|
||||
|
||||
1
deps/v8/test/cctest/test-api.cc
vendored
1
deps/v8/test/cctest/test-api.cc
vendored
@@ -20881,6 +20881,7 @@ TEST(IsolateNewDispose) {
|
||||
CHECK_NOT_NULL(isolate);
|
||||
CHECK(current_isolate != isolate);
|
||||
CHECK(current_isolate == CcTest::isolate());
|
||||
CHECK(isolate->GetArrayBufferAllocator() == CcTest::array_buffer_allocator());
|
||||
|
||||
isolate->SetFatalErrorHandler(StoringErrorCallback);
|
||||
last_location = last_message = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user