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 $iteratorCreateResultObject; |
6 var $arrayValues; | 6 var $arrayValues; |
7 | 7 |
8 (function() { | 8 (function() { |
9 | 9 |
10 "use strict"; | 10 "use strict"; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); | 121 return CreateArrayIterator(this, ITERATOR_KIND_KEYS); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 %FunctionSetPrototype(ArrayIterator, new GlobalObject()); | 125 %FunctionSetPrototype(ArrayIterator, new GlobalObject()); |
126 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); | 126 %FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); |
127 | 127 |
128 InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [ | 128 InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [ |
129 'next', ArrayIteratorNext | 129 'next', ArrayIteratorNext |
130 ]); | 130 ]); |
131 %FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]'); | 131 SetFunctionName(ArrayIteratorIterator, symbolIterator); |
132 %AddNamedProperty(ArrayIterator.prototype, symbolIterator, | 132 %AddNamedProperty(ArrayIterator.prototype, symbolIterator, |
133 ArrayIteratorIterator, DONT_ENUM); | 133 ArrayIteratorIterator, DONT_ENUM); |
134 %AddNamedProperty(ArrayIterator.prototype, symbolToStringTag, | 134 %AddNamedProperty(ArrayIterator.prototype, symbolToStringTag, |
135 "Array Iterator", READ_ONLY | DONT_ENUM); | 135 "Array Iterator", READ_ONLY | DONT_ENUM); |
136 | 136 |
137 InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ | 137 InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ |
138 // No 'values' since it breaks webcompat: http://crbug.com/409858 | 138 // No 'values' since it breaks webcompat: http://crbug.com/409858 |
139 'entries', ArrayEntries, | 139 'entries', ArrayEntries, |
140 'keys', ArrayKeys | 140 'keys', ArrayKeys |
141 ]); | 141 ]); |
142 | 142 |
143 %AddNamedProperty(GlobalArray.prototype, symbolIterator, ArrayValues, | 143 %AddNamedProperty(GlobalArray.prototype, symbolIterator, ArrayValues, |
144 DONT_ENUM); | 144 DONT_ENUM); |
145 | 145 |
146 macro EXTEND_TYPED_ARRAY(NAME) | 146 macro EXTEND_TYPED_ARRAY(NAME) |
147 %AddNamedProperty(GlobalNAME.prototype, 'entries', ArrayEntries, DONT_ENUM); | 147 %AddNamedProperty(GlobalNAME.prototype, 'entries', ArrayEntries, DONT_ENUM); |
148 %AddNamedProperty(GlobalNAME.prototype, 'values', ArrayValues, DONT_ENUM); | 148 %AddNamedProperty(GlobalNAME.prototype, 'values', ArrayValues, DONT_ENUM); |
149 %AddNamedProperty(GlobalNAME.prototype, 'keys', ArrayKeys, DONT_ENUM); | 149 %AddNamedProperty(GlobalNAME.prototype, 'keys', ArrayKeys, DONT_ENUM); |
150 %AddNamedProperty(GlobalNAME.prototype, symbolIterator, ArrayValues, | 150 %AddNamedProperty(GlobalNAME.prototype, symbolIterator, ArrayValues, |
151 DONT_ENUM); | 151 DONT_ENUM); |
152 endmacro | 152 endmacro |
153 | 153 |
154 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 154 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
155 | 155 |
156 $iteratorCreateResultObject = CreateIteratorResultObject; | 156 $iteratorCreateResultObject = CreateIteratorResultObject; |
157 $arrayValues = ArrayValues; | 157 $arrayValues = ArrayValues; |
158 | 158 |
159 })(); | 159 })(); |
OLD | NEW |