[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:
parent
8ee692da87
commit
58249ba601
@ -7569,7 +7569,7 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
|
|||||||
|
|
||||||
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
|
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
|
||||||
call_descriptor, mcgraph, CodeKind::WASM_FUNCTION,
|
call_descriptor, mcgraph, CodeKind::WASM_FUNCTION,
|
||||||
wasm::WasmCode::kFunction, debug_name, WasmStubAssemblerOptions(),
|
wasm::WasmCode::kWasmFunction, debug_name, WasmStubAssemblerOptions(),
|
||||||
source_positions);
|
source_positions);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
|
|||||||
if (wasm::WasmCode* wasm_code =
|
if (wasm::WasmCode* wasm_code =
|
||||||
wasm::GetWasmCodeManager()->LookupCode(pc)) {
|
wasm::GetWasmCodeManager()->LookupCode(pc)) {
|
||||||
switch (wasm_code->kind()) {
|
switch (wasm_code->kind()) {
|
||||||
case wasm::WasmCode::kFunction:
|
case wasm::WasmCode::kWasmFunction:
|
||||||
return WASM;
|
return WASM;
|
||||||
case wasm::WasmCode::kWasmToCapiWrapper:
|
case wasm::WasmCode::kWasmToCapiWrapper:
|
||||||
return WASM_EXIT;
|
return WASM_EXIT;
|
||||||
@ -974,7 +974,7 @@ void CommonFrame::IterateCompiledFrame(RootVisitor* v) const {
|
|||||||
safepoint_entry = table.FindEntry(inner_pointer);
|
safepoint_entry = table.FindEntry(inner_pointer);
|
||||||
stack_slots = wasm_code->stack_slots();
|
stack_slots = wasm_code->stack_slots();
|
||||||
has_tagged_outgoing_params =
|
has_tagged_outgoing_params =
|
||||||
wasm_code->kind() != wasm::WasmCode::kFunction &&
|
wasm_code->kind() != wasm::WasmCode::kWasmFunction &&
|
||||||
wasm_code->kind() != wasm::WasmCode::kWasmToCapiWrapper;
|
wasm_code->kind() != wasm::WasmCode::kWasmToCapiWrapper;
|
||||||
first_tagged_parameter_slot = wasm_code->first_tagged_parameter_slot();
|
first_tagged_parameter_slot = wasm_code->first_tagged_parameter_slot();
|
||||||
num_tagged_parameter_slots = wasm_code->num_tagged_parameter_slots();
|
num_tagged_parameter_slots = wasm_code->num_tagged_parameter_slots();
|
||||||
|
@ -684,7 +684,7 @@ class StackTraceBuilder {
|
|||||||
|
|
||||||
#if V8_ENABLE_WEBASSEMBLY
|
#if V8_ENABLE_WEBASSEMBLY
|
||||||
void AppendWasmFrame(FrameSummary::WasmFrameSummary const& summary) {
|
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();
|
Handle<WasmInstanceObject> instance = summary.wasm_instance();
|
||||||
int flags = StackFrameInfo::kIsWasm;
|
int flags = StackFrameInfo::kIsWasm;
|
||||||
if (instance->module_object().is_asm_js()) {
|
if (instance->module_object().is_asm_js()) {
|
||||||
|
@ -103,7 +103,7 @@ static const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) {
|
|||||||
#if V8_ENABLE_WEBASSEMBLY
|
#if V8_ENABLE_WEBASSEMBLY
|
||||||
static const char* ComputeMarker(const wasm::WasmCode* code) {
|
static const char* ComputeMarker(const wasm::WasmCode* code) {
|
||||||
switch (code->kind()) {
|
switch (code->kind()) {
|
||||||
case wasm::WasmCode::kFunction:
|
case wasm::WasmCode::kWasmFunction:
|
||||||
return code->is_liftoff() ? "" : "*";
|
return code->is_liftoff() ? "" : "*";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
@ -191,7 +191,7 @@ std::unique_ptr<const byte[]> WasmCode::ConcatenateBytes(
|
|||||||
|
|
||||||
void WasmCode::RegisterTrapHandlerData() {
|
void WasmCode::RegisterTrapHandlerData() {
|
||||||
DCHECK(!has_trap_handler_index());
|
DCHECK(!has_trap_handler_index());
|
||||||
if (kind() != WasmCode::kFunction) return;
|
if (kind() != WasmCode::kWasmFunction) return;
|
||||||
if (protected_instructions_size_ == 0) return;
|
if (protected_instructions_size_ == 0) return;
|
||||||
|
|
||||||
Address base = instruction_start();
|
Address base = instruction_start();
|
||||||
@ -350,9 +350,9 @@ void WasmCode::MaybePrint() const {
|
|||||||
bool function_index_matches =
|
bool function_index_matches =
|
||||||
(!IsAnonymous() &&
|
(!IsAnonymous() &&
|
||||||
FLAG_print_wasm_code_function_index == static_cast<int>(index()));
|
FLAG_print_wasm_code_function_index == static_cast<int>(index()));
|
||||||
if (FLAG_print_code ||
|
if (FLAG_print_code || (kind() == kWasmFunction
|
||||||
(kind() == kFunction ? (FLAG_print_wasm_code || function_index_matches)
|
? (FLAG_print_wasm_code || function_index_matches)
|
||||||
: FLAG_print_wasm_stub_code)) {
|
: FLAG_print_wasm_stub_code)) {
|
||||||
std::string name = DebugName();
|
std::string name = DebugName();
|
||||||
Print(name.c_str());
|
Print(name.c_str());
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
|
|||||||
if (name) os << "name: " << name << "\n";
|
if (name) os << "name: " << name << "\n";
|
||||||
if (!IsAnonymous()) os << "index: " << index() << "\n";
|
if (!IsAnonymous()) os << "index: " << index() << "\n";
|
||||||
os << "kind: " << GetWasmCodeKindAsString(kind()) << "\n";
|
os << "kind: " << GetWasmCodeKindAsString(kind()) << "\n";
|
||||||
if (kind() == kFunction) {
|
if (kind() == kWasmFunction) {
|
||||||
DCHECK(is_liftoff() || tier() == ExecutionTier::kTurbofan);
|
DCHECK(is_liftoff() || tier() == ExecutionTier::kTurbofan);
|
||||||
const char* compiler =
|
const char* compiler =
|
||||||
is_liftoff() ? (for_debugging() ? "Liftoff (debug)" : "Liftoff")
|
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) {
|
const char* GetWasmCodeKindAsString(WasmCode::Kind kind) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case WasmCode::kFunction:
|
case WasmCode::kWasmFunction:
|
||||||
return "wasm function";
|
return "wasm function";
|
||||||
case WasmCode::kWasmToCapiWrapper:
|
case WasmCode::kWasmToCapiWrapper:
|
||||||
return "wasm-to-capi";
|
return "wasm-to-capi";
|
||||||
@ -1129,22 +1129,22 @@ WasmCode* NativeModule::AddCodeForTesting(Handle<Code> code) {
|
|||||||
FlushInstructionCache(dst_code_bytes.begin(), dst_code_bytes.size());
|
FlushInstructionCache(dst_code_bytes.begin(), dst_code_bytes.size());
|
||||||
|
|
||||||
std::unique_ptr<WasmCode> new_code{
|
std::unique_ptr<WasmCode> new_code{
|
||||||
new WasmCode{this, // native_module
|
new WasmCode{this, // native_module
|
||||||
kAnonymousFuncIndex, // index
|
kAnonymousFuncIndex, // index
|
||||||
dst_code_bytes, // instructions
|
dst_code_bytes, // instructions
|
||||||
stack_slots, // stack_slots
|
stack_slots, // stack_slots
|
||||||
0, // tagged_parameter_slots
|
0, // tagged_parameter_slots
|
||||||
safepoint_table_offset, // safepoint_table_offset
|
safepoint_table_offset, // safepoint_table_offset
|
||||||
handler_table_offset, // handler_table_offset
|
handler_table_offset, // handler_table_offset
|
||||||
constant_pool_offset, // constant_pool_offset
|
constant_pool_offset, // constant_pool_offset
|
||||||
code_comments_offset, // code_comments_offset
|
code_comments_offset, // code_comments_offset
|
||||||
instructions.length(), // unpadded_binary_size
|
instructions.length(), // unpadded_binary_size
|
||||||
{}, // protected_instructions
|
{}, // protected_instructions
|
||||||
reloc_info.as_vector(), // reloc_info
|
reloc_info.as_vector(), // reloc_info
|
||||||
source_pos.as_vector(), // source positions
|
source_pos.as_vector(), // source positions
|
||||||
WasmCode::kFunction, // kind
|
WasmCode::kWasmFunction, // kind
|
||||||
ExecutionTier::kNone, // tier
|
ExecutionTier::kNone, // tier
|
||||||
kNoDebugging}}; // for_debugging
|
kNoDebugging}}; // for_debugging
|
||||||
new_code->MaybePrint();
|
new_code->MaybePrint();
|
||||||
new_code->Validate();
|
new_code->Validate();
|
||||||
|
|
||||||
@ -1304,7 +1304,7 @@ WasmCode::Kind GetCodeKind(const WasmCompilationResult& result) {
|
|||||||
case WasmCompilationResult::kWasmToJsWrapper:
|
case WasmCompilationResult::kWasmToJsWrapper:
|
||||||
return WasmCode::Kind::kWasmToJsWrapper;
|
return WasmCode::Kind::kWasmToJsWrapper;
|
||||||
case WasmCompilationResult::kFunction:
|
case WasmCompilationResult::kFunction:
|
||||||
return WasmCode::Kind::kFunction;
|
return WasmCode::Kind::kWasmFunction;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
@ -156,12 +156,7 @@ class V8_EXPORT_PRIVATE DisjointAllocationPool final {
|
|||||||
|
|
||||||
class V8_EXPORT_PRIVATE WasmCode final {
|
class V8_EXPORT_PRIVATE WasmCode final {
|
||||||
public:
|
public:
|
||||||
enum Kind {
|
enum Kind { kWasmFunction, kWasmToCapiWrapper, kWasmToJsWrapper, kJumpTable };
|
||||||
kFunction,
|
|
||||||
kWasmToCapiWrapper,
|
|
||||||
kWasmToJsWrapper,
|
|
||||||
kJumpTable
|
|
||||||
};
|
|
||||||
|
|
||||||
// Each runtime stub is identified by an id. This id is used to reference the
|
// 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.
|
// stub via {RelocInfo::WASM_STUB_CALL} and gets resolved during relocation.
|
||||||
|
@ -303,7 +303,7 @@ NativeModuleSerializer::NativeModuleSerializer(
|
|||||||
|
|
||||||
size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const {
|
size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const {
|
||||||
if (code == nullptr) return sizeof(bool);
|
if (code == nullptr) return sizeof(bool);
|
||||||
DCHECK_EQ(WasmCode::kFunction, code->kind());
|
DCHECK_EQ(WasmCode::kWasmFunction, code->kind());
|
||||||
if (code->tier() != ExecutionTier::kTurbofan) {
|
if (code->tier() != ExecutionTier::kTurbofan) {
|
||||||
return sizeof(bool);
|
return sizeof(bool);
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
|
|||||||
writer->Write(false);
|
writer->Write(false);
|
||||||
return true;
|
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
|
// Only serialize TurboFan code, as Liftoff code can contain breakpoints or
|
||||||
// non-relocatable constants.
|
// non-relocatable constants.
|
||||||
if (code->tier() != ExecutionTier::kTurbofan) {
|
if (code->tier() != ExecutionTier::kTurbofan) {
|
||||||
|
@ -3958,7 +3958,7 @@ TEST(Liftoff_tier_up) {
|
|||||||
{
|
{
|
||||||
CodeSpaceWriteScope write_scope(native_module);
|
CodeSpaceWriteScope write_scope(native_module);
|
||||||
std::unique_ptr<WasmCode> new_code = native_module->AddCode(
|
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);
|
ExecutionTier::kTurbofan, kNoDebugging);
|
||||||
native_module->PublishCode(std::move(new_code));
|
native_module->PublishCode(std::move(new_code));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user