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 var $getHash; | 5 var $getHash; |
6 var $getExistingHash; | 6 var $getExistingHash; |
7 | 7 |
8 (function(global, utils) { | 8 (function(global, utils) { |
9 "use strict"; | 9 "use strict"; |
10 | 10 |
11 %CheckIsBootstrapping(); | 11 %CheckIsBootstrapping(); |
12 | 12 |
13 // ------------------------------------------------------------------- | 13 // ------------------------------------------------------------------- |
14 // Imports | 14 // Imports |
15 | 15 |
16 var GlobalMap = global.Map; | 16 var GlobalMap = global.Map; |
17 var GlobalObject = global.Object; | 17 var GlobalObject = global.Object; |
18 var GlobalSet = global.Set; | 18 var GlobalSet = global.Set; |
19 var hashCodeSymbol = utils.GetPrivateSymbol("hash_code_symbol"); | 19 var hashCodeSymbol = utils.ImportNow("hash_code_symbol"); |
20 var IntRandom; | 20 var IntRandom; |
| 21 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
21 | 22 |
22 utils.Import(function(from) { | 23 utils.Import(function(from) { |
23 IntRandom = from.IntRandom; | 24 IntRandom = from.IntRandom; |
24 }); | 25 }); |
25 | 26 |
26 var NumberIsNaN; | 27 var NumberIsNaN; |
27 | 28 |
28 utils.Import(function(from) { | 29 utils.Import(function(from) { |
29 NumberIsNaN = from.NumberIsNaN; | 30 NumberIsNaN = from.NumberIsNaN; |
30 }); | 31 }); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 %_CallFunction(new_receiver, key, key, this, f); | 264 %_CallFunction(new_receiver, key, key, this, f); |
264 } | 265 } |
265 } | 266 } |
266 | 267 |
267 // ------------------------------------------------------------------- | 268 // ------------------------------------------------------------------- |
268 | 269 |
269 %SetCode(GlobalSet, SetConstructor); | 270 %SetCode(GlobalSet, SetConstructor); |
270 %FunctionSetLength(GlobalSet, 0); | 271 %FunctionSetLength(GlobalSet, 0); |
271 %FunctionSetPrototype(GlobalSet, new GlobalObject()); | 272 %FunctionSetPrototype(GlobalSet, new GlobalObject()); |
272 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM); | 273 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM); |
273 %AddNamedProperty(GlobalSet.prototype, symbolToStringTag, "Set", | 274 %AddNamedProperty(GlobalSet.prototype, toStringTagSymbol, "Set", |
274 DONT_ENUM | READ_ONLY); | 275 DONT_ENUM | READ_ONLY); |
275 | 276 |
276 %FunctionSetLength(SetForEach, 1); | 277 %FunctionSetLength(SetForEach, 1); |
277 | 278 |
278 // Set up the non-enumerable functions on the Set prototype object. | 279 // Set up the non-enumerable functions on the Set prototype object. |
279 utils.InstallGetter(GlobalSet.prototype, "size", SetGetSize); | 280 utils.InstallGetter(GlobalSet.prototype, "size", SetGetSize); |
280 utils.InstallFunctions(GlobalSet.prototype, DONT_ENUM, [ | 281 utils.InstallFunctions(GlobalSet.prototype, DONT_ENUM, [ |
281 "add", SetAdd, | 282 "add", SetAdd, |
282 "has", SetHas, | 283 "has", SetHas, |
283 "delete", SetDelete, | 284 "delete", SetDelete, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 454 } |
454 } | 455 } |
455 | 456 |
456 // ------------------------------------------------------------------- | 457 // ------------------------------------------------------------------- |
457 | 458 |
458 %SetCode(GlobalMap, MapConstructor); | 459 %SetCode(GlobalMap, MapConstructor); |
459 %FunctionSetLength(GlobalMap, 0); | 460 %FunctionSetLength(GlobalMap, 0); |
460 %FunctionSetPrototype(GlobalMap, new GlobalObject()); | 461 %FunctionSetPrototype(GlobalMap, new GlobalObject()); |
461 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); | 462 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); |
462 %AddNamedProperty( | 463 %AddNamedProperty( |
463 GlobalMap.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY); | 464 GlobalMap.prototype, toStringTagSymbol, "Map", DONT_ENUM | READ_ONLY); |
464 | 465 |
465 %FunctionSetLength(MapForEach, 1); | 466 %FunctionSetLength(MapForEach, 1); |
466 | 467 |
467 // Set up the non-enumerable functions on the Map prototype object. | 468 // Set up the non-enumerable functions on the Map prototype object. |
468 utils.InstallGetter(GlobalMap.prototype, "size", MapGetSize); | 469 utils.InstallGetter(GlobalMap.prototype, "size", MapGetSize); |
469 utils.InstallFunctions(GlobalMap.prototype, DONT_ENUM, [ | 470 utils.InstallFunctions(GlobalMap.prototype, DONT_ENUM, [ |
470 "get", MapGet, | 471 "get", MapGet, |
471 "set", MapSet, | 472 "set", MapSet, |
472 "has", MapHas, | 473 "has", MapHas, |
473 "delete", MapDelete, | 474 "delete", MapDelete, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 "map_has", MapHas, | 509 "map_has", MapHas, |
509 "map_delete", MapDelete, | 510 "map_delete", MapDelete, |
510 "set_add", SetAdd, | 511 "set_add", SetAdd, |
511 "set_has", SetHas, | 512 "set_has", SetHas, |
512 "set_delete", SetDelete, | 513 "set_delete", SetDelete, |
513 "map_from_array", MapFromArray, | 514 "map_from_array", MapFromArray, |
514 "set_from_array",SetFromArray, | 515 "set_from_array",SetFromArray, |
515 ]); | 516 ]); |
516 | 517 |
517 }) | 518 }) |
OLD | NEW |