FixedDataPolymorphism.js 760 B

12345678910111213141516171819202122232425
  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. function test4()
  6. {
  7. //Polymorphic Object Reference.
  8. //Obj.C is a property on the prototype and will only get optimized.
  9. return obj.C + obj.F;
  10. }
  11. var obj = {D:5,F:2};
  12. Object.prototype.C = 10;
  13. WScript.Echo(test4());
  14. obj.B = 5;
  15. WScript.Echo(test4());
  16. //JIT - Polymorphic Fixed Field for LdRootFld
  17. WScript.Echo(test4());
  18. obj.C = 99;
  19. WScript.Echo(test4());