memop_bounds_check.js 853 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. function foo() {
  6. const size = 100;
  7. let a = new Array(size);
  8. let b = new Array(size);
  9. let c = new Array(size);
  10. let d = new Array(size);
  11. let e = new Array(size);
  12. a.fill(1);
  13. b.fill(1);
  14. c.fill(1);
  15. d.fill(1);
  16. // If the extracted bounds check are not removed and we do a memop.
  17. // This will throw an Uninitialized reg?
  18. for(let i = 0; i < size; ++i) {
  19. a[i] = b[i];
  20. c[i] = d[i];
  21. e[i] = 0;
  22. }
  23. }
  24. foo();
  25. foo();
  26. print("PASSED");