Skip to content

Commit e270121

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[js] Improve labels for ProgramBuilder.reassign
Change-Id: If51387c564c5c4245d23122be751ce46682b0fee Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9159756 Commit-Queue: Matthias Liedtke <mliedtke@google.com> Reviewed-by: Marja Hölttä <marja@chromium.org> Auto-Submit: Matthias Liedtke <mliedtke@google.com>
1 parent 2d85538 commit e270121

File tree

8 files changed

+127
-127
lines changed

8 files changed

+127
-127
lines changed

Sources/Fuzzilli/Base/ProgramBuilder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,17 +3200,17 @@ public class ProgramBuilder {
32003200
return emit(TernaryOperation(), withInputs: [condition, lhs, rhs]).output
32013201
}
32023202

3203-
public func reassign(_ output: Variable, to input: Variable, with op: BinaryOperator) {
3204-
emit(Update(op), withInputs: [output, input])
3203+
public func reassign(variable: Variable, value: Variable, with op: BinaryOperator) {
3204+
emit(Update(op), withInputs: [variable, value])
32053205
}
32063206

32073207
@discardableResult
32083208
public func dup(_ v: Variable) -> Variable {
32093209
return emit(Dup(), withInputs: [v]).output
32103210
}
32113211

3212-
public func reassign(_ output: Variable, to input: Variable) {
3213-
emit(Reassign(), withInputs: [output, input])
3212+
public func reassign(variable: Variable, value: Variable) {
3213+
emit(Reassign(), withInputs: [variable, value])
32143214
}
32153215

32163216
@discardableResult

Sources/Fuzzilli/CodeGen/CodeGenerators.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ public let CodeGenerators: [CodeGenerator] = [
14201420
CodeGenerator("BuiltinOverwriteGenerator", inputs: .one) { b, value in
14211421
let builtin = b.createNamedVariable(
14221422
b.randomBuiltin(), declarationMode: .none)
1423-
b.reassign(builtin, to: value)
1423+
b.reassign(variable: builtin, value: value)
14241424
},
14251425

14261426
CodeGenerator("PlainFunctionGenerator", [
@@ -2104,7 +2104,7 @@ public let CodeGenerators: [CodeGenerator] = [
21042104
CodeGenerator("UpdateGenerator", inputs: .one) { b, v in
21052105
let newValue = b.randomVariable(forUseAs: b.type(of: v))
21062106
b.reassign(
2107-
newValue, to: v, with: chooseUniform(from: BinaryOperator.allCases))
2107+
variable: newValue, value: v, with: chooseUniform(from: BinaryOperator.allCases))
21082108
},
21092109

21102110
CodeGenerator("DupGenerator") { b in
@@ -2114,7 +2114,7 @@ public let CodeGenerators: [CodeGenerator] = [
21142114
CodeGenerator("ReassignmentGenerator", inputs: .one) { b, v in
21152115
let newValue = b.randomVariable(forUseAs: b.type(of: v))
21162116
guard newValue != v else { return }
2117-
b.reassign(newValue, to: v)
2117+
b.reassign(variable: newValue, value: v)
21182118
},
21192119

21202120
CodeGenerator("DestructArrayGenerator", inputs: .preferred(.iterable)) {

Sources/Fuzzilli/Profiles/V8CommonProfile.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,11 @@ public let V8RegExpFuzzer = ProgramTemplate("RegExpFuzzer") { b in
522522
let symbol = b.createNamedVariable(forBuiltin: "Symbol")
523523
withEqualProbability({
524524
let res = b.callMethod("exec", on: regExpVar, withArgs: [subjectVar])
525-
b.reassign(resultVar, to: res)
525+
b.reassign(variable: resultVar, value: res)
526526
}, {
527527
let prop = b.getProperty("match", of: symbol)
528528
let res = b.callComputedMethod(prop, on: regExpVar, withArgs: [subjectVar])
529-
b.reassign(resultVar, to: res)
529+
b.reassign(variable: resultVar, value: res)
530530
}, {
531531
let prop = b.getProperty("replace", of: symbol)
532532
let replacement = withEqualProbability({
@@ -535,11 +535,11 @@ public let V8RegExpFuzzer = ProgramTemplate("RegExpFuzzer") { b in
535535
b.loadString(chooseUniform(from: replacementCandidates))
536536
})
537537
let res = b.callComputedMethod(prop, on: regExpVar, withArgs: [subjectVar, replacement])
538-
b.reassign(resultVar, to: res)
538+
b.reassign(variable: resultVar, value: res)
539539
}, {
540540
let prop = b.getProperty("search", of: symbol)
541541
let res = b.callComputedMethod(prop, on: regExpVar, withArgs: [subjectVar])
542-
b.reassign(resultVar, to: res)
542+
b.reassign(variable: resultVar, value: res)
543543
}, {
544544
let prop = b.getProperty("split", of: symbol)
545545
let randomSplitLimit = withEqualProbability({
@@ -551,10 +551,10 @@ public let V8RegExpFuzzer = ProgramTemplate("RegExpFuzzer") { b in
551551
})
552552
let limit = b.loadString(randomSplitLimit)
553553
let res = b.callComputedMethod(symbol, on: regExpVar, withArgs: [subjectVar, limit])
554-
b.reassign(resultVar, to: res)
554+
b.reassign(variable: resultVar, value: res)
555555
}, {
556556
let res = b.callMethod("test", on: regExpVar, withArgs: [subjectVar])
557-
b.reassign(resultVar, to: res)
557+
b.reassign(variable: resultVar, value: res)
558558
})
559559
}, catchBody: { _ in
560560
})
@@ -590,7 +590,7 @@ public let LazyDeoptFuzzer = ProgramTemplate("LazyDeoptFuzzer") { b in
590590
b.build(n: 10)
591591

592592
b.buildIf(b.compare(counter, with: max, using: .lessThan)) {
593-
b.reassign(counter, to: b.binary(counter, b.loadInt(1), with: .Add))
593+
b.reassign(variable: counter, value: b.binary(counter, b.loadInt(1), with: .Add))
594594
b.callFunction(dummyFct, withArgs: b.randomArguments(forCalling: dummyFct))
595595
}
596596
// Mark the function for deoptimization. Due to the recursive pattern above, on the outer
@@ -601,7 +601,7 @@ public let LazyDeoptFuzzer = ProgramTemplate("LazyDeoptFuzzer") { b in
601601
}
602602

603603
// Turn the call into a recursive call.
604-
b.reassign(dummyFct, to: realFct)
604+
b.reassign(variable: dummyFct, value: realFct)
605605
let args = b.randomArguments(forCalling: realFct)
606606
let guardCalls = probability(0.5)
607607
b.eval("%PrepareFunctionForOptimization(%@)", with: [realFct]);

Sources/Fuzzilli/Profiles/XSProfile.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ fileprivate let RegExpFuzzer = ProgramTemplate("RegExpFuzzer") { b in
181181
let symbol = b.createNamedVariable(forBuiltin: "Symbol")
182182
withEqualProbability({
183183
let res = b.callMethod("exec", on: regExpVar, withArgs: [subjectVar])
184-
b.reassign(resultVar, to: res)
184+
b.reassign(variable: resultVar, value: res)
185185
}, {
186186
let prop = b.getProperty("match", of: symbol)
187187
let res = b.callComputedMethod(prop, on: regExpVar, withArgs: [subjectVar])
188-
b.reassign(resultVar, to: res)
188+
b.reassign(variable: resultVar, value: res)
189189
}, {
190190
let prop = b.getProperty("replace", of: symbol)
191191
let replacement = withEqualProbability({
@@ -194,11 +194,11 @@ fileprivate let RegExpFuzzer = ProgramTemplate("RegExpFuzzer") { b in
194194
b.loadString(chooseUniform(from: replacementCandidates))
195195
})
196196
let res = b.callComputedMethod(prop, on: regExpVar, withArgs: [subjectVar, replacement])
197-
b.reassign(resultVar, to: res)
197+
b.reassign(variable: resultVar, value: res)
198198
}, {
199199
let prop = b.getProperty("search", of: symbol)
200200
let res = b.callComputedMethod(prop, on: regExpVar, withArgs: [subjectVar])
201-
b.reassign(resultVar, to: res)
201+
b.reassign(variable: resultVar, value: res)
202202
}, {
203203
let prop = b.getProperty("split", of: symbol)
204204
let randomSplitLimit = withEqualProbability({
@@ -210,10 +210,10 @@ fileprivate let RegExpFuzzer = ProgramTemplate("RegExpFuzzer") { b in
210210
})
211211
let limit = b.loadString(randomSplitLimit)
212212
let res = b.callComputedMethod(symbol, on: regExpVar, withArgs: [subjectVar, limit])
213-
b.reassign(resultVar, to: res)
213+
b.reassign(variable: resultVar, value: res)
214214
}, {
215215
let res = b.callMethod("test", on: regExpVar, withArgs: [subjectVar])
216-
b.reassign(resultVar, to: res)
216+
b.reassign(variable: resultVar, value: res)
217217
})
218218
}, catchBody: { _ in
219219
})

0 commit comments

Comments
 (0)