Debian Codegraph @

js/src/jit-test/tests/ion/bug1123064.js

raw
1
2
3 function toint32() {
4
5 // The test case to trigger MToNumberInt32 operation.
6 var ToInteger = getSelfHostedValue("ToInteger");
7
8 // Case1: The input operand is constant int32.
9 var result = ToInteger(1);
10 assertEq(result, 1);
11
12 // Case2: The input operand is constant double.
13 result = ToInteger(0.12);
14 assertEq(result, 0);
15
16 // Case3: The input operand is constant float.
17 result = ToInteger(Math.fround(0.13));
18 assertEq(result, 0);
19
20 // Case4: The input operand is constant boolean.
21 result = ToInteger(true);
22 assertEq(result, 1);
23
24 // Case5: The input operand is null.
25 result = ToInteger(null);
26 assertEq(result, 0);
27 }
28
29 toint32();
30 toint32();