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