js/src/jit-test/tests/saved-stacks/get-set.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/get-set.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +// Test that we can save stacks with getter and setter function frames.
     1.5 +
     1.6 +function assertStackLengthEq(stack, expectedLength) {
     1.7 +  let actual = 0;
     1.8 +  while (stack) {
     1.9 +    actual++;
    1.10 +    stack = stack.parent;
    1.11 +  }
    1.12 +  assertEq(actual, expectedLength);
    1.13 +}
    1.14 +
    1.15 +const get = { get s() { return saveStack(); } }.s;
    1.16 +assertStackLengthEq(get, 2);
    1.17 +
    1.18 +let set;
    1.19 +try {
    1.20 +  ({
    1.21 +    set s(v) {
    1.22 +      throw saveStack();
    1.23 +    }
    1.24 +  }).s = 1;
    1.25 +} catch (s) {
    1.26 +  set = s;
    1.27 +}
    1.28 +assertStackLengthEq(set, 2);

mercurial