Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: src/snapshot/code-serializer.cc

Issue 2629853004: [wasm] Skip serialization of breakpoints and certion stubs (Closed)
Patch Set: Move implementation to .cc file Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/code-serializer.cc
diff --git a/src/snapshot/code-serializer.cc b/src/snapshot/code-serializer.cc
index 73edbff4f49020f0531f1ed877d0486bdcdf9b4e..197c569c84610081fd532d50b7120476f981237f 100644
--- a/src/snapshot/code-serializer.cc
+++ b/src/snapshot/code-serializer.cc
@@ -229,14 +229,20 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
return scope.CloseAndEscape(result);
}
+WasmCompiledModuleSerializer::WasmCompiledModuleSerializer(
+ Isolate* isolate, uint32_t source_hash, Handle<Context> native_context,
+ Handle<SeqOneByteString> module_bytes)
+ : CodeSerializer(isolate, source_hash) {
+ reference_map()->AddAttachedReference(*isolate->native_context());
+ reference_map()->AddAttachedReference(*module_bytes);
+}
+
std::unique_ptr<ScriptData> WasmCompiledModuleSerializer::SerializeWasmModule(
Isolate* isolate, Handle<FixedArray> input) {
Handle<WasmCompiledModule> compiled_module =
Handle<WasmCompiledModule>::cast(input);
- WasmCompiledModuleSerializer wasm_cs(isolate, 0);
- wasm_cs.reference_map()->AddAttachedReference(*isolate->native_context());
- wasm_cs.reference_map()->AddAttachedReference(
- compiled_module->module_bytes());
+ WasmCompiledModuleSerializer wasm_cs(isolate, 0, isolate->native_context(),
+ handle(compiled_module->module_bytes()));
ScriptData* data = wasm_cs.Serialize(compiled_module);
return std::unique_ptr<ScriptData>(data);
}
@@ -277,11 +283,35 @@ MaybeHandle<FixedArray> WasmCompiledModuleSerializer::DeserializeWasmModule(
Handle<WasmCompiledModule> compiled_module(
static_cast<WasmCompiledModule*>(*obj.ToHandleChecked()), isolate);
- WasmCompiledModule::RecreateModuleWrapper(isolate, compiled_module);
+ WasmCompiledModule::ReinitializeAfterDeserialization(isolate,
+ compiled_module);
DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
return compiled_module;
}
+void WasmCompiledModuleSerializer::SerializeCodeObject(
+ Code* code_object, HowToCode how_to_code, WhereToPoint where_to_point) {
+ Code::Kind kind = code_object->kind();
+ switch (kind) {
+ case Code::WASM_FUNCTION:
+ case Code::JS_TO_WASM_FUNCTION:
+ // Just serialize the code_object.
+ break;
+ case Code::WASM_TO_JS_FUNCTION:
+ // Serialize the illegal builtin instead. On instantiation of a
+ // deserialized module, these will be replaced again.
+ code_object = *isolate()->builtins()->Illegal();
+ break;
+ default:
+ UNREACHABLE();
+ }
+ SerializeGeneric(code_object, how_to_code, where_to_point);
+}
+
+bool WasmCompiledModuleSerializer::ElideObject(Object* obj) {
+ return obj->IsWeakCell() || obj->IsForeign() || obj->IsBreakPointInfo();
+}
+
class Checksum {
public:
explicit Checksum(Vector<const byte> payload) {
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698