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

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

Issue 2361053004: Revert of [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 2 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/ensure-wasm-binaries-up-to-date.js ('k') | test/mjsunit/wasm/export-table.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 --wasm-eh-prototype 5 // Flags: --expose-wasm --wasm-eh-prototype
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 var module = (function () { 10 var module = (function () {
11 var builder = new WasmModuleBuilder(); 11 var builder = new WasmModuleBuilder();
12 12
13 builder.addFunction("throw_param_if_not_zero", kSig_i_i) 13 builder.addFunction("throw_param_if_not_zero", kSig_i_i)
14 .addBody([ 14 .addBody([
15 kExprGetLocal, 0, 15 kExprGetLocal, 0,
16 kExprI32Const, 0, 16 kExprI32Const, 0,
17 kExprI32Ne, 17 kExprI32Ne,
18 kExprIf, kAstStmt, 18 kExprIf,
19 kExprGetLocal, 0, 19 kExprGetLocal, 0,
20 kExprThrow, kAstStmt, 20 kExprThrow,
21 kExprEnd, 21 kExprEnd,
22 kExprI32Const, 1 22 kExprI32Const, 1
23 ]) 23 ])
24 .exportFunc() 24 .exportFunc()
25 25
26 builder.addFunction("throw_20", kSig_v_v) 26 builder.addFunction("throw_20", kSig_v_v)
27 .addBody([ 27 .addBody([
28 kExprI32Const, 20, 28 kExprI32Const, 20,
29 kExprThrow, kAstStmt 29 kExprThrow
30 ]) 30 ])
31 .exportFunc() 31 .exportFunc()
32 32
33 builder.addFunction("throw_expr_with_params", kSig_v_ddi) 33 builder.addFunction("throw_expr_with_params", kSig_v_ddi)
34 .addBody([ 34 .addBody([
35 // p2 * (p0 + min(p0, p1))|0 - 20 35 // p2 * (p0 + min(p0, p1))|0 - 20
36 kExprGetLocal, 2, 36 kExprGetLocal, 2,
37 kExprGetLocal, 0, 37 kExprGetLocal, 0,
38 kExprGetLocal, 0, 38 kExprGetLocal, 0,
39 kExprGetLocal, 1, 39 kExprGetLocal, 1,
40 kExprF64Min, 40 kExprF64Min,
41 kExprF64Add, 41 kExprF64Add,
42 kExprI32SConvertF64, 42 kExprI32SConvertF64,
43 kExprI32Mul, 43 kExprI32Mul,
44 kExprI32Const, 20, 44 kExprI32Const, 20,
45 kExprI32Sub, 45 kExprI32Sub,
46 kExprThrow, kAstStmt 46 kExprThrow
47 ]) 47 ])
48 .exportFunc() 48 .exportFunc()
49 49
50 return builder.instantiate(); 50 return builder.instantiate();
51 })(); 51 })();
52 52
53 // Check the module exists. 53 // Check the module exists.
54 assertFalse(module === undefined); 54 assertFalse(module === undefined);
55 assertFalse(module === null); 55 assertFalse(module === null);
56 assertFalse(module === 0); 56 assertFalse(module === 0);
57 assertEquals("object", typeof module.exports); 57 assertEquals("object", typeof module.exports);
58 assertEquals("function", typeof module.exports.throw_param_if_not_zero); 58 assertEquals("function", typeof module.exports.throw_param_if_not_zero);
59 59
60 assertEquals(1, module.exports.throw_param_if_not_zero(0)); 60 assertEquals(1, module.exports.throw_param_if_not_zero(0));
61 assertWasmThrows(10, function() { module.exports.throw_param_if_not_zero(10) }); 61 assertWasmThrows(10, function() { module.exports.throw_param_if_not_zero(10) });
62 assertWasmThrows(-1, function() { module.exports.throw_param_if_not_zero(-1) }); 62 assertWasmThrows(-1, function() { module.exports.throw_param_if_not_zero(-1) });
63 assertWasmThrows(20, module.exports.throw_20); 63 assertWasmThrows(20, module.exports.throw_20);
64 assertWasmThrows( 64 assertWasmThrows(
65 -8, function() { module.exports.throw_expr_with_params(1.5, 2.5, 4); }); 65 -8, function() { module.exports.throw_expr_with_params(1.5, 2.5, 4); });
66 assertWasmThrows( 66 assertWasmThrows(
67 12, function() { module.exports.throw_expr_with_params(5.7, 2.5, 4); }); 67 12, function() { module.exports.throw_expr_with_params(5.7, 2.5, 4); });
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js ('k') | test/mjsunit/wasm/export-table.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698