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 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 | 1767 |
1768 if (!IS_UNDEFINED(iterable)) { | 1768 if (!IS_UNDEFINED(iterable)) { |
1769 result = %IsConstructor(this) ? new this() : []; | 1769 result = %IsConstructor(this) ? new this() : []; |
1770 | 1770 |
1771 var iterator = GetIterator(items, iterable); | 1771 var iterator = GetIterator(items, iterable); |
1772 | 1772 |
1773 k = 0; | 1773 k = 0; |
1774 while (true) { | 1774 while (true) { |
1775 var next = iterator.next(); | 1775 var next = iterator.next(); |
1776 | 1776 |
1777 if (!IS_SPEC_OBJECT(next)) { | 1777 if (!IS_RECEIVER(next)) { |
1778 throw MakeTypeError(kIteratorResultNotAnObject, next); | 1778 throw MakeTypeError(kIteratorResultNotAnObject, next); |
1779 } | 1779 } |
1780 | 1780 |
1781 if (next.done) { | 1781 if (next.done) { |
1782 result.length = k; | 1782 result.length = k; |
1783 return result; | 1783 return result; |
1784 } | 1784 } |
1785 | 1785 |
1786 nextValue = next.value; | 1786 nextValue = next.value; |
1787 if (mapping) { | 1787 if (mapping) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 %InstallToContext([ | 1964 %InstallToContext([ |
1965 "array_pop", ArrayPop, | 1965 "array_pop", ArrayPop, |
1966 "array_push", ArrayPush, | 1966 "array_push", ArrayPush, |
1967 "array_shift", ArrayShift, | 1967 "array_shift", ArrayShift, |
1968 "array_splice", ArraySplice, | 1968 "array_splice", ArraySplice, |
1969 "array_slice", ArraySlice, | 1969 "array_slice", ArraySlice, |
1970 "array_unshift", ArrayUnshift, | 1970 "array_unshift", ArrayUnshift, |
1971 ]); | 1971 ]); |
1972 | 1972 |
1973 }); | 1973 }); |
OLD | NEW |