Commit bd8447af authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[serializer] Fix wasm code serialization

The SerializeGeneric method assumes that the object was not serialized
before. Hence, we should not call it repeatedly for the same builtin.
This CL now exposes SerializeBuiltin, and calls that directly.
We also serialize the Illegal builtin for wasm interpreter entries,
which are never reused across instantiations anyway.

R=ahaas@chromium.org, yangguo@chromium.org
BUG=v8:5822

Change-Id: Id74b86fe29171908ed35ddbc06c93f0d241e4917
Reviewed-on: https://chromium-review.googlesource.com/458380Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44155}
parent b90a20b2
......@@ -302,16 +302,17 @@ void WasmCompiledModuleSerializer::SerializeCodeObject(
case Code::WASM_FUNCTION:
case Code::JS_TO_WASM_FUNCTION:
// Just serialize the code_object.
SerializeGeneric(code_object, how_to_code, where_to_point);
break;
case Code::WASM_INTERPRETER_ENTRY:
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();
SerializeBuiltin(Builtins::kIllegal, how_to_code, where_to_point);
break;
default:
UNREACHABLE();
}
SerializeGeneric(code_object, how_to_code, where_to_point);
}
bool WasmCompiledModuleSerializer::ElideObject(Object* obj) {
......
......@@ -39,13 +39,13 @@ class CodeSerializer : public Serializer {
virtual bool ElideObject(Object* obj) { return false; }
void SerializeGeneric(HeapObject* heap_object, HowToCode how_to_code,
WhereToPoint where_to_point);
void SerializeBuiltin(int builtin_index, HowToCode how_to_code,
WhereToPoint where_to_point);
private:
void SerializeObject(HeapObject* o, HowToCode how_to_code,
WhereToPoint where_to_point, int skip) override;
void SerializeBuiltin(int builtin_index, HowToCode how_to_code,
WhereToPoint where_to_point);
void SerializeCodeStub(Code* code_stub, HowToCode how_to_code,
WhereToPoint where_to_point);
......
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