Skip to content

Commit 52e4ba5

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[js] Add magic numbers around Smi range
V8 has lots of optimizations around smi ranges (e.g. untagging smis). Change-Id: I1393d1c30a61ef43d45f3ede4a74e6fe0b6c0e2d Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9111056 Reviewed-by: Darius Mercadier <dmercadier@google.com> Commit-Queue: Darius Mercadier <dmercadier@google.com> Commit-Queue: Matthias Liedtke <mliedtke@google.com> Auto-Submit: Matthias Liedtke <mliedtke@google.com>
1 parent cab3f42 commit 52e4ba5

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

Sources/Fuzzilli/Environment/JavaScriptEnvironment.swift

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,28 @@ public class JavaScriptEnvironment: ComponentBase {
2727

2828
// Integer values that are more likely to trigger edge-cases.
2929
public static let InterestingIntegers: [Int64] = [
30-
-9223372036854775808, -9223372036854775807, // Int64 min, mostly for BigInts
31-
-9007199254740992, -9007199254740991, -9007199254740990, // Smallest integer value that is still precisely representable by a double
32-
-4294967297, -4294967296, -4294967295, // Negative Uint32 max
33-
-2147483649, -2147483648, -2147483647, // Int32 min
34-
-1073741824, -536870912, -268435456, // -2**32 / {4, 8, 16}
35-
-65537, -65536, -65535, // -2**16
36-
-4096, -1024, -256, -128, // Other powers of two
37-
-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16, 64, // Numbers around 0
38-
127, 128, 129, // 2**7
39-
255, 256, 257, // 2**8
40-
512, 1000, 1024, 4096, 10000, // Misc numbers
41-
65535, 65536, 65537, // 2**16
42-
268435439, 268435440, 268435441, // V8 String kMaxLength (32-bit)
43-
536870887, 536870888, 536870889, // V8 String kMaxLength (64-bit)
44-
268435456, 536870912, 1073741824, // 2**32 / {4, 8, 16}
45-
1073741823, 1073741824, 1073741825, // 2**30
46-
2147483647, 2147483648, 2147483649, // Int32 max
47-
4294967295, 4294967296, 4294967297, // Uint32 max
48-
9007199254740990, 9007199254740991, 9007199254740992, // Biggest integer value that is still precisely representable by a double
49-
9223372036854775807, // Int64 max, mostly for BigInts
30+
-9223372036854775808, -9223372036854775807, // Int64 min, mostly for BigInts
31+
-9007199254740992, -9007199254740991, -9007199254740990, // Smallest integer value that is still precisely representable by a double
32+
-4294967297, -4294967296, -4294967295, // Negative Uint32 max
33+
-2147483649, -2147483648, -2147483647, // Int32 min
34+
-1073741824, -536870912, -268435456, // -2**32 / {4, 8, 16}
35+
-65537, -65536, -65535, // -2**16
36+
-4096, -1024, -256, -128, // Other powers of two
37+
-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16, 64, // Numbers around 0
38+
127, 128, 129, // 2**7
39+
255, 256, 257, // 2**8
40+
512, 1000, 1024, 4096, 10000, // Misc numbers
41+
65535, 65536, 65537, // 2**16
42+
268435439, 268435440, 268435441, // V8 String kMaxLength (32-bit)
43+
536870887, 536870888, 536870889, // V8 String kMaxLength (64-bit)
44+
268435456, 536870912, 1073741824, // 2**32 / {4, 8, 16}
45+
1073741823, 1073741824, 1073741825, // 2**30
46+
2147483647, 2147483648, 2147483649, // Int32 max
47+
4294967295, 4294967296, 4294967297, // Uint32 max
48+
9007199254740990, 9007199254740991, 9007199254740992, // Biggest integer value that is still precisely representable by a double
49+
9223372036854775807, // Int64 max, mostly for BigInts
50+
0x3ffffffc, 0x3ffffffe, 0x3fffffff, 0x40000000, 0x40000002, // Numbers around smi max (2^30 - 1)
51+
0xbffffffd, 0xbfffffff, 0xc0000000, 0xc0000001, 0xc0000003 // Numbers around Smi min (-2^30)
5052
]
5153

5254
static let wellKnownSymbols = ["iterator", "asyncIterator", "match", "matchAll", "replace", "search", "split", "hasInstance", "isConcatSpreadable", "unscopables", "species", "toPrimitive", "toStringTag", "dispose", "asyncDispose"]

0 commit comments

Comments
 (0)