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 {
// Decode module name, ignore the rest.
// 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");
if (inner.ok() && validate_utf8(&inner, name)) {
module_->name = name;
......@@ -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");
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");
continue;
}
......
......@@ -118,19 +118,19 @@ constexpr uint8_t kNoCompilationHint = kMaxUInt8;
// Binary encoding of name section kinds.
enum NameSectionKindCode : uint8_t {
kModule = 0,
kFunction = 1,
kLocal = 2,
kModuleCode = 0,
kFunctionCode = 1,
kLocalCode = 2,
// https://github.com/WebAssembly/extended-name-section/
kLabel = 3,
kType = 4,
kTable = 5,
kMemory = 6,
kGlobal = 7,
kElementSegment = 8,
kDataSegment = 9,
kLabelCode = 3,
kTypeCode = 4,
kTableCode = 5,
kMemoryCode = 6,
kGlobalCode = 7,
kElementSegmentCode = 8,
kDataSegmentCode = 9,
// https://github.com/WebAssembly/gc/issues/193
kField = 10
kFieldCode = 10
};
constexpr size_t kWasmPageSize = 0x10000;
......
......@@ -194,7 +194,7 @@ class DebugInfoImpl {
base::MutexGuard guard(&mutex_);
if (!type_names_) {
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);
}
......@@ -203,7 +203,7 @@ class DebugInfoImpl {
base::MutexGuard guard(&mutex_);
if (!local_names_) {
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);
}
......@@ -212,7 +212,7 @@ class DebugInfoImpl {
base::MutexGuard guard(&mutex_);
if (!field_names_) {
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);
}
......
......@@ -899,7 +899,7 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const {
// Emit the section string.
buffer->write_string(base::CStrVector("name"));
// Emit a subsection for the function names.
buffer->write_u8(NameSectionKindCode::kFunction);
buffer->write_u8(NameSectionKindCode::kFunctionCode);
// Emit a placeholder for the subsection length.
size_t functions_start = buffer->reserve_u32v();
// Emit the function names.
......
......@@ -1264,19 +1264,19 @@ STREAM_TEST(TestCompileErrorFunctionName) {
};
const uint8_t bytes_names[] = {
kUnknownSectionCode, // section code
U32V_1(11), // section size
4, // section name length
'n', // section name
'a', // section name
'm', // section name
'e', // section name
NameSectionKindCode::kFunction, // name section kind
4, // name section kind length
1, // num function names
0, // function index
1, // function name length
'f', // function name
kUnknownSectionCode, // section code
U32V_1(11), // section size
4, // section name length
'n', // section name
'a', // section name
'm', // section name
'e', // section name
NameSectionKindCode::kFunctionCode, // name section kind
4, // name section kind length
1, // num function names
0, // function index
1, // function name length
'f', // function name
};
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