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

[wasm] Remove redundant parameters

The {ModuleEnv} already contains a pointer to the {WasmModule}, no need
to pass it explicitly.

R=titzer@chromium.org

Change-Id: Icf0e8ea8b25c33dd5bcaeab2a4a746376e73813d
Reviewed-on: https://chromium-review.googlesource.com/1105828
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53858}
parent 7e4e5d0f
......@@ -878,14 +878,15 @@ size_t WasmCodeManager::EstimateNativeModuleSize(const WasmModule* module) {
return estimate;
}
std::unique_ptr<NativeModule> WasmCodeManager::NewNativeModule(
Isolate* isolate, const WasmModule& module, ModuleEnv& env) {
size_t memory_estimate = EstimateNativeModuleSize(&module);
std::unique_ptr<NativeModule> WasmCodeManager::NewNativeModule(Isolate* isolate,
ModuleEnv& env) {
const WasmModule* module = env.module;
size_t memory_estimate = EstimateNativeModuleSize(module);
uint32_t num_wasm_functions =
module.num_imported_functions + module.num_declared_functions;
DCHECK_EQ(module.functions.size(), num_wasm_functions);
module->num_imported_functions + module->num_declared_functions;
DCHECK_EQ(module->functions.size(), num_wasm_functions);
return NewNativeModule(isolate, memory_estimate, num_wasm_functions,
module.num_imported_functions,
module->num_imported_functions,
kModuleCanAllocateMoreMemory, env);
}
......
......@@ -428,7 +428,6 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
// code. The native module may later request more memory.
// TODO(titzer): isolate is only required here for CompilationState.
std::unique_ptr<NativeModule> NewNativeModule(Isolate* isolate,
const WasmModule& module,
ModuleEnv& env);
// TODO(titzer): isolate is only required here for CompilationState.
std::unique_ptr<NativeModule> NewNativeModule(
......
......@@ -276,6 +276,7 @@ Handle<WasmModuleObject> WasmModuleObject::New(
std::shared_ptr<wasm::WasmModule> module, wasm::ModuleEnv& env,
Handle<SeqOneByteString> module_bytes, Handle<Script> script,
Handle<ByteArray> asm_js_offset_table) {
DCHECK_EQ(module.get(), env.module);
// The {managed_module} will take shared ownership of the {WasmModule} object,
// and release it when the GC reclaim the managed.
size_t module_size = EstimateWasmModuleSize(module.get());
......@@ -286,7 +287,7 @@ Handle<WasmModuleObject> WasmModuleObject::New(
// Create the first {WasmCompiledModule} associated with this
// {WasmModuleObject}.
Handle<WasmCompiledModule> compiled_module =
WasmCompiledModule::New(isolate, managed_module->raw(), env);
WasmCompiledModule::New(isolate, env);
// Now create the {WasmModuleObject}.
Handle<JSFunction> module_cons(
......@@ -1506,7 +1507,6 @@ Address WasmExportedFunction::GetWasmCallTarget() {
}
Handle<WasmCompiledModule> WasmCompiledModule::New(Isolate* isolate,
WasmModule* module,
wasm::ModuleEnv& env) {
Handle<WasmCompiledModule> compiled_module = Handle<WasmCompiledModule>::cast(
isolate->factory()->NewStruct(WASM_COMPILED_MODULE_TYPE, TENURED));
......@@ -1514,10 +1514,9 @@ Handle<WasmCompiledModule> WasmCompiledModule::New(Isolate* isolate,
{
size_t memory_estimate =
isolate->wasm_engine()->code_manager()->EstimateNativeModuleSize(
module);
env.module);
auto native_module =
isolate->wasm_engine()->code_manager()->NewNativeModule(isolate,
*module, env);
isolate->wasm_engine()->code_manager()->NewNativeModule(isolate, env);
Handle<Foreign> native_module_wrapper =
Managed<wasm::NativeModule>::FromUniquePtr(isolate, memory_estimate,
std::move(native_module));
......
......@@ -574,7 +574,6 @@ class WasmCompiledModule : public Struct {
public:
static Handle<WasmCompiledModule> New(Isolate* isolate,
wasm::WasmModule* module,
wasm::ModuleEnv& env);
static Handle<WasmCompiledModule> Clone(Isolate* isolate,
......
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