loopstslot.js 854 B

1234567891011121314151617181920212223
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. const buf = WebAssembly.wabt.convertWast2Wasm(`
  6. (module
  7. (global $x (mut i32) (i32.const -12))
  8. (func (export "stslot") (param i32)
  9. (loop
  10. (br_if 1 (i32.eqz (get_local 0)))
  11. (set_global $x (get_local 0))
  12. (set_global $x (get_local 0))
  13. (br 0)
  14. )
  15. )
  16. )`);
  17. const view = new Uint8Array(buf);
  18. var mod = new WebAssembly.Module(buf);
  19. var {stslot} = new WebAssembly.Instance(mod).exports;
  20. stslot(0);
  21. print("Pass");