Commit 16afa0a2 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[api][wasm] Rename WasmCompiledModule to WasmModuleObject

A WasmModuleObject represents an instance of WebAssembly.Module. It is
called WasmModuleObject internally, so also use that name externally.

We still have a typedef for WasmCompiledModule which will be deprecated
once chromium has been updated to use WasmModuleObject.

R=titzer@chromium.org, adamk@chromium.org

Bug: v8:8238, chromium:912031
Change-Id: I2d7708d4dc183cb4f4714f741b1ea0c153014430
Reviewed-on: https://chromium-review.googlesource.com/c/1362048Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58055}
parent f8eb3dba
......@@ -81,7 +81,7 @@ class Private;
class Uint32;
class Utils;
class Value;
class WasmCompiledModule;
class WasmModuleObject;
template <class T> class Local;
template <class T>
class MaybeLocal;
......@@ -1902,7 +1902,7 @@ class V8_EXPORT ValueSerializer {
Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
virtual Maybe<uint32_t> GetWasmModuleTransferId(
Isolate* isolate, Local<WasmCompiledModule> module);
Isolate* isolate, Local<WasmModuleObject> module);
/**
* Allocates memory for the buffer of at least the size provided. The actual
* size (which may be greater or equal) is written to |actual_size|. If no
......@@ -2006,10 +2006,10 @@ class V8_EXPORT ValueDeserializer {
virtual MaybeLocal<Object> ReadHostObject(Isolate* isolate);
/**
* Get a WasmCompiledModule given a transfer_id previously provided
* Get a WasmModuleObject given a transfer_id previously provided
* by ValueSerializer::GetWasmModuleTransferId
*/
virtual MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(
virtual MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
Isolate* isolate, uint32_t transfer_id);
/**
......@@ -4253,9 +4253,8 @@ class V8_EXPORT Proxy : public Object {
static void CheckCast(Value* obj);
};
// TODO(mtrofin): rename WasmCompiledModule to WasmModuleObject, for
// consistency with internal APIs.
class V8_EXPORT WasmCompiledModule : public Object {
// An instance of WebAssembly.Module.
class V8_EXPORT WasmModuleObject : public Object {
public:
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
......@@ -4284,7 +4283,7 @@ class V8_EXPORT WasmCompiledModule : public Object {
private:
typedef std::shared_ptr<internal::wasm::NativeModule> SharedModule;
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> OwnedBuffer;
friend class WasmCompiledModule;
friend class WasmModuleObject;
explicit TransferrableModule(SharedModule shared_module)
: shared_module_(std::move(shared_module)) {}
TransferrableModule(OwnedBuffer serialized, OwnedBuffer bytes)
......@@ -4303,10 +4302,10 @@ class V8_EXPORT WasmCompiledModule : public Object {
TransferrableModule GetTransferrableModule();
/**
* Efficiently re-create a WasmCompiledModule, without recompiling, from
* Efficiently re-create a WasmModuleObject, without recompiling, from
* a TransferrableModule.
*/
static MaybeLocal<WasmCompiledModule> FromTransferrableModule(
static MaybeLocal<WasmModuleObject> FromTransferrableModule(
Isolate* isolate, const TransferrableModule&);
/**
......@@ -4324,27 +4323,30 @@ class V8_EXPORT WasmCompiledModule : public Object {
* If possible, deserialize the module, otherwise compile it from the provided
* uncompiled bytes.
*/
static MaybeLocal<WasmCompiledModule> DeserializeOrCompile(
static MaybeLocal<WasmModuleObject> DeserializeOrCompile(
Isolate* isolate, BufferReference serialized_module,
BufferReference wire_bytes);
V8_INLINE static WasmCompiledModule* Cast(Value* obj);
V8_INLINE static WasmModuleObject* Cast(Value* obj);
private:
static MaybeLocal<WasmCompiledModule> Deserialize(
static MaybeLocal<WasmModuleObject> Deserialize(
Isolate* isolate, BufferReference serialized_module,
BufferReference wire_bytes);
static MaybeLocal<WasmCompiledModule> Compile(Isolate* isolate,
const uint8_t* start,
size_t length);
static MaybeLocal<WasmModuleObject> Compile(Isolate* isolate,
const uint8_t* start,
size_t length);
static BufferReference AsReference(
const TransferrableModule::OwnedBuffer& buff) {
return {buff.first.get(), buff.second};
}
WasmCompiledModule();
WasmModuleObject();
static void CheckCast(Value* obj);
};
V8_DEPRECATE_SOON("Use WasmModuleObject",
typedef WasmModuleObject WasmCompiledModule);
/**
* The V8 interface for WebAssembly streaming compilation. When streaming
* compilation is initiated, V8 passes a {WasmStreaming} object to the embedder
......@@ -4384,7 +4386,7 @@ class V8_EXPORT WasmStreaming final {
* passed to {SetModuleCompiledCallback}, |compiled_module| is the result.
*/
typedef void (*ModuleCompiledCallback)(
intptr_t data, Local<WasmCompiledModule> compiled_module);
intptr_t data, Local<WasmModuleObject> compiled_module);
/**
* Sets a callback for when compilation of the Wasm module has been completed
......@@ -10140,11 +10142,11 @@ Proxy* Proxy::Cast(v8::Value* value) {
return static_cast<Proxy*>(value);
}
WasmCompiledModule* WasmCompiledModule::Cast(v8::Value* value) {
WasmModuleObject* WasmModuleObject::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
#endif
return static_cast<WasmCompiledModule*>(value);
return static_cast<WasmModuleObject*>(value);
}
Promise::Resolver* Promise::Resolver::Cast(v8::Value* value) {
......
......@@ -3043,7 +3043,7 @@ Maybe<uint32_t> ValueSerializer::Delegate::GetSharedArrayBufferId(
}
Maybe<uint32_t> ValueSerializer::Delegate::GetWasmModuleTransferId(
Isolate* v8_isolate, Local<WasmCompiledModule> module) {
Isolate* v8_isolate, Local<WasmModuleObject> module) {
return Nothing<uint32_t>();
}
......@@ -3127,13 +3127,13 @@ MaybeLocal<Object> ValueDeserializer::Delegate::ReadHostObject(
return MaybeLocal<Object>();
}
MaybeLocal<WasmCompiledModule> ValueDeserializer::Delegate::GetWasmModuleFromId(
MaybeLocal<WasmModuleObject> ValueDeserializer::Delegate::GetWasmModuleFromId(
Isolate* v8_isolate, uint32_t id) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->ScheduleThrow(*isolate->factory()->NewError(
isolate->error_function(),
i::MessageTemplate::kDataCloneDeserializationError));
return MaybeLocal<WasmCompiledModule>();
return MaybeLocal<WasmModuleObject>();
}
MaybeLocal<SharedArrayBuffer>
......@@ -3745,10 +3745,10 @@ void v8::Proxy::CheckCast(Value* that) {
"Could not convert to proxy");
}
void v8::WasmCompiledModule::CheckCast(Value* that) {
void v8::WasmModuleObject::CheckCast(Value* that) {
Utils::ApiCheck(that->IsWebAssemblyCompiledModule(),
"v8::WasmCompiledModule::Cast",
"Could not convert to wasm compiled module");
"v8::WasmModuleObject::Cast",
"Could not convert to wasm module object");
}
void v8::ArrayBuffer::CheckCast(Value* that) {
......@@ -7352,21 +7352,21 @@ MaybeLocal<Proxy> Proxy::New(Local<Context> context, Local<Object> local_target,
RETURN_ESCAPED(result);
}
WasmCompiledModule::BufferReference WasmCompiledModule::GetWasmWireBytesRef() {
WasmModuleObject::BufferReference WasmModuleObject::GetWasmWireBytesRef() {
i::Handle<i::WasmModuleObject> obj =
i::Handle<i::WasmModuleObject>::cast(Utils::OpenHandle(this));
i::Vector<const uint8_t> bytes_vec = obj->native_module()->wire_bytes();
return {bytes_vec.start(), bytes_vec.size()};
}
WasmCompiledModule::TransferrableModule
WasmCompiledModule::GetTransferrableModule() {
WasmModuleObject::TransferrableModule
WasmModuleObject::GetTransferrableModule() {
if (i::FLAG_wasm_shared_code) {
i::Handle<i::WasmModuleObject> obj =
i::Handle<i::WasmModuleObject>::cast(Utils::OpenHandle(this));
return TransferrableModule(obj->managed_native_module()->get());
} else {
WasmCompiledModule::SerializedModule serialized_module = Serialize();
WasmModuleObject::SerializedModule serialized_module = Serialize();
BufferReference wire_bytes_ref = GetWasmWireBytesRef();
size_t wire_size = wire_bytes_ref.size;
std::unique_ptr<uint8_t[]> wire_bytes_copy(new uint8_t[wire_size]);
......@@ -7376,15 +7376,15 @@ WasmCompiledModule::GetTransferrableModule() {
}
}
MaybeLocal<WasmCompiledModule> WasmCompiledModule::FromTransferrableModule(
MaybeLocal<WasmModuleObject> WasmModuleObject::FromTransferrableModule(
Isolate* isolate,
const WasmCompiledModule::TransferrableModule& transferrable_module) {
const WasmModuleObject::TransferrableModule& transferrable_module) {
if (i::FLAG_wasm_shared_code) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::WasmModuleObject> module_object =
i_isolate->wasm_engine()->ImportNativeModule(
i_isolate, transferrable_module.shared_module_);
return Local<WasmCompiledModule>::Cast(
return Local<WasmModuleObject>::Cast(
Utils::ToLocal(i::Handle<i::JSObject>::cast(module_object)));
} else {
return Deserialize(isolate, AsReference(transferrable_module.serialized_),
......@@ -7392,7 +7392,7 @@ MaybeLocal<WasmCompiledModule> WasmCompiledModule::FromTransferrableModule(
}
}
WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() {
WasmModuleObject::SerializedModule WasmModuleObject::Serialize() {
i::Handle<i::WasmModuleObject> obj =
i::Handle<i::WasmModuleObject>::cast(Utils::OpenHandle(this));
i::wasm::NativeModule* native_module = obj->native_module();
......@@ -7404,9 +7404,9 @@ WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() {
return {};
}
MaybeLocal<WasmCompiledModule> WasmCompiledModule::Deserialize(
Isolate* isolate, WasmCompiledModule::BufferReference serialized_module,
WasmCompiledModule::BufferReference wire_bytes) {
MaybeLocal<WasmModuleObject> WasmModuleObject::Deserialize(
Isolate* isolate, WasmModuleObject::BufferReference serialized_module,
WasmModuleObject::BufferReference wire_bytes) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::MaybeHandle<i::WasmModuleObject> maybe_module_object =
i::wasm::DeserializeNativeModule(
......@@ -7414,16 +7414,16 @@ MaybeLocal<WasmCompiledModule> WasmCompiledModule::Deserialize(
{wire_bytes.start, wire_bytes.size});
i::Handle<i::WasmModuleObject> module_object;
if (!maybe_module_object.ToHandle(&module_object)) {
return MaybeLocal<WasmCompiledModule>();
return MaybeLocal<WasmModuleObject>();
}
return Local<WasmCompiledModule>::Cast(
return Local<WasmModuleObject>::Cast(
Utils::ToLocal(i::Handle<i::JSObject>::cast(module_object)));
}
MaybeLocal<WasmCompiledModule> WasmCompiledModule::DeserializeOrCompile(
Isolate* isolate, WasmCompiledModule::BufferReference serialized_module,
WasmCompiledModule::BufferReference wire_bytes) {
MaybeLocal<WasmCompiledModule> ret =
MaybeLocal<WasmModuleObject> WasmModuleObject::DeserializeOrCompile(
Isolate* isolate, WasmModuleObject::BufferReference serialized_module,
WasmModuleObject::BufferReference wire_bytes) {
MaybeLocal<WasmModuleObject> ret =
Deserialize(isolate, serialized_module, wire_bytes);
if (!ret.IsEmpty()) {
return ret;
......@@ -7431,21 +7431,21 @@ MaybeLocal<WasmCompiledModule> WasmCompiledModule::DeserializeOrCompile(
return Compile(isolate, wire_bytes.start, wire_bytes.size);
}
MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate,
const uint8_t* start,
size_t length) {
MaybeLocal<WasmModuleObject> WasmModuleObject::Compile(Isolate* isolate,
const uint8_t* start,
size_t length) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Compile()");
i::wasm::ErrorThrower thrower(i_isolate, "WasmModuleObject::Compile()");
if (!i::wasm::IsWasmCodegenAllowed(i_isolate, i_isolate->native_context())) {
return MaybeLocal<WasmCompiledModule>();
return MaybeLocal<WasmModuleObject>();
}
auto enabled_features = i::wasm::WasmFeaturesFromIsolate(i_isolate);
i::MaybeHandle<i::JSObject> maybe_compiled =
i_isolate->wasm_engine()->SyncCompile(
i_isolate, enabled_features, &thrower,
i::wasm::ModuleWireBytes(start, start + length));
if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>();
return Local<WasmCompiledModule>::Cast(
if (maybe_compiled.is_null()) return MaybeLocal<WasmModuleObject>();
return Local<WasmModuleObject>::Cast(
Utils::ToLocal(maybe_compiled.ToHandleChecked()));
}
......
......@@ -3121,7 +3121,7 @@ class Serializer : public ValueSerializer::Delegate {
}
Maybe<uint32_t> GetWasmModuleTransferId(
Isolate* isolate, Local<WasmCompiledModule> module) override {
Isolate* isolate, Local<WasmModuleObject> module) override {
DCHECK_NOT_NULL(data_);
for (size_t index = 0; index < wasm_modules_.size(); ++index) {
if (wasm_modules_[index] == module) {
......@@ -3220,7 +3220,7 @@ class Serializer : public ValueSerializer::Delegate {
std::unique_ptr<SerializationData> data_;
std::vector<Global<ArrayBuffer>> array_buffers_;
std::vector<Global<SharedArrayBuffer>> shared_array_buffers_;
std::vector<Global<WasmCompiledModule>> wasm_modules_;
std::vector<Global<WasmModuleObject>> wasm_modules_;
std::vector<ExternalizedContents> externalized_contents_;
size_t current_memory_usage_;
......@@ -3264,14 +3264,14 @@ class Deserializer : public ValueDeserializer::Delegate {
return MaybeLocal<SharedArrayBuffer>();
}
MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(
MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
Isolate* isolate, uint32_t transfer_id) override {
DCHECK_NOT_NULL(data_);
if (transfer_id < data_->transferrable_modules().size()) {
return WasmCompiledModule::FromTransferrableModule(
return WasmModuleObject::FromTransferrableModule(
isolate_, data_->transferrable_modules().at(transfer_id));
}
return MaybeLocal<WasmCompiledModule>();
return MaybeLocal<WasmModuleObject>();
}
private:
......
......@@ -186,7 +186,7 @@ class SerializationData {
shared_array_buffer_contents() {
return shared_array_buffer_contents_;
}
const std::vector<WasmCompiledModule::TransferrableModule>&
const std::vector<WasmModuleObject::TransferrableModule>&
transferrable_modules() {
return transferrable_modules_;
}
......@@ -200,7 +200,7 @@ class SerializationData {
size_t size_;
std::vector<ArrayBuffer::Contents> array_buffer_contents_;
std::vector<SharedArrayBuffer::Contents> shared_array_buffer_contents_;
std::vector<WasmCompiledModule::TransferrableModule> transferrable_modules_;
std::vector<WasmModuleObject::TransferrableModule> transferrable_modules_;
private:
friend class Serializer;
......
......@@ -68,8 +68,8 @@ bool IsWasmInstantiateAllowed(v8::Isolate* isolate,
if (!module_or_bytes->IsWebAssemblyCompiledModule()) {
return IsWasmCompileAllowed(isolate, module_or_bytes, is_async);
}
v8::Local<v8::WasmCompiledModule> module =
v8::Local<v8::WasmCompiledModule>::Cast(module_or_bytes);
v8::Local<v8::WasmModuleObject> module =
v8::Local<v8::WasmModuleObject>::Cast(module_or_bytes);
return static_cast<uint32_t>(module->GetWasmWireBytesRef().size) <=
ctrls.MaxWasmBufferSize;
}
......
......@@ -874,7 +874,7 @@ Maybe<bool> ValueSerializer::WriteWasmModule(Handle<WasmModuleObject> object) {
// TODO(titzer): introduce a Utils::ToLocal for WasmModuleObject.
Maybe<uint32_t> transfer_id = delegate_->GetWasmModuleTransferId(
reinterpret_cast<v8::Isolate*>(isolate_),
v8::Local<v8::WasmCompiledModule>::Cast(
v8::Local<v8::WasmModuleObject>::Cast(
Utils::ToLocal(Handle<JSObject>::cast(object))));
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate_, Nothing<bool>());
uint32_t id = 0;
......
......@@ -62,10 +62,10 @@ class WasmStreaming::WasmStreamingImpl {
void SetModuleCompiledCallback(ModuleCompiledCallback callback,
intptr_t data) {
// Wrap the embedder callback here so we can also wrap the result as a
// Local<WasmCompiledModule> here.
// Local<WasmModuleObject> here.
streaming_decoder_->SetModuleCompiledCallback(
[callback, data](i::Handle<i::WasmModuleObject> module_object) {
callback(data, Local<WasmCompiledModule>::Cast(Utils::ToLocal(
callback(data, Local<WasmModuleObject>::Cast(Utils::ToLocal(
i::Handle<i::JSObject>::cast(module_object))));
});
}
......
......@@ -58,12 +58,12 @@ void BuildTrivialModule(Zone* zone, ZoneBuffer* buffer) {
}
bool TestModule(Isolate* isolate,
v8::WasmCompiledModule::BufferReference wire_bytes) {
v8::WasmModuleObject::BufferReference wire_bytes) {
HandleScope scope(isolate);
v8::WasmCompiledModule::BufferReference serialized_module(nullptr, 0);
MaybeLocal<v8::WasmCompiledModule> module =
v8::WasmCompiledModule::DeserializeOrCompile(
v8::WasmModuleObject::BufferReference serialized_module(nullptr, 0);
MaybeLocal<v8::WasmModuleObject> module =
v8::WasmModuleObject::DeserializeOrCompile(
reinterpret_cast<v8::Isolate*>(isolate), serialized_module,
wire_bytes);
return !module.IsEmpty();
......@@ -76,8 +76,8 @@ TEST(PropertiesOfCodegenCallbacks) {
Zone zone(&allocator, ZONE_NAME);
ZoneBuffer buffer(&zone);
BuildTrivialModule(&zone, &buffer);
v8::WasmCompiledModule::BufferReference wire_bytes = {buffer.begin(),
buffer.size()};
v8::WasmModuleObject::BufferReference wire_bytes = {buffer.begin(),
buffer.size()};
Isolate* isolate = CcTest::InitIsolateOnce();
HandleScope scope(isolate);
testing::SetupIsolateForWasmModule(isolate);
......
......@@ -84,17 +84,17 @@ class WasmSerializationTest {
*slot = 0u;
}
v8::MaybeLocal<v8::WasmCompiledModule> Deserialize() {
v8::MaybeLocal<v8::WasmModuleObject> Deserialize() {
ErrorThrower thrower(current_isolate(), "");
v8::MaybeLocal<v8::WasmCompiledModule> deserialized =
v8::WasmCompiledModule::DeserializeOrCompile(
v8::MaybeLocal<v8::WasmModuleObject> deserialized =
v8::WasmModuleObject::DeserializeOrCompile(
current_isolate_v8(), serialized_bytes_, wire_bytes_);
return deserialized;
}
void DeserializeAndRun() {
ErrorThrower thrower(current_isolate(), "");
v8::Local<v8::WasmCompiledModule> deserialized_module;
v8::Local<v8::WasmModuleObject> deserialized_module;
CHECK(Deserialize().ToLocal(&deserialized_module));
Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast(
v8::Utils::OpenHandle(*deserialized_module));
......@@ -159,9 +159,9 @@ class WasmSerializationTest {
v8::Utils::ToLocal(Handle<JSObject>::cast(module_object));
CHECK(v8_module_obj->IsWebAssemblyCompiledModule());
v8::Local<v8::WasmCompiledModule> v8_compiled_module =
v8_module_obj.As<v8::WasmCompiledModule>();
v8::WasmCompiledModule::BufferReference uncompiled_bytes =
v8::Local<v8::WasmModuleObject> v8_compiled_module =
v8_module_obj.As<v8::WasmModuleObject>();
v8::WasmModuleObject::BufferReference uncompiled_bytes =
v8_compiled_module->GetWasmWireBytesRef();
uint8_t* bytes_copy = zone()->NewArray<uint8_t>(uncompiled_bytes.size);
memcpy(bytes_copy, uncompiled_bytes.start, uncompiled_bytes.size);
......@@ -191,9 +191,9 @@ class WasmSerializationTest {
v8::internal::AccountingAllocator allocator_;
Zone zone_;
v8::WasmCompiledModule::SerializedModule data_;
v8::WasmCompiledModule::BufferReference wire_bytes_ = {nullptr, 0};
v8::WasmCompiledModule::BufferReference serialized_bytes_ = {nullptr, 0};
v8::WasmModuleObject::SerializedModule data_;
v8::WasmModuleObject::BufferReference wire_bytes_ = {nullptr, 0};
v8::WasmModuleObject::BufferReference serialized_bytes_ = {nullptr, 0};
v8::Isolate* current_isolate_v8_;
};
......@@ -263,7 +263,7 @@ TEST(BlockWasmCodeGenAtDeserialization) {
{
HandleScope scope(test.current_isolate());
test.current_isolate_v8()->SetAllowCodeGenerationFromStringsCallback(False);
v8::MaybeLocal<v8::WasmCompiledModule> nothing = test.Deserialize();
v8::MaybeLocal<v8::WasmModuleObject> nothing = test.Deserialize();
CHECK(nothing.IsEmpty());
}
Cleanup(test.current_isolate());
......@@ -283,7 +283,7 @@ void TestTransferrableWasmModules(bool should_share) {
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* from_isolate = v8::Isolate::New(create_params);
std::vector<v8::WasmCompiledModule::TransferrableModule> store;
std::vector<v8::WasmModuleObject::TransferrableModule> store;
std::shared_ptr<NativeModule> original_native_module;
{
v8::HandleScope scope(from_isolate);
......@@ -299,8 +299,8 @@ void TestTransferrableWasmModules(bool should_share) {
ModuleWireBytes(buffer.begin(), buffer.end()));
Handle<WasmModuleObject> module_object =
maybe_module_object.ToHandleChecked();
v8::Local<v8::WasmCompiledModule> v8_module =
v8::Local<v8::WasmCompiledModule>::Cast(
v8::Local<v8::WasmModuleObject> v8_module =
v8::Local<v8::WasmModuleObject>::Cast(
v8::Utils::ToLocal(Handle<JSObject>::cast(module_object)));
store.push_back(v8_module->GetTransferrableModule());
original_native_module = module_object->managed_native_module()->get();
......@@ -312,8 +312,8 @@ void TestTransferrableWasmModules(bool should_share) {
v8::HandleScope scope(to_isolate);
LocalContext env(to_isolate);
v8::MaybeLocal<v8::WasmCompiledModule> transferred_module =
v8::WasmCompiledModule::FromTransferrableModule(to_isolate, store[0]);
v8::MaybeLocal<v8::WasmModuleObject> transferred_module =
v8::WasmModuleObject::FromTransferrableModule(to_isolate, store[0]);
CHECK(!transferred_module.IsEmpty());
Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast(
v8::Utils::OpenHandle(*transferred_module.ToLocalChecked()));
......
......@@ -2382,7 +2382,7 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
class ThrowingSerializer : public ValueSerializer::Delegate {
public:
Maybe<uint32_t> GetWasmModuleTransferId(
Isolate* isolate, Local<WasmCompiledModule> module) override {
Isolate* isolate, Local<WasmModuleObject> module) override {
isolate->ThrowException(Exception::Error(
String::NewFromOneByte(
isolate,
......@@ -2398,10 +2398,10 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
class SerializeToTransfer : public ValueSerializer::Delegate {
public:
SerializeToTransfer(
std::vector<WasmCompiledModule::TransferrableModule>* modules)
std::vector<WasmModuleObject::TransferrableModule>* modules)
: modules_(modules) {}
Maybe<uint32_t> GetWasmModuleTransferId(
Isolate* isolate, Local<WasmCompiledModule> module) override {
Isolate* isolate, Local<WasmModuleObject> module) override {
modules_->push_back(module->GetTransferrableModule());
return Just(static_cast<uint32_t>(modules_->size()) - 1);
}
......@@ -2409,23 +2409,23 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
void ThrowDataCloneError(Local<String> message) override { UNREACHABLE(); }
private:
std::vector<WasmCompiledModule::TransferrableModule>* modules_;
std::vector<WasmModuleObject::TransferrableModule>* modules_;
};
class DeserializeFromTransfer : public ValueDeserializer::Delegate {
public:
DeserializeFromTransfer(
std::vector<WasmCompiledModule::TransferrableModule>* modules)
std::vector<WasmModuleObject::TransferrableModule>* modules)
: modules_(modules) {}
MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(Isolate* isolate,
uint32_t id) override {
return WasmCompiledModule::FromTransferrableModule(isolate,
modules_->at(id));
MaybeLocal<WasmModuleObject> GetWasmModuleFromId(Isolate* isolate,
uint32_t id) override {
return WasmModuleObject::FromTransferrableModule(isolate,
modules_->at(id));
}
private:
std::vector<WasmCompiledModule::TransferrableModule>* modules_;
std::vector<WasmModuleObject::TransferrableModule>* modules_;
};
ValueSerializer::Delegate* GetSerializerDelegate() override {
......@@ -2436,9 +2436,9 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
return current_deserializer_delegate_;
}
Local<WasmCompiledModule> MakeWasm() {
Local<WasmModuleObject> MakeWasm() {
Context::Scope scope(serialization_context());
return WasmCompiledModule::DeserializeOrCompile(
return WasmModuleObject::DeserializeOrCompile(
isolate(), {nullptr, 0},
{kIncrementerWasm, sizeof(kIncrementerWasm)})
.ToLocalChecked();
......@@ -2505,7 +2505,7 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
private:
static bool g_saved_flag;
std::vector<WasmCompiledModule::TransferrableModule> transfer_modules_;
std::vector<WasmModuleObject::TransferrableModule> transfer_modules_;
SerializeToTransfer serialize_delegate_;
DeserializeFromTransfer deserialize_delegate_;
ValueSerializer::Delegate* current_serializer_delegate_ = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment