ObjectHeaderInlining.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. //flags : -off:simplejit -mic:1
  6. function TwoProperty(p, q) {
  7. this.p = p;
  8. this.q = q;
  9. }
  10. function OneProperty(x){
  11. this.x = x;
  12. }
  13. function CreateTwoPropertyObj()
  14. {
  15. var a = new TwoProperty(2, 3);
  16. return a;
  17. }
  18. function CreateOnePropertyObj()
  19. {
  20. var a = new OneProperty(4)
  21. return a;
  22. }
  23. function grow(a, r, s)
  24. {
  25. a.r = r;
  26. a.s = s;
  27. }
  28. var obj;
  29. var obj1;
  30. for(i = 0; i < 5; i++)
  31. {
  32. obj = CreateTwoPropertyObj();
  33. obj1 = CreateOnePropertyObj();
  34. }
  35. //Try grow and overwrite properties.
  36. grow(obj, 10, 20);
  37. obj = CreateTwoPropertyObj();
  38. grow(obj, 10, 20);
  39. obj = CreateTwoPropertyObj();
  40. grow(obj, 10, 20);
  41. WScript.Echo(obj.p);
  42. WScript.Echo(obj.q);
  43. WScript.Echo(obj.r);
  44. WScript.Echo(obj.s);
  45. WScript.Echo(obj1.x);