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

Side by Side Diff: test/mjsunit/wasm/jit-single-function.js

Issue 2226053002: [wasm] Remove single function JIT support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Drop test 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 | « test/mjsunit/wasm/default-func-call.js ('k') | test/mjsunit/wasm/wasm-constants.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --expose-wasm
6 // Flags: --wasm-jit-prototype
7
8 load("test/mjsunit/wasm/wasm-constants.js");
9 load("test/mjsunit/wasm/wasm-module-builder.js");
10
11 var module = (function () {
12 var builder = new WasmModuleBuilder();
13
14 var kSig_i_iiiii =
15 makeSig([kAstI32, kAstI32, kAstI32, kAstI32, kAstI32], [kAstI32]);
16
17 var sig_index2 = builder.addType(kSig_i_ii);
18 var sig_index5 = builder.addType(kSig_i_iiiii);
19
20 builder.addMemory(1, 1, true);
21 var wasm_bytes_sub = [
22 0,
23 kExprGetLocal, 0,
24 kExprGetLocal, 1,
25 kExprI32Sub
26 ];
27 builder.addDataSegment(0, wasm_bytes_sub, false);
28
29 var wasm_bytes_mul = [
30 0,
31 kExprGetLocal, 0,
32 kExprGetLocal, 1,
33 kExprI32Mul
34 ];
35 builder.addDataSegment(6, wasm_bytes_mul, false);
36
37 builder.addPadFunctionTable(10);
38 builder.addImport("add", sig_index2);
39 builder.addFunction("add", sig_index2)
40 .addBody([
41 kExprGetLocal, 0, kExprGetLocal, 1, kExprCallImport, kArity2, 0
42 ]);
43 builder.addFunction("main", sig_index5)
44 .addBody([
45 kExprGetLocal, 0,
46 kExprGetLocal, 1,
47 kExprGetLocal, 2,
48 kExprJITSingleFunction, sig_index2,
49 kExprGetLocal, 2,
50 kExprGetLocal, 3,
51 kExprGetLocal, 4,
52 kExprCallIndirect, kArity2, sig_index2
53 ])
54 .exportFunc()
55 builder.appendToTable([0, 1]);
56
57 return builder.instantiate({add: function(a, b) { return a + b | 0; }});
58 })();
59
60 // Check that the module exists
61 assertFalse(module === undefined);
62 assertFalse(module === null);
63 assertFalse(module === 0);
64 assertEquals("object", typeof module.exports);
65 assertEquals("function", typeof module.exports.main);
66
67 // Check that the bytes referred to lie in the bounds of the memory buffer
68 assertTraps(kTrapMemOutOfBounds, "module.exports.main(0, 100000, 3, 55, 99)");
69 assertTraps(kTrapMemOutOfBounds, "module.exports.main(65536, 1, 3, 55, 99)");
70
71 // Check that the index lies in the bounds of the table size
72 assertTraps(kTrapInvalidIndex, "module.exports.main(0, 6, 10, 55, 99)");
73 assertTraps(kTrapInvalidIndex, "module.exports.main(0, 6, -1, 55, 99)");
74
75 // args: base offset, size of func_bytes, index, param1, param2
76 assertEquals(-444, module.exports.main(0, 6, 3, 555, 999)); // JIT sub function
77 assertEquals(13, module.exports.main(0, 6, 9, 45, 32)); // JIT sub function
78 assertEquals(187, module.exports.main(6, 6, 6, 17, 11)); // JIT mul function
79 assertEquals(30525, module.exports.main(6, 6, 9, 555, 55)); // JIT mul function
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/default-func-call.js ('k') | test/mjsunit/wasm/wasm-constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698