Commit 8ee692da authored by Andreas Haas's avatar Andreas Haas Committed by V8 LUCI CQ

[cleanup] Rename NameSectionKindCode fields to avoid shadowing

NameSectionKindCode::kFunction got shadowed by
WasmCompilationResult::Kind::kFunction. NameSectionKindCode is not used
often, so this CL just adds "Code" to all fields of this enum.

R=clemensb@chromium.org

Bug: v8:12244
Change-Id: I87155a43084b868f6c118ddc2e44cb9c35b4249b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3181535Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77049}
parent 1e6a8ae0
...@@ -1149,7 +1149,7 @@ class ModuleDecoderImpl : public Decoder { ...@@ -1149,7 +1149,7 @@ class ModuleDecoderImpl : public Decoder {
// Decode module name, ignore the rest. // Decode module name, ignore the rest.
// Function and local names will be decoded when needed. // Function and local names will be decoded when needed.
if (name_type == NameSectionKindCode::kModule) { if (name_type == NameSectionKindCode::kModuleCode) {
WireBytesRef name = consume_string(&inner, false, "module name"); WireBytesRef name = consume_string(&inner, false, "module name");
if (inner.ok() && validate_utf8(&inner, name)) { if (inner.ok() && validate_utf8(&inner, name)) {
module_->name = name; module_->name = name;
...@@ -2412,7 +2412,7 @@ void DecodeFunctionNames(const byte* module_start, const byte* module_end, ...@@ -2412,7 +2412,7 @@ void DecodeFunctionNames(const byte* module_start, const byte* module_end,
uint32_t name_payload_len = decoder.consume_u32v("name payload length"); uint32_t name_payload_len = decoder.consume_u32v("name payload length");
if (!decoder.checkAvailable(name_payload_len)) break; if (!decoder.checkAvailable(name_payload_len)) break;
if (name_type != NameSectionKindCode::kFunction) { if (name_type != NameSectionKindCode::kFunctionCode) {
decoder.consume_bytes(name_payload_len, "name subsection payload"); decoder.consume_bytes(name_payload_len, "name subsection payload");
continue; continue;
} }
......
...@@ -118,19 +118,19 @@ constexpr uint8_t kNoCompilationHint = kMaxUInt8; ...@@ -118,19 +118,19 @@ constexpr uint8_t kNoCompilationHint = kMaxUInt8;
// Binary encoding of name section kinds. // Binary encoding of name section kinds.
enum NameSectionKindCode : uint8_t { enum NameSectionKindCode : uint8_t {
kModule = 0, kModuleCode = 0,
kFunction = 1, kFunctionCode = 1,
kLocal = 2, kLocalCode = 2,
// https://github.com/WebAssembly/extended-name-section/ // https://github.com/WebAssembly/extended-name-section/
kLabel = 3, kLabelCode = 3,
kType = 4, kTypeCode = 4,
kTable = 5, kTableCode = 5,
kMemory = 6, kMemoryCode = 6,
kGlobal = 7, kGlobalCode = 7,
kElementSegment = 8, kElementSegmentCode = 8,
kDataSegment = 9, kDataSegmentCode = 9,
// https://github.com/WebAssembly/gc/issues/193 // https://github.com/WebAssembly/gc/issues/193
kField = 10 kFieldCode = 10
}; };
constexpr size_t kWasmPageSize = 0x10000; constexpr size_t kWasmPageSize = 0x10000;
......
...@@ -194,7 +194,7 @@ class DebugInfoImpl { ...@@ -194,7 +194,7 @@ class DebugInfoImpl {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
if (!type_names_) { if (!type_names_) {
type_names_ = std::make_unique<NameMap>(DecodeNameMap( type_names_ = std::make_unique<NameMap>(DecodeNameMap(
native_module_->wire_bytes(), NameSectionKindCode::kType)); native_module_->wire_bytes(), NameSectionKindCode::kTypeCode));
} }
return type_names_->GetName(type_index); return type_names_->GetName(type_index);
} }
...@@ -203,7 +203,7 @@ class DebugInfoImpl { ...@@ -203,7 +203,7 @@ class DebugInfoImpl {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
if (!local_names_) { if (!local_names_) {
local_names_ = std::make_unique<IndirectNameMap>(DecodeIndirectNameMap( local_names_ = std::make_unique<IndirectNameMap>(DecodeIndirectNameMap(
native_module_->wire_bytes(), NameSectionKindCode::kLocal)); native_module_->wire_bytes(), NameSectionKindCode::kLocalCode));
} }
return local_names_->GetName(func_index, local_index); return local_names_->GetName(func_index, local_index);
} }
...@@ -212,7 +212,7 @@ class DebugInfoImpl { ...@@ -212,7 +212,7 @@ class DebugInfoImpl {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
if (!field_names_) { if (!field_names_) {
field_names_ = std::make_unique<IndirectNameMap>(DecodeIndirectNameMap( field_names_ = std::make_unique<IndirectNameMap>(DecodeIndirectNameMap(
native_module_->wire_bytes(), NameSectionKindCode::kField)); native_module_->wire_bytes(), NameSectionKindCode::kFieldCode));
} }
return field_names_->GetName(struct_index, field_index); return field_names_->GetName(struct_index, field_index);
} }
......
...@@ -899,7 +899,7 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const { ...@@ -899,7 +899,7 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const {
// Emit the section string. // Emit the section string.
buffer->write_string(base::CStrVector("name")); buffer->write_string(base::CStrVector("name"));
// Emit a subsection for the function names. // Emit a subsection for the function names.
buffer->write_u8(NameSectionKindCode::kFunction); buffer->write_u8(NameSectionKindCode::kFunctionCode);
// Emit a placeholder for the subsection length. // Emit a placeholder for the subsection length.
size_t functions_start = buffer->reserve_u32v(); size_t functions_start = buffer->reserve_u32v();
// Emit the function names. // Emit the function names.
......
...@@ -1264,19 +1264,19 @@ STREAM_TEST(TestCompileErrorFunctionName) { ...@@ -1264,19 +1264,19 @@ STREAM_TEST(TestCompileErrorFunctionName) {
}; };
const uint8_t bytes_names[] = { const uint8_t bytes_names[] = {
kUnknownSectionCode, // section code kUnknownSectionCode, // section code
U32V_1(11), // section size U32V_1(11), // section size
4, // section name length 4, // section name length
'n', // section name 'n', // section name
'a', // section name 'a', // section name
'm', // section name 'm', // section name
'e', // section name 'e', // section name
NameSectionKindCode::kFunction, // name section kind NameSectionKindCode::kFunctionCode, // name section kind
4, // name section kind length 4, // name section kind length
1, // num function names 1, // num function names
0, // function index 0, // function index
1, // function name length 1, // function name length
'f', // function name 'f', // function name
}; };
for (bool late_names : {false, true}) { for (bool late_names : {false, true}) {
......
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