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

Side by Side Diff: test/mjsunit/wasm/function-names.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/frame-inspection.js ('k') | test/mjsunit/wasm/gc-frame.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 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 builder = new WasmModuleBuilder(); 10 var builder = new WasmModuleBuilder();
11 11
12 var last_func_index = builder.addFunction("exec_unreachable", kSig_v_v) 12 var last_func_index = builder.addFunction("exec_unreachable", kSig_v_v)
13 .addBody([kExprUnreachable]) 13 .addBody([kExprUnreachable])
14 14
15 var illegal_func_name = [0xff]; 15 var illegal_func_name = [0xff];
16 var func_names = [ "☠", illegal_func_name, "some math: (½)² = ¼", "" ]; 16 var func_names = [ "☠", illegal_func_name, "some math: (½)² = ¼", "" ];
17 var expected_names = ["exec_unreachable", "☠", null, 17 var expected_names = ["exec_unreachable", "☠", null,
18 "some math: (½)² = ¼", "", "main"]; 18 "some math: (½)² = ¼", "", "main"];
19 19
20 for (var func_name of func_names) { 20 for (var func_name of func_names) {
21 last_func_index = builder.addFunction(func_name, kSig_v_v) 21 last_func_index = builder.addFunction(func_name, kSig_v_v)
22 .addBody([kExprCallFunction, last_func_index]).index; 22 .addBody([kExprCallFunction, kArity0, last_func_index]).index;
23 } 23 }
24 24
25 builder.addFunction("main", kSig_v_v) 25 builder.addFunction("main", kSig_v_v)
26 .addBody([kExprCallFunction, last_func_index]) 26 .addBody([kExprCallFunction, kArity0, last_func_index])
27 .exportFunc(); 27 .exportFunc();
28 28
29 var module = builder.instantiate(); 29 var module = builder.instantiate();
30 30
31 (function testFunctionNamesAsString() { 31 (function testFunctionNamesAsString() {
32 var names = expected_names.concat(["testFunctionNamesAsString", null]); 32 var names = expected_names.concat(["testFunctionNamesAsString", null]);
33 try { 33 try {
34 module.exports.main(); 34 module.exports.main();
35 assertFalse("should throw"); 35 assertFalse("should throw");
36 } catch (e) { 36 } catch (e) {
(...skipping 23 matching lines...) Expand all
60 try { 60 try {
61 module.exports.main(); 61 module.exports.main();
62 assertFalse("should throw"); 62 assertFalse("should throw");
63 } catch (e) { 63 } catch (e) {
64 assertEquals(names.length, e.stack.length); 64 assertEquals(names.length, e.stack.length);
65 for (var i = 0; i < names.length; ++i) { 65 for (var i = 0; i < names.length; ++i) {
66 assertEquals(names[i], e.stack[i].getFunctionName()); 66 assertEquals(names[i], e.stack[i].getFunctionName());
67 } 67 }
68 } 68 }
69 })(); 69 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/frame-inspection.js ('k') | test/mjsunit/wasm/gc-frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698