]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/dfg-put-by-val-direct-with-edge-numbers.js
1 // Test that a object accepts DFG PutByValueDirect operation with edge numbers.
3 function lookupWithKey(key
) {
9 noInline(lookupWithKey
);
11 for (var i
= 0; i
< 10000; ++i
) {
14 -0x80000001, // out of int32_t
15 -0x80000000, // int32_t min
19 0x7fffffff, // int32_t max
20 0x80000000, // out of int32_t
21 0xfffffffd, // less than array max in JSObject
22 0xfffffffe, // array max in JSObject
23 0xffffffff, // uint32_t max, not array index
24 0x100000000, // out of uint32_t
26 // stringified integers
27 (-0x80000001).toString(), // out of int32_t
28 (-0x80000000).toString(), // int32_t min
29 (-1).toString(), // negative
30 (0).toString(), // zero
31 (1).toString(), // positive
32 (0x7fffffff).toString(), // int32_t max
33 (0x80000000).toString(), // out of int32_t
34 (0xfffffffd).toString(), // less than array max in JSObject
35 (0xfffffffe).toString(), // array max in JSObject
36 (0xffffffff).toString(), // (uint32_t max).toString()
37 (0x100000000).toString(), // out of uint32_t
42 Number
.MIN_SAFE_INTEGER
,
43 Number
.MAX_SAFE_INTEGER
,
44 Number
.POSITIVE_INFINITY
,
45 Number
.NEGATIVE_INFINITY
,
54 0x80000000 + 0.5, // out of int32_t, double
57 (Number
.MIN_VALUE
).toString(),
58 (Number
.MAX_VALUE
).toString(),
59 (Number
.MIN_SAFE_INTEGER
).toString(),
60 (Number
.MAX_SAFE_INTEGER
).toString(),
61 (Number
.POSITIVE_INFINITY
).toString(),
62 (Number
.NEGATIVE_INFINITY
).toString(),
64 (Number
.EPSILON
).toString(),
71 (0x80000000 + 0.5).toString()
72 ].forEach(function (key
) {
73 var value
= lookupWithKey(key
);
75 throw new Error('bad value: ' + value
);
79 function lookupWithKey2(key
) {
85 noInline(lookupWithKey2
);
87 var toStringThrowsError
= {
88 toString: function () {
89 throw new Error('ng');
93 for (var i
= 0; i
< 10000; ++i
) {
96 lookupWithKey2(toStringThrowsError
);
101 throw new Error('not thrown');
102 if (String(error
) !== 'Error: ng')
103 throw new Error('bad error: ' + String(error
));