OLD | NEW |
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 | 8 |
9 var module = (function () { | 9 var module = (function () { |
10 var kBodySize = 5; | 10 var kBodySize = 5; |
11 var kNameOffset = 21 + kBodySize + 1; | 11 var kNameOffset = 21 + kBodySize + 1; |
12 | 12 |
13 return WASM.instantiateModule(bytes( | 13 return _WASMEXP_.instantiateModule(bytes( |
14 // -- memory | 14 // -- memory |
15 kDeclMemory, | 15 kDeclMemory, |
16 12, 12, 1, | 16 12, 12, 1, |
17 // -- signatures | 17 // -- signatures |
18 kDeclSignatures, 1, | 18 kDeclSignatures, 1, |
19 2, kAstI32, kAstI32, kAstI32, // int, int -> int | 19 2, kAstI32, kAstI32, kAstI32, // int, int -> int |
20 // -- functions | 20 // -- functions |
21 kDeclFunctions, 1, | 21 kDeclFunctions, 1, |
22 kDeclFunctionName | kDeclFunctionExport, | 22 kDeclFunctionName | kDeclFunctionExport, |
23 0, 0, | 23 0, 0, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 assertEquals(-55, module.sub(33, 88)); | 58 assertEquals(-55, module.sub(33, 88)); |
59 assertEquals(-55555, module.sub(33333, 88888)); | 59 assertEquals(-55555, module.sub(33333, 88888)); |
60 assertEquals(-5555555, module.sub(3333333, 8888888)); | 60 assertEquals(-5555555, module.sub(3333333, 8888888)); |
61 | 61 |
62 | 62 |
63 var module = (function() { | 63 var module = (function() { |
64 var kBodySize = 1; | 64 var kBodySize = 1; |
65 var kNameOffset2 = 19 + kBodySize + 1; | 65 var kNameOffset2 = 19 + kBodySize + 1; |
66 | 66 |
67 return WASM.instantiateModule(bytes( | 67 return _WASMEXP_.instantiateModule(bytes( |
68 // -- memory | 68 // -- memory |
69 kDeclMemory, | 69 kDeclMemory, |
70 12, 12, 1, | 70 12, 12, 1, |
71 // -- signatures | 71 // -- signatures |
72 kDeclSignatures, 1, | 72 kDeclSignatures, 1, |
73 0, kAstStmt, // signature: void -> void | 73 0, kAstStmt, // signature: void -> void |
74 // -- functions | 74 // -- functions |
75 kDeclFunctions, 1, | 75 kDeclFunctions, 1, |
76 kDeclFunctionName | kDeclFunctionExport, | 76 kDeclFunctionName | kDeclFunctionExport, |
77 0, 0, // signature index | 77 0, 0, // signature index |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 kNameOffset, 0, 0, 0, // name offset | 129 kNameOffset, 0, 0, 0, // name offset |
130 kBodySize, 0, | 130 kBodySize, 0, |
131 // -- body | 131 // -- body |
132 kExprF64Lt, // -- | 132 kExprF64Lt, // -- |
133 kExprGetLocal, 0, // -- | 133 kExprGetLocal, 0, // -- |
134 kExprGetLocal, 1, // -- | 134 kExprGetLocal, 1, // -- |
135 kDeclEnd, | 135 kDeclEnd, |
136 'f', 'l', 't', 0 // name | 136 'f', 'l', 't', 0 // name |
137 ); | 137 ); |
138 | 138 |
139 var module = WASM.instantiateModule(data); | 139 var module = _WASMEXP_.instantiateModule(data); |
140 | 140 |
141 assertEquals("function", typeof module.flt); | 141 assertEquals("function", typeof module.flt); |
142 assertEquals(1, module.flt(-2, -1)); | 142 assertEquals(1, module.flt(-2, -1)); |
143 assertEquals(0, module.flt(7.3, 7.1)); | 143 assertEquals(0, module.flt(7.3, 7.1)); |
144 assertEquals(1, module.flt(7.1, 7.3)); | 144 assertEquals(1, module.flt(7.1, 7.3)); |
145 })(); | 145 })(); |
OLD | NEW |