From 54ef7ad38a9429e29234c1e5c77fb4394df77dce Mon Sep 17 00:00:00 2001 From: gahaas Date: Thu, 27 Jun 2024 15:50:01 +0200 Subject: [PATCH] Reland: [v8] Stop using deprecated fields of v8::FastApiCallbackOptions (#196) * Reland: [v8] Stop using deprecated fields of v8::FastApiCallbackOptions Two fields on the v8::FastApiCallbackOptions struct were deprecated recently, fallback and wasm_memory. This PR removes uses of these two fields in node.js. This change is a refactoring and does not add new features. Therefore existing tests should be sufficient. * return correct type --- src/node_wasi.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/node_wasi.cc b/src/node_wasi.cc index 4c06761c6ac1ce..e4503a8c6a70dc 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc @@ -258,12 +258,12 @@ R WASI::WasiFunction::FastCallback( THROW_ERR_WASI_NOT_STARTED(isolate); return EinvalError(); } - uint8_t* memory = nullptr; - CHECK(LIKELY(options.wasm_memory->getStorageIfAligned(&memory))); + Local ab = wasi->memory_.Get(isolate)->Buffer(); + size_t mem_size = ab->ByteLength(); + char* mem_data = static_cast(ab->Data()); + CHECK_NOT_NULL(mem_data); - return F(*wasi, - {reinterpret_cast(memory), options.wasm_memory->length()}, - args...); + return F(*wasi, {mem_data, mem_size}, args...); } namespace {