[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/1367748
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58120}
This commit is contained in:
Andreas Haas 2018-12-07 16:04:59 +01:00 committed by Commit Bot
parent 4d2b197d4c
commit 96a3ec79a5
4 changed files with 7 additions and 7 deletions

View File

@ -999,7 +999,8 @@ std::unique_ptr<NativeModule> CompileToNativeModule(
// Compile JS->wasm wrappers for exported functions.
*export_wrappers_out =
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.
native_module->LogWasmCodes(isolate);
@ -2732,7 +2733,7 @@ class AsyncCompileJob::CompileWrappers : public CompileStep {
TRACE_COMPILE("(5) Compile wrappers...\n");
// Compile JS->wasm wrappers for exported functions.
CompileJsToWasmWrappers(
job->isolate_, job->module_object_->native_module(),
job->isolate_, job->module_object_->native_module()->module(),
handle(job->module_object_->export_wrappers(), job->isolate_));
job->DoSync<FinishModule>();
}
@ -3213,11 +3214,10 @@ void CompilationStateImpl::NotifyOnEvent(CompilationEvent event,
if (callback_) callback_(event, error_result);
}
void CompileJsToWasmWrappers(Isolate* isolate, NativeModule* native_module,
void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
Handle<FixedArray> export_wrappers) {
JSToWasmWrapperCache js_to_wasm_cache;
int wrapper_index = 0;
const WasmModule* module = native_module->module();
// TODO(6792): Wrappers below are allocated with {Factory::NewCode}. As an
// optimization we keep the code space unlocked to avoid repeated unlocking

View File

@ -48,7 +48,7 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
MaybeHandle<JSArrayBuffer> memory);
V8_EXPORT_PRIVATE
void CompileJsToWasmWrappers(Isolate* isolate, NativeModule* native_module,
void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
Handle<FixedArray> export_wrappers);
V8_EXPORT_PRIVATE Handle<Script> CreateWasmScript(

View File

@ -249,7 +249,7 @@ Handle<WasmModuleObject> WasmEngine::ImportNativeModule(
size_t code_size = shared_module->committed_code_space();
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
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));
return module_object;
}

View File

@ -606,7 +606,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Reader reader(data + kVersionSize);
if (!deserializer.Read(&reader)) return {};
CompileJsToWasmWrappers(isolate, native_module,
CompileJsToWasmWrappers(isolate, native_module->module(),
handle(module_object->export_wrappers(), isolate));
// Log the code within the generated module for profiling.