LargeAuxArray.js 965 B

12345678910111213141516171819202122232425262728
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. //Run with -nonative -BigDictionaryTypeHandlerThreshold:20
  6. var o = { };
  7. function AddAccessorProperty()
  8. {
  9. // add accessor property (converts to DictionaryTypeHandler)
  10. Object.defineProperty(o, "a", { get: function () { return 10; } , configurable: true} );
  11. }
  12. function AddPropertiesToObjectArray()
  13. {
  14. // add enough properties to convert to BigDictionaryTypeHandler
  15. for (var i = 0; i < 25; i++) {
  16. o["p" + i] = 0;
  17. }
  18. }
  19. AddAccessorProperty();
  20. AddPropertiesToObjectArray();
  21. AddAccessorProperty();
  22. WScript.Echo(o.a === 10 ? "PASSED" : "FAILED");