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

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

Issue 2465253011: Fastpath some spread-call desugaring. (Closed)
Patch Set: Handles double arrays too 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
« no previous file with comments | « src/lookup.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698