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

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

Issue 2254803002: [wasm] Throw a type error if an I64 is exported to JS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove IfSuccess nodes for now. Created 4 years, 4 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/runtime/runtime-wasm.cc ('k') | test/mjsunit/wasm/ffi-error.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 assertModule(module, memsize) { 10 function assertModule(module, memsize) {
(...skipping 22 matching lines...) Expand all
33 assertEquals("object", typeof module.exports); 33 assertEquals("object", typeof module.exports);
34 34
35 var exp = module.exports[func]; 35 var exp = module.exports[func];
36 assertFalse(exp === undefined); 36 assertFalse(exp === undefined);
37 assertFalse(exp === null); 37 assertFalse(exp === null);
38 assertFalse(exp === 0); 38 assertFalse(exp === 0);
39 assertEquals("function", typeof exp); 39 assertEquals("function", typeof exp);
40 return exp; 40 return exp;
41 } 41 }
42 42
43 (function I64SubTest() {
44
45 var builder = new WasmModuleBuilder();
46
47 builder.addMemory(1, 1, true);
48 builder.addFunction("sub", kSig_l_ll)
49 .addBody([ // --
50 kExprGetLocal, 0, // --
51 kExprGetLocal, 1, // --
52 kExprI64Sub]) // --
53 .exportFunc()
54
55 var module = builder.instantiate();
56 assertModule(module, kPageSize);
57
58 // Check the properties of the sub function.
59 var sub = assertFunction(module, "sub");
60 assertEquals(-55, sub(33, 88));
61 assertEquals(-55555, sub(33333, 88888));
62 assertEquals(-5555555, sub(3333333, 8888888));
63 })();
64
65 (function SubTest() { 43 (function SubTest() {
66 44
67 var builder = new WasmModuleBuilder(); 45 var builder = new WasmModuleBuilder();
68 46
69 builder.addMemory(1, 1, true); 47 builder.addMemory(1, 1, true);
70 builder.addFunction("sub", kSig_i_ii) 48 builder.addFunction("sub", kSig_i_ii)
71 .addBody([ 49 .addBody([
72 kExprGetLocal, 0, // -- 50 kExprGetLocal, 0, // --
73 kExprGetLocal, 1, // -- 51 kExprGetLocal, 1, // --
74 kExprI32Sub, // -- 52 kExprI32Sub, // --
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 .exportFunc(); 96 .exportFunc();
119 97
120 var module = builder.instantiate(); 98 var module = builder.instantiate();
121 assertModule(module, kPageSize * kPages); 99 assertModule(module, kPageSize * kPages);
122 100
123 var flt = assertFunction(module, "flt"); 101 var flt = assertFunction(module, "flt");
124 assertEquals(1, flt(-2, -1)); 102 assertEquals(1, flt(-2, -1));
125 assertEquals(0, flt(7.3, 7.1)); 103 assertEquals(0, flt(7.3, 7.1));
126 assertEquals(1, flt(7.1, 7.3)); 104 assertEquals(1, flt(7.1, 7.3));
127 })(); 105 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-wasm.cc ('k') | test/mjsunit/wasm/ffi-error.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698