[wasm] [cleanup] Remove NativeModule::instance_id
The name itself does not make sense any more since the {NativeModule} is shared across instances. It is also only used for debugging, so remove it, and replace it by the address of the {NativeModule} itself in debug output. R=mstarzinger@chromium.org Bug: v8:7754 Change-Id: I02f9252981b776934811a904287be31c7076e90b Reviewed-on: https://chromium-review.googlesource.com/1114965 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#54064}
This commit is contained in:
parent
9b39394eb8
commit
f10412d495
@ -1116,7 +1116,7 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
||||
// Create the WebAssembly.Instance object.
|
||||
//--------------------------------------------------------------------------
|
||||
wasm::NativeModule* native_module = module_object_->native_module();
|
||||
TRACE("New module instantiation for %zu\n", native_module->instance_id);
|
||||
TRACE("New module instantiation for %p\n", native_module);
|
||||
Handle<WasmInstanceObject> instance =
|
||||
WasmInstanceObject::New(isolate_, module_object_);
|
||||
wasm::NativeModuleModificationScope native_modification_scope(native_module);
|
||||
@ -1309,8 +1309,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
||||
}
|
||||
|
||||
DCHECK(!isolate_->has_pending_exception());
|
||||
TRACE("Successfully built instance %zu\n",
|
||||
module_object_->native_module()->instance_id);
|
||||
TRACE("Successfully built instance for module %p\n",
|
||||
module_object_->native_module());
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <iomanip>
|
||||
|
||||
#include "src/assembler-inl.h"
|
||||
#include "src/base/atomic-utils.h"
|
||||
#include "src/base/macros.h"
|
||||
#include "src/base/platform/platform.h"
|
||||
#include "src/codegen.h"
|
||||
@ -297,14 +296,11 @@ WasmCode::~WasmCode() {
|
||||
}
|
||||
}
|
||||
|
||||
base::AtomicNumber<size_t> NativeModule::next_id_;
|
||||
|
||||
NativeModule::NativeModule(Isolate* isolate, uint32_t num_functions,
|
||||
uint32_t num_imported_functions,
|
||||
bool can_request_more, VirtualMemory* code_space,
|
||||
WasmCodeManager* code_manager, ModuleEnv& env)
|
||||
: instance_id(next_id_.Increment(1)),
|
||||
num_functions_(num_functions),
|
||||
: num_functions_(num_functions),
|
||||
num_imported_functions_(num_imported_functions),
|
||||
compilation_state_(NewCompilationState(isolate, env)),
|
||||
free_code_space_({code_space->address(), code_space->end()}),
|
||||
@ -648,8 +644,7 @@ Address NativeModule::AllocateForCode(size_t size) {
|
||||
}
|
||||
DCHECK(IsAligned(mem.start, kCodeAlignment));
|
||||
allocated_code_space_.Merge(std::move(mem));
|
||||
TRACE_HEAP("ID: %zu. Code alloc: %p,+%zu\n", instance_id,
|
||||
reinterpret_cast<void*>(mem.start), size);
|
||||
TRACE_HEAP("Code alloc for %p: %" PRIuPTR ",+%zu\n", this, mem.start, size);
|
||||
return mem.start;
|
||||
}
|
||||
|
||||
@ -829,8 +824,8 @@ std::unique_ptr<NativeModule> WasmCodeManager::NewNativeModule(
|
||||
std::unique_ptr<NativeModule> ret(
|
||||
new NativeModule(isolate, num_functions, num_imported_functions,
|
||||
can_request_more, &mem, this, env));
|
||||
TRACE_HEAP("New Module: ID:%zu. Mem: %p,+%zu\n", ret->instance_id,
|
||||
reinterpret_cast<void*>(start), size);
|
||||
TRACE_HEAP("New NativeModule %p: Mem: %" PRIuPTR ",+%zu\n", this, start,
|
||||
size);
|
||||
AssignRanges(start, end, ret.get());
|
||||
++active_;
|
||||
return ret;
|
||||
@ -842,8 +837,7 @@ std::unique_ptr<NativeModule> WasmCodeManager::NewNativeModule(
|
||||
|
||||
bool NativeModule::SetExecutable(bool executable) {
|
||||
if (is_executable_ == executable) return true;
|
||||
TRACE_HEAP("Setting module %zu as executable: %d.\n", instance_id,
|
||||
executable);
|
||||
TRACE_HEAP("Setting module %p as executable: %d.\n", this, executable);
|
||||
PageAllocator::Permission permission =
|
||||
executable ? PageAllocator::kReadExecute : PageAllocator::kReadWrite;
|
||||
|
||||
@ -888,7 +882,7 @@ bool NativeModule::SetExecutable(bool executable) {
|
||||
void WasmCodeManager::FreeNativeModule(NativeModule* native_module) {
|
||||
DCHECK_GE(active_, 1);
|
||||
--active_;
|
||||
TRACE_HEAP("Freeing %zu\n", native_module->instance_id);
|
||||
TRACE_HEAP("Freeing NativeModule %p\n", this);
|
||||
for (auto& vmem : native_module->owned_code_space_) {
|
||||
lookup_map_.erase(vmem.address());
|
||||
Free(&vmem);
|
||||
|
@ -314,7 +314,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
|
||||
WasmCode* Lookup(Address) const;
|
||||
|
||||
const size_t instance_id = 0;
|
||||
~NativeModule();
|
||||
|
||||
private:
|
||||
@ -324,7 +323,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
friend class NativeModuleDeserializer;
|
||||
friend class NativeModuleModificationScope;
|
||||
|
||||
static base::AtomicNumber<size_t> next_id_;
|
||||
NativeModule(Isolate* isolate, uint32_t num_functions,
|
||||
uint32_t num_imported_functions, bool can_request_more,
|
||||
VirtualMemory* code_space, WasmCodeManager* code_manager,
|
||||
|
@ -1266,8 +1266,8 @@ void InstanceFinalizer(const v8::WeakCallbackInfo<void>& data) {
|
||||
Isolate* isolate = reinterpret_cast<Isolate*>(data.GetIsolate());
|
||||
// If a link to shared memory instances exists, update the list of memory
|
||||
// instances before the instance is destroyed.
|
||||
TRACE("Finalizing %zu {\n",
|
||||
instance->module_object()->native_module()->instance_id);
|
||||
TRACE("Finalizing instance of %p {\n",
|
||||
instance->module_object()->native_module());
|
||||
|
||||
// Since the order of finalizers is not guaranteed, it can be the case
|
||||
// that {instance->compiled_module()->module()}, which is a
|
||||
|
Loading…
Reference in New Issue
Block a user