| OLD | NEW |
| 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 | 5 // Flags: --validate-asm |
| 6 | 6 |
| 7 let {session, contextGroup, Protocol} = InspectorTest.start('Tests that asm-js s
cripts produce correct stack'); |
| 8 |
| 7 function testFunction() { | 9 function testFunction() { |
| 8 function generateAsmJs(stdlib, foreign, heap) { | 10 function generateAsmJs(stdlib, foreign, heap) { |
| 9 'use asm'; | 11 'use asm'; |
| 10 var debugger_fun = foreign.call_debugger; | 12 var debugger_fun = foreign.call_debugger; |
| 11 function callDebugger() { | 13 function callDebugger() { |
| 12 debugger_fun(); | 14 debugger_fun(); |
| 13 } | 15 } |
| 14 function redirectFun() { | 16 function redirectFun() { |
| 15 callDebugger(); | 17 callDebugger(); |
| 16 } | 18 } |
| 17 return redirectFun; | 19 return redirectFun; |
| 18 } | 20 } |
| 19 | 21 |
| 20 function call_debugger() { | 22 function call_debugger() { |
| 21 debugger; | 23 debugger; |
| 22 } | 24 } |
| 23 | 25 |
| 24 var fun = generateAsmJs(this, {'call_debugger': call_debugger}, undefined); | 26 var fun = generateAsmJs(this, {'call_debugger': call_debugger}, undefined); |
| 25 fun(); | 27 fun(); |
| 26 } | 28 } |
| 27 | 29 |
| 28 InspectorTest.addScript(testFunction.toString()); | 30 contextGroup.addScript(testFunction.toString()); |
| 29 | 31 |
| 30 Protocol.Debugger.enable(); | 32 Protocol.Debugger.enable(); |
| 31 Protocol.Debugger.oncePaused().then(handleDebuggerPaused); | 33 Protocol.Debugger.oncePaused().then(handleDebuggerPaused); |
| 32 Protocol.Runtime.evaluate({'expression': 'testFunction()'}); | 34 Protocol.Runtime.evaluate({'expression': 'testFunction()'}); |
| 33 | 35 |
| 34 function locationToString(callFrame) { | 36 function locationToString(callFrame) { |
| 35 var res = {functionName: callFrame.functionName}; | 37 var res = {functionName: callFrame.functionName}; |
| 36 for (var attr in callFrame.functionLocation) { | 38 for (var attr in callFrame.functionLocation) { |
| 37 if (attr == 'scriptId') continue; | 39 if (attr == 'scriptId') continue; |
| 38 res['function_'+attr] = callFrame.functionLocation[attr]; | 40 res['function_'+attr] = callFrame.functionLocation[attr]; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 { | 72 { |
| 71 InspectorTest.log( | 73 InspectorTest.log( |
| 72 'Result of evaluate (' + response.result.result.type + '):'); | 74 'Result of evaluate (' + response.result.result.type + '):'); |
| 73 var result_lines = response.result.result.value.split("\n"); | 75 var result_lines = response.result.result.value.split("\n"); |
| 74 // Skip the second line, containing the 'evaluate' position. | 76 // Skip the second line, containing the 'evaluate' position. |
| 75 result_lines[1] = " -- skipped --"; | 77 result_lines[1] = " -- skipped --"; |
| 76 InspectorTest.log(result_lines.join('\n')); | 78 InspectorTest.log(result_lines.join('\n')); |
| 77 InspectorTest.log('Finished!'); | 79 InspectorTest.log('Finished!'); |
| 78 InspectorTest.completeTest(); | 80 InspectorTest.completeTest(); |
| 79 } | 81 } |
| OLD | NEW |