OLD | NEW |
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 var $iteratorCreateResultObject; | |
6 var $arrayValues; | 5 var $arrayValues; |
7 | 6 |
8 (function(global, utils) { | 7 (function(global, utils) { |
9 | 8 |
10 "use strict"; | 9 "use strict"; |
11 | 10 |
12 %CheckIsBootstrapping(); | 11 %CheckIsBootstrapping(); |
13 | 12 |
14 var GlobalArray = global.Array; | 13 var GlobalArray = global.Array; |
15 | 14 |
(...skipping 101 matching lines...) Loading... |
117 | 116 |
118 | 117 |
119 function ArrayKeys() { | 118 function ArrayKeys() { |
120 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); | 119 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); |
121 } | 120 } |
122 | 121 |
123 | 122 |
124 %FunctionSetPrototype(ArrayIterator, {__proto__: $iteratorPrototype}); | 123 %FunctionSetPrototype(ArrayIterator, {__proto__: $iteratorPrototype}); |
125 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); | 124 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); |
126 | 125 |
127 $installFunctions(ArrayIterator.prototype, DONT_ENUM, [ | 126 utils.InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [ |
128 'next', ArrayIteratorNext | 127 'next', ArrayIteratorNext |
129 ]); | 128 ]); |
130 $setFunctionName(ArrayIteratorIterator, symbolIterator); | 129 utils.SetFunctionName(ArrayIteratorIterator, symbolIterator); |
131 %AddNamedProperty(ArrayIterator.prototype, symbolIterator, | 130 %AddNamedProperty(ArrayIterator.prototype, symbolIterator, |
132 ArrayIteratorIterator, DONT_ENUM); | 131 ArrayIteratorIterator, DONT_ENUM); |
133 %AddNamedProperty(ArrayIterator.prototype, symbolToStringTag, | 132 %AddNamedProperty(ArrayIterator.prototype, symbolToStringTag, |
134 "Array Iterator", READ_ONLY | DONT_ENUM); | 133 "Array Iterator", READ_ONLY | DONT_ENUM); |
135 | 134 |
136 $installFunctions(GlobalArray.prototype, DONT_ENUM, [ | 135 utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ |
137 // No 'values' since it breaks webcompat: http://crbug.com/409858 | 136 // No 'values' since it breaks webcompat: http://crbug.com/409858 |
138 'entries', ArrayEntries, | 137 'entries', ArrayEntries, |
139 'keys', ArrayKeys | 138 'keys', ArrayKeys |
140 ]); | 139 ]); |
141 | 140 |
142 %AddNamedProperty(GlobalArray.prototype, symbolIterator, ArrayValues, | 141 %AddNamedProperty(GlobalArray.prototype, symbolIterator, ArrayValues, |
143 DONT_ENUM); | 142 DONT_ENUM); |
144 | 143 |
145 macro EXTEND_TYPED_ARRAY(NAME) | 144 macro EXTEND_TYPED_ARRAY(NAME) |
146 %AddNamedProperty(GlobalNAME.prototype, 'entries', ArrayEntries, DONT_ENUM); | 145 %AddNamedProperty(GlobalNAME.prototype, 'entries', ArrayEntries, DONT_ENUM); |
147 %AddNamedProperty(GlobalNAME.prototype, 'values', ArrayValues, DONT_ENUM); | 146 %AddNamedProperty(GlobalNAME.prototype, 'values', ArrayValues, DONT_ENUM); |
148 %AddNamedProperty(GlobalNAME.prototype, 'keys', ArrayKeys, DONT_ENUM); | 147 %AddNamedProperty(GlobalNAME.prototype, 'keys', ArrayKeys, DONT_ENUM); |
149 %AddNamedProperty(GlobalNAME.prototype, symbolIterator, ArrayValues, | 148 %AddNamedProperty(GlobalNAME.prototype, symbolIterator, ArrayValues, |
150 DONT_ENUM); | 149 DONT_ENUM); |
151 endmacro | 150 endmacro |
152 | 151 |
153 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 152 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
154 | 153 |
155 $iteratorCreateResultObject = CreateIteratorResultObject; | 154 // ------------------------------------------------------------------- |
| 155 // Exports |
| 156 |
| 157 utils.Export(function(to) { |
| 158 to.ArrayIteratorCreateResultObject = CreateIteratorResultObject; |
| 159 }); |
| 160 |
156 $arrayValues = ArrayValues; | 161 $arrayValues = ArrayValues; |
157 | 162 |
158 }) | 163 }) |
OLD | NEW |