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 (function (global, utils) { | 5 (function (global, utils) { |
6 "use strict"; | 6 "use strict"; |
7 | 7 |
8 // ---------------------------------------------------------------------------- | 8 // ---------------------------------------------------------------------------- |
9 // Imports | 9 // Imports |
10 | 10 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 this.column_ = opt_column; | 247 this.column_ = opt_column; |
248 this.groupId_ = opt_groupId; | 248 this.groupId_ = opt_groupId; |
249 this.position_alignment_ = IS_UNDEFINED(opt_position_alignment) | 249 this.position_alignment_ = IS_UNDEFINED(opt_position_alignment) |
250 ? Debug.BreakPositionAlignment.Statement : opt_position_alignment; | 250 ? Debug.BreakPositionAlignment.Statement : opt_position_alignment; |
251 this.active_ = true; | 251 this.active_ = true; |
252 this.condition_ = null; | 252 this.condition_ = null; |
253 this.break_points_ = []; | 253 this.break_points_ = []; |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 // Creates a clone of script breakpoint that is linked to another script. | |
258 ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) { | |
259 var copy = new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, | |
260 other_script.id, this.line_, this.column_, this.groupId_, | |
261 this.position_alignment_); | |
262 copy.number_ = next_break_point_number++; | |
263 script_break_points.push(copy); | |
264 | |
265 copy.active_ = this.active_; | |
266 copy.condition_ = this.condition_; | |
267 return copy; | |
268 }; | |
269 | |
270 | |
271 ScriptBreakPoint.prototype.number = function() { | 257 ScriptBreakPoint.prototype.number = function() { |
272 return this.number_; | 258 return this.number_; |
273 }; | 259 }; |
274 | 260 |
275 | 261 |
276 ScriptBreakPoint.prototype.groupId = function() { | 262 ScriptBreakPoint.prototype.groupId = function() { |
277 return this.groupId_; | 263 return this.groupId_; |
278 }; | 264 }; |
279 | 265 |
280 | 266 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 %ClearBreakPoint(break_points[i]); | 412 %ClearBreakPoint(break_points[i]); |
427 } else { | 413 } else { |
428 remaining_break_points.push(break_points[i]); | 414 remaining_break_points.push(break_points[i]); |
429 } | 415 } |
430 } | 416 } |
431 break_points = remaining_break_points; | 417 break_points = remaining_break_points; |
432 this.break_points_ = []; | 418 this.break_points_ = []; |
433 }; | 419 }; |
434 | 420 |
435 | 421 |
436 // Function called from runtime when a new script is compiled to set any script | |
437 // break points set in this script. | |
438 function UpdateScriptBreakPoints(script) { | |
439 for (var i = 0; i < script_break_points.length; i++) { | |
440 var break_point = script_break_points[i]; | |
441 if ((break_point.type() == Debug.ScriptBreakPointType.ScriptName || | |
442 break_point.type() == Debug.ScriptBreakPointType.ScriptRegExp) && | |
443 break_point.matchesScript(script)) { | |
444 break_point.set(script); | |
445 } | |
446 } | |
447 } | |
448 | |
449 | |
450 function GetScriptBreakPoints(script) { | |
451 var result = []; | |
452 for (var i = 0; i < script_break_points.length; i++) { | |
453 if (script_break_points[i].matchesScript(script)) { | |
454 result.push(script_break_points[i]); | |
455 } | |
456 } | |
457 return result; | |
458 } | |
459 | |
460 | |
461 Debug.setListener = function(listener, opt_data) { | 422 Debug.setListener = function(listener, opt_data) { |
462 if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) { | 423 if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) { |
463 throw %make_type_error(kDebuggerType); | 424 throw %make_type_error(kDebuggerType); |
464 } | 425 } |
465 %SetDebugEventListener(listener, opt_data); | 426 %SetDebugEventListener(listener, opt_data); |
466 }; | 427 }; |
467 | 428 |
468 | 429 |
469 // Returns a Script object. If the parameter is a function the return value | 430 // Returns a Script object. If the parameter is a function the return value |
470 // is the script in which the function is defined. If the parameter is a string | 431 // is the script in which the function is defined. If the parameter is a string |
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 ]); | 2416 ]); |
2456 | 2417 |
2457 // Functions needed by the debugger runtime. | 2418 // Functions needed by the debugger runtime. |
2458 utils.InstallFunctions(utils, DONT_ENUM, [ | 2419 utils.InstallFunctions(utils, DONT_ENUM, [ |
2459 "MakeExecutionState", MakeExecutionState, | 2420 "MakeExecutionState", MakeExecutionState, |
2460 "MakeExceptionEvent", MakeExceptionEvent, | 2421 "MakeExceptionEvent", MakeExceptionEvent, |
2461 "MakeBreakEvent", MakeBreakEvent, | 2422 "MakeBreakEvent", MakeBreakEvent, |
2462 "MakeCompileEvent", MakeCompileEvent, | 2423 "MakeCompileEvent", MakeCompileEvent, |
2463 "MakeAsyncTaskEvent", MakeAsyncTaskEvent, | 2424 "MakeAsyncTaskEvent", MakeAsyncTaskEvent, |
2464 "IsBreakPointTriggered", IsBreakPointTriggered, | 2425 "IsBreakPointTriggered", IsBreakPointTriggered, |
2465 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, | |
2466 ]); | 2426 ]); |
2467 | 2427 |
2468 // Export to liveedit.js | |
2469 utils.Export(function(to) { | |
2470 to.GetScriptBreakPoints = GetScriptBreakPoints; | |
2471 }); | |
2472 | |
2473 }) | 2428 }) |
OLD | NEW |