diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/ion/recover-lambdas.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/ion/recover-lambdas.js')
-rw-r--r-- | js/src/jit-test/tests/ion/recover-lambdas.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/recover-lambdas.js b/js/src/jit-test/tests/ion/recover-lambdas.js new file mode 100644 index 000000000..08bf2f81f --- /dev/null +++ b/js/src/jit-test/tests/ion/recover-lambdas.js @@ -0,0 +1,56 @@ + +var max = 40; +setJitCompilerOption("ion.warmup.trigger", max - 10); + +// This function is used to escape "g" which is a non-escaped inner function. +// As it is not escaped within "f", the lambda for "g" would be computed on the +// bailout path. Resolving the first ".caller" implies that we have to recover +// the lambda. Resolving the second ".caller" is needed such as we can build the +// test case without explicitly escaping "g", which would prevent this +// optimization. + +function return_f(i) { + if (i != max - 1) + return f; + + // return_f.caller == g + // return_f.caller.caller == f + return return_f.caller.caller; +} + +function f(i) { + function g() { + return return_f(i); + } + + assertRecoveredOnBailout(g, true); + return g(); +} + +// This function is used to cause an invalidation after having removed a branch. +// These functions are used to check if we correctly recover the lambda +// and its environment during a bailout. +var uceFault = function (i) { + if (i == max - 1) + uceFault = function (i) { return true; }; + return false; +}; + +var uceFault_lambdaCall = eval(uneval(uceFault).replace('uceFault', 'uceFault_lambdaCall')); +function lambdaCall(i) { + function g() { + return i; + } + + if (uceFault_lambdaCall(i) || uceFault_lambdaCall(i)) + assertEq(g(), i); + + assertRecoveredOnBailout(g, true); +}; + + + +for (var i = 0; i < max; i++) { + assertEq(f(i), f); + lambdaCall(i); +} |