Skip to content

Commit

Permalink
src: remove usages of GetBackingStore in WASI
Browse files Browse the repository at this point in the history
This removes all usages of GetBackingStore in WASI. See the linked issue
for an explanation.

Refs: #32226
Refs: #43921
PR-URL: #44077
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Feng Yu <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
kvakil authored Aug 3, 2022
1 parent 24c1869 commit 13d93b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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 @@ -107,12 +107,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

0 comments on commit 13d93b6

Please sign in to comment.