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

Side by Side Diff: test/mjsunit/wasm/asm-wasm-stack.js

Issue 2448833004: [wasm] Fix binary search for asm.js offsets (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/wasm/wasm-debug.cc ('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 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: --validate-asm --allow-natives-syntax 5 // Flags: --validate-asm --allow-natives-syntax
6 6
7 var filename = '(?:[^ ]+/)?test/mjsunit/wasm/asm-wasm-stack.js'; 7 var filename = '(?:[^ ]+/)?test/mjsunit/wasm/asm-wasm-stack.js';
8 filename = filename.replace(/\//g, '[/\\\\]'); 8 filename = filename.replace(/\//g, '[/\\\\]');
9 9
10 function checkPreformattedStack(e, expected_lines) { 10 function checkPreformattedStack(e, expected_lines) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 function throwException() { 42 function throwException() {
43 throw new Error('exception from JS'); 43 throw new Error('exception from JS');
44 } 44 }
45 45
46 function generateWasmFromAsmJs(stdlib, foreign, heap) { 46 function generateWasmFromAsmJs(stdlib, foreign, heap) {
47 'use asm'; 47 'use asm';
48 var throwFunc = foreign.throwFunc; 48 var throwFunc = foreign.throwFunc;
49 function callThrow() { 49 function callThrow() {
50 throwFunc(); 50 throwFunc();
51 } 51 }
52 function redirectFun() { 52 function redirectFun(i) {
53 callThrow(); 53 i = i|0;
54 switch (i|0) {
55 case 0: callThrow(); break;
56 case 1: redirectFun(0); break;
57 case 2: redirectFun(1); break;
58 }
54 } 59 }
55 return redirectFun; 60 return redirectFun;
56 } 61 }
57 62
58 (function PreformattedStackTraceFromJS() { 63 (function PreformattedStackTraceFromJS() {
59 var fun = generateWasmFromAsmJs(this, {throwFunc: throwException}, undefined); 64 var fun = generateWasmFromAsmJs(this, {throwFunc: throwException}, undefined);
60 var e = null; 65 var e = null;
61 try { 66 try {
62 fun(); 67 fun(0);
63 } catch (ex) { 68 } catch (ex) {
64 e = ex; 69 e = ex;
65 } 70 }
66 assertInstanceof(e, Error, 'exception should have been thrown'); 71 assertInstanceof(e, Error, 'exception should have been thrown');
67 checkPreformattedStack(e, [ 72 checkPreformattedStack(e, [
68 '^Error: exception from JS$', 73 '^Error: exception from JS$',
69 '^ *at throwException \\(' + filename + ':43:9\\)$', 74 '^ *at throwException \\(' + filename + ':43:9\\)$',
70 '^ *at callThrow \\(' + filename + ':50:5\\)$', 75 '^ *at callThrow \\(' + filename + ':50:5\\)$',
71 '^ *at redirectFun \\(' + filename + ':53:5\\)$', 76 '^ *at redirectFun \\(' + filename + ':55:15\\)$',
72 '^ *at PreformattedStackTraceFromJS \\(' + filename + ':62:5\\)$', 77 '^ *at PreformattedStackTraceFromJS \\(' + filename + ':67:5\\)$',
73 '^ *at ' + filename + ':75:3$' 78 '^ *at ' + filename + ':80:3$'
74 ]); 79 ]);
75 })(); 80 })();
76 81
77 // Now collect the Callsite objects instead of just a string. 82 // Now collect the Callsite objects instead of just a string.
78 Error.prepareStackTrace = function(error, frames) { 83 Error.prepareStackTrace = function(error, frames) {
79 return frames; 84 return frames;
80 }; 85 };
81 86
82 (function CallsiteObjectsFromJS() { 87 (function CallsiteObjectsFromJS() {
83 var fun = generateWasmFromAsmJs(this, {throwFunc: throwException}, undefined); 88 var fun = generateWasmFromAsmJs(this, {throwFunc: throwException}, undefined);
84 var e = null; 89 var e = null;
85 try { 90 try {
86 fun(); 91 fun(2);
87 } catch (ex) { 92 } catch (ex) {
88 e = ex; 93 e = ex;
89 } 94 }
90 assertInstanceof(e, Error, 'exception should have been thrown'); 95 assertInstanceof(e, Error, 'exception should have been thrown');
91 checkFunctionsOnCallsites(e, [ 96 checkFunctionsOnCallsites(e, [
92 ['throwException', 43, 9], // -- 97 ['throwException', 43, 9], // --
93 ['callThrow', 50, 5], // -- 98 ['callThrow', 50, 5], // --
94 ['redirectFun', 53, 5], // -- 99 ['redirectFun', 55, 15], // --
95 ['CallsiteObjectsFromJS', 86, 5], // -- 100 ['redirectFun', 56, 15], // --
96 [null, 98, 3] 101 ['redirectFun', 57, 15], // --
102 ['CallsiteObjectsFromJS', 91, 5], // --
103 [null, 105, 3]
97 ]); 104 ]);
98 })(); 105 })();
OLDNEW
« no previous file with comments | « src/wasm/wasm-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698