aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-serialization.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/wasm/wasm-serialization.cc')
-rw-r--r--deps/v8/src/wasm/wasm-serialization.cc35
1 files changed, 18 insertions, 17 deletions
diff --git a/deps/v8/src/wasm/wasm-serialization.cc b/deps/v8/src/wasm/wasm-serialization.cc
index 2edc412afa..b676a5b61b 100644
--- a/deps/v8/src/wasm/wasm-serialization.cc
+++ b/deps/v8/src/wasm/wasm-serialization.cc
@@ -46,9 +46,9 @@ class Writer {
DCHECK_GE(current_size(), sizeof(T));
WriteUnalignedValue(reinterpret_cast<Address>(current_location()), value);
pos_ += sizeof(T);
- if (FLAG_wasm_trace_serialization) {
- StdoutStream{} << "wrote: " << (size_t)value << " sized: " << sizeof(T)
- << std::endl;
+ if (FLAG_trace_wasm_serialization) {
+ StdoutStream{} << "wrote: " << static_cast<size_t>(value)
+ << " sized: " << sizeof(T) << std::endl;
}
}
@@ -58,7 +58,7 @@ class Writer {
memcpy(current_location(), v.start(), v.size());
pos_ += v.size();
}
- if (FLAG_wasm_trace_serialization) {
+ if (FLAG_trace_wasm_serialization) {
StdoutStream{} << "wrote vector of " << v.size() << " elements"
<< std::endl;
}
@@ -90,9 +90,9 @@ class Reader {
T value =
ReadUnalignedValue<T>(reinterpret_cast<Address>(current_location()));
pos_ += sizeof(T);
- if (FLAG_wasm_trace_serialization) {
- StdoutStream{} << "read: " << (size_t)value << " sized: " << sizeof(T)
- << std::endl;
+ if (FLAG_trace_wasm_serialization) {
+ StdoutStream{} << "read: " << static_cast<size_t>(value)
+ << " sized: " << sizeof(T) << std::endl;
}
return value;
}
@@ -103,7 +103,7 @@ class Reader {
memcpy(v.start(), current_location(), v.size());
pos_ += v.size();
}
- if (FLAG_wasm_trace_serialization) {
+ if (FLAG_trace_wasm_serialization) {
StdoutStream{} << "read vector of " << v.size() << " elements"
<< std::endl;
}
@@ -127,14 +127,6 @@ void WriteVersion(Isolate* isolate, Writer* writer) {
writer->Write(FlagList::Hash());
}
-bool IsSupportedVersion(Isolate* isolate, const Vector<const byte> version) {
- if (version.size() < kVersionSize) return false;
- byte current_version[kVersionSize];
- Writer writer({current_version, kVersionSize});
- WriteVersion(isolate, &writer);
- return memcmp(version.start(), current_version, kVersionSize) == 0;
-}
-
// On Intel, call sites are encoded as a displacement. For linking and for
// serialization/deserialization, we want to store/retrieve a tag (the function
// index). On Intel, that means accessing the raw displacement.
@@ -537,6 +529,14 @@ bool NativeModuleDeserializer::ReadCode(uint32_t fn_index, Reader* reader) {
return true;
}
+bool IsSupportedVersion(Isolate* isolate, Vector<const byte> version) {
+ if (version.size() < kVersionSize) return false;
+ byte current_version[kVersionSize];
+ Writer writer({current_version, kVersionSize});
+ WriteVersion(isolate, &writer);
+ return memcmp(version.start(), current_version, kVersionSize) == 0;
+}
+
MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Isolate* isolate, Vector<const byte> data, Vector<const byte> wire_bytes) {
if (!IsWasmCodegenAllowed(isolate, isolate->native_context())) {
@@ -553,7 +553,8 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
if (!decode_result.ok()) return {};
CHECK_NOT_NULL(decode_result.val);
WasmModule* module = decode_result.val.get();
- Handle<Script> script = CreateWasmScript(isolate, wire_bytes);
+ Handle<Script> script =
+ CreateWasmScript(isolate, wire_bytes, module->source_map_url);
// TODO(eholk): We need to properly preserve the flag whether the trap
// handler was used or not when serializing.