Index: src/wasm/encoder.cc |
diff --git a/src/wasm/encoder.cc b/src/wasm/encoder.cc |
index d80a27533884401ae845ec185b385225c56361c7..a6b2f43983e9d1952f0274a7aa5f55e6d244f435 100644 |
--- a/src/wasm/encoder.cc |
+++ b/src/wasm/encoder.cc |
@@ -461,6 +461,8 @@ struct Sizes { |
WasmModuleIndex* WasmModuleWriter::WriteTo(Zone* zone) const { |
Sizes sizes = {0, 0}; |
+ sizes.Add(2 * sizeof(uint32_t), 0); // header |
+ |
sizes.Add(1, 0); |
sizes.Add(kDeclMemorySize, 0); |
@@ -495,6 +497,10 @@ WasmModuleIndex* WasmModuleWriter::WriteTo(Zone* zone) const { |
byte* header = buffer; |
byte* body = buffer + sizes.header_size; |
+ // -- emit magic ------------------------------------------------------------- |
+ EmitUint32(&header, kWasmMagic); |
+ EmitUint32(&header, kWasmVersion); |
+ |
// -- emit memory declaration ------------------------------------------------ |
EmitUint8(&header, kDeclMemory); |
EmitUint8(&header, 16); // min memory size |