Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index c0989d1d112f70be6e4c7c1940a4f235cb9b415c..45f520f262655cc6ad1fe3c9b23c4ae22b7da0fb 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1083,7 +1083,8 @@ void Template::Set(v8::Local<Name> name, v8::Local<Data> value, |
ENTER_V8(isolate); |
i::HandleScope scope(isolate); |
auto value_obj = Utils::OpenHandle(*value); |
- CHECK(!value_obj->IsJSReceiver() || value_obj->IsTemplateInfo()); |
+ CHECK(!value_obj->IsJSReceiver() || value_obj->IsTemplateInfo() || |
+ value_obj->IsExternal()); |
if (value_obj->IsObjectTemplateInfo()) { |
templ->set_serial_number(i::Smi::kZero); |
if (templ->IsFunctionTemplateInfo()) { |
@@ -7225,12 +7226,15 @@ WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() { |
MaybeLocal<WasmCompiledModule> WasmCompiledModule::Deserialize( |
Isolate* isolate, |
- const WasmCompiledModule::CallerOwnedBuffer& serialized_module) { |
+ const WasmCompiledModule::CallerOwnedBuffer& serialized_module, |
+ const WasmCompiledModule::CallerOwnedBuffer& wire_bytes) { |
int size = static_cast<int>(serialized_module.second); |
i::ScriptData sc(serialized_module.first, size); |
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
i::MaybeHandle<i::FixedArray> maybe_compiled_part = |
- i::WasmCompiledModuleSerializer::DeserializeWasmModule(i_isolate, &sc); |
+ i::WasmCompiledModuleSerializer::DeserializeWasmModule( |
+ i_isolate, &sc, |
+ {wire_bytes.first, static_cast<int>(wire_bytes.second)}); |
i::Handle<i::FixedArray> compiled_part; |
if (!maybe_compiled_part.ToHandle(&compiled_part)) { |
return MaybeLocal<WasmCompiledModule>(); |
@@ -7246,24 +7250,9 @@ MaybeLocal<WasmCompiledModule> WasmCompiledModule::DeserializeOrCompile( |
Isolate* isolate, |
const WasmCompiledModule::CallerOwnedBuffer& serialized_module, |
const WasmCompiledModule::CallerOwnedBuffer& wire_bytes) { |
- MaybeLocal<WasmCompiledModule> ret = Deserialize(isolate, serialized_module); |
+ MaybeLocal<WasmCompiledModule> ret = |
+ Deserialize(isolate, serialized_module, wire_bytes); |
if (!ret.IsEmpty()) { |
- // TODO(mtrofin): once we stop taking a dependency on Deserialize, |
- // clean this up to avoid the back and forth between internal |
- // and external representations. |
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
- i::Vector<const uint8_t> str(wire_bytes.first, |
- static_cast<int>(wire_bytes.second)); |
- i::Handle<i::SeqOneByteString> wire_bytes_as_string( |
- i::SeqOneByteString::cast( |
- *i_isolate->factory()->NewStringFromOneByte(str).ToHandleChecked()), |
- i_isolate); |
- |
- i::Handle<i::JSObject> obj = |
- i::Handle<i::JSObject>::cast(Utils::OpenHandle(*ret.ToLocalChecked())); |
- i::Handle<i::wasm::WasmCompiledModule> compiled_part = |
- i::handle(i::wasm::WasmCompiledModule::cast(obj->GetInternalField(0))); |
- compiled_part->set_module_bytes(wire_bytes_as_string); |
return ret; |
} |
return Compile(isolate, wire_bytes.first, wire_bytes.second); |