[fuzzer] Use recursion scope only for nullable references in GenerateRef

Use recursion scope only for nullable references in the
GenerateRef function. We declare the recursion scope as
an optional and only initialize it if the reference type
is nullable.

Bug: v8:11954, chromium:1270126
Change-Id: I1548290cc9d48167f6fd56ff653744d472f65635
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3284894
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Maria Tîmbur <mtimbur@google.com>
Cr-Commit-Position: refs/heads/main@{#77943}
This commit is contained in:
Maria Tîmbur 2021-11-16 15:27:54 +00:00 committed by V8 LUCI CQ
parent a533662e79
commit 521679172e

View File

@ -2065,7 +2065,11 @@ void WasmGenerator::Generate(ValueType type, DataRange* data) {
void WasmGenerator::GenerateRef(HeapType type, DataRange* data,
Nullability nullability) {
GeneratorRecursionScope rec_scope(this);
base::Optional<GeneratorRecursionScope> rec_scope;
if (nullability) {
rec_scope.emplace(this);
}
if (recursion_limit_reached() || data->size() == 0) {
if (nullability == kNullable) {
ref_null(type, data);