js/src/jit-test/tests/saved-stacks/self-hosted.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/saved-stacks/self-hosted.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +// Test that we can save stacks with self-hosted function frames in them.
     1.5 +
     1.6 +const map = (function () {
     1.7 +  return [3].map(n => saveStack()).pop();
     1.8 +}());
     1.9 +
    1.10 +assertEq(map.parent.functionDisplayName, "map");
    1.11 +assertEq(map.parent.source, "self-hosted");
    1.12 +
    1.13 +const reduce = (function () {
    1.14 +  return [3].reduce(() => saveStack(), 3);
    1.15 +}());
    1.16 +
    1.17 +assertEq(reduce.parent.functionDisplayName, "reduce");
    1.18 +assertEq(reduce.parent.source, "self-hosted");
    1.19 +
    1.20 +const forEach = (function () {
    1.21 +  try {
    1.22 +    [3].forEach(n => { throw saveStack() });
    1.23 +  } catch (s) {
    1.24 +    return s;
    1.25 +  }
    1.26 +}());
    1.27 +
    1.28 +assertEq(forEach.parent.functionDisplayName, "forEach");
    1.29 +assertEq(forEach.parent.source, "self-hosted");

mercurial