box_postjit.js 796 B

123456789101112131415161718192021
  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. // Compile with -mic:1 -forcedeferparse to generate jitted code with stack funcs and stack closures.
  6. // Then box after jitting and force jitted code to detect that it must allocate closures on heap.
  7. function outer() {
  8. WScript.Echo('outer');
  9. function inner() {
  10. return inner;
  11. }
  12. if (i) return inner();
  13. i++;
  14. }
  15. var i = 0;
  16. outer();
  17. outer();
  18. var f = outer();
  19. WScript.Echo(typeof f());