OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 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, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 | 1754 |
1755 if (!IS_UNDEFINED(iterable)) { | 1755 if (!IS_UNDEFINED(iterable)) { |
1756 result = %IsConstructor(this) ? new this() : []; | 1756 result = %IsConstructor(this) ? new this() : []; |
1757 | 1757 |
1758 var iterator = GetIterator(items, iterable); | 1758 var iterator = GetIterator(items, iterable); |
1759 | 1759 |
1760 k = 0; | 1760 k = 0; |
1761 while (true) { | 1761 while (true) { |
1762 var next = iterator.next(); | 1762 var next = iterator.next(); |
1763 | 1763 |
1764 if (!IS_OBJECT(next)) { | 1764 if (!IS_SPEC_OBJECT(next)) { |
1765 throw MakeTypeError(kIteratorResultNotAnObject, next); | 1765 throw MakeTypeError(kIteratorResultNotAnObject, next); |
1766 } | 1766 } |
1767 | 1767 |
1768 if (next.done) { | 1768 if (next.done) { |
1769 result.length = k; | 1769 result.length = k; |
1770 return result; | 1770 return result; |
1771 } | 1771 } |
1772 | 1772 |
1773 nextValue = next.value; | 1773 nextValue = next.value; |
1774 if (mapping) { | 1774 if (mapping) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 %InstallToContext([ | 1950 %InstallToContext([ |
1951 "array_pop", ArrayPop, | 1951 "array_pop", ArrayPop, |
1952 "array_push", ArrayPush, | 1952 "array_push", ArrayPush, |
1953 "array_shift", ArrayShift, | 1953 "array_shift", ArrayShift, |
1954 "array_splice", ArraySplice, | 1954 "array_splice", ArraySplice, |
1955 "array_slice", ArraySlice, | 1955 "array_slice", ArraySlice, |
1956 "array_unshift", ArrayUnshift, | 1956 "array_unshift", ArrayUnshift, |
1957 ]); | 1957 ]); |
1958 | 1958 |
1959 }); | 1959 }); |
OLD | NEW |