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(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
12 // Imports | 12 // Imports |
13 | 13 |
14 var GetIterator; | 14 var GetIterator; |
15 var GetMethod; | 15 var GetMethod; |
16 var GlobalArray = global.Array; | 16 var GlobalArray = global.Array; |
17 var GlobalSymbol = global.Symbol; | 17 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
18 var MathMax; | 18 var MathMax; |
19 var MathMin; | 19 var MathMin; |
20 var ObjectIsFrozen; | 20 var ObjectIsFrozen; |
21 var ObjectDefineProperty; | 21 var ObjectDefineProperty; |
22 var ToNumber; | 22 var ToNumber; |
23 | 23 |
24 utils.Import(function(from) { | 24 utils.Import(function(from) { |
25 GetIterator = from.GetIterator; | 25 GetIterator = from.GetIterator; |
26 GetMethod = from.GetMethod; | 26 GetMethod = from.GetMethod; |
27 MathMax = from.MathMax; | 27 MathMax = from.MathMax; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 throw MakeTypeError(kCalledNonCallable, mapfn); | 214 throw MakeTypeError(kCalledNonCallable, mapfn); |
215 } else if (%IsSloppyModeFunction(mapfn)) { | 215 } else if (%IsSloppyModeFunction(mapfn)) { |
216 if (IS_NULL(receiver)) { | 216 if (IS_NULL(receiver)) { |
217 receiver = UNDEFINED; | 217 receiver = UNDEFINED; |
218 } else if (!IS_UNDEFINED(receiver)) { | 218 } else if (!IS_UNDEFINED(receiver)) { |
219 receiver = TO_OBJECT(receiver); | 219 receiver = TO_OBJECT(receiver); |
220 } | 220 } |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 var iterable = GetMethod(items, symbolIterator); | 224 var iterable = GetMethod(items, iteratorSymbol); |
225 var k; | 225 var k; |
226 var result; | 226 var result; |
227 var mappedValue; | 227 var mappedValue; |
228 var nextValue; | 228 var nextValue; |
229 | 229 |
230 if (!IS_UNDEFINED(iterable)) { | 230 if (!IS_UNDEFINED(iterable)) { |
231 result = %IsConstructor(this) ? new this() : []; | 231 result = %IsConstructor(this) ? new this() : []; |
232 | 232 |
233 var iterator = GetIterator(items, iterable); | 233 var iterator = GetIterator(items, iterable); |
234 | 234 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 utils.Export(function(to) { | 314 utils.Export(function(to) { |
315 to.ArrayFrom = ArrayFrom; | 315 to.ArrayFrom = ArrayFrom; |
316 to.InnerArrayCopyWithin = InnerArrayCopyWithin; | 316 to.InnerArrayCopyWithin = InnerArrayCopyWithin; |
317 to.InnerArrayFill = InnerArrayFill; | 317 to.InnerArrayFill = InnerArrayFill; |
318 to.InnerArrayFind = InnerArrayFind; | 318 to.InnerArrayFind = InnerArrayFind; |
319 to.InnerArrayFindIndex = InnerArrayFindIndex; | 319 to.InnerArrayFindIndex = InnerArrayFindIndex; |
320 }); | 320 }); |
321 | 321 |
322 }) | 322 }) |
OLD | NEW |