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

Side by Side Diff: src/js/runtime.js

Issue 1704533002: Support rest element pattern with user-defined iterable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months 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/contexts.h ('k') | src/parsing/pattern-rewriter.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. 5 // This files contains runtime support implemented in JavaScript.
6 6
7 // CAUTION: Some of the functions specified in this file are called 7 // CAUTION: Some of the functions specified in this file are called
8 // directly from compiled code. These are the functions with names in 8 // directly from compiled code. These are the functions with names in
9 // ALL CAPS. The compiled code passes the first argument in 'this'. 9 // ALL CAPS. The compiled code passes the first argument in 'this'.
10 10
11 11
12 // The following declarations are shared with other native JS files. 12 // The following declarations are shared with other native JS files.
13 // They are all declared at this one spot to avoid redeclaration errors. 13 // They are all declared at this one spot to avoid redeclaration errors.
14 14
15 (function(global, utils) { 15 (function(global, utils) {
16 16
17 %CheckIsBootstrapping(); 17 %CheckIsBootstrapping();
18 18
19 var FLAG_harmony_species; 19 var FLAG_harmony_species;
20 var GlobalArray = global.Array; 20 var GlobalArray = global.Array;
21 var GlobalBoolean = global.Boolean; 21 var GlobalBoolean = global.Boolean;
22 var GlobalString = global.String; 22 var GlobalString = global.String;
23 var MakeRangeError; 23 var MakeRangeError;
24 var MakeTypeError; 24 var MakeTypeError;
25 var speciesSymbol; 25 var speciesSymbol;
26 var iteratorSymbol
26 27
27 utils.Import(function(from) { 28 utils.Import(function(from) {
28 MakeRangeError = from.MakeRangeError; 29 MakeRangeError = from.MakeRangeError;
29 MakeTypeError = from.MakeTypeError; 30 MakeTypeError = from.MakeTypeError;
30 speciesSymbol = from.species_symbol; 31 speciesSymbol = from.species_symbol;
32 iteratorSymbol = from.iterator_symbol;
31 }); 33 });
32 34
33 utils.ImportFromExperimental(function(from) { 35 utils.ImportFromExperimental(function(from) {
34 FLAG_harmony_species = from.FLAG_harmony_species; 36 FLAG_harmony_species = from.FLAG_harmony_species;
35 }); 37 });
36 38
37 // ---------------------------------------------------------------------------- 39 // ----------------------------------------------------------------------------
38 40
39 /* ------------------------------------- 41 /* -------------------------------------
40 - - - C o n v e r s i o n s - - - 42 - - - C o n v e r s i o n s - - -
(...skipping 19 matching lines...) Expand all
60 function SameValueZero(x, y) { 62 function SameValueZero(x, y) {
61 if (typeof x !== typeof y) return false; 63 if (typeof x !== typeof y) return false;
62 if (IS_NUMBER(x)) { 64 if (IS_NUMBER(x)) {
63 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; 65 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true;
64 } 66 }
65 if (IS_SIMD_VALUE(x)) return %SimdSameValueZero(x, y); 67 if (IS_SIMD_VALUE(x)) return %SimdSameValueZero(x, y);
66 return x === y; 68 return x === y;
67 } 69 }
68 70
69 71
70 function ConcatIterableToArray(target, iterable) { 72 function ConcatIteratorToArray(target, iterator) {
71 var index = target.length; 73 var index = target.length;
74 var iterable = { [iteratorSymbol]() { return iterator; } };
72 for (var element of iterable) { 75 for (var element of iterable) {
73 AddIndexedProperty(target, index++, element); 76 AddIndexedProperty(target, index++, element);
74 } 77 }
75 return target; 78 return target;
76 } 79 }
77 80
78 81
79 /* --------------------------------- 82 /* ---------------------------------
80 - - - U t i l i t i e s - - - 83 - - - U t i l i t i e s - - -
81 --------------------------------- 84 ---------------------------------
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 to.AddIndexedProperty = AddIndexedProperty; 167 to.AddIndexedProperty = AddIndexedProperty;
165 to.MaxSimple = MaxSimple; 168 to.MaxSimple = MaxSimple;
166 to.MinSimple = MinSimple; 169 to.MinSimple = MinSimple;
167 to.SameValue = SameValue; 170 to.SameValue = SameValue;
168 to.SameValueZero = SameValueZero; 171 to.SameValueZero = SameValueZero;
169 to.ToPositiveInteger = ToPositiveInteger; 172 to.ToPositiveInteger = ToPositiveInteger;
170 to.SpeciesConstructor = SpeciesConstructor; 173 to.SpeciesConstructor = SpeciesConstructor;
171 }); 174 });
172 175
173 %InstallToContext([ 176 %InstallToContext([
174 "concat_iterable_to_array", ConcatIterableToArray, 177 "concat_iterator_to_array", ConcatIteratorToArray,
175 ]); 178 ]);
176 179
177 }) 180 })
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698