[wasm] Remove dead exported wrapper handling from {NativeModule}.
R=titzer@chromium.org Change-Id: I9c947440e4e92ff7176d8dc2f334182c524898f9 Reviewed-on: https://chromium-review.googlesource.com/962451 Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Ben Titzer <titzer@chromium.org> Cr-Commit-Position: refs/heads/master@{#51941}
This commit is contained in:
parent
8581e30929
commit
b20aafb967
@ -535,21 +535,6 @@ Address NativeModule::GetLocalAddressFor(Handle<Code> code) {
|
||||
}
|
||||
}
|
||||
|
||||
WasmCode* NativeModule::GetExportedWrapper(uint32_t index) {
|
||||
auto found = exported_wasm_to_wasm_wrappers_.find(index);
|
||||
if (found != exported_wasm_to_wasm_wrappers_.end()) {
|
||||
return found->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WasmCode* NativeModule::AddExportedWrapper(Handle<Code> code, uint32_t index) {
|
||||
WasmCode* ret = AddAnonymousCode(code, WasmCode::kWasmToWasmWrapper);
|
||||
ret->index_ = Just(index);
|
||||
exported_wasm_to_wasm_wrappers_.insert(std::make_pair(index, ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void NativeModule::LinkAll() {
|
||||
Isolate* isolate = compiled_module()->GetIsolate();
|
||||
Zone specialization_zone(isolate->allocator(), ZONE_NAME);
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "src/base/macros.h"
|
||||
#include "src/handles.h"
|
||||
@ -222,11 +221,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
// by the runtime.
|
||||
void SetLazyBuiltin(Handle<Code> code);
|
||||
|
||||
// ExportedWrappers are WasmToWasmWrappers for functions placed on import
|
||||
// tables. We construct them as-needed.
|
||||
WasmCode* GetExportedWrapper(uint32_t index);
|
||||
WasmCode* AddExportedWrapper(Handle<Code> code, uint32_t index);
|
||||
|
||||
// FunctionCount is WasmModule::functions.size().
|
||||
uint32_t FunctionCount() const;
|
||||
WasmCode* GetCode(uint32_t index) const;
|
||||
@ -303,7 +297,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
Address CreateTrampolineTo(Handle<Code>);
|
||||
|
||||
std::vector<std::unique_ptr<WasmCode>> owned_code_;
|
||||
std::unordered_map<uint32_t, WasmCode*> exported_wasm_to_wasm_wrappers_;
|
||||
|
||||
WasmCodeUniquePtrComparer owned_code_comparer_;
|
||||
|
||||
|
@ -155,33 +155,6 @@ WasmFunction* GetWasmFunctionForExport(Isolate* isolate,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Handle<Object> GetOrCreateIndirectCallWrapper(
|
||||
Isolate* isolate, Handle<WasmInstanceObject> owning_instance,
|
||||
wasm::WasmCode* wasm_code, uint32_t func_index, FunctionSig* sig) {
|
||||
Address new_context_address =
|
||||
reinterpret_cast<Address>(owning_instance->wasm_context()->get());
|
||||
DCHECK_NE(wasm_code->kind(), wasm::WasmCode::kWasmToWasmWrapper);
|
||||
wasm::NativeModule* native_module = wasm_code->owner();
|
||||
// The only reason we pass owning_instance is for the GC case. Check
|
||||
// that the values match.
|
||||
DCHECK_EQ(owning_instance->compiled_module()->GetNativeModule(),
|
||||
native_module);
|
||||
// We create the wrapper on the module exporting the function. This
|
||||
// wrapper will only be called as indirect call.
|
||||
wasm::WasmCode* exported_wrapper =
|
||||
native_module->GetExportedWrapper(wasm_code->index());
|
||||
if (exported_wrapper == nullptr) {
|
||||
wasm::NativeModuleModificationScope native_modification_scope(
|
||||
native_module);
|
||||
Handle<Code> new_wrapper = compiler::CompileWasmToWasmWrapper(
|
||||
isolate, wasm_code, sig, new_context_address);
|
||||
exported_wrapper =
|
||||
native_module->AddExportedWrapper(new_wrapper, wasm_code->index());
|
||||
}
|
||||
Address target = exported_wrapper->instructions().start();
|
||||
return isolate->factory()->NewForeign(target, TENURED);
|
||||
}
|
||||
|
||||
bool IsWasmCodegenAllowed(Isolate* isolate, Handle<Context> context) {
|
||||
// TODO(wasm): Once wasm has its own CSP policy, we should introduce a
|
||||
// separate callback that includes information about the module about to be
|
||||
|
@ -268,10 +268,6 @@ Handle<FixedArray> DecodeLocalNames(Isolate*, Handle<WasmSharedModuleData>);
|
||||
// TODO(titzer): move this to WasmExportedFunction.
|
||||
WasmFunction* GetWasmFunctionForExport(Isolate* isolate, Handle<Object> target);
|
||||
|
||||
Handle<Object> GetOrCreateIndirectCallWrapper(
|
||||
Isolate* isolate, Handle<WasmInstanceObject> owning_instance,
|
||||
wasm::WasmCode* wasm_code, uint32_t func_index, FunctionSig* sig);
|
||||
|
||||
void UnpackAndRegisterProtectedInstructions(
|
||||
Isolate* isolate, const wasm::NativeModule* native_module);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user