Commit 9182c028 authored by Matthias Liedtke's avatar Matthias Liedtke Committed by V8 LUCI CQ

[fuzzer][wasm] Fix struct.new_default for immutable structs

struct.new_default may not be called for immutable structs.
Follow-up to d2c75d32.

Change-Id: I7b682938ca5da00ef6c9bec29856133301beb6b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3802688
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82108}
parent 0505419a
......@@ -862,8 +862,10 @@ class WasmGenerator {
bool can_be_defaultable = std::all_of(
struct_gen->fields().begin(), struct_gen->fields().end(),
[](ValueType type) -> bool { return type.is_defaultable(); });
if (new_default && can_be_defaultable) {
bool is_mutable = std::all_of(
struct_gen->mutabilities().begin(), struct_gen->mutabilities().end(),
[](bool mutability) -> bool { return mutability; });
if (new_default && can_be_defaultable && is_mutable) {
builder_->EmitWithPrefix(kExprStructNewDefault);
builder_->EmitU32V(index);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment