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

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

Issue 2808403002: [wasm] Bumped DEPS for public js api tests, fixed failures. (Closed)
Patch Set: [wasm] Bumped DEPS for public js api tests, fixed failures. Created 3 years, 8 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
« no previous file with comments | « DEPS ('k') | test/mjsunit/wasm/errors.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index cd5fa420628e1d75b3f2985865fb9825b10cd09a..40015a70e161c889906896a242e94d7b4fa399b9 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1455,22 +1455,26 @@ class InstantiationHelper {
std::vector<Handle<JSFunction>> js_wrappers_;
JSToWasmWrapperCache js_to_wasm_cache_;
- // Helper routines to print out errors with imports.
- void ReportLinkError(const char* error, uint32_t index,
- Handle<String> module_name, Handle<String> import_name) {
- thrower_->LinkError(
- "Import #%d module=\"%.*s\" function=\"%.*s\" error: %s", index,
- module_name->length(), module_name->ToCString().get(),
- import_name->length(), import_name->ToCString().get(), error);
- }
-
- MaybeHandle<Object> ReportLinkError(const char* error, uint32_t index,
- Handle<String> module_name) {
- thrower_->LinkError("Import #%d module=\"%.*s\" error: %s", index,
- module_name->length(), module_name->ToCString().get(),
- error);
- return MaybeHandle<Object>();
- }
+// Helper routines to print out errors with imports.
+#define ERROR_THROWER_WITH_MESSAGE(TYPE) \
+ void Report##TYPE(const char* error, uint32_t index, \
+ Handle<String> module_name, Handle<String> import_name) { \
+ thrower_->TYPE("Import #%d module=\"%.*s\" function=\"%.*s\" error: %s", \
+ index, module_name->length(), \
+ module_name->ToCString().get(), import_name->length(), \
+ import_name->ToCString().get(), error); \
+ } \
+ \
+ MaybeHandle<Object> Report##TYPE(const char* error, uint32_t index, \
+ Handle<String> module_name) { \
+ thrower_->TYPE("Import #%d module=\"%.*s\" error: %s", index, \
+ module_name->length(), module_name->ToCString().get(), \
+ error); \
+ return MaybeHandle<Object>(); \
+ }
+
+ ERROR_THROWER_WITH_MESSAGE(LinkError)
+ ERROR_THROWER_WITH_MESSAGE(TypeError)
// Look up an import value in the {ffi_} object.
MaybeHandle<Object> LookupImport(uint32_t index, Handle<String> module_name,
@@ -1483,14 +1487,14 @@ class InstantiationHelper {
MaybeHandle<Object> result =
Object::GetPropertyOrElement(ffi_, module_name);
if (result.is_null()) {
- return ReportLinkError("module not found", index, module_name);
+ return ReportTypeError("module not found", index, module_name);
}
Handle<Object> module = result.ToHandleChecked();
// Look up the value in the module.
if (!module->IsJSReceiver()) {
- return ReportLinkError("module is not an object or function", index,
+ return ReportTypeError("module is not an object or function", index,
module_name);
}
« no previous file with comments | « DEPS ('k') | test/mjsunit/wasm/errors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698