From 54d68665f25280e7c84874f36b4cae3c16789a19 Mon Sep 17 00:00:00 2001 From: Clemens Hammacher Date: Wed, 8 Nov 2017 11:25:14 +0100 Subject: [PATCH] [wasm] [fuzzer] [cleanup] Reuse helper method We already have a helper method for generating a sequence of values. Reuse this instead of reimplementing the same thing two more times. R=ahaas@chromium.org CC=eholk@chromium.org Change-Id: Ifbbe1324173951156c1ec9bba84fd1aa4bcb2adb Reviewed-on: https://chromium-review.googlesource.com/758365 Reviewed-by: Andreas Haas Commit-Queue: Clemens Hammacher Cr-Commit-Position: refs/heads/master@{#49216} --- test/fuzzer/wasm-compile.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/test/fuzzer/wasm-compile.cc b/test/fuzzer/wasm-compile.cc index a598a68763..eca7c316d4 100644 --- a/test/fuzzer/wasm-compile.cc +++ b/test/fuzzer/wasm-compile.cc @@ -106,22 +106,13 @@ class WasmGenerator { blocks_.pop_back(); } - template + template void memop(DataRange data) { const auto align = data.get(); const auto offset = data.get(); - if (arg_type == kWasmStmt) { - // Generate the index - Generate(data); - } else { - const auto parts = data.split(); - - // Generate the index - Generate(parts.first); - // Generate the value - Generate(parts.second); - } + // Generate the index and the arguments, if any. + Generate(data); builder_->Emit(memory_op); builder_->EmitU32V(align); @@ -130,9 +121,7 @@ class WasmGenerator { template void sequence(DataRange data) { - const auto parts = data.split(); - Generate(parts.first); - Generate(parts.second); + Generate(data); } void current_memory(DataRange data) {