| 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 "use strict"; | 4 "use strict"; | 
| 5 | 5 | 
| 6 // Default number of frames to include in the response to backtrace request. | 6 // Default number of frames to include in the response to backtrace request. | 
| 7 var kDefaultBacktraceLength = 10; | 7 var kDefaultBacktraceLength = 10; | 
| 8 | 8 | 
| 9 var Debug = {}; | 9 var Debug = {}; | 
| 10 | 10 | 
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 257   this.position_alignment_ = IS_UNDEFINED(opt_position_alignment) | 257   this.position_alignment_ = IS_UNDEFINED(opt_position_alignment) | 
| 258       ? Debug.BreakPositionAlignment.Statement : opt_position_alignment; | 258       ? Debug.BreakPositionAlignment.Statement : opt_position_alignment; | 
| 259   this.hit_count_ = 0; | 259   this.hit_count_ = 0; | 
| 260   this.active_ = true; | 260   this.active_ = true; | 
| 261   this.condition_ = null; | 261   this.condition_ = null; | 
| 262   this.ignoreCount_ = 0; | 262   this.ignoreCount_ = 0; | 
| 263   this.break_points_ = []; | 263   this.break_points_ = []; | 
| 264 } | 264 } | 
| 265 | 265 | 
| 266 | 266 | 
| 267 //Creates a clone of script breakpoint that is linked to another script. | 267 // Creates a clone of script breakpoint that is linked to another script. | 
| 268 ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) { | 268 ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) { | 
| 269   var copy = new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, | 269   var copy = new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, | 
| 270       other_script.id, this.line_, this.column_, this.groupId_, | 270       other_script.id, this.line_, this.column_, this.groupId_, | 
| 271       this.position_alignment_); | 271       this.position_alignment_); | 
| 272   copy.number_ = next_break_point_number++; | 272   copy.number_ = next_break_point_number++; | 
| 273   script_break_points.push(copy); | 273   script_break_points.push(copy); | 
| 274 | 274 | 
| 275   copy.hit_count_ = this.hit_count_; | 275   copy.hit_count_ = this.hit_count_; | 
| 276   copy.active_ = this.active_; | 276   copy.active_ = this.active_; | 
| 277   copy.condition_ = this.condition_; | 277   copy.condition_ = this.condition_; | 
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 492 | 492 | 
| 493 | 493 | 
| 494 Debug.setListener = function(listener, opt_data) { | 494 Debug.setListener = function(listener, opt_data) { | 
| 495   if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) { | 495   if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) { | 
| 496     throw new Error('Parameters have wrong types.'); | 496     throw new Error('Parameters have wrong types.'); | 
| 497   } | 497   } | 
| 498   %SetDebugEventListener(listener, opt_data); | 498   %SetDebugEventListener(listener, opt_data); | 
| 499 }; | 499 }; | 
| 500 | 500 | 
| 501 | 501 | 
| 502 Debug.breakExecution = function(f) { |  | 
| 503   %Break(); |  | 
| 504 }; |  | 
| 505 |  | 
| 506 Debug.breakLocations = function(f, opt_position_aligment) { | 502 Debug.breakLocations = function(f, opt_position_aligment) { | 
| 507   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 503   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 
| 508   var position_aligment = IS_UNDEFINED(opt_position_aligment) | 504   var position_aligment = IS_UNDEFINED(opt_position_aligment) | 
| 509       ? Debug.BreakPositionAlignment.Statement : opt_position_aligment; | 505       ? Debug.BreakPositionAlignment.Statement : opt_position_aligment; | 
| 510   return %GetBreakLocations(f, position_aligment); | 506   return %GetBreakLocations(f, position_aligment); | 
| 511 }; | 507 }; | 
| 512 | 508 | 
| 513 // Returns a Script object. If the parameter is a function the return value | 509 // Returns a Script object. If the parameter is a function the return value | 
| 514 // is the script in which the function is defined. If the parameter is a string | 510 // is the script in which the function is defined. If the parameter is a string | 
| 515 // the return value is the script for which the script name has that string | 511 // the return value is the script for which the script name has that string | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 545 }; | 541 }; | 
| 546 | 542 | 
| 547 // Returns the script source. If the parameter is a function the return value | 543 // Returns the script source. If the parameter is a function the return value | 
| 548 // is the script source for the script in which the function is defined. If the | 544 // is the script source for the script in which the function is defined. If the | 
| 549 // parameter is a string the return value is the script for which the script | 545 // parameter is a string the return value is the script for which the script | 
| 550 // name has that string value. | 546 // name has that string value. | 
| 551 Debug.scriptSource = function(func_or_script_name) { | 547 Debug.scriptSource = function(func_or_script_name) { | 
| 552   return this.findScript(func_or_script_name).source; | 548   return this.findScript(func_or_script_name).source; | 
| 553 }; | 549 }; | 
| 554 | 550 | 
|  | 551 | 
| 555 Debug.source = function(f) { | 552 Debug.source = function(f) { | 
| 556   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 553   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 
| 557   return %FunctionGetSourceCode(f); | 554   return %FunctionGetSourceCode(f); | 
| 558 }; | 555 }; | 
| 559 | 556 | 
| 560 Debug.disassemble = function(f) { |  | 
| 561   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); |  | 
| 562   return %DebugDisassembleFunction(f); |  | 
| 563 }; |  | 
| 564 |  | 
| 565 Debug.disassembleConstructor = function(f) { |  | 
| 566   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); |  | 
| 567   return %DebugDisassembleConstructor(f); |  | 
| 568 }; |  | 
| 569 |  | 
| 570 Debug.ExecuteInDebugContext = function(f, without_debugger) { |  | 
| 571   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); |  | 
| 572   return %ExecuteInDebugContext(f, !!without_debugger); |  | 
| 573 }; |  | 
| 574 | 557 | 
| 575 Debug.sourcePosition = function(f) { | 558 Debug.sourcePosition = function(f) { | 
| 576   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 559   if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 
| 577   return %FunctionGetScriptSourcePosition(f); | 560   return %FunctionGetScriptSourcePosition(f); | 
| 578 }; | 561 }; | 
| 579 | 562 | 
| 580 | 563 | 
| 581 Debug.findFunctionSourceLocation = function(func, opt_line, opt_column) { | 564 Debug.findFunctionSourceLocation = function(func, opt_line, opt_column) { | 
| 582   var script = %FunctionGetScript(func); | 565   var script = %FunctionGetScript(func); | 
| 583   var script_offset = %FunctionGetScriptSourcePosition(func); | 566   var script_offset = %FunctionGetScriptSourcePosition(func); | 
| (...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2577     case 'string': | 2560     case 'string': | 
| 2578     case 'number': | 2561     case 'number': | 
| 2579       json = value; | 2562       json = value; | 
| 2580       break; | 2563       break; | 
| 2581 | 2564 | 
| 2582     default: | 2565     default: | 
| 2583       json = null; | 2566       json = null; | 
| 2584   } | 2567   } | 
| 2585   return json; | 2568   return json; | 
| 2586 } | 2569 } | 
| 2587 |  | 
| 2588 Debug.TestApi = { |  | 
| 2589   CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |  | 
| 2590 }; |  | 
| OLD | NEW | 
|---|