Commit c6654952 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Remove obsolete {GetWasmFunctionForExport} helper.

R=titzer@chromium.org

Change-Id: I2de3bef1753669c7a9f653ece14f168930392180
Reviewed-on: https://chromium-review.googlesource.com/997692Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52394}
parent e863e926
......@@ -854,11 +854,8 @@ void WebAssemblyTableSet(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Parameter 1.
i::Handle<i::Object> value = Utils::OpenHandle(*args[1]);
// TODO(titzer): use WasmExportedFunction::IsWasmExportedFunction() here.
if (!value->IsNull(i_isolate) &&
(!value->IsJSFunction() ||
i::Handle<i::JSFunction>::cast(value)->code()->kind() !=
i::Code::JS_TO_WASM_FUNCTION)) {
!i::WasmExportedFunction::IsWasmExportedFunction(*value)) {
thrower.TypeError("Argument 1 must be null or a WebAssembly function");
return;
}
......
......@@ -138,20 +138,6 @@ std::ostream& operator<<(std::ostream& os, const WasmFunctionName& name) {
WasmModule::WasmModule(std::unique_ptr<Zone> owned)
: signature_zone(std::move(owned)) {}
WasmFunction* GetWasmFunctionForExport(Isolate* isolate,
Handle<Object> target) {
if (target->IsJSFunction()) {
Handle<JSFunction> func = Handle<JSFunction>::cast(target);
if (func->code()->kind() == Code::JS_TO_WASM_FUNCTION) {
auto exported = Handle<WasmExportedFunction>::cast(func);
Handle<WasmInstanceObject> other_instance(exported->instance(), isolate);
int func_index = exported->function_index();
return &other_instance->module()->functions[func_index];
}
}
return nullptr;
}
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
......
......@@ -262,13 +262,6 @@ V8_EXPORT_PRIVATE Handle<JSArray> GetCustomSections(
// function index, the inner one by the local index.
Handle<FixedArray> DecodeLocalNames(Isolate*, Handle<WasmSharedModuleData>);
// If the target is an export wrapper, return the {WasmFunction*} corresponding
// to the wrapped wasm function; in all other cases, return nullptr.
// The returned pointer is owned by the wasm instance target belongs to. The
// result is alive as long as the instance exists.
// TODO(titzer): move this to WasmExportedFunction.
WasmFunction* GetWasmFunctionForExport(Isolate* isolate, Handle<Object> target);
void UnpackAndRegisterProtectedInstructions(
Isolate* isolate, const wasm::NativeModule* native_module);
......
......@@ -285,8 +285,11 @@ void WasmTableObject::Set(Isolate* isolate, Handle<WasmTableObject> table,
}
// TODO(titzer): Change this to MaybeHandle<WasmExportedFunction>
DCHECK(WasmExportedFunction::IsWasmExportedFunction(*function));
auto exported_function = Handle<WasmExportedFunction>::cast(function);
auto* wasm_function = wasm::GetWasmFunctionForExport(isolate, function);
Handle<WasmInstanceObject> other_instance(exported_function->instance());
int func_index = exported_function->function_index();
auto* wasm_function = &other_instance->module()->functions[func_index];
DCHECK_NOT_NULL(wasm_function);
DCHECK_NOT_NULL(wasm_function->sig);
wasm::WasmCode* wasm_code = exported_function->GetWasmCode();
......
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