Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
wasi: support SharedArrayBuffers as memory
Browse files Browse the repository at this point in the history
This commit adds support for SharedArrayBuffers as the WASI
memory.
  • Loading branch information
cjihrig committed Sep 10, 2019
1 parent 118fb4f commit 2b0131c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/wasi.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const { Array, ArrayPrototype } = primordials;
const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;
const { WASI: _WASI } = internalBinding('wasi');
const { isAnyArrayBuffer } = require('internal/util/types');


class WASI {
Expand Down Expand Up @@ -46,7 +47,7 @@ class WASI {

if (memory instanceof WebAssembly.Memory) {
memory = memory.buffer;
} else {
} else if (!isAnyArrayBuffer(memory)) {
throw new ERR_INVALID_ARG_TYPE(
'options.memory', 'WebAssembly.Memory', memory);
}
Expand Down
2 changes: 1 addition & 1 deletion src/node_wasi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsArray());
CHECK(args[1]->IsArray());
// CHECK(args[2]->IsArray());
CHECK(args[3]->IsArrayBuffer());
CHECK(args[3]->IsArrayBuffer() || args[3]->IsSharedArrayBuffer());

Environment* env = Environment::GetCurrent(args);
Local<Context> context = env->context();
Expand Down

0 comments on commit 2b0131c

Please sign in to comment.