Commit 96a3ec79 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][cleanup] CompileJsToWasmWrappers does not need a NativeModule

CompileJsToWasmWrappers only needs a WasmModule, so we should not pass
in a NativeModule.

R=clemensh@chromium.org

Bug: v8:8562
Change-Id: Ic38f1bee2eab3a06921c27f56fd175b51688ad5f
Reviewed-on: https://chromium-review.googlesource.com/c/1367748Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58120}
parent 4d2b197d
...@@ -999,7 +999,8 @@ std::unique_ptr<NativeModule> CompileToNativeModule( ...@@ -999,7 +999,8 @@ std::unique_ptr<NativeModule> CompileToNativeModule(
// Compile JS->wasm wrappers for exported functions. // Compile JS->wasm wrappers for exported functions.
*export_wrappers_out = *export_wrappers_out =
isolate->factory()->NewFixedArray(export_wrapper_size, TENURED); isolate->factory()->NewFixedArray(export_wrapper_size, TENURED);
CompileJsToWasmWrappers(isolate, native_module.get(), *export_wrappers_out); CompileJsToWasmWrappers(isolate, native_module->module(),
*export_wrappers_out);
// Log the code within the generated module for profiling. // Log the code within the generated module for profiling.
native_module->LogWasmCodes(isolate); native_module->LogWasmCodes(isolate);
...@@ -2732,7 +2733,7 @@ class AsyncCompileJob::CompileWrappers : public CompileStep { ...@@ -2732,7 +2733,7 @@ class AsyncCompileJob::CompileWrappers : public CompileStep {
TRACE_COMPILE("(5) Compile wrappers...\n"); TRACE_COMPILE("(5) Compile wrappers...\n");
// Compile JS->wasm wrappers for exported functions. // Compile JS->wasm wrappers for exported functions.
CompileJsToWasmWrappers( CompileJsToWasmWrappers(
job->isolate_, job->module_object_->native_module(), job->isolate_, job->module_object_->native_module()->module(),
handle(job->module_object_->export_wrappers(), job->isolate_)); handle(job->module_object_->export_wrappers(), job->isolate_));
job->DoSync<FinishModule>(); job->DoSync<FinishModule>();
} }
...@@ -3213,11 +3214,10 @@ void CompilationStateImpl::NotifyOnEvent(CompilationEvent event, ...@@ -3213,11 +3214,10 @@ void CompilationStateImpl::NotifyOnEvent(CompilationEvent event,
if (callback_) callback_(event, error_result); if (callback_) callback_(event, error_result);
} }
void CompileJsToWasmWrappers(Isolate* isolate, NativeModule* native_module, void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
Handle<FixedArray> export_wrappers) { Handle<FixedArray> export_wrappers) {
JSToWasmWrapperCache js_to_wasm_cache; JSToWasmWrapperCache js_to_wasm_cache;
int wrapper_index = 0; int wrapper_index = 0;
const WasmModule* module = native_module->module();
// TODO(6792): Wrappers below are allocated with {Factory::NewCode}. As an // TODO(6792): Wrappers below are allocated with {Factory::NewCode}. As an
// optimization we keep the code space unlocked to avoid repeated unlocking // optimization we keep the code space unlocked to avoid repeated unlocking
......
...@@ -48,7 +48,7 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject( ...@@ -48,7 +48,7 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
MaybeHandle<JSArrayBuffer> memory); MaybeHandle<JSArrayBuffer> memory);
V8_EXPORT_PRIVATE V8_EXPORT_PRIVATE
void CompileJsToWasmWrappers(Isolate* isolate, NativeModule* native_module, void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
Handle<FixedArray> export_wrappers); Handle<FixedArray> export_wrappers);
V8_EXPORT_PRIVATE Handle<Script> CreateWasmScript( V8_EXPORT_PRIVATE Handle<Script> CreateWasmScript(
......
...@@ -249,7 +249,7 @@ Handle<WasmModuleObject> WasmEngine::ImportNativeModule( ...@@ -249,7 +249,7 @@ Handle<WasmModuleObject> WasmEngine::ImportNativeModule(
size_t code_size = shared_module->committed_code_space(); size_t code_size = shared_module->committed_code_space();
Handle<WasmModuleObject> module_object = WasmModuleObject::New( Handle<WasmModuleObject> module_object = WasmModuleObject::New(
isolate, std::move(shared_module), script, code_size); isolate, std::move(shared_module), script, code_size);
CompileJsToWasmWrappers(isolate, module_object->native_module(), CompileJsToWasmWrappers(isolate, module_object->native_module()->module(),
handle(module_object->export_wrappers(), isolate)); handle(module_object->export_wrappers(), isolate));
return module_object; return module_object;
} }
......
...@@ -606,7 +606,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule( ...@@ -606,7 +606,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Reader reader(data + kVersionSize); Reader reader(data + kVersionSize);
if (!deserializer.Read(&reader)) return {}; if (!deserializer.Read(&reader)) return {};
CompileJsToWasmWrappers(isolate, native_module, CompileJsToWasmWrappers(isolate, native_module->module(),
handle(module_object->export_wrappers(), isolate)); handle(module_object->export_wrappers(), isolate));
// Log the code within the generated module for profiling. // Log the code within the generated module for profiling.
......
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