OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
10 | 10 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 %SetCode($Set, SetConstructor); | 238 %SetCode($Set, SetConstructor); |
239 %FunctionSetPrototype($Set, new $Object()); | 239 %FunctionSetPrototype($Set, new $Object()); |
240 %AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM); | 240 %AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM); |
241 %AddNamedProperty( | 241 %AddNamedProperty( |
242 $Set.prototype, symbolToStringTag, "Set", DONT_ENUM | READ_ONLY); | 242 $Set.prototype, symbolToStringTag, "Set", DONT_ENUM | READ_ONLY); |
243 | 243 |
244 %FunctionSetLength(SetForEach, 1); | 244 %FunctionSetLength(SetForEach, 1); |
245 | 245 |
246 // Set up the non-enumerable functions on the Set prototype object. | 246 // Set up the non-enumerable functions on the Set prototype object. |
247 InstallGetter($Set.prototype, "size", SetGetSize); | 247 InstallGetter($Set.prototype, "size", SetGetSize); |
248 InstallFunctions($Set.prototype, DONT_ENUM, $Array( | 248 InstallFunctions($Set.prototype, DONT_ENUM, [ |
249 "add", SetAdd, | 249 "add", SetAdd, |
250 "has", SetHas, | 250 "has", SetHas, |
251 "delete", SetDelete, | 251 "delete", SetDelete, |
252 "clear", SetClearJS, | 252 "clear", SetClearJS, |
253 "forEach", SetForEach | 253 "forEach", SetForEach |
254 )); | 254 ]); |
255 | 255 |
256 | 256 |
257 // ------------------------------------------------------------------- | 257 // ------------------------------------------------------------------- |
258 // Harmony Map | 258 // Harmony Map |
259 | 259 |
260 function MapConstructor(iterable) { | 260 function MapConstructor(iterable) { |
261 if (!%_IsConstructCall()) { | 261 if (!%_IsConstructCall()) { |
262 throw MakeTypeError('constructor_not_function', ['Map']); | 262 throw MakeTypeError('constructor_not_function', ['Map']); |
263 } | 263 } |
264 | 264 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 %SetCode($Map, MapConstructor); | 426 %SetCode($Map, MapConstructor); |
427 %FunctionSetPrototype($Map, new $Object()); | 427 %FunctionSetPrototype($Map, new $Object()); |
428 %AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM); | 428 %AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM); |
429 %AddNamedProperty( | 429 %AddNamedProperty( |
430 $Map.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY); | 430 $Map.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY); |
431 | 431 |
432 %FunctionSetLength(MapForEach, 1); | 432 %FunctionSetLength(MapForEach, 1); |
433 | 433 |
434 // Set up the non-enumerable functions on the Map prototype object. | 434 // Set up the non-enumerable functions on the Map prototype object. |
435 InstallGetter($Map.prototype, "size", MapGetSize); | 435 InstallGetter($Map.prototype, "size", MapGetSize); |
436 InstallFunctions($Map.prototype, DONT_ENUM, $Array( | 436 InstallFunctions($Map.prototype, DONT_ENUM, [ |
437 "get", MapGet, | 437 "get", MapGet, |
438 "set", MapSet, | 438 "set", MapSet, |
439 "has", MapHas, | 439 "has", MapHas, |
440 "delete", MapDelete, | 440 "delete", MapDelete, |
441 "clear", MapClearJS, | 441 "clear", MapClearJS, |
442 "forEach", MapForEach | 442 "forEach", MapForEach |
443 )); | 443 ]); |
444 | 444 |
445 })(); | 445 })(); |
OLD | NEW |