| 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 | 
| 11 // not really code. Currently the regular expression matches whitespace and | 11 // not really code. Currently the regular expression matches whitespace and | 
| 12 // comments. | 12 // comments. | 
| 13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; | 13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; | 
| 14 | 14 | 
| 15 // Debug events which can occour in the V8 JavaScript engine. These originate | 15 // Debug events which can occour in the V8 JavaScript engine. These originate | 
| 16 // from the API include file debug.h. | 16 // from the API include file debug.h. | 
| 17 Debug.DebugEvent = { Break: 1, | 17 Debug.DebugEvent = { Break: 1, | 
| 18                      Exception: 2, | 18                      Exception: 2, | 
| 19                      NewFunction: 3, | 19                      NewFunction: 3, | 
| 20                      BeforeCompile: 4, | 20                      BeforeCompile: 4, | 
| 21                      AfterCompile: 5, | 21                      AfterCompile: 5, | 
| 22                      ScriptCollected: 6 }; | 22                      ScriptCollected: 6, | 
|  | 23                      CompileError: 7 }; | 
| 23 | 24 | 
| 24 // Types of exceptions that can be broken upon. | 25 // Types of exceptions that can be broken upon. | 
| 25 Debug.ExceptionBreak = { Caught : 0, | 26 Debug.ExceptionBreak = { Caught : 0, | 
| 26                          Uncaught: 1 }; | 27                          Uncaught: 1 }; | 
| 27 | 28 | 
| 28 // The different types of steps. | 29 // The different types of steps. | 
| 29 Debug.StepAction = { StepOut: 0, | 30 Debug.StepAction = { StepOut: 0, | 
| 30                      StepNext: 1, | 31                      StepNext: 1, | 
| 31                      StepIn: 2, | 32                      StepIn: 2, | 
| 32                      StepMin: 3, | 33                      StepMin: 3, | 
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1136       o.body.script = MakeScriptObject_(script, false); | 1137       o.body.script = MakeScriptObject_(script, false); | 
| 1137     } | 1138     } | 
| 1138   } else { | 1139   } else { | 
| 1139     o.body.sourceLine = -1; | 1140     o.body.sourceLine = -1; | 
| 1140   } | 1141   } | 
| 1141 | 1142 | 
| 1142   return o.toJSONProtocol(); | 1143   return o.toJSONProtocol(); | 
| 1143 }; | 1144 }; | 
| 1144 | 1145 | 
| 1145 | 1146 | 
| 1146 function MakeCompileEvent(script, before) { | 1147 function MakeCompileEvent(script, type) { | 
| 1147   return new CompileEvent(script, before); | 1148   return new CompileEvent(script, type); | 
| 1148 } | 1149 } | 
| 1149 | 1150 | 
| 1150 | 1151 | 
| 1151 function CompileEvent(script, before) { | 1152 function CompileEvent(script, type) { | 
| 1152   this.script_ = MakeMirror(script); | 1153   this.script_ = MakeMirror(script); | 
| 1153   this.before_ = before; | 1154   this.type_ = type; | 
| 1154 } | 1155 } | 
| 1155 | 1156 | 
| 1156 | 1157 | 
| 1157 CompileEvent.prototype.eventType = function() { | 1158 CompileEvent.prototype.eventType = function() { | 
| 1158   if (this.before_) { | 1159   return this.type_; | 
| 1159     return Debug.DebugEvent.BeforeCompile; |  | 
| 1160   } else { |  | 
| 1161     return Debug.DebugEvent.AfterCompile; |  | 
| 1162   } |  | 
| 1163 }; | 1160 }; | 
| 1164 | 1161 | 
| 1165 | 1162 | 
| 1166 CompileEvent.prototype.script = function() { | 1163 CompileEvent.prototype.script = function() { | 
| 1167   return this.script_; | 1164   return this.script_; | 
| 1168 }; | 1165 }; | 
| 1169 | 1166 | 
| 1170 | 1167 | 
| 1171 CompileEvent.prototype.toJSONProtocol = function() { | 1168 CompileEvent.prototype.toJSONProtocol = function() { | 
| 1172   var o = new ProtocolMessage(); | 1169   var o = new ProtocolMessage(); | 
| 1173   o.running = true; | 1170   o.running = true; | 
| 1174   if (this.before_) { | 1171   switch (this.type_) { | 
| 1175     o.event = "beforeCompile"; | 1172     case Debug.DebugEvent.BeforeCompile: | 
| 1176   } else { | 1173       o.event = "beforeCompile"; | 
| 1177     o.event = "afterCompile"; | 1174     case Debug.DebugEvent.AfterCompile: | 
|  | 1175       o.event = "afterCompile"; | 
|  | 1176     case Debug.DebugEvent.CompileError: | 
|  | 1177       o.event = "compileError"; | 
| 1178   } | 1178   } | 
| 1179   o.body = {}; | 1179   o.body = {}; | 
| 1180   o.body.script = this.script_; | 1180   o.body.script = this.script_; | 
| 1181 | 1181 | 
| 1182   return o.toJSONProtocol(); | 1182   return o.toJSONProtocol(); | 
| 1183 }; | 1183 }; | 
| 1184 | 1184 | 
| 1185 | 1185 | 
| 1186 function MakeScriptCollectedEvent(id) { | 1186 function MakeScriptCollectedEvent(id) { | 
| 1187   return new ScriptCollectedEvent(id); | 1187   return new ScriptCollectedEvent(id); | 
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2539 | 2539 | 
| 2540     default: | 2540     default: | 
| 2541       json = null; | 2541       json = null; | 
| 2542   } | 2542   } | 
| 2543   return json; | 2543   return json; | 
| 2544 } | 2544 } | 
| 2545 | 2545 | 
| 2546 Debug.TestApi = { | 2546 Debug.TestApi = { | 
| 2547   CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2547   CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 
| 2548 }; | 2548 }; | 
| OLD | NEW | 
|---|