Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // Default number of frames to include in the response to backtrace request. | 5 // Default number of frames to include in the response to backtrace request. |
| 6 var kDefaultBacktraceLength = 10; | 6 var kDefaultBacktraceLength = 10; |
| 7 | 7 |
| 8 var Debug = {}; | 8 var Debug = {}; |
| 9 | 9 |
| 10 // Regular expression to skip "crud" at the beginning of a source line which is | 10 // Regular expression to skip "crud" at the beginning of a source line which is |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 var result = []; | 479 var result = []; |
| 480 for (var i = 0; i < script_break_points.length; i++) { | 480 for (var i = 0; i < script_break_points.length; i++) { |
| 481 if (script_break_points[i].matchesScript(script)) { | 481 if (script_break_points[i].matchesScript(script)) { |
| 482 result.push(script_break_points[i]); | 482 result.push(script_break_points[i]); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 return result; | 485 return result; |
| 486 } | 486 } |
| 487 | 487 |
| 488 | 488 |
| 489 function GetLoadedScripts() { | |
| 490 ClearMirrorCache(); // The mirror cache may be holding onto scripts. | |
| 491 return %DebugGetLoadedScripts(); | |
|
yurys
2014/06/03 08:07:21
This change looks wrong to me. By design of V8 deb
Yang
2014/06/03 08:12:46
Not sure I understand. Which code path does blink
| |
| 492 } | |
| 493 | |
| 494 | |
| 489 Debug.setListener = function(listener, opt_data) { | 495 Debug.setListener = function(listener, opt_data) { |
| 490 if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) { | 496 if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) { |
| 491 throw new Error('Parameters have wrong types.'); | 497 throw new Error('Parameters have wrong types.'); |
| 492 } | 498 } |
| 493 %SetDebugEventListener(listener, opt_data); | 499 %SetDebugEventListener(listener, opt_data); |
| 494 }; | 500 }; |
| 495 | 501 |
| 496 | 502 |
| 497 Debug.breakExecution = function(f) { | 503 Debug.breakExecution = function(f) { |
| 498 %Break(); | 504 %Break(); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 pos = source.length; | 914 pos = source.length; |
| 909 result += source.substring(prev_pos, pos); | 915 result += source.substring(prev_pos, pos); |
| 910 return result; | 916 return result; |
| 911 }; | 917 }; |
| 912 | 918 |
| 913 | 919 |
| 914 // Get all the scripts currently loaded. Locating all the scripts is based on | 920 // Get all the scripts currently loaded. Locating all the scripts is based on |
| 915 // scanning the heap. | 921 // scanning the heap. |
| 916 Debug.scripts = function() { | 922 Debug.scripts = function() { |
| 917 // Collect all scripts in the heap. | 923 // Collect all scripts in the heap. |
| 918 return %DebugGetLoadedScripts(); | 924 return GetLoadedScripts(); |
| 919 }; | 925 }; |
| 920 | 926 |
| 921 | 927 |
| 922 Debug.debuggerFlags = function() { | 928 Debug.debuggerFlags = function() { |
| 923 return debugger_flags; | 929 return debugger_flags; |
| 924 }; | 930 }; |
| 925 | 931 |
| 926 Debug.MakeMirror = MakeMirror; | 932 Debug.MakeMirror = MakeMirror; |
| 927 | 933 |
| 928 function MakeExecutionState(break_id) { | 934 function MakeExecutionState(break_id) { |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2237 if (!IS_UNDEFINED(request.arguments.filter)) { | 2243 if (!IS_UNDEFINED(request.arguments.filter)) { |
| 2238 var num = %ToNumber(request.arguments.filter); | 2244 var num = %ToNumber(request.arguments.filter); |
| 2239 if (!isNaN(num)) { | 2245 if (!isNaN(num)) { |
| 2240 filterNum = num; | 2246 filterNum = num; |
| 2241 } | 2247 } |
| 2242 filterStr = request.arguments.filter; | 2248 filterStr = request.arguments.filter; |
| 2243 } | 2249 } |
| 2244 } | 2250 } |
| 2245 | 2251 |
| 2246 // Collect all scripts in the heap. | 2252 // Collect all scripts in the heap. |
| 2247 var scripts = %DebugGetLoadedScripts(); | 2253 var scripts = GetLoadedScripts(); |
| 2248 | 2254 |
| 2249 response.body = []; | 2255 response.body = []; |
| 2250 | 2256 |
| 2251 for (var i = 0; i < scripts.length; i++) { | 2257 for (var i = 0; i < scripts.length; i++) { |
| 2252 if (idsToInclude && !idsToInclude[scripts[i].id]) { | 2258 if (idsToInclude && !idsToInclude[scripts[i].id]) { |
| 2253 continue; | 2259 continue; |
| 2254 } | 2260 } |
| 2255 if (filterStr || filterNum) { | 2261 if (filterStr || filterNum) { |
| 2256 var script = scripts[i]; | 2262 var script = scripts[i]; |
| 2257 var found = false; | 2263 var found = false; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2309 | 2315 |
| 2310 | 2316 |
| 2311 DebugCommandProcessor.prototype.changeLiveRequest_ = function( | 2317 DebugCommandProcessor.prototype.changeLiveRequest_ = function( |
| 2312 request, response) { | 2318 request, response) { |
| 2313 if (!request.arguments) { | 2319 if (!request.arguments) { |
| 2314 return response.failed('Missing arguments'); | 2320 return response.failed('Missing arguments'); |
| 2315 } | 2321 } |
| 2316 var script_id = request.arguments.script_id; | 2322 var script_id = request.arguments.script_id; |
| 2317 var preview_only = !!request.arguments.preview_only; | 2323 var preview_only = !!request.arguments.preview_only; |
| 2318 | 2324 |
| 2319 var scripts = %DebugGetLoadedScripts(); | 2325 var scripts = GetLoadedScripts(); |
| 2320 | 2326 |
| 2321 var the_script = null; | 2327 var the_script = null; |
| 2322 for (var i = 0; i < scripts.length; i++) { | 2328 for (var i = 0; i < scripts.length; i++) { |
| 2323 if (scripts[i].id == script_id) { | 2329 if (scripts[i].id == script_id) { |
| 2324 the_script = scripts[i]; | 2330 the_script = scripts[i]; |
| 2325 } | 2331 } |
| 2326 } | 2332 } |
| 2327 if (!the_script) { | 2333 if (!the_script) { |
| 2328 response.failed('Script not found'); | 2334 response.failed('Script not found'); |
| 2329 return; | 2335 return; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2562 | 2568 |
| 2563 default: | 2569 default: |
| 2564 json = null; | 2570 json = null; |
| 2565 } | 2571 } |
| 2566 return json; | 2572 return json; |
| 2567 } | 2573 } |
| 2568 | 2574 |
| 2569 Debug.TestApi = { | 2575 Debug.TestApi = { |
| 2570 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2576 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
| 2571 }; | 2577 }; |
| OLD | NEW |