| 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 --allow-natives-syntax | 5 // Flags: --validate-asm --allow-natives-syntax |
| 6 | 6 |
| 7 InspectorTest.log( | 7 InspectorTest.log( |
| 8 'This test runs asm.js which calls back to JS. Before executing (after ' + | 8 'This test runs asm.js which calls back to JS. Before executing (after ' + |
| 9 'the script is parsed) we set breakpoints in the asm.js code.'); | 9 'the script is parsed) we set breakpoints in the asm.js code.'); |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 var numScripts = 0; | 97 var numScripts = 0; |
| 98 | 98 |
| 99 function handleScriptParsed(messageObject) | 99 function handleScriptParsed(messageObject) |
| 100 { | 100 { |
| 101 var scriptId = messageObject.params.scriptId; | 101 var scriptId = messageObject.params.scriptId; |
| 102 ++numScripts; | 102 ++numScripts; |
| 103 InspectorTest.log('Script nr ' + numScripts + ' parsed!'); | 103 InspectorTest.log('Script nr ' + numScripts + ' parsed!'); |
| 104 if (numScripts > 1) return; | 104 if (numScripts > 1) return; |
| 105 | 105 |
| 106 var startLine = messageObject.params.startLine; | 106 var startLine = messageObject.params.startLine + 3; |
| 107 var endLine = messageObject.params.endLine; | 107 var endLine = messageObject.params.endLine; |
| 108 InspectorTest.log('First script; assuming testFunction.'); | 108 InspectorTest.log('First script; assuming testFunction.'); |
| 109 InspectorTest.log( | 109 InspectorTest.log( |
| 110 'Flooding script with breakpoints for all lines (' + startLine + ' - ' + | 110 'Flooding script with breakpoints for the lines ' + startLine + ' to ' + |
| 111 endLine + ')...'); | 111 endLine + '...'); |
| 112 var currentLine = startLine; | 112 var currentLine = startLine; |
| 113 function setNextBreakpoint(message) { | 113 function setNextBreakpoint(message) { |
| 114 if (message) InspectorTest.logMessage('error: ' + message.error); | 114 if (message) InspectorTest.logMessage('error: ' + message.error); |
| 115 if (currentLine == endLine) { | 115 if (currentLine == endLine) { |
| 116 afterScriptParsedCallback(); | 116 afterScriptParsedCallback(); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 var thisLine = currentLine; | 119 var thisLine = currentLine; |
| 120 currentLine += 1; | 120 currentLine += 1; |
| 121 InspectorTest.log('Setting breakpoint on line ' + thisLine); | 121 InspectorTest.log('Setting breakpoint on line ' + thisLine); |
| 122 Protocol.Debugger | 122 Protocol.Debugger |
| 123 .setBreakpoint( | 123 .setBreakpoint( |
| 124 {'location': {'scriptId': scriptId, 'lineNumber': thisLine}}) | 124 {'location': {'scriptId': scriptId, 'lineNumber': thisLine}}) |
| 125 .then(setNextBreakpoint); | 125 .then(setNextBreakpoint); |
| 126 } | 126 } |
| 127 setNextBreakpoint(); | 127 setNextBreakpoint(); |
| 128 } | 128 } |
| OLD | NEW |