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

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

Issue 2465253011: Fastpath some spread-call desugaring. (Closed)
Patch Set: Move helper to a runtime function 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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 if (list->length() == 1) { 3954 if (list->length() == 1) {
3955 // Spread-call with single spread argument produces an InternalArray 3955 // Spread-call with single spread argument produces an InternalArray
3956 // containing the values from the array. 3956 // containing the values from the array.
3957 // 3957 //
3958 // Function is called or constructed with the produced array of arguments 3958 // Function is called or constructed with the produced array of arguments
3959 // 3959 //
3960 // EG: Apply(Func, Spread(spread0)) 3960 // EG: Apply(Func, Spread(spread0))
3961 ZoneList<Expression*>* spread_list = 3961 ZoneList<Expression*>* spread_list =
3962 new (zone()) ZoneList<Expression*>(0, zone()); 3962 new (zone()) ZoneList<Expression*>(0, zone());
3963 spread_list->Add(list->at(0)->AsSpread()->expression(), zone()); 3963 spread_list->Add(list->at(0)->AsSpread()->expression(), zone());
3964 args->Add(factory()->NewCallRuntime(Context::SPREAD_ITERABLE_INDEX, 3964 args->Add(factory()->NewCallRuntime(Runtime::kSpreadIterablePrepare,
3965 spread_list, kNoSourcePosition), 3965 spread_list, kNoSourcePosition),
3966 zone()); 3966 zone());
3967 return args; 3967 return args;
3968 } else { 3968 } else {
3969 // Spread-call with multiple arguments produces array literals for each 3969 // Spread-call with multiple arguments produces array literals for each
3970 // sequences of unspread arguments, and converts each spread iterable to 3970 // sequences of unspread arguments, and converts each spread iterable to
3971 // an Internal array. Finally, all of these produced arrays are flattened 3971 // an Internal array. Finally, all of these produced arrays are flattened
3972 // into a single InternalArray, containing the arguments for the call. 3972 // into a single InternalArray, containing the arguments for the call.
3973 // 3973 //
3974 // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0), 3974 // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0),
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
5400 5400
5401 return final_loop; 5401 return final_loop;
5402 } 5402 }
5403 5403
5404 #undef CHECK_OK 5404 #undef CHECK_OK
5405 #undef CHECK_OK_VOID 5405 #undef CHECK_OK_VOID
5406 #undef CHECK_FAILED 5406 #undef CHECK_FAILED
5407 5407
5408 } // namespace internal 5408 } // namespace internal
5409 } // namespace v8 5409 } // 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