[wasm] Remove {NativeModule::module_object} field.
R=titzer@chromium.org BUG=v8:7424 Change-Id: I1e5f41fba6cc575001cac1fd0a862736784a2131 Reviewed-on: https://chromium-review.googlesource.com/1113456 Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Ben Titzer <titzer@chromium.org> Cr-Commit-Position: refs/heads/master@{#54021}
This commit is contained in:
parent
e3d4dd0805
commit
4769681cd3
@ -442,20 +442,6 @@ void NativeModule::SetRuntimeStubs(Isolate* isolate) {
|
||||
#undef COPY_BUILTIN
|
||||
}
|
||||
|
||||
WasmModuleObject* NativeModule::module_object() const {
|
||||
DCHECK_NOT_NULL(module_object_);
|
||||
return *module_object_;
|
||||
}
|
||||
|
||||
void NativeModule::SetModuleObject(Handle<WasmModuleObject> module_object) {
|
||||
DCHECK_NULL(module_object_);
|
||||
module_object_ = module_object->GetIsolate()
|
||||
->global_handles()
|
||||
->Create(*module_object)
|
||||
.location();
|
||||
GlobalHandles::MakeWeak(reinterpret_cast<Object***>(&module_object_));
|
||||
}
|
||||
|
||||
WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
|
||||
WasmCode::Kind kind) {
|
||||
std::unique_ptr<byte[]> reloc_info;
|
||||
@ -732,14 +718,6 @@ void NativeModule::DisableTrapHandler() {
|
||||
|
||||
NativeModule::~NativeModule() {
|
||||
TRACE_HEAP("Deleting native module: %p\n", reinterpret_cast<void*>(this));
|
||||
// Clear the handle at the beginning of destructor to make it robust against
|
||||
// potential GCs in the rest of the destructor.
|
||||
if (module_object_ != nullptr) {
|
||||
Isolate* isolate = module_object()->GetIsolate();
|
||||
isolate->global_handles()->Destroy(
|
||||
reinterpret_cast<Object**>(module_object_));
|
||||
module_object_ = nullptr;
|
||||
}
|
||||
wasm_code_manager_->FreeNativeModule(this);
|
||||
}
|
||||
|
||||
|
@ -311,11 +311,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
|
||||
CompilationState* compilation_state() { return compilation_state_.get(); }
|
||||
|
||||
// TODO(mstarzinger): The link to the {WasmModuleObject} is deprecated and
|
||||
// all uses should vanish to make {NativeModule} independent of the Isolate.
|
||||
WasmModuleObject* module_object() const;
|
||||
void SetModuleObject(Handle<WasmModuleObject>);
|
||||
|
||||
uint32_t num_functions() const { return num_functions_; }
|
||||
uint32_t num_imported_functions() const { return num_imported_functions_; }
|
||||
Vector<WasmCode*> code_table() const {
|
||||
@ -399,11 +394,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
|
||||
std::unique_ptr<CompilationState, CompilationStateDeleter> compilation_state_;
|
||||
|
||||
// A phantom reference to the {WasmModuleObject}. It is intentionally not
|
||||
// typed {Handle<WasmModuleObject>} because this location will be cleared
|
||||
// when the phantom reference is cleared.
|
||||
WasmModuleObject** module_object_ = nullptr;
|
||||
|
||||
DisjointAllocationPool free_code_space_;
|
||||
DisjointAllocationPool allocated_code_space_;
|
||||
std::list<VirtualMemory> owned_code_space_;
|
||||
|
@ -307,13 +307,11 @@ Handle<WasmModuleObject> WasmModuleObject::New(
|
||||
module_object->set_asm_js_offset_table(*asm_js_offset_table);
|
||||
}
|
||||
|
||||
// Create the {NativeModule}, and link it bidirectionally to the
|
||||
// {WasmModuleObject}.
|
||||
// Create the {NativeModule}, and let the {WasmModuleObject} reference it.
|
||||
size_t memory_estimate =
|
||||
isolate->wasm_engine()->code_manager()->EstimateNativeModuleSize(module);
|
||||
auto native_module =
|
||||
isolate->wasm_engine()->code_manager()->NewNativeModule(isolate, env);
|
||||
native_module->SetModuleObject(module_object);
|
||||
native_module->set_wire_bytes(std::move(wire_bytes), wire_bytes_len);
|
||||
native_module->SetRuntimeStubs(isolate);
|
||||
Handle<Managed<wasm::NativeModule>> managed_native_module =
|
||||
|
Loading…
Reference in New Issue
Block a user