Skip to content

Commit 6395ef6

Browse files
mi-acV8-internal LUCI CQ
authored andcommitted
[clean-up] Remove redundant context assertions
This removes some redundant assertions that are already checked in the same way by the `inContext` requirements of the respective code generators. Bug: 446632644 Change-Id: I50b9432d15d8554040d0598893b3fb35ae264fba Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/8686138 Commit-Queue: Michael Achenbach <machenbach@google.com> Reviewed-by: Matthias Liedtke <mliedtke@google.com>
1 parent 12f601c commit 6395ef6

File tree

1 file changed

+0
-120
lines changed

1 file changed

+0
-120
lines changed

Sources/Fuzzilli/CodeGen/CodeGenerators.swift

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ public let CodeGenerators: [CodeGenerator] = [
446446
},
447447

448448
CodeGenerator("ArgumentsAccessGenerator", inContext: .single(.subroutine)) { b in
449-
assert(b.context.contains(.subroutine))
450449
b.loadArguments()
451450
},
452451

@@ -503,9 +502,6 @@ public let CodeGenerators: [CodeGenerator] = [
503502

504503
CodeGenerator("ObjectLiteralPropertyGenerator", inContext: .single(.objectLiteral)) {
505504
b in
506-
assert(
507-
b.context.contains(.objectLiteral)
508-
&& !b.context.contains(.javascript))
509505

510506
// Try to find a property that hasn't already been added to this literal.
511507
var propertyName: String
@@ -526,10 +522,6 @@ public let CodeGenerators: [CodeGenerator] = [
526522
CodeGenerator(
527523
"ObjectLiteralElementGenerator", inContext: .single(.objectLiteral), inputs: .one
528524
) { b, value in
529-
assert(
530-
b.context.contains(.objectLiteral)
531-
&& !b.context.contains(.javascript))
532-
533525
// Select an element that hasn't already been added to this literal.
534526
var index = b.randomIndex()
535527
while b.currentObjectLiteral.elements.contains(index) {
@@ -544,10 +536,6 @@ public let CodeGenerators: [CodeGenerator] = [
544536
"ObjectLiteralComputedPropertyGenerator", inContext: .single(.objectLiteral),
545537
inputs: .one
546538
) { b, value in
547-
assert(
548-
b.context.contains(.objectLiteral)
549-
&& !b.context.contains(.javascript))
550-
551539
// Try to find a computed property that hasn't already been added to this literal.
552540
var propertyName: Variable
553541
var attempts = 0
@@ -568,18 +556,11 @@ public let CodeGenerators: [CodeGenerator] = [
568556
"ObjectLiteralCopyPropertiesGenerator", inContext: .single(.objectLiteral),
569557
inputs: .preferred(.object())
570558
) { b, object in
571-
assert(
572-
b.context.contains(.objectLiteral)
573-
&& !b.context.contains(.javascript))
574559
b.currentObjectLiteral.copyProperties(from: object)
575560
},
576561

577562
CodeGenerator("ObjectLiteralPrototypeGenerator", inContext: .single(.objectLiteral))
578563
{ b in
579-
assert(
580-
b.context.contains(.objectLiteral)
581-
&& !b.context.contains(.javascript))
582-
583564
// There should only be one __proto__ field in an object literal.
584565
guard !b.currentObjectLiteral.hasPrototype else { return }
585566

@@ -594,10 +575,6 @@ public let CodeGenerators: [CodeGenerator] = [
594575
"ObjectLiteralMethodBeginGenerator", inContext: .single(.objectLiteral),
595576
provides: [.javascript, .subroutine, .method]
596577
) { b in
597-
assert(
598-
b.context.contains(.objectLiteral)
599-
&& !b.context.contains(.javascript))
600-
601578
// Try to find a method that hasn't already been added to this literal.
602579
var methodName: String
603580
var attempts = 0
@@ -632,10 +609,6 @@ public let CodeGenerators: [CodeGenerator] = [
632609
inContext: .single(.objectLiteral),
633610
provides: [.javascript, .subroutine, .method]
634611
) { b in
635-
assert(
636-
b.context.contains(.objectLiteral)
637-
&& !b.context.contains(.javascript))
638-
639612
// Try to find a computed method name that hasn't already been added to this literal.
640613
var methodName: Variable
641614
var attempts = 0
@@ -675,10 +648,6 @@ public let CodeGenerators: [CodeGenerator] = [
675648
inContext: .single(.objectLiteral),
676649
provides: [.javascript, .subroutine, .method]
677650
) { b in
678-
assert(
679-
b.context.contains(.objectLiteral)
680-
&& !b.context.contains(.javascript))
681-
682651
// Try to find a property that hasn't already been added and for which a getter has not yet been installed.
683652
var propertyName: String
684653
var attempts = 0
@@ -715,10 +684,6 @@ public let CodeGenerators: [CodeGenerator] = [
715684
inContext: .single(.objectLiteral),
716685
provides: [.javascript, .subroutine, .method]
717686
) { b in
718-
assert(
719-
b.context.contains(.objectLiteral)
720-
&& !b.context.contains(.javascript))
721-
722687
// Try to find a property that hasn't already been added and for which a setter has not yet been installed.
723688
var propertyName: String
724689
var attempts = 0
@@ -752,9 +717,6 @@ public let CodeGenerators: [CodeGenerator] = [
752717
inContext: .single(.classDefinition),
753718
provides: []
754719
) { b in
755-
assert(
756-
b.context.contains(.classDefinition)
757-
&& !b.context.contains(.javascript))
758720

759721
guard !b.currentClassDefinition.hasConstructor else {
760722
// There must only be one constructor
@@ -799,10 +761,6 @@ public let CodeGenerators: [CodeGenerator] = [
799761

800762
CodeGenerator("ClassInstancePropertyGenerator", inContext: .single(.classDefinition))
801763
{ b in
802-
assert(
803-
b.context.contains(.classDefinition)
804-
&& !b.context.contains(.javascript))
805-
806764
// Try to find a property that hasn't already been added to this literal.
807765
var propertyName: String
808766
var attempts = 0
@@ -819,10 +777,6 @@ public let CodeGenerators: [CodeGenerator] = [
819777

820778
CodeGenerator("ClassInstanceElementGenerator", inContext: .single(.classDefinition))
821779
{ b in
822-
assert(
823-
b.context.contains(.classDefinition)
824-
&& !b.context.contains(.javascript))
825-
826780
// Select an element that hasn't already been added to this literal.
827781
var index = b.randomIndex()
828782
while b.currentClassDefinition.instanceElements.contains(index) {
@@ -837,10 +791,6 @@ public let CodeGenerators: [CodeGenerator] = [
837791
CodeGenerator(
838792
"ClassInstanceComputedPropertyGenerator", inContext: .single(.classDefinition)
839793
) { b in
840-
assert(
841-
b.context.contains(.classDefinition)
842-
&& !b.context.contains(.javascript))
843-
844794
// Try to find a computed property that hasn't already been added to this literal.
845795
var propertyName: Variable
846796
var attempts = 0
@@ -864,10 +814,6 @@ public let CodeGenerators: [CodeGenerator] = [
864814
inContext: .single(.classDefinition),
865815
provides: [.javascript, .subroutine, .method, .classMethod]
866816
) { b in
867-
assert(
868-
b.context.contains(.classDefinition)
869-
&& !b.context.contains(.javascript))
870-
871817
// Try to find a method that hasn't already been added to this class.
872818
var methodName: String
873819
var attempts = 0
@@ -906,10 +852,6 @@ public let CodeGenerators: [CodeGenerator] = [
906852
inContext: .single(.classDefinition),
907853
provides: [.javascript, .subroutine, .method, .classMethod]
908854
) { b in
909-
assert(
910-
b.context.contains(.classDefinition)
911-
&& !b.context.contains(.javascript))
912-
913855
// Try to find a method that hasn't already been added to this class.
914856
var methodName = b.randomJsVariable()
915857
var attempts = 0
@@ -944,10 +886,6 @@ public let CodeGenerators: [CodeGenerator] = [
944886
inContext: .single(.classDefinition),
945887
provides: [.javascript, .subroutine, .method, .classMethod]
946888
) { b in
947-
assert(
948-
b.context.contains(.classDefinition)
949-
&& !b.context.contains(.javascript))
950-
951889
// Try to find a property that hasn't already been added and for which a getter has not yet been installed.
952890
var propertyName: String
953891
var attempts = 0
@@ -982,10 +920,6 @@ public let CodeGenerators: [CodeGenerator] = [
982920
inContext: .single(.classDefinition),
983921
provides: [.javascript, .subroutine, .method, .classMethod]
984922
) { b in
985-
assert(
986-
b.context.contains(.classDefinition)
987-
&& !b.context.contains(.javascript))
988-
989923
// Try to find a property that hasn't already been added and for which a setter has not yet been installed.
990924
var propertyName: String
991925
var attempts = 0
@@ -1015,10 +949,6 @@ public let CodeGenerators: [CodeGenerator] = [
1015949

1016950
CodeGenerator("ClassStaticPropertyGenerator", inContext: .single(.classDefinition)) {
1017951
b in
1018-
assert(
1019-
b.context.contains(.classDefinition)
1020-
&& !b.context.contains(.javascript))
1021-
1022952
// Try to find a property that hasn't already been added to this literal.
1023953
var propertyName: String
1024954
var attempts = 0
@@ -1038,10 +968,6 @@ public let CodeGenerators: [CodeGenerator] = [
1038968

1039969
CodeGenerator("ClassStaticElementGenerator", inContext: .single(.classDefinition)) {
1040970
b in
1041-
assert(
1042-
b.context.contains(.classDefinition)
1043-
&& !b.context.contains(.javascript))
1044-
1045971
// Select an element that hasn't already been added to this literal.
1046972
var index = b.randomIndex()
1047973
while b.currentClassDefinition.staticElements.contains(index) {
@@ -1056,10 +982,6 @@ public let CodeGenerators: [CodeGenerator] = [
1056982
CodeGenerator(
1057983
"ClassStaticComputedPropertyGenerator", inContext: .single(.classDefinition)
1058984
) { b in
1059-
assert(
1060-
b.context.contains(.classDefinition)
1061-
&& !b.context.contains(.javascript))
1062-
1063985
// Try to find a computed property that hasn't already been added to this literal.
1064986
var propertyName: Variable
1065987
var attempts = 0
@@ -1086,10 +1008,6 @@ public let CodeGenerators: [CodeGenerator] = [
10861008
inContext: .single(.classDefinition),
10871009
provides: [.javascript, .method, .classMethod]
10881010
) { b in
1089-
assert(
1090-
b.context.contains(.classDefinition)
1091-
&& !b.context.contains(.javascript))
1092-
10931011
b.emit(BeginClassStaticInitializer())
10941012
},
10951013
GeneratorStub(
@@ -1108,10 +1026,6 @@ public let CodeGenerators: [CodeGenerator] = [
11081026
inContext: .single(.classDefinition),
11091027
provides: [.javascript, .method, .subroutine, .classMethod]
11101028
) { b in
1111-
assert(
1112-
b.context.contains(.classDefinition)
1113-
&& !b.context.contains(.javascript))
1114-
11151029
// Try to find a method that hasn't already been added to this class.
11161030
var methodName: String
11171031
var attempts = 0
@@ -1152,10 +1066,6 @@ public let CodeGenerators: [CodeGenerator] = [
11521066
inContext: .single(.classDefinition),
11531067
provides: [.javascript, .subroutine, .method, .classMethod]
11541068
) { b in
1155-
assert(
1156-
b.context.contains(.classDefinition)
1157-
&& !b.context.contains(.javascript))
1158-
11591069
// Try to find a method that hasn't already been added to this class.
11601070
var methodName = b.randomJsVariable()
11611071
var attempts = 0
@@ -1190,10 +1100,6 @@ public let CodeGenerators: [CodeGenerator] = [
11901100
inContext: .single(.classDefinition),
11911101
provides: [.javascript, .subroutine, .method, .classMethod]
11921102
) { b in
1193-
assert(
1194-
b.context.contains(.classDefinition)
1195-
&& !b.context.contains(.javascript))
1196-
11971103
// Try to find a property that hasn't already been added and for which a getter has not yet been installed.
11981104
var propertyName: String
11991105
var attempts = 0
@@ -1229,10 +1135,6 @@ public let CodeGenerators: [CodeGenerator] = [
12291135
inContext: .single(.classDefinition),
12301136
provides: [.javascript, .subroutine, .method, .classMethod]
12311137
) { b in
1232-
assert(
1233-
b.context.contains(.classDefinition)
1234-
&& !b.context.contains(.javascript))
1235-
12361138
// Try to find a property that hasn't already been added and for which a setter has not yet been installed.
12371139
var propertyName: String
12381140
var attempts = 0
@@ -1262,10 +1164,6 @@ public let CodeGenerators: [CodeGenerator] = [
12621164
CodeGenerator(
12631165
"ClassPrivateInstancePropertyGenerator", inContext: .single(.classDefinition)
12641166
) { b in
1265-
assert(
1266-
b.context.contains(.classDefinition)
1267-
&& !b.context.contains(.javascript))
1268-
12691167
// Try to find a private field that hasn't already been added to this literal.
12701168
var propertyName: String
12711169
var attempts = 0
@@ -1288,10 +1186,6 @@ public let CodeGenerators: [CodeGenerator] = [
12881186
inContext: .single(.classDefinition),
12891187
provides: [.javascript, .subroutine, .method, .classMethod]
12901188
) { b in
1291-
assert(
1292-
b.context.contains(.classDefinition)
1293-
&& !b.context.contains(.javascript))
1294-
12951189
// Try to find a private field that hasn't already been added to this class.
12961190
var methodName: String
12971191
var attempts = 0
@@ -1323,10 +1217,6 @@ public let CodeGenerators: [CodeGenerator] = [
13231217
CodeGenerator(
13241218
"ClassPrivateStaticPropertyGenerator", inContext: .single(.classDefinition)
13251219
) { b in
1326-
assert(
1327-
b.context.contains(.classDefinition)
1328-
&& !b.context.contains(.javascript))
1329-
13301220
// Try to find a private field that hasn't already been added to this literal.
13311221
var propertyName: String
13321222
var attempts = 0
@@ -1349,10 +1239,6 @@ public let CodeGenerators: [CodeGenerator] = [
13491239
inContext: .single(.classDefinition),
13501240
provides: [.javascript, .subroutine, .method, .classMethod]
13511241
) { b in
1352-
assert(
1353-
b.context.contains(.classDefinition)
1354-
&& !b.context.contains(.javascript))
1355-
13561242
// Try to find a private field that hasn't already been added to this class.
13571243
var methodName: String
13581244
var attempts = 0
@@ -2038,7 +1924,6 @@ public let CodeGenerators: [CodeGenerator] = [
20381924
CodeGenerator(
20391925
"SubroutineReturnGenerator", inContext: .single(.subroutine), inputs: .one
20401926
) { b, val in
2041-
assert(b.context.contains(.subroutine))
20421927
if probability(0.9) {
20431928
b.doReturn(val)
20441929
} else {
@@ -2048,7 +1933,6 @@ public let CodeGenerators: [CodeGenerator] = [
20481933

20491934
CodeGenerator("YieldGenerator", inContext: .single(.generatorFunction), inputs: .one)
20501935
{ b, val in
2051-
assert(b.context.contains(.generatorFunction))
20521936
if probability(0.9) {
20531937
b.yield(val)
20541938
} else {
@@ -2060,13 +1944,11 @@ public let CodeGenerators: [CodeGenerator] = [
20601944
"YieldEachGenerator", inContext: .single(.generatorFunction),
20611945
inputs: .required(.iterable)
20621946
) { b, val in
2063-
assert(b.context.contains(.generatorFunction))
20641947
b.yieldEach(val)
20651948
},
20661949

20671950
CodeGenerator("AwaitGenerator", inContext: .single(.asyncFunction), inputs: .one) {
20681951
b, val in
2069-
assert(b.context.contains(.asyncFunction))
20701952
b.await(val)
20711953
},
20721954

@@ -2603,7 +2485,6 @@ public let CodeGenerators: [CodeGenerator] = [
26032485
},
26042486

26052487
CodeGenerator("ContinueGenerator", inContext: .single(.loop)) { b in
2606-
assert(b.context.contains(.loop))
26072488
b.loopContinue()
26082489
},
26092490

@@ -3130,7 +3011,6 @@ public let CodeGenerators: [CodeGenerator] = [
31303011
},
31313012

31323013
CodeGenerator("LoadNewTargetGenerator", inContext: .single(.subroutine)) { b in
3133-
assert(b.context.contains(.subroutine))
31343014
b.loadNewTarget()
31353015
},
31363016

0 commit comments

Comments
 (0)