| 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 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3966 if (list->length() == 1) { | 3966 if (list->length() == 1) { |
| 3967 // Spread-call with single spread argument produces an InternalArray | 3967 // Spread-call with single spread argument produces an InternalArray |
| 3968 // containing the values from the array. | 3968 // containing the values from the array. |
| 3969 // | 3969 // |
| 3970 // Function is called or constructed with the produced array of arguments | 3970 // Function is called or constructed with the produced array of arguments |
| 3971 // | 3971 // |
| 3972 // EG: Apply(Func, Spread(spread0)) | 3972 // EG: Apply(Func, Spread(spread0)) |
| 3973 ZoneList<Expression*>* spread_list = | 3973 ZoneList<Expression*>* spread_list = |
| 3974 new (zone()) ZoneList<Expression*>(0, zone()); | 3974 new (zone()) ZoneList<Expression*>(0, zone()); |
| 3975 spread_list->Add(list->at(0)->AsSpread()->expression(), zone()); | 3975 spread_list->Add(list->at(0)->AsSpread()->expression(), zone()); |
| 3976 args->Add(factory()->NewCallRuntime(Context::SPREAD_ITERABLE_INDEX, | 3976 args->Add(factory()->NewCallRuntime(Runtime::kSpreadIterablePrepare, |
| 3977 spread_list, kNoSourcePosition), | 3977 spread_list, kNoSourcePosition), |
| 3978 zone()); | 3978 zone()); |
| 3979 return args; | 3979 return args; |
| 3980 } else { | 3980 } else { |
| 3981 // Spread-call with multiple arguments produces array literals for each | 3981 // Spread-call with multiple arguments produces array literals for each |
| 3982 // sequences of unspread arguments, and converts each spread iterable to | 3982 // sequences of unspread arguments, and converts each spread iterable to |
| 3983 // an Internal array. Finally, all of these produced arrays are flattened | 3983 // an Internal array. Finally, all of these produced arrays are flattened |
| 3984 // into a single InternalArray, containing the arguments for the call. | 3984 // into a single InternalArray, containing the arguments for the call. |
| 3985 // | 3985 // |
| 3986 // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0), | 3986 // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0), |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5412 | 5412 |
| 5413 return final_loop; | 5413 return final_loop; |
| 5414 } | 5414 } |
| 5415 | 5415 |
| 5416 #undef CHECK_OK | 5416 #undef CHECK_OK |
| 5417 #undef CHECK_OK_VOID | 5417 #undef CHECK_OK_VOID |
| 5418 #undef CHECK_FAILED | 5418 #undef CHECK_FAILED |
| 5419 | 5419 |
| 5420 } // namespace internal | 5420 } // namespace internal |
| 5421 } // namespace v8 | 5421 } // namespace v8 |
| OLD | NEW |