Index: test/mjsunit/wasm/wasm-module-builder.js |
diff --git a/test/mjsunit/wasm/wasm-module-builder.js b/test/mjsunit/wasm/wasm-module-builder.js |
index 61e074b13deeb10fe73e5ce6fc507947fd5db460..86727e787854d10b1ee07e3dbdde8d8173efd24e 100644 |
--- a/test/mjsunit/wasm/wasm-module-builder.js |
+++ b/test/mjsunit/wasm/wasm-module-builder.js |
@@ -2,11 +2,6 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-function DataRef(data) { |
- this.pos = -1; |
- this.data = data; |
-} |
- |
function WasmFunctionBuilder(name, sig_index) { |
this.name = name; |
this.sig_index = sig_index; |
@@ -118,13 +113,6 @@ function emit_string(bytes, string) { |
} |
} |
-function emit_data_ref(bytes, string) { |
- bytes.push(new DataRef(string)); |
- bytes.push(0); |
- bytes.push(0); |
- bytes.push(0); |
-} |
- |
function emit_varint(bytes, val) { |
while (true) { |
var v = val & 0xff; |
@@ -269,10 +257,11 @@ WasmModuleBuilder.prototype.toArray = function(debug) { |
emit_u8(bytes, kDeclDataSegments); |
emit_varint(bytes, this.data_segments.length); |
for (seg of this.data_segments) { |
- emit_u32(bytes, seg.addr); |
- emit_data_ref(bytes, seg.data); |
- emit_u32(bytes, seg.data.length); |
- emit_u8(bytes, seg.init ? 1 : 0); |
+ emit_varint(bytes, seg.addr); |
+ emit_varint(bytes, seg.data.length); |
+ for (var i = 0; i < seg.data.length; i++) { |
+ emit_u8(bytes, seg.data[i]); |
+ } |
} |
} |
@@ -288,39 +277,6 @@ WasmModuleBuilder.prototype.toArray = function(debug) { |
if (debug) print("emitting end @ " + bytes.length); |
emit_u8(bytes, kDeclEnd); |
- // Collect references. |
- var strings = new Object(); |
- var data_segments = []; |
- var count = 0; |
- for (var i = 0; i < bytes.length; i++) { |
- var b = bytes[i]; |
- if (b instanceof DataRef) { |
- data_segments.push(b); |
- count++; |
- } |
- } |
- |
- if (count > 0) { |
- // Emit data. |
- if (debug) print("emitting data @ " + bytes.length); |
- for (ref of data_segments) { |
- ref.pos = bytes.length; |
- for (var i = 0; i < ref.data.length; i++) { |
- emit_u8(bytes, ref.data[i]); |
- } |
- } |
- // Update references to strings and data. |
- for (var i = 0; i < bytes.length; i++) { |
- var b = bytes[i]; |
- if (b instanceof DataRef) { |
- bytes[i] = b.pos & 0xFF; |
- bytes[i + 1] = (b.pos >> 8) & 0xFF; |
- bytes[i + 2] = (b.pos >> 16) & 0xFF; |
- bytes[i + 3] = (b.pos >> 24) & 0xFF; |
- } |
- } |
- } |
- |
return bytes; |
} |