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

Side by Side Diff: src/js/harmony-spread.js

Issue 1429653006: Remove flags for spread calls and arrays (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/flag-definitions.h ('k') | src/js/spread.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 (function(global, utils) {
6
7 'use strict';
8
9 // -------------------------------------------------------------------
10 // Imports
11 var InternalArray = utils.InternalArray;
12 var MakeTypeError;
13
14 utils.Import(function(from) {
15 MakeTypeError = from.MakeTypeError;
16 });
17
18 // -------------------------------------------------------------------
19
20 function SpreadArguments() {
21 var count = %_ArgumentsLength();
22 var args = new InternalArray();
23
24 for (var i = 0; i < count; ++i) {
25 var array = %_Arguments(i);
26 var length = array.length;
27 for (var j = 0; j < length; ++j) {
28 args.push(array[j]);
29 }
30 }
31
32 return args;
33 }
34
35
36 function SpreadIterable(collection) {
37 if (IS_NULL_OR_UNDEFINED(collection)) {
38 throw MakeTypeError(kNotIterable, collection);
39 }
40
41 var args = new InternalArray();
42 for (var value of collection) {
43 args.push(value);
44 }
45 return args;
46 }
47
48 // ----------------------------------------------------------------------------
49 // Exports
50
51 %InstallToContext([
52 "spread_arguments", SpreadArguments,
53 "spread_iterable", SpreadIterable,
54 ]);
55
56 })
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/js/spread.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698