relazify.js (889B)
1 // |jit-test| skip-if: isLcovEnabled() 2 3 load(libdir + 'bytecode-cache.js'); 4 var test = ""; 5 gczeal(0); 6 7 // Check that a GC can relazify decoded functions. 8 // 9 // Generations 0 and 3 are executed from the source, thus f is not executed yet. 10 // Generations 1 and 2 are decoded, thus we recorded the delazified f function. 11 test = ` 12 function f() { return 1; }; 13 assertEq(isLazyFunction(f), generation == 0 || generation == 3); 14 f(); 15 expect = isRelazifiableFunction(f); 16 assertEq(isLazyFunction(f), false); 17 `; 18 evalWithCache(test, { 19 checkAfter: function (ctx) { 20 relazifyFunctions(); // relazify f, if possible. 21 evaluate("assertEq(isLazyFunction(f), expect);", ctx); 22 } 23 }); 24 25 evalWithCache(test, { 26 collectDelazifications: true, 27 checkAfter: function (ctx) { 28 relazifyFunctions(); // relazify f, if possible. 29 evaluate("assertEq(isLazyFunction(f), expect);", ctx); 30 } 31 });