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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
11 var InternalArray = utils.InternalArray; | 11 var InternalArray = utils.InternalArray; |
12 var MakeTypeError; | 12 var MakeTypeError; |
13 | 13 |
14 utils.Import(function(from) { | 14 utils.Import(function(from) { |
15 MakeTypeError = from.MakeTypeError; | 15 MakeTypeError = from.MakeTypeError; |
16 }); | 16 }); |
17 | 17 |
18 // ------------------------------------------------------------------- | 18 // ------------------------------------------------------------------- |
19 | 19 |
20 function SpreadArguments() { | 20 function SpreadArguments() { |
21 var count = arguments.length; | 21 var count = %_ArgumentsLength(); |
22 var args = new InternalArray(); | 22 var args = new InternalArray(); |
23 | 23 |
24 for (var i = 0; i < count; ++i) { | 24 for (var i = 0; i < count; ++i) { |
25 var array = arguments[i]; | 25 var array = %_Arguments(i); |
26 var length = array.length; | 26 var length = array.length; |
27 for (var j = 0; j < length; ++j) { | 27 for (var j = 0; j < length; ++j) { |
28 args.push(array[j]); | 28 args.push(array[j]); |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 return args; | 32 return args; |
33 } | 33 } |
34 | 34 |
35 | 35 |
(...skipping 11 matching lines...) Expand all Loading... |
47 | 47 |
48 // ---------------------------------------------------------------------------- | 48 // ---------------------------------------------------------------------------- |
49 // Exports | 49 // Exports |
50 | 50 |
51 %InstallToContext([ | 51 %InstallToContext([ |
52 "spread_arguments", SpreadArguments, | 52 "spread_arguments", SpreadArguments, |
53 "spread_iterable", SpreadIterable, | 53 "spread_iterable", SpreadIterable, |
54 ]); | 54 ]); |
55 | 55 |
56 }) | 56 }) |
OLD | NEW |