Skip to content

Commit cb649fa

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[v8] Add %AllocationTimeout generator
Besides the existing --gc-interval=n flag, this can help finding bugs for a GC happening at a specific point in a builtin or runtime function. Bug: 467294029 Change-Id: I9d78d7d01d229ecd3e0c631f9d1e2f54a456b4ba Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/8832419 Reviewed-by: Michael Achenbach <machenbach@google.com> Commit-Queue: Matthias Liedtke <mliedtke@google.com>
1 parent e0c17b6 commit cb649fa

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Sources/FuzzilliCli/Profiles/V8CommonProfile.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public let V8GcGenerator = CodeGenerator("GcGenerator") { b in
5151
b.callFunction(gc, withArgs: b.findOrGenerateArguments(forSignature: b.fuzzer.environment.type(ofBuiltin: "gc").signature!))
5252
}
5353

54+
public let V8AllocationTimeoutGenerator = CodeGenerator("AllocationTimeoutGenerator") { b in
55+
// Repeated GCs are expensive, so only rarely use an interval.
56+
let interval = probability(0.1) ? Int64.random(in: 100...10000) : -1
57+
let timeout = Int64.random(in: 0...(Bool.random() ? 10 : 100)) // prefer small values
58+
b.eval("%SetAllocationTimeout(%@, %@)", with: [b.loadInt(interval), b.loadInt(timeout)]);
59+
}
60+
5461
public let V8MajorGcGenerator = CodeGenerator("MajorGcGenerator") { b in
5562
// Differently to `gc()`, this intrinsic is registered with less effects, preventing fewer
5663
// optimizations in V8's optimizing compilers.

Sources/FuzzilliCli/Profiles/V8Profile.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ let v8Profile = Profile(
6363

6464
(WorkerGenerator, 10),
6565
(V8GcGenerator, 5),
66+
(V8AllocationTimeoutGenerator, 5),
6667
(V8MajorGcGenerator, 5),
6768

6869
(WasmStructGenerator, 15),

0 commit comments

Comments
 (0)