[JSC] AI should not propagate AbstractValue relying on constant folding phase
[WebKit-https.git] / JSTests / stress / big-int-bitwise-and-wrapped-value.js
1 //@ runBigIntEnabled
2
3 assert = {
4     sameValue: function (input, expected, message) {
5         if (input !== expected)
6             throw new Error(message);
7     }
8 };
9
10 function testBitAnd(x, y, z, message) {
11     assert.sameValue(x & y, z, message);
12     assert.sameValue(y & x, z, message);
13 }
14
15 testBitAnd(Object(0b10n), 0b01n, 0b00n, "ToPrimitive: unbox object with internal slot");
16
17 let o = {
18     [Symbol.toPrimitive]: function() {
19         return 0b10n;
20     }
21 };
22 testBitAnd(o, 0b01n, 0b00n, "ToPrimitive: @@toPrimitive");
23
24 o = {
25     valueOf: function() {
26         return 0b10n;
27     }
28 };
29 testBitAnd(o, 0b01n, 0b00n, "ToPrimitive: valueOf");
30
31 o = {
32     toString: function() {
33         return 0b10n;
34     }
35 }
36 testBitAnd(o, 0b01n, 0b00n, "ToPrimitive: toString");
37