[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: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#51993}
This commit is contained in:
parent
1516f3f25e
commit
609c0a137e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user