memop_slot.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. const size = 100;
  6. function foo() {
  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. e.fill(1);
  17. validSlotMemop = function() {
  18. let cl = c.length;
  19. total = 0;
  20. let _c = c, _d = d;
  21. // This is valid
  22. for(let i = 0; i < cl; ++i) {
  23. _c[i] = _d[i];
  24. }
  25. };
  26. return function slotMemop() {
  27. let al = a.length;
  28. total = 0;
  29. // Right now this is invalid
  30. for(let i = 0; i < al; ++i) {
  31. a[i] = b[i];
  32. e[i] = 0;
  33. }
  34. validSlotMemop();
  35. };
  36. }
  37. const f = foo();
  38. f();
  39. f();
  40. print("PASSED");