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

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

Issue 2417773004: [wasm] Reduce usage of old Wasm.* API in JS tests. (Closed)
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/data-segments.js ('k') | test/mjsunit/wasm/instantiate-module-basic.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 // The following methods do not attempt to catch the exception they raise. 10 // The following methods do not attempt to catch the exception they raise.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 throw 10.5; 99 throw 10.5;
100 } 100 }
101 var kJSThrowFP = builder.addImport("throw_fp", sig_index); 101 var kJSThrowFP = builder.addImport("throw_fp", sig_index);
102 102
103 // Helper function that throws a large number. Wasm should not catch it. 103 // Helper function that throws a large number. Wasm should not catch it.
104 function throw_large() { 104 function throw_large() {
105 throw 1e+28; 105 throw 1e+28;
106 } 106 }
107 var kJSThrowLarge = builder.addImport("throw_large", sig_index); 107 var kJSThrowLarge = builder.addImport("throw_large", sig_index);
108 108
109 // Helper function for throwing from Wasm. 109 // Helper function for throwing from WebAssembly.
110 var kWasmThrowFunction = 110 var kWasmThrowFunction =
111 builder.addFunction("throw", kSig_v_i) 111 builder.addFunction("throw", kSig_v_i)
112 .addBody([ 112 .addBody([
113 kExprGetLocal, 0, 113 kExprGetLocal, 0,
114 kExprThrow 114 kExprThrow
115 ]) 115 ])
116 .index; 116 .index;
117 117
118 // Scenario 1: Throw and catch appear on the same function. This should 118 // Scenario 1: Throw and catch appear on the same function. This should
119 // happen in case of inlining, for example. 119 // happen in case of inlining, for example.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 assertEquals(-1, test_catch.exports.from_direct_callee(0xFFFFFFFF)); 374 assertEquals(-1, test_catch.exports.from_direct_callee(0xFFFFFFFF));
375 assertEquals(0x7FFFFFFF, test_catch.exports.from_direct_callee(0x7FFFFFFF)); 375 assertEquals(0x7FFFFFFF, test_catch.exports.from_direct_callee(0x7FFFFFFF));
376 assertEquals(-10, test_catch.exports.from_indirect_callee(10)); 376 assertEquals(-10, test_catch.exports.from_indirect_callee(10));
377 assertEquals(-77, test_catch.exports.from_indirect_callee(77)); 377 assertEquals(-77, test_catch.exports.from_indirect_callee(77));
378 assertEquals(10, test_catch.exports.from_js(10)); 378 assertEquals(10, test_catch.exports.from_js(10));
379 assertEquals(-10, test_catch.exports.from_js(-10)); 379 assertEquals(-10, test_catch.exports.from_js(-10));
380 380
381 assertThrowsEquals(test_catch.exports.string_from_js, "use wasm;"); 381 assertThrowsEquals(test_catch.exports.string_from_js, "use wasm;");
382 assertThrowsEquals(test_catch.exports.large_from_js, 1e+28); 382 assertThrowsEquals(test_catch.exports.large_from_js, 1e+28);
383 assertThrowsEquals(test_catch.exports.undefined_from_js, undefined); 383 assertThrowsEquals(test_catch.exports.undefined_from_js, undefined);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/data-segments.js ('k') | test/mjsunit/wasm/instantiate-module-basic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698