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/array-iterator.js

Issue 1411653002: Install iterator meta objects via utils object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 years, 2 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/js/array.js ('k') | src/js/collection.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 // ----------------------------------------------------------------------- 11 // -----------------------------------------------------------------------
12 // Imports 12 // Imports
13 13
14 var arrayIterationKindSymbol = 14 var arrayIterationKindSymbol =
15 utils.ImportNow("array_iteration_kind_symbol"); 15 utils.ImportNow("array_iteration_kind_symbol");
16 var arrayIteratorNextIndexSymbol = 16 var arrayIteratorNextIndexSymbol =
17 utils.ImportNow("array_iterator_next_symbol"); 17 utils.ImportNow("array_iterator_next_symbol");
18 var arrayIteratorObjectSymbol = 18 var arrayIteratorObjectSymbol =
19 utils.ImportNow("array_iterator_object_symbol"); 19 utils.ImportNow("array_iterator_object_symbol");
20 var GlobalArray = global.Array; 20 var GlobalArray = global.Array;
21 var IteratorPrototype = utils.ImportNow("IteratorPrototype");
21 var iteratorSymbol = utils.ImportNow("iterator_symbol"); 22 var iteratorSymbol = utils.ImportNow("iterator_symbol");
22 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 23 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
23 24
24 macro TYPED_ARRAYS(FUNCTION) 25 macro TYPED_ARRAYS(FUNCTION)
25 FUNCTION(Uint8Array) 26 FUNCTION(Uint8Array)
26 FUNCTION(Int8Array) 27 FUNCTION(Int8Array)
27 FUNCTION(Uint16Array) 28 FUNCTION(Uint16Array)
28 FUNCTION(Int16Array) 29 FUNCTION(Int16Array)
29 FUNCTION(Uint32Array) 30 FUNCTION(Uint32Array)
30 FUNCTION(Int32Array) 31 FUNCTION(Int32Array)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 function ArrayValues() { 115 function ArrayValues() {
115 return CreateArrayIterator(this, ITERATOR_KIND_VALUES); 116 return CreateArrayIterator(this, ITERATOR_KIND_VALUES);
116 } 117 }
117 118
118 119
119 function ArrayKeys() { 120 function ArrayKeys() {
120 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); 121 return CreateArrayIterator(this, ITERATOR_KIND_KEYS);
121 } 122 }
122 123
123 124
124 %FunctionSetPrototype(ArrayIterator, {__proto__: $iteratorPrototype}); 125 %FunctionSetPrototype(ArrayIterator, {__proto__: IteratorPrototype});
125 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); 126 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator');
126 127
127 utils.InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [ 128 utils.InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [
128 'next', ArrayIteratorNext 129 'next', ArrayIteratorNext
129 ]); 130 ]);
130 utils.SetFunctionName(ArrayIteratorIterator, iteratorSymbol); 131 utils.SetFunctionName(ArrayIteratorIterator, iteratorSymbol);
131 %AddNamedProperty(ArrayIterator.prototype, iteratorSymbol, 132 %AddNamedProperty(ArrayIterator.prototype, iteratorSymbol,
132 ArrayIteratorIterator, DONT_ENUM); 133 ArrayIteratorIterator, DONT_ENUM);
133 %AddNamedProperty(ArrayIterator.prototype, toStringTagSymbol, 134 %AddNamedProperty(ArrayIterator.prototype, toStringTagSymbol,
134 "Array Iterator", READ_ONLY | DONT_ENUM); 135 "Array Iterator", READ_ONLY | DONT_ENUM);
(...skipping 28 matching lines...) Expand all
163 to.ArrayValues = ArrayValues; 164 to.ArrayValues = ArrayValues;
164 }); 165 });
165 166
166 %InstallToContext([ 167 %InstallToContext([
167 "array_keys_iterator", ArrayKeys, 168 "array_keys_iterator", ArrayKeys,
168 "array_values_iterator", ArrayValues, 169 "array_values_iterator", ArrayValues,
169 "array_entries_iterator", ArrayEntries 170 "array_entries_iterator", ArrayEntries
170 ]); 171 ]);
171 172
172 }) 173 })
OLDNEW
« no previous file with comments | « src/js/array.js ('k') | src/js/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698