Commit 609c0a13 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Simplify {IsWasmExportedFunction} predicate.

R=clemensh@chromium.org

Change-Id: Ia495e09bdd0c529685de8ed77f6016d58b68f0d6
Reviewed-on: https://chromium-review.googlesource.com/965983
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51993}
parent 1516f3f2
......@@ -762,13 +762,15 @@ bool WasmExportedFunction::IsWasmExportedFunction(Object* object) {
Handle<JSFunction> js_function(JSFunction::cast(object));
if (Code::JS_TO_WASM_FUNCTION != js_function->code()->kind()) return false;
Handle<Symbol> symbol(
js_function->GetIsolate()->factory()->wasm_instance_symbol());
MaybeHandle<Object> maybe_result =
JSObject::GetPropertyOrElement(js_function, symbol);
Handle<Object> result;
if (!maybe_result.ToHandle(&result)) return false;
return result->IsWasmInstanceObject();
// Any function having code of {JS_TO_WASM_FUNCTION} kind must be an exported
// function and hence will have a property holding the instance object.
DCHECK(JSObject::GetPropertyOrElement(
js_function,
js_function->GetIsolate()->factory()->wasm_instance_symbol())
.ToHandleChecked()
->IsWasmInstanceObject());
return true;
}
WasmExportedFunction* WasmExportedFunction::cast(Object* object) {
......
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