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
With the preceeding change, we can now import failing programs by
wrapping them in a big try-catch statement. This is somewhat
inefficient, however, as we may end up with samples where a lot of the
code is never executed (because an exception is thrown early on). This
change now adds additional logic to improve that and ensure that as much
code as possible will also be executed at runtime. Specifically, the
fixup algorithm when importing programs now works like this:
1. We first try to replace known test functions (such as `assertEquals`)
with a dummy function as these test functions aren't available
outside the testing environment. This now replaces a mechanism in the
compiler that would also try to remove calls to these functions.
2. If the first attempt fails, we'll then attempt to insert try-catch
blocks around individual instructions. For that, we first enable all
guardable operations (which will cause them to be wrapped in
try-catch), then perform one round of fixup during which all
unecessary guards will be disabled again. As a result, only those
try-catch block that are necessary will stay in the imported program.
3. Only if the previous attempts fail do we now insert one big try-catch
statement around the entire program.
// Default list of functions that are filtered out during compilation. These are functions that may be used in testcases but which do not influence the test's behaviour and so should be omitted for fuzzing.
28
-
// The functions can use the wildcard '*' character as _last_ character, in which case a prefix match will be performed.
29
-
letfilteredFunctionsForCompiler=[
30
-
// Functions used in V8's test suite
31
-
"assert*",
32
-
"print*",
33
-
// Functions used in Mozilla's test suite
34
-
"startTest",
35
-
"enterFunc",
36
-
"exitFunc",
37
-
"report*",
38
-
"options*",
39
-
]
40
-
41
27
// Loads a serialized FuzzIL program from the given file
/// A list of function names or prefixes (e.g. `assert*`) which should be deleted from the output program.
38
-
/// The function calls can in general only be removed if their return value isn't used, and so currently they are only
39
-
/// removed if they make up a full ExpressionStatement, in which case the entire statement is ignored.
40
-
/// This functionality is useful to remove calls to functions such as `assert*` or `print*` from tests
41
-
/// as those are not useful for fuzzing.
42
-
/// The function names may contain the wildcard character `*`, but _only_ as last character, in which case
43
-
/// a prefix match will be performed instead of a string comparison.
44
-
privateletfilteredFunctions:[String]
45
-
46
35
/// The environment is used to determine if an identifier identifies a builtin object.
47
36
/// TODO we should probably use the correct target environment, with any additional builtins etc. here. But for now, we just manually add `gc` since that's relatively common.
0 commit comments