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

Side by Side Diff: test/mjsunit/wasm/wasm-constants.js

Issue 2339053003: [V8][Wasm] Wasm throws. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addresses comments. Created 4 years, 3 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/exceptions.js ('k') | no next file » | 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 function bytes() { 7 function bytes() {
8 var buffer = new ArrayBuffer(arguments.length); 8 var buffer = new ArrayBuffer(arguments.length);
9 var view = new Uint8Array(buffer); 9 var view = new Uint8Array(buffer);
10 for (var i = 0; i < arguments.length; i++) { 10 for (var i = 0; i < arguments.length; i++) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 var kSig_d_dd = makeSig([kAstF64, kAstF64], [kAstF64]); 99 var kSig_d_dd = makeSig([kAstF64, kAstF64], [kAstF64]);
100 var kSig_l_ll = makeSig([kAstI64, kAstI64], [kAstI64]); 100 var kSig_l_ll = makeSig([kAstI64, kAstI64], [kAstI64]);
101 var kSig_i_dd = makeSig([kAstF64, kAstF64], [kAstI32]); 101 var kSig_i_dd = makeSig([kAstF64, kAstF64], [kAstI32]);
102 var kSig_v_v = makeSig([], []); 102 var kSig_v_v = makeSig([], []);
103 var kSig_i_v = makeSig([], [kAstI32]); 103 var kSig_i_v = makeSig([], [kAstI32]);
104 var kSig_v_i = makeSig([kAstI32], []); 104 var kSig_v_i = makeSig([kAstI32], []);
105 var kSig_v_ii = makeSig([kAstI32, kAstI32], []); 105 var kSig_v_ii = makeSig([kAstI32, kAstI32], []);
106 var kSig_v_iii = makeSig([kAstI32, kAstI32, kAstI32], []); 106 var kSig_v_iii = makeSig([kAstI32, kAstI32, kAstI32], []);
107 var kSig_v_d = makeSig([kAstF64], []); 107 var kSig_v_d = makeSig([kAstF64], []);
108 var kSig_v_dd = makeSig([kAstF64, kAstF64], []); 108 var kSig_v_dd = makeSig([kAstF64, kAstF64], []);
109 var kSig_v_ddi = makeSig([kAstF64, kAstF64, kAstI32], []);
109 110
110 function makeSig(params, results) { 111 function makeSig(params, results) {
111 return {params: params, results: results}; 112 return {params: params, results: results};
112 } 113 }
113 114
114 function makeSig_v_x(x) { 115 function makeSig_v_x(x) {
115 return makeSig([x], []); 116 return makeSig([x], []);
116 } 117 }
117 118
118 function makeSig_v_xx(x) { 119 function makeSig_v_xx(x) {
(...skipping 17 matching lines...) Expand all
136 var kExprBlock = 0x01; 137 var kExprBlock = 0x01;
137 var kExprLoop = 0x02; 138 var kExprLoop = 0x02;
138 var kExprIf = 0x03; 139 var kExprIf = 0x03;
139 var kExprElse = 0x04; 140 var kExprElse = 0x04;
140 var kExprSelect = 0x05; 141 var kExprSelect = 0x05;
141 var kExprBr = 0x06; 142 var kExprBr = 0x06;
142 var kExprBrIf = 0x07; 143 var kExprBrIf = 0x07;
143 var kExprBrTable = 0x08; 144 var kExprBrTable = 0x08;
144 var kExprReturn = 0x09; 145 var kExprReturn = 0x09;
145 var kExprUnreachable = 0x0a; 146 var kExprUnreachable = 0x0a;
147 var kExprThrow = 0xfa;
146 var kExprEnd = 0x0f; 148 var kExprEnd = 0x0f;
147 149
148 var kExprI32Const = 0x10; 150 var kExprI32Const = 0x10;
149 var kExprI64Const = 0x11; 151 var kExprI64Const = 0x11;
150 var kExprF64Const = 0x12; 152 var kExprF64Const = 0x12;
151 var kExprF32Const = 0x13; 153 var kExprF32Const = 0x13;
152 var kExprGetLocal = 0x14; 154 var kExprGetLocal = 0x14;
153 var kExprSetLocal = 0x15; 155 var kExprSetLocal = 0x15;
154 var kExprCallFunction = 0x16; 156 var kExprCallFunction = 0x16;
155 var kExprCallIndirect = 0x17; 157 var kExprCallIndirect = 0x17;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 343 }
342 threwException = false; 344 threwException = false;
343 } catch (e) { 345 } catch (e) {
344 assertEquals("object", typeof e); 346 assertEquals("object", typeof e);
345 assertEquals(kTrapMsgs[trap], e.message); 347 assertEquals(kTrapMsgs[trap], e.message);
346 // Success. 348 // Success.
347 return; 349 return;
348 } 350 }
349 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 351 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
350 } 352 }
353
354 function assertWasmThrows(value, code) {
355 assertEquals("number", typeof(value));
356 try {
357 if (typeof code === 'function') {
358 code();
359 } else {
360 eval(code);
361 }
362 } catch (e) {
363 assertEquals("number", typeof e);
364 assertEquals(value, e);
365 // Success.
366 return;
367 }
368 throw new MjsUnitAssertionError("Did not throw at all, expected: " + value);
369 }
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/exceptions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698