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

Side by Side Diff: test/mjsunit/wasm/globals.js

Issue 2627723007: [wasm] Exporting i64 globals causes a link error. (Closed)
Patch Set: 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 | « src/wasm/wasm-module.cc ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | 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 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 function TestImported(type, val, expected) { 10 function TestImported(type, val, expected) {
(...skipping 26 matching lines...) Expand all
37 builder.addGlobal(kWasmI32); // pad 37 builder.addGlobal(kWasmI32); // pad
38 38
39 var instance = builder.instantiate(); 39 var instance = builder.instantiate();
40 assertEquals(expected, instance.exports.foo); 40 assertEquals(expected, instance.exports.foo);
41 } 41 }
42 42
43 TestExported(kWasmI32, 455.5, 455); 43 TestExported(kWasmI32, 455.5, 455);
44 TestExported(kWasmF32, -999.34343, Math.fround(-999.34343)); 44 TestExported(kWasmF32, -999.34343, Math.fround(-999.34343));
45 TestExported(kWasmF64, 87347.66666, 87347.66666); 45 TestExported(kWasmF64, 87347.66666, 87347.66666);
46 46
47 (function TestI64Exported() {
48 var builder = new WasmModuleBuilder();
49 var sig = makeSig([kWasmI64], []);
50 builder.addGlobal(kWasmI32); // pad
51 var g = builder.addGlobal(kWasmI64, false)
52 .exportAs("foo");
53 g.init = 1234;
54 builder.addGlobal(kWasmI32); // pad
55
56 assertThrows(()=> {builder.instantiate()}, WebAssembly.LinkError);
57 })();
47 58
48 function TestImportedExported(type, val, expected) { 59 function TestImportedExported(type, val, expected) {
49 print("TestImportedExported " + type + "(" + val +")" + " = " + expected); 60 print("TestImportedExported " + type + "(" + val +")" + " = " + expected);
50 var builder = new WasmModuleBuilder(); 61 var builder = new WasmModuleBuilder();
51 var sig = makeSig([type], []); 62 var sig = makeSig([type], []);
52 var i = builder.addImportedGlobal("ttt", "foo", type); 63 var i = builder.addImportedGlobal("ttt", "foo", type);
53 builder.addGlobal(kWasmI32); // pad 64 builder.addGlobal(kWasmI32); // pad
54 var o = builder.addGlobal(type, false) 65 var o = builder.addGlobal(type, false)
55 .exportAs("bar"); 66 .exportAs("bar");
56 o.init_index = i; 67 o.init_index = i;
(...skipping 21 matching lines...) Expand all
78 .addBody([kExprGetGlobal, def.index]) 89 .addBody([kExprGetGlobal, def.index])
79 .exportAs("main"); 90 .exportAs("main");
80 91
81 var instance = builder.instantiate({nnn: {foo: val}}); 92 var instance = builder.instantiate({nnn: {foo: val}});
82 assertEquals(val, instance.exports.main()); 93 assertEquals(val, instance.exports.main());
83 } 94 }
84 95
85 TestGlobalIndexSpace(kWasmI32, 123); 96 TestGlobalIndexSpace(kWasmI32, 123);
86 TestGlobalIndexSpace(kWasmF32, 54321.125); 97 TestGlobalIndexSpace(kWasmF32, 54321.125);
87 TestGlobalIndexSpace(kWasmF64, 12345.678); 98 TestGlobalIndexSpace(kWasmF64, 12345.678);
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698