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

Side by Side Diff: test/mjsunit/wasm/import-table.js

Issue 2595733003: [wasm] Remove non-standard kExprI8Const bytecode (Closed)
Patch Set: Remove regression test 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
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 testCallImport(func, check) { 10 function testCallImport(func, check) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 }}}; 183 }}};
184 184
185 var builder = new WasmModuleBuilder(); 185 var builder = new WasmModuleBuilder();
186 186
187 builder.addImport("q", "func", makeSig_v_xx(type)); 187 builder.addImport("q", "func", makeSig_v_xx(type));
188 builder.addFunction("main", makeSig_r_xx(kWasmI32, type)) 188 builder.addFunction("main", makeSig_r_xx(kWasmI32, type))
189 .addBody([ 189 .addBody([
190 kExprGetLocal, 0, // -- 190 kExprGetLocal, 0, // --
191 kExprGetLocal, 1, // -- 191 kExprGetLocal, 1, // --
192 kExprCallFunction, 0, // -- 192 kExprCallFunction, 0, // --
193 kExprI8Const, 99, // -- 193 kExprI32Const, 39, // --
194 ]) 194 ])
195 .exportFunc("main"); 195 .exportFunc("main");
196 196
197 var main = builder.instantiate(ffi).exports.main; 197 var main = builder.instantiate(ffi).exports.main;
198 198
199 print("testCallBinopVoid", type); 199 print("testCallBinopVoid", type);
200 200
201 for (var i = 0; i < 100000; i += 10003.1) { 201 for (var i = 0; i < 100000; i += 10003.1) {
202 var a = 22.5 + i, b = 10.5 + i; 202 var a = 22.5 + i, b = 10.5 + i;
203 var r = main(a, b); 203 var r = main(a, b);
204 assertEquals(99, r); 204 assertEquals(39, r);
205 assertEquals(2, passed_length); 205 assertEquals(2, passed_length);
206 var expected_a, expected_b; 206 var expected_a, expected_b;
207 switch (type) { 207 switch (type) {
208 case kWasmI32: { 208 case kWasmI32: {
209 expected_a = a | 0; 209 expected_a = a | 0;
210 expected_b = b | 0; 210 expected_b = b | 0;
211 break; 211 break;
212 } 212 }
213 case kWasmF32: { 213 case kWasmF32: {
214 expected_a = Math.fround(a); 214 expected_a = Math.fround(a);
(...skipping 21 matching lines...) Expand all
236 testCallBinopVoid(kWasmF64); 236 testCallBinopVoid(kWasmF64);
237 237
238 238
239 239
240 function testCallPrint() { 240 function testCallPrint() {
241 var builder = new WasmModuleBuilder(); 241 var builder = new WasmModuleBuilder();
242 builder.addImport("q", "print", makeSig_v_x(kWasmI32)); 242 builder.addImport("q", "print", makeSig_v_x(kWasmI32));
243 builder.addImport("q", "print", makeSig_r_x(kWasmF64, kWasmF64)); 243 builder.addImport("q", "print", makeSig_r_x(kWasmF64, kWasmF64));
244 builder.addFunction("main", makeSig_r_x(kWasmF64, kWasmF64)) 244 builder.addFunction("main", makeSig_r_x(kWasmF64, kWasmF64))
245 .addBody([ 245 .addBody([
246 kExprI8Const, 97, // -- 246 kExprI32Const, 27, // --
247 kExprCallFunction, 0, // -- 247 kExprCallFunction, 0, // --
248 kExprGetLocal, 0, // -- 248 kExprGetLocal, 0, // --
249 kExprCallFunction, 1 // -- 249 kExprCallFunction, 1 // --
250 ]) 250 ])
251 .exportFunc(); 251 .exportFunc();
252 252
253 var main = builder.instantiate({q: {print: print}}).exports.main; 253 var main = builder.instantiate({q: {print: print}}).exports.main;
254 254
255 for (var i = -9; i < 900; i += 16.125) { 255 for (var i = -9; i < 900; i += 16.125) {
256 main(i); 256 main(i);
257 } 257 }
258 } 258 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 let main = builder.instantiate({M: {[name]: () => 42}}).exports.main; 293 let main = builder.instantiate({M: {[name]: () => 42}}).exports.main;
294 assertEquals(42, main()); 294 assertEquals(42, main());
295 } 295 }
296 296
297 testImportName("bla"); 297 testImportName("bla");
298 testImportName("0"); 298 testImportName("0");
299 testImportName(" a @#$2 324 "); 299 testImportName(" a @#$2 324 ");
300 // TODO(bradnelson): This should succeed. 300 // TODO(bradnelson): This should succeed.
301 // testImportName(""); 301 // testImportName("");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698