From 13d93b6519e955c5393222f4d3cf8c1fe431af31 Mon Sep 17 00:00:00 2001 From: Keyhan Vakil Date: Tue, 2 Aug 2022 21:04:44 -0700 Subject: [PATCH] src: remove usages of GetBackingStore in WASI This removes all usages of GetBackingStore in WASI. See the linked issue for an explanation. Refs: https://github.com/nodejs/node/issues/32226 Refs: https://github.com/nodejs/node/pull/43921 PR-URL: https://github.com/nodejs/node/pull/44077 Reviewed-By: Jiawen Geng Reviewed-By: Darshan Sen Reviewed-By: Gus Caplan Reviewed-By: Feng Yu Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen --- src/node_wasi.cc | 8 +++----- src/node_wasm_web_api.cc | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/node_wasi.cc b/src/node_wasi.cc index a1b244018a6760..e5905f17a5b27e 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc @@ -73,7 +73,6 @@ inline void Debug(WASI* wasi, Args&&... args) { } while (0) using v8::Array; -using v8::BackingStore; using v8::BigInt; using v8::Context; using v8::Exception; @@ -1654,10 +1653,9 @@ void WASI::_SetMemory(const FunctionCallbackInfo& args) { uvwasi_errno_t WASI::backingStore(char** store, size_t* byte_length) { Local memory = PersistentToLocal::Strong(this->memory_); - std::shared_ptr backing_store = - memory->Buffer()->GetBackingStore(); - *byte_length = backing_store->ByteLength(); - *store = static_cast(backing_store->Data()); + Local ab = memory->Buffer(); + *byte_length = ab->ByteLength(); + *store = static_cast(ab->Data()); CHECK_NOT_NULL(*store); return UVWASI_ESUCCESS; } diff --git a/src/node_wasm_web_api.cc b/src/node_wasm_web_api.cc index 7fc423978b2a7c..f327124d388749 100644 --- a/src/node_wasm_web_api.cc +++ b/src/node_wasm_web_api.cc @@ -107,12 +107,12 @@ void WasmStreamingObject::Push(const FunctionCallbackInfo& args) { if (LIKELY(chunk->IsArrayBufferView())) { Local view = chunk.As(); - bytes = view->Buffer()->GetBackingStore()->Data(); + bytes = view->Buffer()->Data(); offset = view->ByteOffset(); size = view->ByteLength(); } else if (LIKELY(chunk->IsArrayBuffer())) { Local buffer = chunk.As(); - bytes = buffer->GetBackingStore()->Data(); + bytes = buffer->Data(); offset = 0; size = buffer->ByteLength(); } else {