table.js 896 B

12345678910111213141516171819202122232425262728
  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. var mod = new WebAssembly.Module(readbuffer('table.wasm'));
  6. var a1 = new WebAssembly.Instance(mod, {"m" : {x : 10}}).exports;
  7. //local offset
  8. print(a1.call(1));
  9. print(a1.call(2));
  10. print(a1.call(3));
  11. print(a1.call(4));
  12. //global offset
  13. /* const global in init expr not supported in MVP
  14. print(a1.call(6));
  15. print(a1.call(7));
  16. print(a1.call(8));
  17. print(a1.call(9));
  18. */
  19. //imported global offset
  20. print(a1.call(10));
  21. print(a1.call(11));
  22. print(a1.call(12));
  23. print(a1.call(13));