OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 | 7 |
8 // This file relies on the fact that the following declaration has been made | 8 // This file relies on the fact that the following declaration has been made |
9 // in runtime.js: | 9 // in runtime.js: |
10 // var $Set = global.Set; | 10 // var $Set = global.Set; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return new SetIterator(this, ITERATOR_KIND_VALUES); | 63 return new SetIterator(this, ITERATOR_KIND_VALUES); |
64 } | 64 } |
65 | 65 |
66 | 66 |
67 function SetUpSetIterator() { | 67 function SetUpSetIterator() { |
68 %CheckIsBootstrapping(); | 68 %CheckIsBootstrapping(); |
69 | 69 |
70 %SetCode(SetIterator, SetIteratorConstructor); | 70 %SetCode(SetIterator, SetIteratorConstructor); |
71 %FunctionSetPrototype(SetIterator, new $Object()); | 71 %FunctionSetPrototype(SetIterator, new $Object()); |
72 %FunctionSetInstanceClassName(SetIterator, 'Set Iterator'); | 72 %FunctionSetInstanceClassName(SetIterator, 'Set Iterator'); |
73 InstallFunctions(SetIterator.prototype, DONT_ENUM, $Array( | 73 InstallFunctions(SetIterator.prototype, DONT_ENUM, [ |
74 'next', SetIteratorNextJS | 74 'next', SetIteratorNextJS |
75 )); | 75 ]); |
76 | 76 |
77 %FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]'); | 77 %FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]'); |
78 %AddNamedProperty(SetIterator.prototype, symbolIterator, | 78 %AddNamedProperty(SetIterator.prototype, symbolIterator, |
79 SetIteratorSymbolIterator, DONT_ENUM); | 79 SetIteratorSymbolIterator, DONT_ENUM); |
80 %AddNamedProperty(SetIterator.prototype, symbolToStringTag, | 80 %AddNamedProperty(SetIterator.prototype, symbolToStringTag, |
81 "Set Iterator", READ_ONLY | DONT_ENUM); | 81 "Set Iterator", READ_ONLY | DONT_ENUM); |
82 } | 82 } |
83 | 83 |
84 SetUpSetIterator(); | 84 SetUpSetIterator(); |
85 | 85 |
86 | 86 |
87 function ExtendSetPrototype() { | 87 function ExtendSetPrototype() { |
88 %CheckIsBootstrapping(); | 88 %CheckIsBootstrapping(); |
89 | 89 |
90 InstallFunctions($Set.prototype, DONT_ENUM, $Array( | 90 InstallFunctions($Set.prototype, DONT_ENUM, [ |
91 'entries', SetEntries, | 91 'entries', SetEntries, |
92 'keys', SetValues, | 92 'keys', SetValues, |
93 'values', SetValues | 93 'values', SetValues |
94 )); | 94 ]); |
95 | 95 |
96 %AddNamedProperty($Set.prototype, symbolIterator, SetValues, DONT_ENUM); | 96 %AddNamedProperty($Set.prototype, symbolIterator, SetValues, DONT_ENUM); |
97 } | 97 } |
98 | 98 |
99 ExtendSetPrototype(); | 99 ExtendSetPrototype(); |
100 | 100 |
101 | 101 |
102 | 102 |
103 function MapIteratorConstructor(map, kind) { | 103 function MapIteratorConstructor(map, kind) { |
104 %MapIteratorInitialize(this, map, kind); | 104 %MapIteratorInitialize(this, map, kind); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return new MapIterator(this, ITERATOR_KIND_VALUES); | 162 return new MapIterator(this, ITERATOR_KIND_VALUES); |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 function SetUpMapIterator() { | 166 function SetUpMapIterator() { |
167 %CheckIsBootstrapping(); | 167 %CheckIsBootstrapping(); |
168 | 168 |
169 %SetCode(MapIterator, MapIteratorConstructor); | 169 %SetCode(MapIterator, MapIteratorConstructor); |
170 %FunctionSetPrototype(MapIterator, new $Object()); | 170 %FunctionSetPrototype(MapIterator, new $Object()); |
171 %FunctionSetInstanceClassName(MapIterator, 'Map Iterator'); | 171 %FunctionSetInstanceClassName(MapIterator, 'Map Iterator'); |
172 InstallFunctions(MapIterator.prototype, DONT_ENUM, $Array( | 172 InstallFunctions(MapIterator.prototype, DONT_ENUM, [ |
173 'next', MapIteratorNextJS | 173 'next', MapIteratorNextJS |
174 )); | 174 ]); |
175 | 175 |
176 %FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]'); | 176 %FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]'); |
177 %AddNamedProperty(MapIterator.prototype, symbolIterator, | 177 %AddNamedProperty(MapIterator.prototype, symbolIterator, |
178 MapIteratorSymbolIterator, DONT_ENUM); | 178 MapIteratorSymbolIterator, DONT_ENUM); |
179 %AddNamedProperty(MapIterator.prototype, symbolToStringTag, | 179 %AddNamedProperty(MapIterator.prototype, symbolToStringTag, |
180 "Map Iterator", READ_ONLY | DONT_ENUM); | 180 "Map Iterator", READ_ONLY | DONT_ENUM); |
181 } | 181 } |
182 | 182 |
183 SetUpMapIterator(); | 183 SetUpMapIterator(); |
184 | 184 |
185 | 185 |
186 function ExtendMapPrototype() { | 186 function ExtendMapPrototype() { |
187 %CheckIsBootstrapping(); | 187 %CheckIsBootstrapping(); |
188 | 188 |
189 InstallFunctions($Map.prototype, DONT_ENUM, $Array( | 189 InstallFunctions($Map.prototype, DONT_ENUM, [ |
190 'entries', MapEntries, | 190 'entries', MapEntries, |
191 'keys', MapKeys, | 191 'keys', MapKeys, |
192 'values', MapValues | 192 'values', MapValues |
193 )); | 193 ]); |
194 | 194 |
195 %AddNamedProperty($Map.prototype, symbolIterator, MapEntries, DONT_ENUM); | 195 %AddNamedProperty($Map.prototype, symbolIterator, MapEntries, DONT_ENUM); |
196 } | 196 } |
197 | 197 |
198 ExtendMapPrototype(); | 198 ExtendMapPrototype(); |
OLD | NEW |