| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 function SpreadArguments() { | 7 function SpreadArguments() { |
| 8 var count = %_ArgumentsLength(); | 8 var count = %_ArgumentsLength(); |
| 9 var args = new InternalArray(); | 9 var args = new InternalArray(); |
| 10 | 10 |
| 11 for (var i = 0; i < count; ++i) { | 11 for (var i = 0; i < count; ++i) { |
| 12 var array = %_Arguments(i); | 12 var array = %_Arguments(i); |
| 13 var length = array.length; | 13 var length = array.length; |
| 14 for (var j = 0; j < length; ++j) { | 14 for (var j = 0; j < length; ++j) { |
| 15 args.push(array[j]); | 15 args.push(array[j]); |
| 16 } | 16 } |
| 17 } | 17 } |
| 18 | 18 |
| 19 return args; | 19 return args; |
| 20 } | 20 } |
| 21 | 21 |
| 22 | 22 |
| 23 function SpreadIterable(collection) { | 23 function SpreadIterable(collection) { |
| 24 if (IS_NULL_OR_UNDEFINED(collection)) { | 24 if (IS_NULL_OR_UNDEFINED(collection)) { |
| 25 throw MakeTypeError("not_iterable", [collection]); | 25 throw MakeTypeError(kNotIterable, collection); |
| 26 } | 26 } |
| 27 | 27 |
| 28 var args = new InternalArray(); | 28 var args = new InternalArray(); |
| 29 for (var value of collection) { | 29 for (var value of collection) { |
| 30 args.push(value); | 30 args.push(value); |
| 31 } | 31 } |
| 32 return args; | 32 return args; |
| 33 } | 33 } |
| OLD | NEW |