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

Side by Side Diff: test/mjsunit/wasm/adapter-frame.js

Issue 1896863003: [wasm] Binary 11: Module changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/cctest/wasm/test-run-wasm-module.cc ('k') | test/mjsunit/wasm/calls.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 const JS = false; // for testing the tests. 10 const JS = false; // for testing the tests.
11 const WRONG1 = 0x0DEDFACE; 11 const WRONG1 = 0x0DEDFACE;
12 const WRONG2 = 0x0DEDBABE; 12 const WRONG2 = 0x0DEDBABE;
13 const WRONG3 = 0x0DEDD011 13 const WRONG3 = 0x0DEDD011
14 14
15 function makeSelect(type, args, which) { 15 function makeSelect(type, args, which) {
16 if (JS) { 16 if (JS) {
17 // For testing the tests. 17 // For testing the tests.
18 return function() { 18 return function() {
19 var val = +arguments[which]; 19 var val = +arguments[which];
20 print(" " + val); 20 print(" " + val);
21 if (type == kAstI32) return val | 0; 21 if (type == kAstI32) return val | 0;
22 if (type == kAstF32) return Math.fround(val); 22 if (type == kAstF32) return Math.fround(val);
23 if (type == kAstF64) return val; 23 if (type == kAstF64) return val;
24 return undefined; 24 return undefined;
25 } 25 }
26 } 26 }
27 27
28 var builder = new WasmModuleBuilder(); 28 var builder = new WasmModuleBuilder();
29 var sig = new Array(); 29 var sig = new Array();
30 sig.push(args);
31 for (var i = 0; i < args; i++) sig.push(type);
32 sig.push(1);
30 sig.push(type); 33 sig.push(type);
31 for (var i = 0; i < args; i++) sig.push(type);
32 builder.addFunction("select", sig) 34 builder.addFunction("select", sig)
33 .addBody([kExprGetLocal, which]) 35 .addBody([kExprGetLocal, which])
34 .exportFunc(); 36 .exportFunc();
35 37
36 return builder.instantiate().exports.select; 38 return builder.instantiate().exports.select;
37 } 39 }
38 40
39 const inputs = [ 41 const inputs = [
40 -1, 0, 2.2, 3.3, 3000.11, Infinity, -Infinity, NaN 42 -1, 0, 2.2, 3.3, 3000.11, Infinity, -Infinity, NaN
41 ]; 43 ];
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 assertEquals(C(val), select(WRONG1, WRONG2, val)); 314 assertEquals(C(val), select(WRONG1, WRONG2, val));
313 315
314 // under args 316 // under args
315 assertEquals(C(undefined), select()); 317 assertEquals(C(undefined), select());
316 assertEquals(C(undefined), select(0xDEDFACE)); 318 assertEquals(C(undefined), select(0xDEDFACE));
317 assertEquals(C(undefined), select(WRONG1, WRONG2)); 319 assertEquals(C(undefined), select(WRONG1, WRONG2));
318 // over args 320 // over args
319 assertEquals(C(val), select(WRONG1, WRONG2, val, WRONG3)); 321 assertEquals(C(val), select(WRONG1, WRONG2, val, WRONG3));
320 } 322 }
321 })(); 323 })();
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-module.cc ('k') | test/mjsunit/wasm/calls.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698