summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/cacheir/bug1651732-ionic-getprop-super.js
blob: a64e2aabb0cc54a4d6f55e1db7e0f55c66e8798e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Base {
  static a = 0;
  static [Symbol.iterator] = 0;
}

class Derived extends Base {
  static m(key) {
    // Attach an IC through IonGetPropSuperIC.
    return super[key];
  }
}

var key = {
  value: "a",

  [Symbol.toPrimitive]() {
    return this.value;
  }
};

for (var i = 0; i < 100; ++i) {
  // Change key[Symbol.toPrimitive] to return a symbol after some warm-up.
  if (i > 80) {
    key.value = Symbol.iterator;
  }

  assertEq(Derived.m(key), 0);
}