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 PromiseEvent: 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1241 if (!IS_UNDEFINED(script.data())) { | 1242 if (!IS_UNDEFINED(script.data())) { |
1242 o.data = script.data(); | 1243 o.data = script.data(); |
1243 } | 1244 } |
1244 if (include_source) { | 1245 if (include_source) { |
1245 o.source = script.source(); | 1246 o.source = script.source(); |
1246 } | 1247 } |
1247 return o; | 1248 return o; |
1248 } | 1249 } |
1249 | 1250 |
1250 | 1251 |
1252 function MakePromiseEvent(event_data) { | |
1253 if (event_data.type = "new Promise") { | |
1254 return new NewPromiseEvent(event_data); | |
1255 } | |
1256 } | |
1257 | |
1258 | |
1259 function PromiseGetter() { | |
1260 return MakeMirror(this.promise_); | |
1261 } | |
1262 | |
1263 | |
1264 function NewPromiseEvent(event_data) { | |
1265 this.resolver_ = event_data.resolver; | |
1266 this.promise_ = event_data.promise; | |
1267 } | |
1268 | |
1269 | |
1270 NewPromiseEvent.prototype.promise = PromiseGetter; | |
aandrey
2014/06/29 12:16:00
inline PromiseGetter?
Yang
2014/06/30 11:11:59
I'm going to introduce other PromiseEvent types, w
| |
1271 | |
1272 | |
1273 NewPromiseEvent.prototype.resolver = function() { | |
1274 return MakeMirror(this.resolver_); | |
1275 } | |
1276 | |
1277 | |
1251 function DebugCommandProcessor(exec_state, opt_is_running) { | 1278 function DebugCommandProcessor(exec_state, opt_is_running) { |
1252 this.exec_state_ = exec_state; | 1279 this.exec_state_ = exec_state; |
1253 this.running_ = opt_is_running || false; | 1280 this.running_ = opt_is_running || false; |
1254 } | 1281 } |
1255 | 1282 |
1256 | 1283 |
1257 DebugCommandProcessor.prototype.processDebugRequest = function (request) { | 1284 DebugCommandProcessor.prototype.processDebugRequest = function (request) { |
1258 return this.processDebugJSONRequest(request); | 1285 return this.processDebugJSONRequest(request); |
1259 }; | 1286 }; |
1260 | 1287 |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2562 | 2589 |
2563 default: | 2590 default: |
2564 json = null; | 2591 json = null; |
2565 } | 2592 } |
2566 return json; | 2593 return json; |
2567 } | 2594 } |
2568 | 2595 |
2569 Debug.TestApi = { | 2596 Debug.TestApi = { |
2570 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2597 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
2571 }; | 2598 }; |
OLD | NEW |