You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[rebase] Delete code re-introduced by rebase to main
findOrGenerateArguments is supposed to use findOrGenerateType, as there
is unnecessary code sharing otherwise. In the wasm branch, this was
already fixed, but when it got rebased to main, the fix was undone
again.
Change-Id: I651e3c8c150a85e550752559cdf6eab432fe4b9b
Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/7967835
Commit-Queue: Andreas Haas <[email protected]>
Reviewed-by: Carl Smith <[email protected]>
// Before we do any generation below, let's take into account that we already create a variable with this invocation, i.e. the createObject at the end.
515
-
// Therefore we need to decrease the budget here temporarily.
516
-
self.argumentGenerationVariableBudget! -=1
517
-
// We defer the increase again, because at that point the variable is actually visible, i.e. `numVariables` was increased through the `createObject` call.
518
-
defer{self.argumentGenerationVariableBudget! +=1}
519
-
520
-
varproperties:[String:Variable]=[:]
521
-
522
-
forpropertyNamein type.properties {
523
-
// If we have an object that has a group, we should get a type here, otherwise if we don't have a group, we will get .anything.
524
-
letpropType= fuzzer.environment.type(ofProperty: propertyName, on: type)
if numVariables >= argumentGenerationVariableBudget! {
551
-
logger.warning("Reached variable generation limit in generateType for Signature: \(argumentGenerationSignature!), returning a random variable for use as type \(type).")
552
-
returnrandomVariable(forUseAs: type)
553
-
}
554
-
555
-
// We only need to check against all base types from TypeSystem.swift, this works because we use .MayBe
556
-
// TODO: Not sure how we should handle merge types, e.g. .string + .object(...).
// If we have a group on this object and we have a builtin, that means we can construct it with new.
580
-
iflet group = type.group,self.fuzzer.environment.hasBuiltin(group) && self.fuzzer.environment.type(ofBuiltin: group).Is(.constructor()){
581
-
returncreateObjectWithGroup(type: type)
582
-
}else{
583
-
// Otherwise this is one of the following:
584
-
// 1. an object with more type information, i.e. it has a group, but no associated builtin, e.g. we cannot construct it with new.
585
-
// 2. an object without a group, but it has some required fields.
586
-
// In either case, we try to construct such an object.
587
-
returncreateObjectWithProperties(type)
588
-
}
589
-
})
590
-
]
591
-
592
-
// Make sure that we walk over these tests and their generators randomly.
593
-
// The requested type could be a Union of other types and as such we want to randomly generate one of them, therefore we also use the MayBe test below.
594
-
for(t, generate)in typeGenerators.shuffled(){
595
-
if type.MayBe(t){
596
-
letvariable=generate()
597
-
return variable
598
-
}
599
-
}
600
-
601
-
logger.warning("Type \(type) was not handled, returning random variable.")
0 commit comments