OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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() { | 5 (function() { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (!IS_UNDEFINED(iterable)) { | 206 if (!IS_UNDEFINED(iterable)) { |
207 result = %IsConstructor(this) ? new this() : []; | 207 result = %IsConstructor(this) ? new this() : []; |
208 | 208 |
209 var iterator = GetIterator(items, iterable); | 209 var iterator = GetIterator(items, iterable); |
210 | 210 |
211 k = 0; | 211 k = 0; |
212 while (true) { | 212 while (true) { |
213 var next = iterator.next(); | 213 var next = iterator.next(); |
214 | 214 |
215 if (!IS_OBJECT(next)) { | 215 if (!IS_OBJECT(next)) { |
216 throw MakeTypeError("iterator_result_not_an_object", [next]); | 216 throw MakeTypeError(kIteratorResultNotAnObject, next); |
217 } | 217 } |
218 | 218 |
219 if (next.done) { | 219 if (next.done) { |
220 result.length = k; | 220 result.length = k; |
221 return result; | 221 return result; |
222 } | 222 } |
223 | 223 |
224 nextValue = next.value; | 224 nextValue = next.value; |
225 if (mapping) { | 225 if (mapping) { |
226 mappedValue = %_CallFunction(receiver, nextValue, k, mapfn); | 226 mappedValue = %_CallFunction(receiver, nextValue, k, mapfn); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 // Set up the non-enumerable functions on the Array prototype object. | 280 // Set up the non-enumerable functions on the Array prototype object. |
281 InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ | 281 InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ |
282 "copyWithin", ArrayCopyWithin, | 282 "copyWithin", ArrayCopyWithin, |
283 "find", ArrayFind, | 283 "find", ArrayFind, |
284 "findIndex", ArrayFindIndex, | 284 "findIndex", ArrayFindIndex, |
285 "fill", ArrayFill | 285 "fill", ArrayFill |
286 ]); | 286 ]); |
287 | 287 |
288 })(); | 288 })(); |
OLD | NEW |