Commit f6c7a484 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Set source url for deserialized modules

R=clemensb@chromium.org

Bug: chromium:1041841
Change-Id: I4a5010fbf58a812e724ab95f2552dd4b6887113f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2004612
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65834}
parent b7f4fb23
......@@ -7208,7 +7208,7 @@ MaybeLocal<WasmModuleObject> WasmModuleObject::Deserialize(
i::MaybeHandle<i::WasmModuleObject> maybe_module_object =
i::wasm::DeserializeNativeModule(
i_isolate, {serialized_module.data(), serialized_module.size()},
{wire_bytes.data(), wire_bytes.size()});
{wire_bytes.data(), wire_bytes.size()}, {});
i::Handle<i::WasmModuleObject> module_object;
if (!maybe_module_object.ToHandle(&module_object)) {
return MaybeLocal<WasmModuleObject>();
......
......@@ -2000,7 +2000,7 @@ MaybeHandle<JSObject> ValueDeserializer::ReadWasmModule() {
// Try to deserialize the compiled module first.
MaybeHandle<WasmModuleObject> result =
wasm::DeserializeNativeModule(isolate_, compiled_bytes, wire_bytes);
wasm::DeserializeNativeModule(isolate_, compiled_bytes, wire_bytes, {});
if (result.is_null()) {
wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule");
// TODO(titzer): are the current features appropriate for deserializing?
......
......@@ -1252,7 +1252,7 @@ RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
// Note that {wasm::DeserializeNativeModule} will allocate. We assume the
// JSArrayBuffer backing store doesn't get relocated.
MaybeHandle<WasmModuleObject> maybe_module_object =
wasm::DeserializeNativeModule(isolate, buffer_vec, wire_bytes_vec);
wasm::DeserializeNativeModule(isolate, buffer_vec, wire_bytes_vec, {});
Handle<WasmModuleObject> module_object;
if (!maybe_module_object.ToHandle(&module_object)) {
return ReadOnlyRoots(isolate).undefined_value();
......
......@@ -1067,7 +1067,7 @@ auto Module::deserialize(Store* store_abs, const vec<byte_t>& serialized)
if (!i::wasm::DeserializeNativeModule(
isolate,
{reinterpret_cast<const uint8_t*>(ptr + data_size), serial_size},
{reinterpret_cast<const uint8_t*>(ptr), data_size})
{reinterpret_cast<const uint8_t*>(ptr), data_size}, {})
.ToHandle(&module_obj)) {
return nullptr;
}
......
......@@ -2210,8 +2210,8 @@ bool AsyncStreamingProcessor::Deserialize(Vector<const uint8_t> module_bytes,
HandleScope scope(job_->isolate_);
SaveAndSwitchContext saved_context(job_->isolate_, *job_->native_context_);
MaybeHandle<WasmModuleObject> result =
DeserializeNativeModule(job_->isolate_, module_bytes, wire_bytes);
MaybeHandle<WasmModuleObject> result = DeserializeNativeModule(
job_->isolate_, module_bytes, wire_bytes, job_->stream_->url());
if (result.is_null()) return false;
......
......@@ -602,7 +602,7 @@ bool IsSupportedVersion(Vector<const byte> version) {
MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Isolate* isolate, Vector<const byte> data,
Vector<const byte> wire_bytes_vec) {
Vector<const byte> wire_bytes_vec, Vector<const char> source_url) {
if (!IsWasmCodegenAllowed(isolate, isolate->native_context())) return {};
if (!IsSupportedVersion(data)) return {};
......@@ -616,8 +616,9 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
if (decode_result.failed()) return {};
std::shared_ptr<WasmModule> module = std::move(decode_result.value());
CHECK_NOT_NULL(module);
Handle<Script> script = CreateWasmScript(
isolate, wire_bytes, VectorOf(module->source_map_url), module->name);
Handle<Script> script =
CreateWasmScript(isolate, wire_bytes, VectorOf(module->source_map_url),
module->name, source_url);
auto shared_native_module =
wasm_engine->MaybeGetNativeModule(module->origin, wire_bytes_vec);
......
......@@ -36,7 +36,8 @@ bool IsSupportedVersion(Vector<const byte> data);
// Deserializes the given data to create a Wasm module object.
MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Isolate* isolate, Vector<const byte> data, Vector<const byte> wire_bytes);
Isolate* isolate, Vector<const byte> data, Vector<const byte> wire_bytes,
Vector<const char> source_url);
} // namespace wasm
} // namespace internal
......
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