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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 PropertyKind.Named = 1; | 170 PropertyKind.Named = 1; |
171 PropertyKind.Indexed = 2; | 171 PropertyKind.Indexed = 2; |
172 | 172 |
173 | 173 |
174 // A copy of the PropertyType enum from property-details.h | 174 // A copy of the PropertyType enum from property-details.h |
175 var PropertyType = {}; | 175 var PropertyType = {}; |
176 PropertyType.Normal = 0; | 176 PropertyType.Normal = 0; |
177 PropertyType.Field = 1; | 177 PropertyType.Field = 1; |
178 PropertyType.Constant = 2; | 178 PropertyType.Constant = 2; |
179 PropertyType.Callbacks = 3; | 179 PropertyType.Callbacks = 3; |
180 PropertyType.Handler = 4; | |
181 PropertyType.Interceptor = 5; | |
182 | 180 |
183 | 181 |
184 // Different attributes for a property. | 182 // Different attributes for a property. |
185 var PropertyAttribute = {}; | 183 var PropertyAttribute = {}; |
186 PropertyAttribute.None = NONE; | 184 PropertyAttribute.None = NONE; |
187 PropertyAttribute.ReadOnly = READ_ONLY; | 185 PropertyAttribute.ReadOnly = READ_ONLY; |
188 PropertyAttribute.DontEnum = DONT_ENUM; | 186 PropertyAttribute.DontEnum = DONT_ENUM; |
189 PropertyAttribute.DontDelete = DONT_DELETE; | 187 PropertyAttribute.DontDelete = DONT_DELETE; |
190 | 188 |
191 | 189 |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 * @param {Array} details Details about the property | 1358 * @param {Array} details Details about the property |
1361 * @constructor | 1359 * @constructor |
1362 * @extends Mirror | 1360 * @extends Mirror |
1363 */ | 1361 */ |
1364 function PropertyMirror(mirror, name, details) { | 1362 function PropertyMirror(mirror, name, details) { |
1365 %_CallFunction(this, PROPERTY_TYPE, Mirror); | 1363 %_CallFunction(this, PROPERTY_TYPE, Mirror); |
1366 this.mirror_ = mirror; | 1364 this.mirror_ = mirror; |
1367 this.name_ = name; | 1365 this.name_ = name; |
1368 this.value_ = details[0]; | 1366 this.value_ = details[0]; |
1369 this.details_ = details[1]; | 1367 this.details_ = details[1]; |
1370 if (details.length > 2) { | 1368 this.is_interceptor_ = details[2]; |
1371 this.exception_ = details[2]; | 1369 if (details.length > 3) { |
1372 this.getter_ = details[3]; | 1370 this.exception_ = details[3]; |
1373 this.setter_ = details[4]; | 1371 this.getter_ = details[4]; |
| 1372 this.setter_ = details[5]; |
1374 } | 1373 } |
1375 } | 1374 } |
1376 inherits(PropertyMirror, Mirror); | 1375 inherits(PropertyMirror, Mirror); |
1377 | 1376 |
1378 | 1377 |
1379 PropertyMirror.prototype.isReadOnly = function() { | 1378 PropertyMirror.prototype.isReadOnly = function() { |
1380 return (this.attributes() & PropertyAttribute.ReadOnly) != 0; | 1379 return (this.attributes() & PropertyAttribute.ReadOnly) != 0; |
1381 }; | 1380 }; |
1382 | 1381 |
1383 | 1382 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 }; | 1480 }; |
1482 | 1481 |
1483 | 1482 |
1484 /** | 1483 /** |
1485 * Returns whether this property is natively implemented by the host or a set | 1484 * Returns whether this property is natively implemented by the host or a set |
1486 * through JavaScript code. | 1485 * through JavaScript code. |
1487 * @return {boolean} True if the property is | 1486 * @return {boolean} True if the property is |
1488 * UndefinedMirror if there is no setter for this property | 1487 * UndefinedMirror if there is no setter for this property |
1489 */ | 1488 */ |
1490 PropertyMirror.prototype.isNative = function() { | 1489 PropertyMirror.prototype.isNative = function() { |
1491 return (this.propertyType() == PropertyType.Interceptor) || | 1490 return this.is_interceptor_ || |
1492 ((this.propertyType() == PropertyType.Callbacks) && | 1491 ((this.propertyType() == PropertyType.Callbacks) && |
1493 !this.hasGetter() && !this.hasSetter()); | 1492 !this.hasGetter() && !this.hasSetter()); |
1494 }; | 1493 }; |
1495 | 1494 |
1496 | 1495 |
1497 /** | 1496 /** |
1498 * Mirror object for internal properties. Internal property reflects properties | 1497 * Mirror object for internal properties. Internal property reflects properties |
1499 * not accessible from user code such as [[BoundThis]] in bound function. | 1498 * not accessible from user code such as [[BoundThis]] in bound function. |
1500 * Their names are merely symbolic. | 1499 * Their names are merely symbolic. |
1501 * @param {string} name The name of the property | 1500 * @param {string} name The name of the property |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2878 } | 2877 } |
2879 if (!NUMBER_IS_FINITE(value)) { | 2878 if (!NUMBER_IS_FINITE(value)) { |
2880 if (value > 0) { | 2879 if (value > 0) { |
2881 return 'Infinity'; | 2880 return 'Infinity'; |
2882 } else { | 2881 } else { |
2883 return '-Infinity'; | 2882 return '-Infinity'; |
2884 } | 2883 } |
2885 } | 2884 } |
2886 return value; | 2885 return value; |
2887 } | 2886 } |
OLD | NEW |