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 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 tempCtor.prototype = superCtor.prototype; | 216 tempCtor.prototype = superCtor.prototype; |
217 ctor.super_ = superCtor.prototype; | 217 ctor.super_ = superCtor.prototype; |
218 ctor.prototype = new tempCtor(); | 218 ctor.prototype = new tempCtor(); |
219 ctor.prototype.constructor = ctor; | 219 ctor.prototype.constructor = ctor; |
220 } | 220 } |
221 | 221 |
222 // Maximum length when sending strings through the JSON protocol. | 222 // Maximum length when sending strings through the JSON protocol. |
223 var kMaxProtocolStringLength = 80; | 223 var kMaxProtocolStringLength = 80; |
224 | 224 |
225 | 225 |
226 // A copy of the PropertyType enum from property-details.h | 226 // A copy of the PropertyKind enum from property-details.h |
227 var PropertyType = {}; | 227 var PropertyType = {}; |
228 PropertyType.Data = 0; | 228 PropertyType.Data = 0; |
229 PropertyType.DataConstant = 2; | 229 PropertyType.Accessor = 1; |
230 PropertyType.AccessorConstant = 3; | |
231 | 230 |
232 | 231 |
233 // Different attributes for a property. | 232 // Different attributes for a property. |
234 var PropertyAttribute = {}; | 233 var PropertyAttribute = {}; |
235 PropertyAttribute.None = NONE; | 234 PropertyAttribute.None = NONE; |
236 PropertyAttribute.ReadOnly = READ_ONLY; | 235 PropertyAttribute.ReadOnly = READ_ONLY; |
237 PropertyAttribute.DontEnum = DONT_ENUM; | 236 PropertyAttribute.DontEnum = DONT_ENUM; |
238 PropertyAttribute.DontDelete = DONT_DELETE; | 237 PropertyAttribute.DontDelete = DONT_DELETE; |
239 | 238 |
240 | 239 |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 * property was found with the specified value UndefinedMirror is returned | 791 * property was found with the specified value UndefinedMirror is returned |
793 */ | 792 */ |
794 ObjectMirror.prototype.lookupProperty = function(value) { | 793 ObjectMirror.prototype.lookupProperty = function(value) { |
795 var properties = this.properties(); | 794 var properties = this.properties(); |
796 | 795 |
797 // Look for property value in properties. | 796 // Look for property value in properties. |
798 for (var i = 0; i < properties.length; i++) { | 797 for (var i = 0; i < properties.length; i++) { |
799 | 798 |
800 // Skip properties which are defined through accessors. | 799 // Skip properties which are defined through accessors. |
801 var property = properties[i]; | 800 var property = properties[i]; |
802 if (property.propertyType() != PropertyType.AccessorConstant) { | 801 if (property.propertyType() == PropertyType.Data) { |
803 if (property.value_ === value.value_) { | 802 if (property.value_ === value.value_) { |
804 return property; | 803 return property; |
805 } | 804 } |
806 } | 805 } |
807 } | 806 } |
808 | 807 |
809 // Nothing found. | 808 // Nothing found. |
810 return GetUndefinedMirror(); | 809 return GetUndefinedMirror(); |
811 }; | 810 }; |
812 | 811 |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 return this.exception_ ? true : false; | 1537 return this.exception_ ? true : false; |
1539 }; | 1538 }; |
1540 | 1539 |
1541 | 1540 |
1542 PropertyMirror.prototype.attributes = function() { | 1541 PropertyMirror.prototype.attributes = function() { |
1543 return %DebugPropertyAttributesFromDetails(this.details_); | 1542 return %DebugPropertyAttributesFromDetails(this.details_); |
1544 }; | 1543 }; |
1545 | 1544 |
1546 | 1545 |
1547 PropertyMirror.prototype.propertyType = function() { | 1546 PropertyMirror.prototype.propertyType = function() { |
1548 return %DebugPropertyTypeFromDetails(this.details_); | 1547 return %DebugPropertyKindFromDetails(this.details_); |
1549 }; | 1548 }; |
1550 | 1549 |
1551 | 1550 |
1552 /** | 1551 /** |
1553 * Returns whether this property has a getter defined through __defineGetter__. | 1552 * Returns whether this property has a getter defined through __defineGetter__. |
1554 * @return {boolean} True if this property has a getter | 1553 * @return {boolean} True if this property has a getter |
1555 */ | 1554 */ |
1556 PropertyMirror.prototype.hasGetter = function() { | 1555 PropertyMirror.prototype.hasGetter = function() { |
1557 return this.getter_ ? true : false; | 1556 return this.getter_ ? true : false; |
1558 }; | 1557 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 | 1595 |
1597 | 1596 |
1598 /** | 1597 /** |
1599 * Returns whether this property is natively implemented by the host or a set | 1598 * Returns whether this property is natively implemented by the host or a set |
1600 * through JavaScript code. | 1599 * through JavaScript code. |
1601 * @return {boolean} True if the property is | 1600 * @return {boolean} True if the property is |
1602 * UndefinedMirror if there is no setter for this property | 1601 * UndefinedMirror if there is no setter for this property |
1603 */ | 1602 */ |
1604 PropertyMirror.prototype.isNative = function() { | 1603 PropertyMirror.prototype.isNative = function() { |
1605 return this.is_interceptor_ || | 1604 return this.is_interceptor_ || |
1606 ((this.propertyType() == PropertyType.AccessorConstant) && | 1605 ((this.propertyType() == PropertyType.Accessor) && |
1607 !this.hasGetter() && !this.hasSetter()); | 1606 !this.hasGetter() && !this.hasSetter()); |
1608 }; | 1607 }; |
1609 | 1608 |
1610 | 1609 |
1611 /** | 1610 /** |
1612 * Mirror object for internal properties. Internal property reflects properties | 1611 * Mirror object for internal properties. Internal property reflects properties |
1613 * not accessible from user code such as [[BoundThis]] in bound function. | 1612 * not accessible from user code such as [[BoundThis]] in bound function. |
1614 * Their names are merely symbolic. | 1613 * Their names are merely symbolic. |
1615 * @param {string} name The name of the property | 1614 * @param {string} name The name of the property |
1616 * @param {value} property value | 1615 * @param {value} property value |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 // Functions needed by the debugger runtime. | 3074 // Functions needed by the debugger runtime. |
3076 utils.InstallFunctions(utils, DONT_ENUM, [ | 3075 utils.InstallFunctions(utils, DONT_ENUM, [ |
3077 "ClearMirrorCache", ClearMirrorCache | 3076 "ClearMirrorCache", ClearMirrorCache |
3078 ]); | 3077 ]); |
3079 | 3078 |
3080 // Export to debug.js | 3079 // Export to debug.js |
3081 utils.Export(function(to) { | 3080 utils.Export(function(to) { |
3082 to.MirrorType = MirrorType; | 3081 to.MirrorType = MirrorType; |
3083 }); | 3082 }); |
3084 }) | 3083 }) |
OLD | NEW |