Commit e7ea5170 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm][fuzzer] Choose more interesting default parameters

We had some (dead) logic to create different parameter values pending on
the position of the parameter. As it was not used any more, it got
removed in https://crrev.com/c/3003464.
This CL changes the existing logic for creating default parameter values
to use a similar logic, which matches what --wasm-fuzzer-gen-test
creates and has a slightly higher chance of triggering interesting
behaviour.

R=ahaas@chromium.org

Change-Id: Ibb4394c1978f25d70166a03002e084211bfe7e1e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3003465
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75619}
parent 12b2a870
......@@ -50,20 +50,22 @@ base::OwnedVector<WasmValue> MakeDefaultInterpreterArguments(
for (size_t i = 0; i < param_count; ++i) {
switch (sig->GetParam(i).kind()) {
case kI32:
arguments[i] = WasmValue(int32_t{0});
arguments[i] = WasmValue(static_cast<int32_t>(i));
break;
case kI64:
arguments[i] = WasmValue(int64_t{0});
arguments[i] = WasmValue(static_cast<int64_t>(i));
break;
case kF32:
arguments[i] = WasmValue(0.0f);
arguments[i] = WasmValue(static_cast<float>(i));
break;
case kF64:
arguments[i] = WasmValue(0.0);
arguments[i] = WasmValue(static_cast<double>(i));
break;
case kS128:
arguments[i] = WasmValue(Simd128{});
case kS128: {
uint8_t s128_bytes[sizeof(Simd128)] = {static_cast<uint8_t>(i)};
arguments[i] = WasmValue(Simd128{s128_bytes});
break;
}
case kOptRef:
arguments[i] =
WasmValue(Handle<Object>::cast(isolate->factory()->null_value()),
......@@ -96,10 +98,10 @@ base::OwnedVector<Handle<Object>> MakeDefaultArguments(Isolate* isolate,
case kS128:
// Argument here for kS128 does not matter as we should error out before
// hitting this case.
arguments[i] = handle(Smi::zero(), isolate);
arguments[i] = handle(Smi::FromInt(static_cast<int>(i)), isolate);
break;
case kI64:
arguments[i] = BigInt::FromInt64(isolate, 0);
arguments[i] = BigInt::FromInt64(isolate, static_cast<int64_t>(i));
break;
case kOptRef:
arguments[i] = isolate->factory()->null_value();
......
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