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

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

Issue 1874383002: [wasm] Throw real Error on wasm trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@trapreasons-to-messages
Patch Set: remove a TODO Created 4 years, 8 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/unreachable.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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 function assertTraps(trap, code) { 283 function assertTraps(trap, code) {
284 var threwException = true; 284 var threwException = true;
285 try { 285 try {
286 if (typeof code === 'function') { 286 if (typeof code === 'function') {
287 code(); 287 code();
288 } else { 288 } else {
289 eval(code); 289 eval(code);
290 } 290 }
291 threwException = false; 291 threwException = false;
292 } catch (e) { 292 } catch (e) {
293 assertEquals("string", typeof e); 293 assertEquals("object", typeof e);
294 assertEquals(kTrapMsgs[trap], e); 294 assertEquals(kTrapMsgs[trap], e.message);
295 // Success. 295 // Success.
296 return; 296 return;
297 } 297 }
298 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 298 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
299 } 299 }
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/unreachable.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698