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 "use strict"; | 4 "use strict"; |
5 | 5 |
6 // Handle id counters. | 6 // Handle id counters. |
7 var next_handle_ = 0; | 7 var next_handle_ = 0; |
8 var next_transient_handle_ = -1; | 8 var next_transient_handle_ = -1; |
9 | 9 |
10 // Mirror cache. | 10 // Mirror cache. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 var kMaxProtocolStringLength = 80; | 173 var kMaxProtocolStringLength = 80; |
174 | 174 |
175 // Different kind of properties. | 175 // Different kind of properties. |
176 var PropertyKind = {}; | 176 var PropertyKind = {}; |
177 PropertyKind.Named = 1; | 177 PropertyKind.Named = 1; |
178 PropertyKind.Indexed = 2; | 178 PropertyKind.Indexed = 2; |
179 | 179 |
180 | 180 |
181 // A copy of the PropertyType enum from property-details.h | 181 // A copy of the PropertyType enum from property-details.h |
182 var PropertyType = {}; | 182 var PropertyType = {}; |
183 PropertyType.Field = 0; | 183 PropertyType.Data = 0; |
184 PropertyType.Constant = 1; | 184 PropertyType.DataConstant = 2; |
185 PropertyType.Callbacks = 3; | 185 PropertyType.AccessorConstant = 3; |
186 | 186 |
187 | 187 |
188 // Different attributes for a property. | 188 // Different attributes for a property. |
189 var PropertyAttribute = {}; | 189 var PropertyAttribute = {}; |
190 PropertyAttribute.None = NONE; | 190 PropertyAttribute.None = NONE; |
191 PropertyAttribute.ReadOnly = READ_ONLY; | 191 PropertyAttribute.ReadOnly = READ_ONLY; |
192 PropertyAttribute.DontEnum = DONT_ENUM; | 192 PropertyAttribute.DontEnum = DONT_ENUM; |
193 PropertyAttribute.DontDelete = DONT_DELETE; | 193 PropertyAttribute.DontDelete = DONT_DELETE; |
194 | 194 |
195 | 195 |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 * property was found with the specified value UndefinedMirror is returned | 841 * property was found with the specified value UndefinedMirror is returned |
842 */ | 842 */ |
843 ObjectMirror.prototype.lookupProperty = function(value) { | 843 ObjectMirror.prototype.lookupProperty = function(value) { |
844 var properties = this.properties(); | 844 var properties = this.properties(); |
845 | 845 |
846 // Look for property value in properties. | 846 // Look for property value in properties. |
847 for (var i = 0; i < properties.length; i++) { | 847 for (var i = 0; i < properties.length; i++) { |
848 | 848 |
849 // Skip properties which are defined through assessors. | 849 // Skip properties which are defined through assessors. |
850 var property = properties[i]; | 850 var property = properties[i]; |
851 if (property.propertyType() != PropertyType.Callbacks) { | 851 if (property.propertyType() != PropertyType.AccessorConstant) { |
852 if (%_ObjectEquals(property.value_, value.value_)) { | 852 if (%_ObjectEquals(property.value_, value.value_)) { |
853 return property; | 853 return property; |
854 } | 854 } |
855 } | 855 } |
856 } | 856 } |
857 | 857 |
858 // Nothing found. | 858 // Nothing found. |
859 return GetUndefinedMirror(); | 859 return GetUndefinedMirror(); |
860 }; | 860 }; |
861 | 861 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 | 1652 |
1653 | 1653 |
1654 /** | 1654 /** |
1655 * Returns whether this property is natively implemented by the host or a set | 1655 * Returns whether this property is natively implemented by the host or a set |
1656 * through JavaScript code. | 1656 * through JavaScript code. |
1657 * @return {boolean} True if the property is | 1657 * @return {boolean} True if the property is |
1658 * UndefinedMirror if there is no setter for this property | 1658 * UndefinedMirror if there is no setter for this property |
1659 */ | 1659 */ |
1660 PropertyMirror.prototype.isNative = function() { | 1660 PropertyMirror.prototype.isNative = function() { |
1661 return this.is_interceptor_ || | 1661 return this.is_interceptor_ || |
1662 ((this.propertyType() == PropertyType.Callbacks) && | 1662 ((this.propertyType() == PropertyType.AccessorConstant) && |
1663 !this.hasGetter() && !this.hasSetter()); | 1663 !this.hasGetter() && !this.hasSetter()); |
1664 }; | 1664 }; |
1665 | 1665 |
1666 | 1666 |
1667 /** | 1667 /** |
1668 * Mirror object for internal properties. Internal property reflects properties | 1668 * Mirror object for internal properties. Internal property reflects properties |
1669 * not accessible from user code such as [[BoundThis]] in bound function. | 1669 * not accessible from user code such as [[BoundThis]] in bound function. |
1670 * Their names are merely symbolic. | 1670 * Their names are merely symbolic. |
1671 * @param {string} name The name of the property | 1671 * @param {string} name The name of the property |
1672 * @param {value} property value | 1672 * @param {value} property value |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 } | 3062 } |
3063 if (!NUMBER_IS_FINITE(value)) { | 3063 if (!NUMBER_IS_FINITE(value)) { |
3064 if (value > 0) { | 3064 if (value > 0) { |
3065 return 'Infinity'; | 3065 return 'Infinity'; |
3066 } else { | 3066 } else { |
3067 return '-Infinity'; | 3067 return '-Infinity'; |
3068 } | 3068 } |
3069 } | 3069 } |
3070 return value; | 3070 return value; |
3071 } | 3071 } |
OLD | NEW |