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 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 var entries = %GetWeakMapEntries(this.value_, opt_limit || 0); | 1377 var entries = %GetWeakMapEntries(this.value_, opt_limit || 0); |
1378 for (var i = 0; i < entries.length; i += 2) { | 1378 for (var i = 0; i < entries.length; i += 2) { |
1379 result.push({ | 1379 result.push({ |
1380 key: entries[i], | 1380 key: entries[i], |
1381 value: entries[i + 1] | 1381 value: entries[i + 1] |
1382 }); | 1382 }); |
1383 } | 1383 } |
1384 return result; | 1384 return result; |
1385 } | 1385 } |
1386 | 1386 |
1387 var iter = %_CallFunction(this.value_, builtins.MapEntries); | 1387 var iter = %_CallFunction(this.value_, builtins.$mapEntries); |
1388 var next; | 1388 var next; |
1389 while ((!opt_limit || result.length < opt_limit) && | 1389 while ((!opt_limit || result.length < opt_limit) && |
1390 !(next = iter.next()).done) { | 1390 !(next = iter.next()).done) { |
1391 result.push({ | 1391 result.push({ |
1392 key: next.value[0], | 1392 key: next.value[0], |
1393 value: next.value[1] | 1393 value: next.value[1] |
1394 }); | 1394 }); |
1395 } | 1395 } |
1396 return result; | 1396 return result; |
1397 }; | 1397 }; |
(...skipping 21 matching lines...) Expand all Loading... |
1419 * This will keep elements alive for WeakSets. | 1419 * This will keep elements alive for WeakSets. |
1420 * | 1420 * |
1421 * @param {number=} opt_limit Max elements to return. | 1421 * @param {number=} opt_limit Max elements to return. |
1422 * @returns {Array.<Object>} Array of elements of a set. | 1422 * @returns {Array.<Object>} Array of elements of a set. |
1423 */ | 1423 */ |
1424 SetMirror.prototype.values = function(opt_limit) { | 1424 SetMirror.prototype.values = function(opt_limit) { |
1425 if (IS_WEAKSET(this.value_)) { | 1425 if (IS_WEAKSET(this.value_)) { |
1426 return %GetWeakSetValues(this.value_, opt_limit || 0); | 1426 return %GetWeakSetValues(this.value_, opt_limit || 0); |
1427 } | 1427 } |
1428 | 1428 |
1429 var iter = %_CallFunction(this.value_, builtins.SetValues); | 1429 var iter = %_CallFunction(this.value_, builtins.$setValues); |
1430 return IteratorGetValues_(iter, builtins.SetIteratorNextJS, opt_limit); | 1430 return IteratorGetValues_(iter, builtins.$setIteratorNext, opt_limit); |
1431 }; | 1431 }; |
1432 | 1432 |
1433 | 1433 |
1434 function IteratorMirror(value) { | 1434 function IteratorMirror(value) { |
1435 %_CallFunction(this, value, ITERATOR_TYPE, ObjectMirror); | 1435 %_CallFunction(this, value, ITERATOR_TYPE, ObjectMirror); |
1436 } | 1436 } |
1437 inherits(IteratorMirror, ObjectMirror); | 1437 inherits(IteratorMirror, ObjectMirror); |
1438 | 1438 |
1439 | 1439 |
1440 /** | 1440 /** |
1441 * Returns a preview of elements of an iterator. | 1441 * Returns a preview of elements of an iterator. |
1442 * Does not change the backing iterator state. | 1442 * Does not change the backing iterator state. |
1443 * | 1443 * |
1444 * @param {number=} opt_limit Max elements to return. | 1444 * @param {number=} opt_limit Max elements to return. |
1445 * @returns {Array.<Object>} Array of elements of an iterator. | 1445 * @returns {Array.<Object>} Array of elements of an iterator. |
1446 */ | 1446 */ |
1447 IteratorMirror.prototype.preview = function(opt_limit) { | 1447 IteratorMirror.prototype.preview = function(opt_limit) { |
1448 if (IS_MAP_ITERATOR(this.value_)) { | 1448 if (IS_MAP_ITERATOR(this.value_)) { |
1449 return IteratorGetValues_(%MapIteratorClone(this.value_), | 1449 return IteratorGetValues_(%MapIteratorClone(this.value_), |
1450 builtins.MapIteratorNextJS, | 1450 builtins.$mapIteratorNext, |
1451 opt_limit); | 1451 opt_limit); |
1452 } else if (IS_SET_ITERATOR(this.value_)) { | 1452 } else if (IS_SET_ITERATOR(this.value_)) { |
1453 return IteratorGetValues_(%SetIteratorClone(this.value_), | 1453 return IteratorGetValues_(%SetIteratorClone(this.value_), |
1454 builtins.SetIteratorNextJS, | 1454 builtins.$setIteratorNext, |
1455 opt_limit); | 1455 opt_limit); |
1456 } | 1456 } |
1457 }; | 1457 }; |
1458 | 1458 |
1459 | 1459 |
1460 /** | 1460 /** |
1461 * Mirror object for a Generator object. | 1461 * Mirror object for a Generator object. |
1462 * @param {Object} data The Generator object | 1462 * @param {Object} data The Generator object |
1463 * @constructor | 1463 * @constructor |
1464 * @extends Mirror | 1464 * @extends Mirror |
(...skipping 1597 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 |