Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: src/wasm/wasm-module.cc

Issue 2208703002: [wasm] Allow import function to be any kind of callables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Create a native context at the beginning of all tests in test-run-wasm-js.cc Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index fdec11b33fb572aac5fbc42a3145cef376484fd3..430a99228c87815888bedb00292a4006eb277270 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -455,7 +455,7 @@ static MaybeHandle<JSFunction> ReportFFIError(
return MaybeHandle<JSFunction>();
}
-static MaybeHandle<JSFunction> LookupFunction(
+static MaybeHandle<JSReceiver> LookupFunction(
ErrorThrower& thrower, Factory* factory, Handle<JSReceiver> ffi,
uint32_t index, Handle<String> module_name,
MaybeHandle<String> function_name) {
@@ -493,12 +493,12 @@ static MaybeHandle<JSFunction> LookupFunction(
function = module;
}
- if (!function->IsJSFunction()) {
- return ReportFFIError(thrower, "not a function", index, module_name,
+ if (!function->IsCallable()) {
+ return ReportFFIError(thrower, "not a callable", index, module_name,
function_name);
}
- return Handle<JSFunction>::cast(function);
+ return Handle<JSReceiver>::cast(function);
}
namespace {
@@ -645,7 +645,7 @@ bool CompileWrappersToImportedFunctions(Isolate* isolate,
int param_count = sig_data_size - ret_count;
CHECK(param_count >= 0);
- MaybeHandle<JSFunction> function = LookupFunction(
+ MaybeHandle<JSReceiver> function = LookupFunction(
*thrower, isolate->factory(), ffi, index, module_name, function_name);
if (function.is_null()) return false;

Powered by Google App Engine
This is Rietveld 408576698