Commit b15be58f authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] [cleanup] Fix WasmCode::Kind enum names

According to the style guide, enum names they must either be
capitalized, or start with a "k". I prefer the kFoo syntax.

R=mtrofin@chromium.org

Bug: v8:7109
Change-Id: I9c06c4cb05b05ec50de8d68d118f1a0807938426
Reviewed-on: https://chromium-review.googlesource.com/796856Reviewed-by: 's avatarMircea Trofin <mtrofin@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49733}
parent c08ab6da
...@@ -442,16 +442,16 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, ...@@ -442,16 +442,16 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
iterator->isolate()->wasm_code_manager()->LookupCode(pc); iterator->isolate()->wasm_code_manager()->LookupCode(pc);
if (wasm_code != nullptr) { if (wasm_code != nullptr) {
switch (wasm_code->kind()) { switch (wasm_code->kind()) {
case wasm::WasmCode::InterpreterStub: case wasm::WasmCode::kInterpreterStub:
return WASM_INTERPRETER_ENTRY; return WASM_INTERPRETER_ENTRY;
case wasm::WasmCode::Function: case wasm::WasmCode::kFunction:
case wasm::WasmCode::CopiedStub: case wasm::WasmCode::kCopiedStub:
return WASM_COMPILED; return WASM_COMPILED;
case wasm::WasmCode::LazyStub: case wasm::WasmCode::kLazyStub:
if (StackFrame::IsTypeMarker(marker)) break; if (StackFrame::IsTypeMarker(marker)) break;
return BUILTIN; return BUILTIN;
case wasm::WasmCode::WasmToJsWrapper: case wasm::WasmCode::kWasmToJsWrapper:
case wasm::WasmCode::WasmToWasmWrapper: case wasm::WasmCode::kWasmToWasmWrapper:
return WASM_TO_JS; return WASM_TO_JS;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -789,7 +789,7 @@ void StandardFrame::IterateCompiledFrame(RootVisitor* v) const { ...@@ -789,7 +789,7 @@ void StandardFrame::IterateCompiledFrame(RootVisitor* v) const {
wasm_code->stack_slots()); wasm_code->stack_slots());
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_params = wasm_code->kind() != wasm::WasmCode::Function; has_tagged_params = wasm_code->kind() != wasm::WasmCode::kFunction;
} else { } else {
InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry = InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry =
isolate()->inner_pointer_to_code_cache()->GetCacheEntry(inner_pointer); isolate()->inner_pointer_to_code_cache()->GetCacheEntry(inner_pointer);
...@@ -1767,7 +1767,7 @@ bool WasmCompiledFrame::at_to_number_conversion() const { ...@@ -1767,7 +1767,7 @@ bool WasmCompiledFrame::at_to_number_conversion() const {
wasm::WasmCode* code = wasm::WasmCode* code =
callee_pc ? isolate()->wasm_code_manager()->LookupCode(callee_pc) callee_pc ? isolate()->wasm_code_manager()->LookupCode(callee_pc)
: nullptr; : nullptr;
if (!code || code->kind() != wasm::WasmCode::WasmToJsWrapper) return false; if (!code || code->kind() != wasm::WasmCode::kWasmToJsWrapper) return false;
int offset = static_cast<int>(callee_pc - code->instructions().start()); int offset = static_cast<int>(callee_pc - code->instructions().start());
pos = FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition(code, pos = FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition(code,
offset); offset);
...@@ -2075,7 +2075,7 @@ void InternalFrame::Iterate(RootVisitor* v) const { ...@@ -2075,7 +2075,7 @@ void InternalFrame::Iterate(RootVisitor* v) const {
FLAG_wasm_jit_to_native ? isolate()->wasm_code_manager()->LookupCode(pc()) FLAG_wasm_jit_to_native ? isolate()->wasm_code_manager()->LookupCode(pc())
: nullptr; : nullptr;
if (wasm_code != nullptr) { if (wasm_code != nullptr) {
DCHECK(wasm_code->kind() == wasm::WasmCode::LazyStub); DCHECK(wasm_code->kind() == wasm::WasmCode::kLazyStub);
} else { } else {
Code* code = LookupCode(); Code* code = LookupCode();
IteratePc(v, pc_address(), constant_pool_address(), code); IteratePc(v, pc_address(), constant_pool_address(), code);
......
...@@ -429,7 +429,7 @@ class FrameArrayBuilder { ...@@ -429,7 +429,7 @@ class FrameArrayBuilder {
//==================================================================== //====================================================================
const auto& summary = summ.AsWasmCompiled(); const auto& summary = summ.AsWasmCompiled();
if (!summary.code().IsCodeObject() && if (!summary.code().IsCodeObject() &&
summary.code().GetWasmCode()->kind() != wasm::WasmCode::Function) { summary.code().GetWasmCode()->kind() != wasm::WasmCode::kFunction) {
continue; continue;
} }
Handle<WasmInstanceObject> instance = summary.wasm_instance(); Handle<WasmInstanceObject> instance = summary.wasm_instance();
......
...@@ -500,7 +500,7 @@ RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) { ...@@ -500,7 +500,7 @@ RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) {
if (FLAG_wasm_jit_to_native) { if (FLAG_wasm_jit_to_native) {
wasm::WasmCode* target = wasm::WasmCode* target =
isolate->wasm_code_manager()->LookupCode(target_address); isolate->wasm_code_manager()->LookupCode(target_address);
if (target->kind() == wasm::WasmCode::Function) { if (target->kind() == wasm::WasmCode::kFunction) {
++count; ++count;
export_fct = target; export_fct = target;
} }
...@@ -524,7 +524,7 @@ RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) { ...@@ -524,7 +524,7 @@ RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) {
Address target_address = rinfo->target_address(); Address target_address = rinfo->target_address();
wasm::WasmCode* target = wasm::WasmCode* target =
isolate->wasm_code_manager()->LookupCode(target_address); isolate->wasm_code_manager()->LookupCode(target_address);
if (target->kind() == wasm::WasmCode::Function) { if (target->kind() == wasm::WasmCode::kFunction) {
++count; ++count;
intermediate_fct = target; intermediate_fct = target;
} }
...@@ -549,8 +549,8 @@ RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) { ...@@ -549,8 +549,8 @@ RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) {
count = 0; count = 0;
if (FLAG_wasm_jit_to_native) { if (FLAG_wasm_jit_to_native) {
wasm::WasmCode::Kind target_kind = type->value() == 0 wasm::WasmCode::Kind target_kind = type->value() == 0
? wasm::WasmCode::WasmToWasmWrapper ? wasm::WasmCode::kWasmToWasmWrapper
: wasm::WasmCode::WasmToJsWrapper; : wasm::WasmCode::kWasmToJsWrapper;
for (RelocIterator it(intermediate_fct->instructions(), for (RelocIterator it(intermediate_fct->instructions(),
intermediate_fct->reloc_info(), intermediate_fct->reloc_info(),
intermediate_fct->constant_pool(), intermediate_fct->constant_pool(),
......
...@@ -738,7 +738,7 @@ Address CompileLazy(Isolate* isolate) { ...@@ -738,7 +738,7 @@ Address CompileLazy(Isolate* isolate) {
Handle<Object> exp_deopt_data_entry; Handle<Object> exp_deopt_data_entry;
const wasm::WasmCode* lazy_stub_or_copy = const wasm::WasmCode* lazy_stub_or_copy =
isolate->wasm_code_manager()->LookupCode(it.frame()->pc()); isolate->wasm_code_manager()->LookupCode(it.frame()->pc());
DCHECK_EQ(wasm::WasmCode::LazyStub, lazy_stub_or_copy->kind()); DCHECK_EQ(wasm::WasmCode::kLazyStub, lazy_stub_or_copy->kind());
if (!lazy_stub_or_copy->IsAnonymous()) { if (!lazy_stub_or_copy->IsAnonymous()) {
// Then it's an indirect call or via JS->wasm wrapper. // Then it's an indirect call or via JS->wasm wrapper.
instance = lazy_stub_or_copy->owner()->compiled_module()->owning_instance(); instance = lazy_stub_or_copy->owner()->compiled_module()->owning_instance();
...@@ -882,7 +882,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileFunction( ...@@ -882,7 +882,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileFunction(
wasm::WasmCode* existing_code = compiled_module->GetNativeModule()->GetCode( wasm::WasmCode* existing_code = compiled_module->GetNativeModule()->GetCode(
static_cast<uint32_t>(func_index)); static_cast<uint32_t>(func_index));
if (existing_code != nullptr && if (existing_code != nullptr &&
existing_code->kind() == wasm::WasmCode::Function) { existing_code->kind() == wasm::WasmCode::kFunction) {
TRACE_LAZY("Function %d already compiled.\n", func_index); TRACE_LAZY("Function %d already compiled.\n", func_index);
return existing_code; return existing_code;
} }
...@@ -1199,7 +1199,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileFromJsToWasm( ...@@ -1199,7 +1199,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileFromJsToWasm(
wasm::WasmCode* ret = wasm::WasmCode* ret =
compiled_module->GetNativeModule()->GetCode(exported_func_index); compiled_module->GetNativeModule()->GetCode(exported_func_index);
DCHECK_NOT_NULL(ret); DCHECK_NOT_NULL(ret);
DCHECK_EQ(wasm::WasmCode::Function, ret->kind()); DCHECK_EQ(wasm::WasmCode::kFunction, ret->kind());
return ret; return ret;
} }
...@@ -1243,7 +1243,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall( ...@@ -1243,7 +1243,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall(
!it.done(); it.next()) { !it.done(); it.next()) {
const WasmCode* callee = isolate->wasm_code_manager()->LookupCode( const WasmCode* callee = isolate->wasm_code_manager()->LookupCode(
it.rinfo()->target_address()); it.rinfo()->target_address());
if (callee->kind() != WasmCode::LazyStub) { if (callee->kind() != WasmCode::kLazyStub) {
non_compiled_functions.push_back(Nothing<WasmDirectCallData>()); non_compiled_functions.push_back(Nothing<WasmDirectCallData>());
continue; continue;
} }
...@@ -1302,7 +1302,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall( ...@@ -1302,7 +1302,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall(
uint32_t lookup = info.ToChecked().func_index; uint32_t lookup = info.ToChecked().func_index;
const WasmCode* callee_compiled = const WasmCode* callee_compiled =
compiled_module->GetNativeModule()->GetCode(lookup); compiled_module->GetNativeModule()->GetCode(lookup);
if (callee_compiled->kind() != WasmCode::Function) continue; if (callee_compiled->kind() != WasmCode::kFunction) continue;
it.rinfo()->set_wasm_call_address( it.rinfo()->set_wasm_call_address(
isolate, callee_compiled->instructions().start()); isolate, callee_compiled->instructions().start());
++patched; ++patched;
...@@ -1721,7 +1721,7 @@ WasmCodeWrapper EnsureExportedLazyDeoptData(Isolate* isolate, ...@@ -1721,7 +1721,7 @@ WasmCodeWrapper EnsureExportedLazyDeoptData(Isolate* isolate,
} else { } else {
wasm::WasmCode* code = native_module->GetCode(func_index); wasm::WasmCode* code = native_module->GetCode(func_index);
// {code} will be nullptr when exporting imports. // {code} will be nullptr when exporting imports.
if (code == nullptr || code->kind() != wasm::WasmCode::LazyStub || if (code == nullptr || code->kind() != wasm::WasmCode::kLazyStub ||
!code->IsAnonymous()) { !code->IsAnonymous()) {
return WasmCodeWrapper(code); return WasmCodeWrapper(code);
} }
...@@ -1787,7 +1787,7 @@ WasmCodeWrapper EnsureTableExportLazyDeoptData( ...@@ -1787,7 +1787,7 @@ WasmCodeWrapper EnsureTableExportLazyDeoptData(
EnsureExportedLazyDeoptData(isolate, instance, code_table, EnsureExportedLazyDeoptData(isolate, instance, code_table,
native_module, func_index) native_module, func_index)
.GetWasmCode(); .GetWasmCode();
if (code == nullptr || code->kind() != wasm::WasmCode::LazyStub) if (code == nullptr || code->kind() != wasm::WasmCode::kLazyStub)
return WasmCodeWrapper(code); return WasmCodeWrapper(code);
// deopt_data: // deopt_data:
...@@ -1866,7 +1866,7 @@ WasmCodeWrapper MakeWasmToWasmWrapper( ...@@ -1866,7 +1866,7 @@ WasmCodeWrapper MakeWasmToWasmWrapper(
new_wasm_context_address); new_wasm_context_address);
return WasmCodeWrapper( return WasmCodeWrapper(
instance->compiled_module()->GetNativeModule()->AddCodeCopy( instance->compiled_module()->GetNativeModule()->AddCodeCopy(
code, wasm::WasmCode::WasmToWasmWrapper, index)); code, wasm::WasmCode::kWasmToWasmWrapper, index));
} }
} }
...@@ -1888,7 +1888,7 @@ WasmCodeWrapper UnwrapExportOrCompileImportWrapper( ...@@ -1888,7 +1888,7 @@ WasmCodeWrapper UnwrapExportOrCompileImportWrapper(
isolate, target, sig, import_index, origin, js_imports_table); isolate, target, sig, import_index, origin, js_imports_table);
return WasmCodeWrapper( return WasmCodeWrapper(
instance->compiled_module()->GetNativeModule()->AddCodeCopy( instance->compiled_module()->GetNativeModule()->AddCodeCopy(
temp_code, wasm::WasmCode::WasmToJsWrapper, import_index)); temp_code, wasm::WasmCode::kWasmToJsWrapper, import_index));
} else { } else {
return WasmCodeWrapper(compiler::CompileWasmToJSWrapper( return WasmCodeWrapper(compiler::CompileWasmToJSWrapper(
isolate, target, sig, import_index, origin, js_imports_table)); isolate, target, sig, import_index, origin, js_imports_table));
...@@ -3405,8 +3405,8 @@ void InstanceBuilder::LoadTableSegments(Handle<FixedArray> code_table, ...@@ -3405,8 +3405,8 @@ void InstanceBuilder::LoadTableSegments(Handle<FixedArray> code_table,
const wasm::WasmCode* code = native_module->GetCode(func_index); const wasm::WasmCode* code = native_module->GetCode(func_index);
// Only increase the counter for lazy compile builtins (it's not // Only increase the counter for lazy compile builtins (it's not
// needed otherwise). // needed otherwise).
if (code->kind() == wasm::WasmCode::Function) continue; if (code->kind() == wasm::WasmCode::kFunction) continue;
DCHECK_EQ(wasm::WasmCode::LazyStub, code->kind()); DCHECK_EQ(wasm::WasmCode::kLazyStub, code->kind());
} }
++num_table_exports[func_index]; ++num_table_exports[func_index];
} }
......
...@@ -131,7 +131,7 @@ bool CodeSpecialization::ApplyToWholeInstance( ...@@ -131,7 +131,7 @@ bool CodeSpecialization::ApplyToWholeInstance(
WasmCodeWrapper wrapper; WasmCodeWrapper wrapper;
if (FLAG_wasm_jit_to_native) { if (FLAG_wasm_jit_to_native) {
const WasmCode* wasm_function = native_module->GetCode(func_index); const WasmCode* wasm_function = native_module->GetCode(func_index);
if (wasm_function->kind() != WasmCode::Function) { if (wasm_function->kind() != WasmCode::kFunction) {
continue; continue;
} }
wrapper = WasmCodeWrapper(wasm_function); wrapper = WasmCodeWrapper(wasm_function);
...@@ -206,7 +206,7 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code, ...@@ -206,7 +206,7 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
if (code.IsCodeObject()) { if (code.IsCodeObject()) {
DCHECK_EQ(Code::WASM_FUNCTION, code.GetCode()->kind()); DCHECK_EQ(Code::WASM_FUNCTION, code.GetCode()->kind());
} else { } else {
DCHECK_EQ(wasm::WasmCode::Function, code.GetWasmCode()->kind()); DCHECK_EQ(wasm::WasmCode::kFunction, code.GetWasmCode()->kind());
} }
bool patch_table_size = old_function_table_size || new_function_table_size; bool patch_table_size = old_function_table_size || new_function_table_size;
......
...@@ -192,19 +192,19 @@ void WasmCode::Print(Isolate* isolate) const { ...@@ -192,19 +192,19 @@ void WasmCode::Print(Isolate* isolate) const {
const char* GetWasmCodeKindAsString(WasmCode::Kind kind) { const char* GetWasmCodeKindAsString(WasmCode::Kind kind) {
switch (kind) { switch (kind) {
case WasmCode::Function: case WasmCode::kFunction:
return "wasm function"; return "wasm function";
case WasmCode::WasmToWasmWrapper: case WasmCode::kWasmToWasmWrapper:
return "wasm-to-wasm"; return "wasm-to-wasm";
case WasmCode::WasmToJsWrapper: case WasmCode::kWasmToJsWrapper:
return "wasm-to-js"; return "wasm-to-js";
case WasmCode::LazyStub: case WasmCode::kLazyStub:
return "lazy-compile"; return "lazy-compile";
case WasmCode::InterpreterStub: case WasmCode::kInterpreterStub:
return "interpreter-entry"; return "interpreter-entry";
case WasmCode::CopiedStub: case WasmCode::kCopiedStub:
return "copied stub"; return "copied stub";
case WasmCode::Trampoline: case WasmCode::kTrampoline:
return "trampoline"; return "trampoline";
} }
return "unknown kind"; return "unknown kind";
...@@ -307,14 +307,14 @@ WasmCode* NativeModule::AddCodeCopy(Handle<Code> code, WasmCode::Kind kind, ...@@ -307,14 +307,14 @@ WasmCode* NativeModule::AddCodeCopy(Handle<Code> code, WasmCode::Kind kind,
WasmCode* NativeModule::AddInterpreterWrapper(Handle<Code> code, WasmCode* NativeModule::AddInterpreterWrapper(Handle<Code> code,
uint32_t index) { uint32_t index) {
WasmCode* ret = AddAnonymousCode(code, WasmCode::InterpreterStub); WasmCode* ret = AddAnonymousCode(code, WasmCode::kInterpreterStub);
ret->index_ = Just(index); ret->index_ = Just(index);
return ret; return ret;
} }
WasmCode* NativeModule::SetLazyBuiltin(Handle<Code> code) { WasmCode* NativeModule::SetLazyBuiltin(Handle<Code> code) {
DCHECK_NULL(lazy_builtin_); DCHECK_NULL(lazy_builtin_);
lazy_builtin_ = AddAnonymousCode(code, WasmCode::LazyStub); lazy_builtin_ = AddAnonymousCode(code, WasmCode::kLazyStub);
for (uint32_t i = num_imported_functions(), e = FunctionCount(); i < e; ++i) { for (uint32_t i = num_imported_functions(), e = FunctionCount(); i < e; ++i) {
SetCodeTable(i, lazy_builtin_); SetCodeTable(i, lazy_builtin_);
...@@ -388,7 +388,7 @@ WasmCode* NativeModule::AddCode( ...@@ -388,7 +388,7 @@ WasmCode* NativeModule::AddCode(
WasmCode* ret = AddOwnedCode( WasmCode* ret = AddOwnedCode(
{desc.buffer, static_cast<size_t>(desc.instr_size)}, {desc.buffer, static_cast<size_t>(desc.instr_size)},
std::move(reloc_info), static_cast<size_t>(desc.reloc_size), Just(index), std::move(reloc_info), static_cast<size_t>(desc.reloc_size), Just(index),
WasmCode::Function, desc.instr_size - desc.constant_pool_size, WasmCode::kFunction, desc.instr_size - desc.constant_pool_size,
frame_slots, safepoint_table_offset, protected_instructions, is_liftoff); frame_slots, safepoint_table_offset, protected_instructions, is_liftoff);
if (ret == nullptr) return nullptr; if (ret == nullptr) return nullptr;
...@@ -437,7 +437,7 @@ Address NativeModule::CreateTrampolineTo(Handle<Code> code) { ...@@ -437,7 +437,7 @@ Address NativeModule::CreateTrampolineTo(Handle<Code> code) {
masm.GetCode(nullptr, &code_desc); masm.GetCode(nullptr, &code_desc);
WasmCode* wasm_code = AddOwnedCode( WasmCode* wasm_code = AddOwnedCode(
{code_desc.buffer, static_cast<size_t>(code_desc.instr_size)}, nullptr, 0, {code_desc.buffer, static_cast<size_t>(code_desc.instr_size)}, nullptr, 0,
Nothing<uint32_t>(), WasmCode::Trampoline, 0, 0, 0, {}); Nothing<uint32_t>(), WasmCode::kTrampoline, 0, 0, 0, {});
if (wasm_code == nullptr) return nullptr; if (wasm_code == nullptr) return nullptr;
Address ret = wasm_code->instructions().start(); Address ret = wasm_code->instructions().start();
trampolines_.emplace(std::make_pair(dest, ret)); trampolines_.emplace(std::make_pair(dest, ret));
...@@ -458,7 +458,7 @@ Address NativeModule::GetLocalAddressFor(Handle<Code> code) { ...@@ -458,7 +458,7 @@ Address NativeModule::GetLocalAddressFor(Handle<Code> code) {
uint32_t key = code->stub_key(); uint32_t key = code->stub_key();
auto copy = stubs_.find(key); auto copy = stubs_.find(key);
if (copy == stubs_.end()) { if (copy == stubs_.end()) {
WasmCode* ret = AddAnonymousCode(code, WasmCode::CopiedStub); WasmCode* ret = AddAnonymousCode(code, WasmCode::kCopiedStub);
copy = stubs_.emplace(std::make_pair(key, ret)).first; copy = stubs_.emplace(std::make_pair(key, ret)).first;
} }
return copy->second->instructions().start(); return copy->second->instructions().start();
...@@ -482,7 +482,7 @@ WasmCode* NativeModule::GetExportedWrapper(uint32_t index) { ...@@ -482,7 +482,7 @@ WasmCode* NativeModule::GetExportedWrapper(uint32_t index) {
} }
WasmCode* NativeModule::AddExportedWrapper(Handle<Code> code, uint32_t index) { WasmCode* NativeModule::AddExportedWrapper(Handle<Code> code, uint32_t index) {
WasmCode* ret = AddAnonymousCode(code, WasmCode::WasmToWasmWrapper); WasmCode* ret = AddAnonymousCode(code, WasmCode::kWasmToWasmWrapper);
ret->index_ = Just(index); ret->index_ = Just(index);
exported_wasm_to_wasm_wrappers_.insert(std::make_pair(index, ret)); exported_wasm_to_wasm_wrappers_.insert(std::make_pair(index, ret));
return ret; return ret;
...@@ -822,14 +822,14 @@ std::unique_ptr<NativeModule> NativeModule::Clone() { ...@@ -822,14 +822,14 @@ std::unique_ptr<NativeModule> NativeModule::Clone() {
for (uint32_t i = num_imported_functions(), e = FunctionCount(); i < e; ++i) { for (uint32_t i = num_imported_functions(), e = FunctionCount(); i < e; ++i) {
const WasmCode* original_code = GetCode(i); const WasmCode* original_code = GetCode(i);
switch (original_code->kind()) { switch (original_code->kind()) {
case WasmCode::LazyStub: { case WasmCode::kLazyStub: {
if (original_code->IsAnonymous()) { if (original_code->IsAnonymous()) {
ret->SetCodeTable(i, ret->lazy_builtin()); ret->SetCodeTable(i, ret->lazy_builtin());
} else { } else {
if (!ret->CloneLazyBuiltinInto(i)) return nullptr; if (!ret->CloneLazyBuiltinInto(i)) return nullptr;
} }
} break; } break;
case WasmCode::Function: { case WasmCode::kFunction: {
WasmCode* new_code = ret->CloneCode(original_code); WasmCode* new_code = ret->CloneCode(original_code);
if (new_code == nullptr) return nullptr; if (new_code == nullptr) return nullptr;
PatchTrampolineAndStubCalls(original_code, new_code, reverse_lookup); PatchTrampolineAndStubCalls(original_code, new_code, reverse_lookup);
......
...@@ -88,13 +88,13 @@ using ProtectedInstructions = ...@@ -88,13 +88,13 @@ using ProtectedInstructions =
class V8_EXPORT_PRIVATE WasmCode final { class V8_EXPORT_PRIVATE WasmCode final {
public: public:
enum Kind { enum Kind {
Function, kFunction,
WasmToWasmWrapper, kWasmToWasmWrapper,
WasmToJsWrapper, kWasmToJsWrapper,
LazyStub, kLazyStub,
InterpreterStub, kInterpreterStub,
CopiedStub, kCopiedStub,
Trampoline kTrampoline
}; };
Vector<byte> instructions() const { return instructions_; } Vector<byte> instructions() const { return instructions_; }
......
...@@ -643,7 +643,7 @@ Handle<HeapObject> UnwrapWasmToJSWrapper(Isolate* isolate, ...@@ -643,7 +643,7 @@ Handle<HeapObject> UnwrapWasmToJSWrapper(Isolate* isolate,
DCHECK_GT(js_imports_table->length(), index); DCHECK_GT(js_imports_table->length(), index);
} else { } else {
const wasm::WasmCode* wasm_code = wrapper.GetWasmCode(); const wasm::WasmCode* wasm_code = wrapper.GetWasmCode();
DCHECK_EQ(wasm::WasmCode::WasmToJsWrapper, wasm_code->kind()); DCHECK_EQ(wasm::WasmCode::kWasmToJsWrapper, wasm_code->kind());
js_imports_table = Handle<FixedArray>(wasm_code->owner() js_imports_table = Handle<FixedArray>(wasm_code->owner()
->compiled_module() ->compiled_module()
->owning_instance() ->owning_instance()
...@@ -2423,14 +2423,14 @@ class ThreadImpl { ...@@ -2423,14 +2423,14 @@ class ThreadImpl {
DCHECK(AllowHandleAllocation::IsAllowed()); DCHECK(AllowHandleAllocation::IsAllowed());
DCHECK(AllowHeapAllocation::IsAllowed()); DCHECK(AllowHeapAllocation::IsAllowed());
if (code->kind() == wasm::WasmCode::Function) { if (code->kind() == wasm::WasmCode::kFunction) {
DCHECK_EQ(*code->owner()->compiled_module()->owning_instance(), DCHECK_EQ(*code->owner()->compiled_module()->owning_instance(),
codemap()->instance()); codemap()->instance());
return {ExternalCallResult::INTERNAL, codemap()->GetCode(code->index())}; return {ExternalCallResult::INTERNAL, codemap()->GetCode(code->index())};
} }
if (code->kind() == wasm::WasmCode::WasmToJsWrapper) { if (code->kind() == wasm::WasmCode::kWasmToJsWrapper) {
return CallExternalJSFunction(isolate, WasmCodeWrapper(code), signature); return CallExternalJSFunction(isolate, WasmCodeWrapper(code), signature);
} else if (code->kind() == wasm::WasmCode::WasmToWasmWrapper) { } else if (code->kind() == wasm::WasmCode::kWasmToWasmWrapper) {
return CallExternalWasmFunction(isolate, WasmCodeWrapper(code), return CallExternalWasmFunction(isolate, WasmCodeWrapper(code),
signature); signature);
} }
......
...@@ -118,7 +118,7 @@ void UnpackAndRegisterProtectedInstructions(Isolate* isolate, ...@@ -118,7 +118,7 @@ void UnpackAndRegisterProtectedInstructions(Isolate* isolate,
i < e; ++i) { i < e; ++i) {
wasm::WasmCode* code = native_module->GetCode(i); wasm::WasmCode* code = native_module->GetCode(i);
if (code == nullptr || code->kind() != wasm::WasmCode::Function) { if (code == nullptr || code->kind() != wasm::WasmCode::kFunction) {
continue; continue;
} }
......
...@@ -614,8 +614,8 @@ WasmInstanceObject* WasmInstanceObject::GetOwningInstance( ...@@ -614,8 +614,8 @@ WasmInstanceObject* WasmInstanceObject::GetOwningInstance(
const wasm::WasmCode* code) { const wasm::WasmCode* code) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
Object* weak_link = nullptr; Object* weak_link = nullptr;
DCHECK(code->kind() == wasm::WasmCode::Function || DCHECK(code->kind() == wasm::WasmCode::kFunction ||
code->kind() == wasm::WasmCode::InterpreterStub); code->kind() == wasm::WasmCode::kInterpreterStub);
weak_link = code->owner()->compiled_module()->ptr_to_weak_owning_instance(); weak_link = code->owner()->compiled_module()->ptr_to_weak_owning_instance();
DCHECK(weak_link->IsWeakCell()); DCHECK(weak_link->IsWeakCell());
WeakCell* cell = WeakCell::cast(weak_link); WeakCell* cell = WeakCell::cast(weak_link);
...@@ -1307,7 +1307,7 @@ void WasmCompiledModule::Reset(Isolate* isolate, ...@@ -1307,7 +1307,7 @@ void WasmCompiledModule::Reset(Isolate* isolate,
i < end; ++i) { i < end; ++i) {
wasm::WasmCode* code = native_module->GetCode(i); wasm::WasmCode* code = native_module->GetCode(i);
// Skip lazy compile stubs. // Skip lazy compile stubs.
if (code == nullptr || code->kind() != wasm::WasmCode::Function) continue; if (code == nullptr || code->kind() != wasm::WasmCode::kFunction) continue;
bool changed = code_specialization.ApplyToWasmCode(WasmCodeWrapper(code), bool changed = code_specialization.ApplyToWasmCode(WasmCodeWrapper(code),
SKIP_ICACHE_FLUSH); SKIP_ICACHE_FLUSH);
// TODO(wasm): Check if this is faster than passing FLUSH_ICACHE_IF_NEEDED // TODO(wasm): Check if this is faster than passing FLUSH_ICACHE_IF_NEEDED
......
...@@ -279,7 +279,7 @@ void NativeModuleSerializer::BufferCopiedStubs() { ...@@ -279,7 +279,7 @@ void NativeModuleSerializer::BufferCopiedStubs() {
FixedArray* NativeModuleSerializer::GetHandlerTable( FixedArray* NativeModuleSerializer::GetHandlerTable(
const WasmCode* code) const { const WasmCode* code) const {
if (code->kind() != WasmCode::Function) return nullptr; if (code->kind() != WasmCode::kFunction) return nullptr;
uint32_t index = code->index(); uint32_t index = code->index();
// We write the address, the size, and then copy the code as-is, followed // We write the address, the size, and then copy the code as-is, followed
// by reloc info, followed by handler table and source positions. // by reloc info, followed by handler table and source positions.
...@@ -294,7 +294,7 @@ FixedArray* NativeModuleSerializer::GetHandlerTable( ...@@ -294,7 +294,7 @@ FixedArray* NativeModuleSerializer::GetHandlerTable(
ByteArray* NativeModuleSerializer::GetSourcePositions( ByteArray* NativeModuleSerializer::GetSourcePositions(
const WasmCode* code) const { const WasmCode* code) const {
if (code->kind() != WasmCode::Function) return nullptr; if (code->kind() != WasmCode::kFunction) return nullptr;
uint32_t index = code->index(); uint32_t index = code->index();
Object* source_positions_entry = Object* source_positions_entry =
native_module_->compiled_module()->source_positions()->get( native_module_->compiled_module()->source_positions()->get(
...@@ -558,7 +558,7 @@ bool NativeModuleDeserializer::ReadCode() { ...@@ -558,7 +558,7 @@ bool NativeModuleDeserializer::ReadCode() {
} }
WasmCode* ret = native_module_->AddOwnedCode( WasmCode* ret = native_module_->AddOwnedCode(
code_buffer, std::move(reloc_info), reloc_size, Just(index_), code_buffer, std::move(reloc_info), reloc_size, Just(index_),
WasmCode::Function, constant_pool_offset, stack_slot_count, WasmCode::kFunction, constant_pool_offset, stack_slot_count,
safepoint_table_offset, protected_instructions, is_liftoff); safepoint_table_offset, protected_instructions, is_liftoff);
if (ret == nullptr) return false; if (ret == nullptr) return false;
native_module_->SetCodeTable(index_, ret); native_module_->SetCodeTable(index_, ret);
......
...@@ -101,7 +101,7 @@ uint32_t TestingModuleBuilder::AddJsFunction( ...@@ -101,7 +101,7 @@ uint32_t TestingModuleBuilder::AddJsFunction(
native_module_->ResizeCodeTableForTest(index); native_module_->ResizeCodeTableForTest(index);
Handle<Code> wrapper = compiler::CompileWasmToJSWrapper( Handle<Code> wrapper = compiler::CompileWasmToJSWrapper(
isolate_, jsfunc, sig, index, test_module_.origin(), js_imports_table); isolate_, jsfunc, sig, index, test_module_.origin(), js_imports_table);
native_module_->AddCodeCopy(wrapper, wasm::WasmCode::WasmToJsWrapper, native_module_->AddCodeCopy(wrapper, wasm::WasmCode::kWasmToJsWrapper,
index); index);
} else { } else {
// TODO(6792): No longer needed once WebAssembly code is off heap. // TODO(6792): No longer needed once WebAssembly code is off heap.
......
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