Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: remove usages of GetBackingStore in WASI
This removes all usages of GetBackingStore in WASI. See the linked issue
for an explanation.

Refs: #32226
Refs: #43921
  • Loading branch information
kvakil committed Aug 1, 2022
commit c721d444375a999f111a688e02706f5df4fe6687
8 changes: 3 additions & 5 deletions src/node_wasi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1654,10 +1653,9 @@ void WASI::_SetMemory(const FunctionCallbackInfo<Value>& args) {

uvwasi_errno_t WASI::backingStore(char** store, size_t* byte_length) {
Local<WasmMemoryObject> memory = PersistentToLocal::Strong(this->memory_);
std::shared_ptr<BackingStore> backing_store =
memory->Buffer()->GetBackingStore();
*byte_length = backing_store->ByteLength();
*store = static_cast<char*>(backing_store->Data());
Local<v8::ArrayBuffer> ab = memory->Buffer();
*byte_length = ab->ByteLength();
*store = static_cast<char*>(ab->Data());
CHECK_NOT_NULL(*store);
return UVWASI_ESUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions src/node_wasm_web_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ void WasmStreamingObject::Push(const FunctionCallbackInfo<Value>& args) {

if (LIKELY(chunk->IsArrayBufferView())) {
Local<ArrayBufferView> view = chunk.As<ArrayBufferView>();
bytes = view->Buffer()->GetBackingStore()->Data();
bytes = view->Buffer()->Data();
offset = view->ByteOffset();
size = view->ByteLength();
} else if (LIKELY(chunk->IsArrayBuffer())) {
Local<ArrayBuffer> buffer = chunk.As<ArrayBuffer>();
bytes = buffer->GetBackingStore()->Data();
bytes = buffer->Data();
offset = 0;
size = buffer->ByteLength();
} else {
Expand Down