Commit c047ba73 authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Inline the WasmCodeManager::SetCodeTable() method

R=ahaas@chromium.org

Bug: v8:7310
Change-Id: I7f4f4f7990a202232a0871f5d73dd8025306e96e
Reviewed-on: https://chromium-review.googlesource.com/934262
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51508}
parent 0ef07c95
......@@ -353,7 +353,7 @@ WasmCode* NativeModule::AddOwnedCode(
WasmCode* NativeModule::AddCodeCopy(Handle<Code> code, WasmCode::Kind kind,
uint32_t index) {
WasmCode* ret = AddAnonymousCode(code, kind);
SetCodeTable(index, ret);
code_table_[index] = ret;
ret->index_ = Just(index);
compiled_module()->source_positions()->set(static_cast<int>(index),
code->source_position_table());
......@@ -372,7 +372,7 @@ WasmCode* NativeModule::AddInterpreterWrapper(Handle<Code> code,
void NativeModule::SetLazyBuiltin(Handle<Code> code) {
WasmCode* lazy_builtin = AddAnonymousCode(code, WasmCode::kLazyStub);
for (uint32_t i = num_imported_functions(), e = FunctionCount(); i < e; ++i) {
SetCodeTable(i, lazy_builtin);
code_table_[i] = lazy_builtin;
}
}
......@@ -448,7 +448,7 @@ WasmCode* NativeModule::AddCode(
is_liftoff);
if (ret == nullptr) return nullptr;
SetCodeTable(index, ret);
code_table_[index] = ret;
// TODO(mtrofin): this is a copy and paste from Code::CopyFrom.
int mode_mask = RelocInfo::kCodeTargetMask |
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
......@@ -662,7 +662,7 @@ WasmCode* NativeModule::CloneLazyBuiltinInto(const WasmCode* code,
uint32_t index) {
DCHECK_EQ(wasm::WasmCode::kLazyStub, code->kind());
WasmCode* ret = CloneCode(code);
SetCodeTable(index, ret);
code_table_[index] = ret;
ret->index_ = Just(index);
return ret;
}
......@@ -699,7 +699,7 @@ WasmCode* NativeModule::CloneCode(const WasmCode* original_code) {
original_code->protected_instructions_, original_code->is_liftoff());
if (ret == nullptr) return nullptr;
if (!ret->IsAnonymous()) {
SetCodeTable(ret->index(), ret);
code_table_[ret->index()] = ret;
}
intptr_t delta =
ret->instructions().start() - original_code->instructions().start();
......@@ -711,10 +711,6 @@ WasmCode* NativeModule::CloneCode(const WasmCode* original_code) {
return ret;
}
void NativeModule::SetCodeTable(uint32_t index, wasm::WasmCode* code) {
code_table_[index] = code;
}
NativeModule::~NativeModule() {
TRACE_HEAP("Deleting native module: %p\n", reinterpret_cast<void*>(this));
wasm_code_manager_->FreeNativeModuleMemories(this);
......@@ -939,7 +935,7 @@ std::unique_ptr<NativeModule> NativeModule::Clone() {
PatchTrampolineAndStubCalls(original_code, new_code, reverse_lookup);
anonymous_lazy_builtin = new_code;
}
ret->SetCodeTable(i, anonymous_lazy_builtin);
ret->code_table_[i] = anonymous_lazy_builtin;
} break;
case WasmCode::kFunction: {
WasmCode* new_code = ret->CloneCode(original_code);
......
......@@ -286,7 +286,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
uint32_t stack_slots, size_t safepoint_table_offset,
std::shared_ptr<ProtectedInstructions>,
bool is_liftoff);
void SetCodeTable(uint32_t, wasm::WasmCode*);
WasmCode* CloneCode(const WasmCode*);
bool CloneTrampolinesAndStubs(const NativeModule* other);
WasmCode* Lookup(Address);
......
......@@ -591,7 +591,7 @@ bool NativeModuleDeserializer::ReadCode() {
WasmCode::kFunction, constant_pool_offset, stack_slot_count,
safepoint_table_offset, protected_instructions, is_liftoff);
if (ret == nullptr) return false;
native_module_->SetCodeTable(index_, ret);
native_module_->code_table_[index_] = ret;
// now relocate the code
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
......
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