[cleanup] Rename WasmCode::Kind::kFunction to kWasmFunction

Rename the enum value to avoid variable shadowing.

R=clemensb@chromium.org

Bug: v8:12244
Change-Id: I96a3bee7615b44692bb9edfedf82c6020a803d0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3181529
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77050}
This commit is contained in:
Andreas Haas 2021-09-24 14:00:50 +02:00 committed by V8 LUCI CQ
parent 8ee692da87
commit 58249ba601
8 changed files with 32 additions and 37 deletions

View File

@ -7569,7 +7569,7 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
call_descriptor, mcgraph, CodeKind::WASM_FUNCTION,
wasm::WasmCode::kFunction, debug_name, WasmStubAssemblerOptions(),
wasm::WasmCode::kWasmFunction, debug_name, WasmStubAssemblerOptions(),
source_positions);
return result;
}

View File

@ -597,7 +597,7 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
if (wasm::WasmCode* wasm_code =
wasm::GetWasmCodeManager()->LookupCode(pc)) {
switch (wasm_code->kind()) {
case wasm::WasmCode::kFunction:
case wasm::WasmCode::kWasmFunction:
return WASM;
case wasm::WasmCode::kWasmToCapiWrapper:
return WASM_EXIT;
@ -974,7 +974,7 @@ void CommonFrame::IterateCompiledFrame(RootVisitor* v) const {
safepoint_entry = table.FindEntry(inner_pointer);
stack_slots = wasm_code->stack_slots();
has_tagged_outgoing_params =
wasm_code->kind() != wasm::WasmCode::kFunction &&
wasm_code->kind() != wasm::WasmCode::kWasmFunction &&
wasm_code->kind() != wasm::WasmCode::kWasmToCapiWrapper;
first_tagged_parameter_slot = wasm_code->first_tagged_parameter_slot();
num_tagged_parameter_slots = wasm_code->num_tagged_parameter_slots();

View File

@ -684,7 +684,7 @@ class StackTraceBuilder {
#if V8_ENABLE_WEBASSEMBLY
void AppendWasmFrame(FrameSummary::WasmFrameSummary const& summary) {
if (summary.code()->kind() != wasm::WasmCode::kFunction) return;
if (summary.code()->kind() != wasm::WasmCode::kWasmFunction) return;
Handle<WasmInstanceObject> instance = summary.wasm_instance();
int flags = StackFrameInfo::kIsWasm;
if (instance->module_object().is_asm_js()) {

View File

@ -103,7 +103,7 @@ static const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) {
#if V8_ENABLE_WEBASSEMBLY
static const char* ComputeMarker(const wasm::WasmCode* code) {
switch (code->kind()) {
case wasm::WasmCode::kFunction:
case wasm::WasmCode::kWasmFunction:
return code->is_liftoff() ? "" : "*";
default:
return "";

View File

@ -191,7 +191,7 @@ std::unique_ptr<const byte[]> WasmCode::ConcatenateBytes(
void WasmCode::RegisterTrapHandlerData() {
DCHECK(!has_trap_handler_index());
if (kind() != WasmCode::kFunction) return;
if (kind() != WasmCode::kWasmFunction) return;
if (protected_instructions_size_ == 0) return;
Address base = instruction_start();
@ -350,9 +350,9 @@ void WasmCode::MaybePrint() const {
bool function_index_matches =
(!IsAnonymous() &&
FLAG_print_wasm_code_function_index == static_cast<int>(index()));
if (FLAG_print_code ||
(kind() == kFunction ? (FLAG_print_wasm_code || function_index_matches)
: FLAG_print_wasm_stub_code)) {
if (FLAG_print_code || (kind() == kWasmFunction
? (FLAG_print_wasm_code || function_index_matches)
: FLAG_print_wasm_stub_code)) {
std::string name = DebugName();
Print(name.c_str());
}
@ -376,7 +376,7 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
if (name) os << "name: " << name << "\n";
if (!IsAnonymous()) os << "index: " << index() << "\n";
os << "kind: " << GetWasmCodeKindAsString(kind()) << "\n";
if (kind() == kFunction) {
if (kind() == kWasmFunction) {
DCHECK(is_liftoff() || tier() == ExecutionTier::kTurbofan);
const char* compiler =
is_liftoff() ? (for_debugging() ? "Liftoff (debug)" : "Liftoff")
@ -470,7 +470,7 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
const char* GetWasmCodeKindAsString(WasmCode::Kind kind) {
switch (kind) {
case WasmCode::kFunction:
case WasmCode::kWasmFunction:
return "wasm function";
case WasmCode::kWasmToCapiWrapper:
return "wasm-to-capi";
@ -1129,22 +1129,22 @@ WasmCode* NativeModule::AddCodeForTesting(Handle<Code> code) {
FlushInstructionCache(dst_code_bytes.begin(), dst_code_bytes.size());
std::unique_ptr<WasmCode> new_code{
new WasmCode{this, // native_module
kAnonymousFuncIndex, // index
dst_code_bytes, // instructions
stack_slots, // stack_slots
0, // tagged_parameter_slots
safepoint_table_offset, // safepoint_table_offset
handler_table_offset, // handler_table_offset
constant_pool_offset, // constant_pool_offset
code_comments_offset, // code_comments_offset
instructions.length(), // unpadded_binary_size
{}, // protected_instructions
reloc_info.as_vector(), // reloc_info
source_pos.as_vector(), // source positions
WasmCode::kFunction, // kind
ExecutionTier::kNone, // tier
kNoDebugging}}; // for_debugging
new WasmCode{this, // native_module
kAnonymousFuncIndex, // index
dst_code_bytes, // instructions
stack_slots, // stack_slots
0, // tagged_parameter_slots
safepoint_table_offset, // safepoint_table_offset
handler_table_offset, // handler_table_offset
constant_pool_offset, // constant_pool_offset
code_comments_offset, // code_comments_offset
instructions.length(), // unpadded_binary_size
{}, // protected_instructions
reloc_info.as_vector(), // reloc_info
source_pos.as_vector(), // source positions
WasmCode::kWasmFunction, // kind
ExecutionTier::kNone, // tier
kNoDebugging}}; // for_debugging
new_code->MaybePrint();
new_code->Validate();
@ -1304,7 +1304,7 @@ WasmCode::Kind GetCodeKind(const WasmCompilationResult& result) {
case WasmCompilationResult::kWasmToJsWrapper:
return WasmCode::Kind::kWasmToJsWrapper;
case WasmCompilationResult::kFunction:
return WasmCode::Kind::kFunction;
return WasmCode::Kind::kWasmFunction;
default:
UNREACHABLE();
}

View File

@ -156,12 +156,7 @@ class V8_EXPORT_PRIVATE DisjointAllocationPool final {
class V8_EXPORT_PRIVATE WasmCode final {
public:
enum Kind {
kFunction,
kWasmToCapiWrapper,
kWasmToJsWrapper,
kJumpTable
};
enum Kind { kWasmFunction, kWasmToCapiWrapper, kWasmToJsWrapper, kJumpTable };
// Each runtime stub is identified by an id. This id is used to reference the
// stub via {RelocInfo::WASM_STUB_CALL} and gets resolved during relocation.

View File

@ -303,7 +303,7 @@ NativeModuleSerializer::NativeModuleSerializer(
size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const {
if (code == nullptr) return sizeof(bool);
DCHECK_EQ(WasmCode::kFunction, code->kind());
DCHECK_EQ(WasmCode::kWasmFunction, code->kind());
if (code->tier() != ExecutionTier::kTurbofan) {
return sizeof(bool);
}
@ -334,7 +334,7 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
writer->Write(false);
return true;
}
DCHECK_EQ(WasmCode::kFunction, code->kind());
DCHECK_EQ(WasmCode::kWasmFunction, code->kind());
// Only serialize TurboFan code, as Liftoff code can contain breakpoints or
// non-relocatable constants.
if (code->tier() != ExecutionTier::kTurbofan) {

View File

@ -3958,7 +3958,7 @@ TEST(Liftoff_tier_up) {
{
CodeSpaceWriteScope write_scope(native_module);
std::unique_ptr<WasmCode> new_code = native_module->AddCode(
add.function_index(), desc, 0, 0, {}, {}, WasmCode::kFunction,
add.function_index(), desc, 0, 0, {}, {}, WasmCode::kWasmFunction,
ExecutionTier::kTurbofan, kNoDebugging);
native_module->PublishCode(std::move(new_code));
}