Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: src/parsing/parser.cc

Issue 2465253011: Fastpath some spread-call desugaring. (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3964 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 if (list->length() == 1) { 3975 if (list->length() == 1) {
3976 // Spread-call with single spread argument produces an InternalArray 3976 // Spread-call with single spread argument produces an InternalArray
3977 // containing the values from the array. 3977 // containing the values from the array.
3978 // 3978 //
3979 // Function is called or constructed with the produced array of arguments 3979 // Function is called or constructed with the produced array of arguments
3980 // 3980 //
3981 // EG: Apply(Func, Spread(spread0)) 3981 // EG: Apply(Func, Spread(spread0))
3982 ZoneList<Expression*>* spread_list = 3982 ZoneList<Expression*>* spread_list =
3983 new (zone()) ZoneList<Expression*>(0, zone()); 3983 new (zone()) ZoneList<Expression*>(0, zone());
3984 spread_list->Add(list->at(0)->AsSpread()->expression(), zone()); 3984 spread_list->Add(list->at(0)->AsSpread()->expression(), zone());
3985 args->Add(factory()->NewCallRuntime(Context::SPREAD_ITERABLE_INDEX, 3985 args->Add(factory()->NewCallRuntime(Runtime::kSpreadIterablePrepare,
3986 spread_list, kNoSourcePosition), 3986 spread_list, kNoSourcePosition),
3987 zone()); 3987 zone());
3988 return args; 3988 return args;
3989 } else { 3989 } else {
3990 // Spread-call with multiple arguments produces array literals for each 3990 // Spread-call with multiple arguments produces array literals for each
3991 // sequences of unspread arguments, and converts each spread iterable to 3991 // sequences of unspread arguments, and converts each spread iterable to
3992 // an Internal array. Finally, all of these produced arrays are flattened 3992 // an Internal array. Finally, all of these produced arrays are flattened
3993 // into a single InternalArray, containing the arguments for the call. 3993 // into a single InternalArray, containing the arguments for the call.
3994 // 3994 //
3995 // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0), 3995 // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0),
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
5421 5421
5422 return final_loop; 5422 return final_loop;
5423 } 5423 }
5424 5424
5425 #undef CHECK_OK 5425 #undef CHECK_OK
5426 #undef CHECK_OK_VOID 5426 #undef CHECK_OK_VOID
5427 #undef CHECK_FAILED 5427 #undef CHECK_FAILED
5428 5428
5429 } // namespace internal 5429 } // namespace internal
5430 } // namespace v8 5430 } // namespace v8
OLDNEW
« src/lookup.cc ('K') | « src/lookup.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698