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

Unified Diff: src/wasm/encoder.cc

Issue 1776923005: [Wasm] Move data segment data inline to the data segment section (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | src/wasm/module-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/encoder.cc
diff --git a/src/wasm/encoder.cc b/src/wasm/encoder.cc
index 4ed8e896b6252481db9f731268118deca0bfc995..b3b2a36c7f8108da9b0621f6b72f0727c35bde7a 100644
--- a/src/wasm/encoder.cc
+++ b/src/wasm/encoder.cc
@@ -369,14 +369,11 @@ uint32_t WasmDataSegmentEncoder::BodySize() const {
void WasmDataSegmentEncoder::Serialize(byte* buffer, byte** header,
byte** body) const {
- uint32_t body_offset = static_cast<uint32_t>(*body - buffer);
- EmitUint32(header, dest_);
- EmitUint32(header, body_offset);
- EmitUint32(header, static_cast<uint32_t>(data_.size()));
- EmitUint8(header, 1); // init
-
- std::memcpy(*body, &data_[0], data_.size());
- (*body) += data_.size();
+ EmitVarInt(header, dest_);
+ EmitVarInt(header, static_cast<uint32_t>(data_.size()));
+
+ std::memcpy(*header, &data_[0], data_.size());
+ (*header) += data_.size();
}
WasmModuleBuilder::WasmModuleBuilder(Zone* zone)
« no previous file with comments | « no previous file | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698