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 FunctionSourceString; |
11 var GlobalArray = global.Array; | 12 var GlobalArray = global.Array; |
12 var IsNaN = global.isNaN; | 13 var IsNaN = global.isNaN; |
13 var JSONStringify = global.JSON.stringify; | 14 var JSONStringify = global.JSON.stringify; |
14 var MathMin = global.Math.min; | 15 var MathMin = global.Math.min; |
| 16 var ToBoolean; |
| 17 var ToString; |
| 18 |
| 19 utils.Import(function(from) { |
| 20 FunctionSourceString = from.FunctionSourceString; |
| 21 ToBoolean = from.ToBoolean; |
| 22 ToString = from.ToString; |
| 23 }); |
15 | 24 |
16 // ---------------------------------------------------------------------------- | 25 // ---------------------------------------------------------------------------- |
17 | 26 |
18 // Mirror hierarchy: | 27 // Mirror hierarchy: |
19 // - Mirror | 28 // - Mirror |
20 // - ValueMirror | 29 // - ValueMirror |
21 // - UndefinedMirror | 30 // - UndefinedMirror |
22 // - NullMirror | 31 // - NullMirror |
23 // - BooleanMirror | 32 // - BooleanMirror |
24 // - NumberMirror | 33 // - NumberMirror |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 | 992 |
984 /** | 993 /** |
985 * Returns the source code for the function. | 994 * Returns the source code for the function. |
986 * @return {string or undefined} The source code for the function. If the | 995 * @return {string or undefined} The source code for the function. If the |
987 * function is not resolved undefined will be returned. | 996 * function is not resolved undefined will be returned. |
988 */ | 997 */ |
989 FunctionMirror.prototype.source = function() { | 998 FunctionMirror.prototype.source = function() { |
990 // Return source if function is resolved. Otherwise just fall through to | 999 // Return source if function is resolved. Otherwise just fall through to |
991 // return undefined. | 1000 // return undefined. |
992 if (this.resolved()) { | 1001 if (this.resolved()) { |
993 return builtins.$functionSourceString(this.value_); | 1002 return FunctionSourceString(this.value_); |
994 } | 1003 } |
995 }; | 1004 }; |
996 | 1005 |
997 | 1006 |
998 /** | 1007 /** |
999 * Returns the script object for the function. | 1008 * Returns the script object for the function. |
1000 * @return {ScriptMirror or undefined} Script object for the function or | 1009 * @return {ScriptMirror or undefined} Script object for the function or |
1001 * undefined if the function has no script | 1010 * undefined if the function has no script |
1002 */ | 1011 */ |
1003 FunctionMirror.prototype.script = function() { | 1012 FunctionMirror.prototype.script = function() { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 }; | 1170 }; |
1162 | 1171 |
1163 | 1172 |
1164 ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, | 1173 ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, |
1165 opt_to_index) { | 1174 opt_to_index) { |
1166 var from_index = opt_from_index || 0; | 1175 var from_index = opt_from_index || 0; |
1167 var to_index = opt_to_index || this.length() - 1; | 1176 var to_index = opt_to_index || this.length() - 1; |
1168 if (from_index > to_index) return new GlobalArray(); | 1177 if (from_index > to_index) return new GlobalArray(); |
1169 var values = new GlobalArray(to_index - from_index + 1); | 1178 var values = new GlobalArray(to_index - from_index + 1); |
1170 for (var i = from_index; i <= to_index; i++) { | 1179 for (var i = from_index; i <= to_index; i++) { |
1171 var details = %DebugGetPropertyDetails(this.value_, builtins.$toString(i)); | 1180 var details = %DebugGetPropertyDetails(this.value_, ToString(i)); |
1172 var value; | 1181 var value; |
1173 if (details) { | 1182 if (details) { |
1174 value = new PropertyMirror(this, i, details); | 1183 value = new PropertyMirror(this, i, details); |
1175 } else { | 1184 } else { |
1176 value = GetUndefinedMirror(); | 1185 value = GetUndefinedMirror(); |
1177 } | 1186 } |
1178 values[i - from_index] = value; | 1187 values[i - from_index] = value; |
1179 } | 1188 } |
1180 return values; | 1189 return values; |
1181 }; | 1190 }; |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 return result; | 2070 return result; |
2062 }; | 2071 }; |
2063 | 2072 |
2064 | 2073 |
2065 FrameMirror.prototype.evaluate = function(source, disable_break, | 2074 FrameMirror.prototype.evaluate = function(source, disable_break, |
2066 opt_context_object) { | 2075 opt_context_object) { |
2067 return MakeMirror(%DebugEvaluate(this.break_id_, | 2076 return MakeMirror(%DebugEvaluate(this.break_id_, |
2068 this.details_.frameId(), | 2077 this.details_.frameId(), |
2069 this.details_.inlinedFrameIndex(), | 2078 this.details_.inlinedFrameIndex(), |
2070 source, | 2079 source, |
2071 $toBoolean(disable_break), | 2080 ToBoolean(disable_break), |
2072 opt_context_object)); | 2081 opt_context_object)); |
2073 }; | 2082 }; |
2074 | 2083 |
2075 | 2084 |
2076 FrameMirror.prototype.invocationText = function() { | 2085 FrameMirror.prototype.invocationText = function() { |
2077 // Format frame invoaction (receiver, function and arguments). | 2086 // Format frame invoaction (receiver, function and arguments). |
2078 var result = ''; | 2087 var result = ''; |
2079 var func = this.func(); | 2088 var func = this.func(); |
2080 var receiver = this.receiver(); | 2089 var receiver = this.receiver(); |
2081 if (this.isConstructCall()) { | 2090 if (this.isConstructCall()) { |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 // Functions needed by the debugger runtime. | 3107 // Functions needed by the debugger runtime. |
3099 utils.InstallFunctions(utils, DONT_ENUM, [ | 3108 utils.InstallFunctions(utils, DONT_ENUM, [ |
3100 "ClearMirrorCache", ClearMirrorCache | 3109 "ClearMirrorCache", ClearMirrorCache |
3101 ]); | 3110 ]); |
3102 | 3111 |
3103 // Export to debug.js | 3112 // Export to debug.js |
3104 utils.Export(function(to) { | 3113 utils.Export(function(to) { |
3105 to.MirrorType = MirrorType; | 3114 to.MirrorType = MirrorType; |
3106 }); | 3115 }); |
3107 }) | 3116 }) |
OLD | NEW |