OLD | NEW |
1 // Copyright 2006-2012 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 |
11 var GlobalArray = global.Array; | 11 var GlobalArray = global.Array; |
12 var IsNaN = global.isNaN; | 12 var IsNaN = global.isNaN; |
13 var JSONStringify = global.JSON.stringify; | 13 var JSONStringify = global.JSON.stringify; |
14 var MakeError; | |
15 var MapEntries; | 14 var MapEntries; |
16 var MapIteratorNext; | 15 var MapIteratorNext; |
17 var promiseStateSymbol = utils.ImportNow("promise_state_symbol"); | 16 var promiseStateSymbol = utils.ImportNow("promise_state_symbol"); |
18 var promiseResultSymbol = utils.ImportNow("promise_result_symbol"); | 17 var promiseResultSymbol = utils.ImportNow("promise_result_symbol"); |
19 var SetIteratorNext; | 18 var SetIteratorNext; |
20 var SetValues; | 19 var SetValues; |
21 | 20 |
22 utils.Import(function(from) { | 21 utils.Import(function(from) { |
23 MakeError = from.MakeError; | |
24 MapEntries = from.MapEntries; | 22 MapEntries = from.MapEntries; |
25 MapIteratorNext = from.MapIteratorNext; | 23 MapIteratorNext = from.MapIteratorNext; |
26 SetIteratorNext = from.SetIteratorNext; | 24 SetIteratorNext = from.SetIteratorNext; |
27 SetValues = from.SetValues; | 25 SetValues = from.SetValues; |
28 }); | 26 }); |
29 | 27 |
30 // ---------------------------------------------------------------------------- | 28 // ---------------------------------------------------------------------------- |
31 | 29 |
32 // Mirror hierarchy: | 30 // Mirror hierarchy: |
33 // - Mirror | 31 // - Mirror |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 183 |
186 /** | 184 /** |
187 * Returns the mirror for a specified mirror handle. | 185 * Returns the mirror for a specified mirror handle. |
188 * | 186 * |
189 * @param {number} handle the handle to find the mirror for | 187 * @param {number} handle the handle to find the mirror for |
190 * @returns {Mirror or undefiend} the mirror with the requested handle or | 188 * @returns {Mirror or undefiend} the mirror with the requested handle or |
191 * undefined if no mirror with the requested handle was found | 189 * undefined if no mirror with the requested handle was found |
192 */ | 190 */ |
193 function LookupMirror(handle) { | 191 function LookupMirror(handle) { |
194 if (!mirror_cache_enabled_) { | 192 if (!mirror_cache_enabled_) { |
195 throw MakeError(kDebugger, "Mirror cache is disabled"); | 193 throw %make_error(kDebugger, "Mirror cache is disabled"); |
196 } | 194 } |
197 return mirror_cache_[handle]; | 195 return mirror_cache_[handle]; |
198 } | 196 } |
199 | 197 |
200 | 198 |
201 /** | 199 /** |
202 * Returns the mirror for the undefined value. | 200 * Returns the mirror for the undefined value. |
203 * | 201 * |
204 * @returns {Mirror} the mirror reflects the undefined value | 202 * @returns {Mirror} the mirror reflects the undefined value |
205 */ | 203 */ |
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) { | 2232 ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) { |
2235 var raw_res; | 2233 var raw_res; |
2236 if (!IS_UNDEFINED(this.break_id_)) { | 2234 if (!IS_UNDEFINED(this.break_id_)) { |
2237 %CheckExecutionState(this.break_id_); | 2235 %CheckExecutionState(this.break_id_); |
2238 raw_res = %SetScopeVariableValue(this.break_id_, this.frame_id_, | 2236 raw_res = %SetScopeVariableValue(this.break_id_, this.frame_id_, |
2239 this.inlined_frame_id_, this.index_, name, new_value); | 2237 this.inlined_frame_id_, this.index_, name, new_value); |
2240 } else { | 2238 } else { |
2241 raw_res = %SetScopeVariableValue(this.fun_value_, null, null, this.index_, | 2239 raw_res = %SetScopeVariableValue(this.fun_value_, null, null, this.index_, |
2242 name, new_value); | 2240 name, new_value); |
2243 } | 2241 } |
2244 if (!raw_res) throw MakeError(kDebugger, "Failed to set variable value"); | 2242 if (!raw_res) throw %make_error(kDebugger, "Failed to set variable value"); |
2245 }; | 2243 }; |
2246 | 2244 |
2247 | 2245 |
2248 /** | 2246 /** |
2249 * Mirror object for scope of frame or function. Either frame or function must | 2247 * Mirror object for scope of frame or function. Either frame or function must |
2250 * be specified. | 2248 * be specified. |
2251 * @param {FrameMirror} frame The frame this scope is a part of | 2249 * @param {FrameMirror} frame The frame this scope is a part of |
2252 * @param {FunctionMirror} function The function this scope is a part of | 2250 * @param {FunctionMirror} function The function this scope is a part of |
2253 * @param {number} index The scope index in the frame | 2251 * @param {number} index The scope index in the frame |
2254 * @param {Array=} opt_details Raw scope details data | 2252 * @param {Array=} opt_details Raw scope details data |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 return this.script_.id; | 2331 return this.script_.id; |
2334 }; | 2332 }; |
2335 | 2333 |
2336 | 2334 |
2337 ScriptMirror.prototype.source = function() { | 2335 ScriptMirror.prototype.source = function() { |
2338 return this.script_.source; | 2336 return this.script_.source; |
2339 }; | 2337 }; |
2340 | 2338 |
2341 | 2339 |
2342 ScriptMirror.prototype.setSource = function(source) { | 2340 ScriptMirror.prototype.setSource = function(source) { |
2343 if (!IS_STRING(source)) throw MakeError(kDebugger, "Source is not a string"); | 2341 if (!IS_STRING(source)) throw %make_error(kDebugger, "Source is not a string")
; |
2344 %DebugSetScriptSource(this.script_, source); | 2342 %DebugSetScriptSource(this.script_, source); |
2345 }; | 2343 }; |
2346 | 2344 |
2347 | 2345 |
2348 ScriptMirror.prototype.lineOffset = function() { | 2346 ScriptMirror.prototype.lineOffset = function() { |
2349 return this.script_.line_offset; | 2347 return this.script_.line_offset; |
2350 }; | 2348 }; |
2351 | 2349 |
2352 | 2350 |
2353 ScriptMirror.prototype.columnOffset = function() { | 2351 ScriptMirror.prototype.columnOffset = function() { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 case MirrorType.ERROR_TYPE: | 2651 case MirrorType.ERROR_TYPE: |
2654 case MirrorType.REGEXP_TYPE: | 2652 case MirrorType.REGEXP_TYPE: |
2655 case MirrorType.PROMISE_TYPE: | 2653 case MirrorType.PROMISE_TYPE: |
2656 case MirrorType.GENERATOR_TYPE: | 2654 case MirrorType.GENERATOR_TYPE: |
2657 // Add object representation. | 2655 // Add object representation. |
2658 this.serializeObject_(mirror, content, details); | 2656 this.serializeObject_(mirror, content, details); |
2659 break; | 2657 break; |
2660 | 2658 |
2661 case MirrorType.PROPERTY_TYPE: | 2659 case MirrorType.PROPERTY_TYPE: |
2662 case MirrorType.INTERNAL_PROPERTY_TYPE: | 2660 case MirrorType.INTERNAL_PROPERTY_TYPE: |
2663 throw MakeError(kDebugger, | 2661 throw %make_error(kDebugger, |
2664 'PropertyMirror cannot be serialized independently'); | 2662 'PropertyMirror cannot be serialized independently'); |
2665 break; | 2663 break; |
2666 | 2664 |
2667 case MirrorType.FRAME_TYPE: | 2665 case MirrorType.FRAME_TYPE: |
2668 // Add object representation. | 2666 // Add object representation. |
2669 this.serializeFrame_(mirror, content); | 2667 this.serializeFrame_(mirror, content); |
2670 break; | 2668 break; |
2671 | 2669 |
2672 case MirrorType.SCOPE_TYPE: | 2670 case MirrorType.SCOPE_TYPE: |
2673 // Add object representation. | 2671 // Add object representation. |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 // Functions needed by the debugger runtime. | 3048 // Functions needed by the debugger runtime. |
3051 utils.InstallFunctions(utils, DONT_ENUM, [ | 3049 utils.InstallFunctions(utils, DONT_ENUM, [ |
3052 "ClearMirrorCache", ClearMirrorCache | 3050 "ClearMirrorCache", ClearMirrorCache |
3053 ]); | 3051 ]); |
3054 | 3052 |
3055 // Export to debug.js | 3053 // Export to debug.js |
3056 utils.Export(function(to) { | 3054 utils.Export(function(to) { |
3057 to.MirrorType = MirrorType; | 3055 to.MirrorType = MirrorType; |
3058 }); | 3056 }); |
3059 }) | 3057 }) |
OLD | NEW |