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

Side by Side Diff: test/mjsunit/wasm/wasm-module-builder.js

Issue 2643783002: [wasm] check that there is at most 1 table (Closed)
Patch Set: Tweak module builder 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/wasm/indirect-tables.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Used for encoding f32 and double constants to bits. 5 // Used for encoding f32 and double constants to bits.
6 let __buffer = new ArrayBuffer(8); 6 let __buffer = new ArrayBuffer(8);
7 let byte_view = new Int8Array(__buffer); 7 let byte_view = new Int8Array(__buffer);
8 let f32_view = new Float32Array(__buffer); 8 let f32_view = new Float32Array(__buffer);
9 let f64_view = new Float64Array(__buffer); 9 let f64_view = new Float64Array(__buffer);
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 addDataSegment(addr, data, is_global = false) { 221 addDataSegment(addr, data, is_global = false) {
222 this.segments.push({addr: addr, data: data, is_global: is_global}); 222 this.segments.push({addr: addr, data: data, is_global: is_global});
223 return this.segments.length - 1; 223 return this.segments.length - 1;
224 } 224 }
225 225
226 exportMemoryAs(name) { 226 exportMemoryAs(name) {
227 this.exports.push({name: name, kind: kExternalMemory, index: 0}); 227 this.exports.push({name: name, kind: kExternalMemory, index: 0});
228 } 228 }
229 229
230 addFunctionTableInit(base, is_global, array) { 230 addFunctionTableInit(base, is_global, array, is_import = false) {
231 this.function_table_inits.push({base: base, is_global: is_global, 231 this.function_table_inits.push({base: base, is_global: is_global,
232 array: array}); 232 array: array});
233 if (!is_global) { 233 if (!is_global) {
234 var length = base + array.length; 234 var length = base + array.length;
235 if (length > this.function_table_length) { 235 if (length > this.function_table_length && !is_import) {
236 this.function_table_length = length; 236 this.function_table_length = length;
237 } 237 }
238 } 238 }
239 return this; 239 return this;
240 } 240 }
241 241
242 appendToTable(array) { 242 appendToTable(array) {
243 return this.addFunctionTableInit(this.function_table.length, false, array); 243 return this.addFunctionTableInit(this.function_table.length, false, array);
244 } 244 }
245 245
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 return buffer; 549 return buffer;
550 } 550 }
551 551
552 instantiate(ffi) { 552 instantiate(ffi) {
553 let module = new WebAssembly.Module(this.toBuffer()); 553 let module = new WebAssembly.Module(this.toBuffer());
554 let instance = new WebAssembly.Instance(module, ffi); 554 let instance = new WebAssembly.Instance(module, ffi);
555 return instance; 555 return instance;
556 } 556 }
557 } 557 }
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/indirect-tables.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698