TryGrowHeadSegmentBug.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. //Bug number 101772
  6. //flags: -forcejitloopbody -ForceArrayBTree -off:ArrayCheckHoist
  7. var debugOn = false //if this test fails turn this flag on and see if the array is correct
  8. function test0() {
  9. var ary = new Array(10);
  10. if(debugOn)
  11. {
  12. WScript.Echo("Contents of ary: ",ary.valueOf());
  13. WScript.Echo("Size of ary: ",ary.length);
  14. }
  15. for(var i = 0; i < 2;i++) // looks like just starting a loop is the problem
  16. {
  17. ary.indexOf();
  18. ary[11] = 1;
  19. ary[12] = 2;
  20. if(debugOn)
  21. {
  22. WScript.Echo("assign index 11 to 1. is it actually set:",ary[11]);
  23. WScript.Echo("assign index 12 to 2. is it actually set:",ary[12]);
  24. }
  25. }
  26. if(debugOn)
  27. {
  28. WScript.Echo("After Loop");
  29. WScript.Echo("is index 12 still 2? It is actually :",ary[12]);
  30. WScript.Echo("Contents of ary: ",ary.valueOf());
  31. WScript.Echo("Size of ary: ",ary.length);
  32. }
  33. ary[15] = 5; //if 26 this will pass
  34. if(debugOn)
  35. {
  36. WScript.Echo("assign index 15 to 5. is it actually set:",ary[15]);
  37. WScript.Echo("Contents of ary: ",ary.valueOf());
  38. WScript.Echo("Size of ary: ",ary.length);
  39. }
  40. }
  41. test0();
  42. WScript.Echo("PASS");