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

[wasm][cleanup] Remove always-true return value

{NativeModuleSerializer::WriteCode} does always return {true}, hence
remove the return value to avoid dead code in callers.

R=ahaas@chromium.org

Bug: v8:12425
Change-Id: I3c07829f327fc039b3baffdec3f9f6637adc2861
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3425357Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78866}
parent abd020fa
...@@ -288,7 +288,7 @@ class V8_EXPORT_PRIVATE NativeModuleSerializer { ...@@ -288,7 +288,7 @@ class V8_EXPORT_PRIVATE NativeModuleSerializer {
private: private:
size_t MeasureCode(const WasmCode*) const; size_t MeasureCode(const WasmCode*) const;
void WriteHeader(Writer*, size_t total_code_size); void WriteHeader(Writer*, size_t total_code_size);
bool WriteCode(const WasmCode*, Writer*); void WriteCode(const WasmCode*, Writer*);
const NativeModule* const native_module_; const NativeModule* const native_module_;
const base::Vector<WasmCode* const> code_table_; const base::Vector<WasmCode* const> code_table_;
...@@ -332,11 +332,12 @@ void NativeModuleSerializer::WriteHeader(Writer* writer, ...@@ -332,11 +332,12 @@ void NativeModuleSerializer::WriteHeader(Writer* writer,
writer->Write(total_code_size); writer->Write(total_code_size);
} }
bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) { void NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
if (code == nullptr) { if (code == nullptr) {
writer->Write(kLazyFunction); writer->Write(kLazyFunction);
return true; return;
} }
DCHECK_EQ(WasmCode::kWasmFunction, code->kind()); DCHECK_EQ(WasmCode::kWasmFunction, code->kind());
// Only serialize TurboFan code, as Liftoff code can contain breakpoints or // Only serialize TurboFan code, as Liftoff code can contain breakpoints or
// non-relocatable constants. // non-relocatable constants.
...@@ -353,8 +354,9 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) { ...@@ -353,8 +354,9 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
writer->Write(budget == static_cast<uint32_t>(FLAG_wasm_tiering_budget) writer->Write(budget == static_cast<uint32_t>(FLAG_wasm_tiering_budget)
? kLazyFunction ? kLazyFunction
: kLiftoffFunction); : kLiftoffFunction);
return true; return;
} }
++num_turbofan_functions_; ++num_turbofan_functions_;
writer->Write(kTurboFanFunction); writer->Write(kTurboFanFunction);
// Write the size of the entire code section, followed by the code header. // Write the size of the entire code section, followed by the code header.
...@@ -445,7 +447,6 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) { ...@@ -445,7 +447,6 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
memcpy(serialized_code_start, code_start, code_size); memcpy(serialized_code_start, code_start, code_size);
} }
total_written_code_ += code_size; total_written_code_ += code_size;
return true;
} }
bool NativeModuleSerializer::Write(Writer* writer) { bool NativeModuleSerializer::Write(Writer* writer) {
...@@ -462,7 +463,7 @@ bool NativeModuleSerializer::Write(Writer* writer) { ...@@ -462,7 +463,7 @@ bool NativeModuleSerializer::Write(Writer* writer) {
WriteHeader(writer, total_code_size); WriteHeader(writer, total_code_size);
for (WasmCode* code : code_table_) { for (WasmCode* code : code_table_) {
if (!WriteCode(code, writer)) return false; WriteCode(code, writer);
} }
// If not a single function was written, serialization was not successful. // If not a single function was written, serialization was not successful.
if (num_turbofan_functions_ == 0) return false; if (num_turbofan_functions_ == 0) return false;
......
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