Chromium Code Reviews| 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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 // Copy names for named properties. | 752 // Copy names for named properties. |
| 753 if (kind & PropertyKind.Named) { | 753 if (kind & PropertyKind.Named) { |
| 754 for (var i = 0; index < limit && i < propertyNames.length; i++) { | 754 for (var i = 0; index < limit && i < propertyNames.length; i++) { |
| 755 names[index++] = propertyNames[i]; | 755 names[index++] = propertyNames[i]; |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 | 758 |
| 759 // Copy names for indexed properties. | 759 // Copy names for indexed properties. |
| 760 if (kind & PropertyKind.Indexed) { | 760 if (kind & PropertyKind.Indexed) { |
| 761 for (var i = 0; index < limit && i < elementNames.length; i++) { | 761 for (var i = 0; index < limit && i < elementNames.length; i++) { |
| 762 names[index++] = elementNames[i]; | 762 names[index++] = %ToString(elementNames[i]); |
|
rossberg
2014/08/06 14:21:30
Hm, I don't understand why this change is necessar
| |
| 763 } | 763 } |
| 764 } | 764 } |
| 765 | 765 |
| 766 return names; | 766 return names; |
| 767 }; | 767 }; |
| 768 | 768 |
| 769 | 769 |
| 770 /** | 770 /** |
| 771 * Return the properties for this object as an array of PropertyMirror objects. | 771 * Return the properties for this object as an array of PropertyMirror objects. |
| 772 * @param {number} kind Indicate whether named, indexed or both kinds of | 772 * @param {number} kind Indicate whether named, indexed or both kinds of |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 790 * Return the internal properties for this object as an array of | 790 * Return the internal properties for this object as an array of |
| 791 * InternalPropertyMirror objects. | 791 * InternalPropertyMirror objects. |
| 792 * @return {Array} Property mirrors for this object | 792 * @return {Array} Property mirrors for this object |
| 793 */ | 793 */ |
| 794 ObjectMirror.prototype.internalProperties = function() { | 794 ObjectMirror.prototype.internalProperties = function() { |
| 795 return ObjectMirror.GetInternalProperties(this.value_); | 795 return ObjectMirror.GetInternalProperties(this.value_); |
| 796 } | 796 } |
| 797 | 797 |
| 798 | 798 |
| 799 ObjectMirror.prototype.property = function(name) { | 799 ObjectMirror.prototype.property = function(name) { |
| 800 var details = %DebugGetPropertyDetails(this.value_, %ToString(name)); | 800 name = IS_SYMBOL(name) ? name : %ToString(name); |
|
rossberg
2014/08/06 14:21:29
You can use %ToName for this.
| |
| 801 var details = %DebugGetPropertyDetails(this.value_, name); | |
| 801 if (details) { | 802 if (details) { |
| 802 return new PropertyMirror(this, name, details); | 803 return new PropertyMirror(this, name, details); |
| 803 } | 804 } |
| 804 | 805 |
| 805 // Nothing found. | 806 // Nothing found. |
| 806 return GetUndefinedMirror(); | 807 return GetUndefinedMirror(); |
| 807 }; | 808 }; |
| 808 | 809 |
| 809 | 810 |
| 810 | 811 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1350 while (!(next = iter.next()).done) { | 1351 while (!(next = iter.next()).done) { |
| 1351 result.push(next.value); | 1352 result.push(next.value); |
| 1352 } | 1353 } |
| 1353 return result; | 1354 return result; |
| 1354 }; | 1355 }; |
| 1355 | 1356 |
| 1356 | 1357 |
| 1357 /** | 1358 /** |
| 1358 * Base mirror object for properties. | 1359 * Base mirror object for properties. |
| 1359 * @param {ObjectMirror} mirror The mirror object having this property | 1360 * @param {ObjectMirror} mirror The mirror object having this property |
| 1360 * @param {string} name The name of the property | 1361 * @param {Name} name The name of the property (a string or a symbol) |
| 1361 * @param {Array} details Details about the property | 1362 * @param {Array} details Details about the property |
| 1362 * @constructor | 1363 * @constructor |
| 1363 * @extends Mirror | 1364 * @extends Mirror |
| 1364 */ | 1365 */ |
| 1365 function PropertyMirror(mirror, name, details) { | 1366 function PropertyMirror(mirror, name, details) { |
| 1366 %_CallFunction(this, PROPERTY_TYPE, Mirror); | 1367 %_CallFunction(this, PROPERTY_TYPE, Mirror); |
| 1367 this.mirror_ = mirror; | 1368 this.mirror_ = mirror; |
| 1368 this.name_ = name; | 1369 this.name_ = name; |
| 1369 this.value_ = details[0]; | 1370 this.value_ = details[0]; |
| 1370 this.details_ = details[1]; | 1371 this.details_ = details[1]; |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2879 } | 2880 } |
| 2880 if (!NUMBER_IS_FINITE(value)) { | 2881 if (!NUMBER_IS_FINITE(value)) { |
| 2881 if (value > 0) { | 2882 if (value > 0) { |
| 2882 return 'Infinity'; | 2883 return 'Infinity'; |
| 2883 } else { | 2884 } else { |
| 2884 return '-Infinity'; | 2885 return '-Infinity'; |
| 2885 } | 2886 } |
| 2886 } | 2887 } |
| 2887 return value; | 2888 return value; |
| 2888 } | 2889 } |
| OLD | NEW |