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 // Handle id counters. | 5 // Handle id counters. |
6 var next_handle_ = 0; | 6 var next_handle_ = 0; |
7 var next_transient_handle_ = -1; | 7 var next_transient_handle_ = -1; |
8 | 8 |
9 // Mirror cache. | 9 // Mirror cache. |
10 var mirror_cache_ = []; | 10 var mirror_cache_ = []; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 var kMaxProtocolStringLength = 80; | 172 var kMaxProtocolStringLength = 80; |
173 | 173 |
174 // Different kind of properties. | 174 // Different kind of properties. |
175 var PropertyKind = {}; | 175 var PropertyKind = {}; |
176 PropertyKind.Named = 1; | 176 PropertyKind.Named = 1; |
177 PropertyKind.Indexed = 2; | 177 PropertyKind.Indexed = 2; |
178 | 178 |
179 | 179 |
180 // A copy of the PropertyType enum from property-details.h | 180 // A copy of the PropertyType enum from property-details.h |
181 var PropertyType = {}; | 181 var PropertyType = {}; |
182 PropertyType.Normal = 0; | 182 PropertyType.Field = 0; |
183 PropertyType.Field = 1; | 183 PropertyType.Constant = 1; |
184 PropertyType.Constant = 2; | 184 PropertyType.Callbacks = 2; |
185 PropertyType.Callbacks = 3; | |
186 | 185 |
187 | 186 |
188 // Different attributes for a property. | 187 // Different attributes for a property. |
189 var PropertyAttribute = {}; | 188 var PropertyAttribute = {}; |
190 PropertyAttribute.None = NONE; | 189 PropertyAttribute.None = NONE; |
191 PropertyAttribute.ReadOnly = READ_ONLY; | 190 PropertyAttribute.ReadOnly = READ_ONLY; |
192 PropertyAttribute.DontEnum = DONT_ENUM; | 191 PropertyAttribute.DontEnum = DONT_ENUM; |
193 PropertyAttribute.DontDelete = DONT_DELETE; | 192 PropertyAttribute.DontDelete = DONT_DELETE; |
194 | 193 |
195 | 194 |
(...skipping 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 /** | 2894 /** |
2896 * Serialize property information to the following JSON format for building the | 2895 * Serialize property information to the following JSON format for building the |
2897 * array of properties. | 2896 * array of properties. |
2898 * | 2897 * |
2899 * {"name":"<property name>", | 2898 * {"name":"<property name>", |
2900 * "attributes":<number>, | 2899 * "attributes":<number>, |
2901 * "propertyType":<number>, | 2900 * "propertyType":<number>, |
2902 * "ref":<number>} | 2901 * "ref":<number>} |
2903 * | 2902 * |
2904 * If the attribute for the property is PropertyAttribute.None it is not added. | 2903 * If the attribute for the property is PropertyAttribute.None it is not added. |
2905 * If the propertyType for the property is PropertyType.Normal it is not added. | |
2906 * Here are a couple of examples. | 2904 * Here are a couple of examples. |
2907 * | 2905 * |
2908 * {"name":"hello","ref":1} | 2906 * {"name":"hello","propertyType":0,"ref":1} |
2909 * {"name":"length","attributes":7,"propertyType":3,"ref":2} | 2907 * {"name":"length","attributes":7,"propertyType":3,"ref":2} |
2910 * | 2908 * |
2911 * @param {PropertyMirror} propertyMirror The property to serialize. | 2909 * @param {PropertyMirror} propertyMirror The property to serialize. |
2912 * @returns {Object} Protocol object representing the property. | 2910 * @returns {Object} Protocol object representing the property. |
2913 */ | 2911 */ |
2914 JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { | 2912 JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { |
2915 var result = {}; | 2913 var result = {}; |
2916 | 2914 |
2917 result.name = propertyMirror.name(); | 2915 result.name = propertyMirror.name(); |
2918 var propertyValue = propertyMirror.value(); | 2916 var propertyValue = propertyMirror.value(); |
2919 if (this.inlineRefs_() && propertyValue.isValue()) { | 2917 if (this.inlineRefs_() && propertyValue.isValue()) { |
2920 result.value = this.serializeReferenceWithDisplayData_(propertyValue); | 2918 result.value = this.serializeReferenceWithDisplayData_(propertyValue); |
2921 } else { | 2919 } else { |
2922 if (propertyMirror.attributes() != PropertyAttribute.None) { | 2920 if (propertyMirror.attributes() != PropertyAttribute.None) { |
2923 result.attributes = propertyMirror.attributes(); | 2921 result.attributes = propertyMirror.attributes(); |
2924 } | 2922 } |
2925 if (propertyMirror.propertyType() != PropertyType.Normal) { | 2923 result.propertyType = propertyMirror.propertyType(); |
2926 result.propertyType = propertyMirror.propertyType(); | |
2927 } | |
2928 result.ref = propertyValue.handle(); | 2924 result.ref = propertyValue.handle(); |
2929 } | 2925 } |
2930 return result; | 2926 return result; |
2931 }; | 2927 }; |
2932 | 2928 |
2933 | 2929 |
2934 /** | 2930 /** |
2935 * Serialize internal property information to the following JSON format for | 2931 * Serialize internal property information to the following JSON format for |
2936 * building the array of properties. | 2932 * building the array of properties. |
2937 * | 2933 * |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 } | 3030 } |
3035 if (!NUMBER_IS_FINITE(value)) { | 3031 if (!NUMBER_IS_FINITE(value)) { |
3036 if (value > 0) { | 3032 if (value > 0) { |
3037 return 'Infinity'; | 3033 return 'Infinity'; |
3038 } else { | 3034 } else { |
3039 return '-Infinity'; | 3035 return '-Infinity'; |
3040 } | 3036 } |
3041 } | 3037 } |
3042 return value; | 3038 return value; |
3043 } | 3039 } |
OLD | NEW |