Commit 53908d05 authored by mtrofin's avatar mtrofin Committed by Commit bot

[wasm] Bumped DEPS for public js api tests, fixed failures.

This also fixes an existing discrepancy.

BUG=v8:6017

Review-Url: https://codereview.chromium.org/2808403002
Cr-Commit-Position: refs/heads/master@{#44590}
parent cb4ceee2
......@@ -40,7 +40,7 @@ deps = {
"v8/tools/clang":
Var("chromium_url") + "/chromium/src/tools/clang.git" + "@" + "49df471350a60efaec6951f321dd65475496ba17",
"v8/test/wasm-js":
Var("chromium_url") + "/external/github.com/WebAssembly/spec.git" + "@" + "002e57c86ccf5c80db0de6e40246665340350c43",
Var("chromium_url") + "/external/github.com/WebAssembly/spec.git" + "@" + "7c62b17f547b80c9c717cc6ef3a8aba1e04e4bcb",
}
deps_os = {
......
......@@ -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);
}
......
......@@ -86,12 +86,24 @@ function assertConversionError(bytes, imports) {
assertCompileError(builder().addStart(0).toBuffer());
})();
(function TestLinkingError() {
(function TestTypeError() {
let b;
b = builder();
b.addImport("foo", "bar", kSig_v_v);
assertLinkError(b.toBuffer(), {});
assertTypeError(b.toBuffer(), {});
b = builder();
b.addImportedGlobal("foo", "bar", kWasmI32);
assertTypeError(b.toBuffer(), {});
b = builder();
b.addImportedMemory("foo", "bar");
assertTypeError(b.toBuffer(), {});
})();
(function TestLinkingError() {
let b;
b = builder();
b.addImport("foo", "bar", kSig_v_v);
assertLinkError(b.toBuffer(), {foo: {}});
......@@ -99,9 +111,6 @@ function assertConversionError(bytes, imports) {
b.addImport("foo", "bar", kSig_v_v);
assertLinkError(b.toBuffer(), {foo: {bar: 9}});
b = builder();
b.addImportedGlobal("foo", "bar", kWasmI32);
assertLinkError(b.toBuffer(), {});
b = builder();
b.addImportedGlobal("foo", "bar", kWasmI32);
assertLinkError(b.toBuffer(), {foo: {}});
......@@ -112,9 +121,6 @@ function assertConversionError(bytes, imports) {
b.addImportedGlobal("foo", "bar", kWasmI32);
assertLinkError(b.toBuffer(), {foo: {bar: () => 9}});
b = builder();
b.addImportedMemory("foo", "bar");
assertLinkError(b.toBuffer(), {});
b = builder();
b.addImportedMemory("foo", "bar");
assertLinkError(b.toBuffer(), {foo: {}});
......
......@@ -365,7 +365,7 @@ assertErrorMessage(
assertErrorMessage(
() => new Instance(importingModule, {'': {g: () => {}}}), LinkError, '');
assertErrorMessage(
() => new Instance(importingModule, {t: {f: () => {}}}), LinkError, '');
() => new Instance(importingModule, {t: {f: () => {}}}), TypeError, '');
assertTrue(new Instance(emptyModule) instanceof Instance);
assertTrue(new Instance(emptyModule, {}) instanceof Instance);
......@@ -793,12 +793,12 @@ assertInstantiateError(
assertInstantiateError(
[importingModuleBinary, undefined], TypeError, /TODO: error messages?/);
assertInstantiateError(
[importingModuleBinary, {}], LinkError, /TODO: error messages?/);
[importingModuleBinary, {}], TypeError, /TODO: error messages?/);
assertInstantiateError(
[importingModuleBinary, {'': {g: () => {}}}], LinkError,
/TODO: error messages?/);
assertInstantiateError(
[importingModuleBinary, {t: {f: () => {}}}], LinkError,
[importingModuleBinary, {t: {f: () => {}}}], TypeError,
/TODO: error messages?/);
assertInstantiateError(
[memoryImportingModuleBinary, null], TypeError, /TODO: error messages?/);
......@@ -806,10 +806,10 @@ assertInstantiateError(
[memoryImportingModuleBinary, undefined], TypeError,
/TODO: error messages?/);
assertInstantiateError(
[memoryImportingModuleBinary, {}], LinkError, /TODO: error messages?/);
[memoryImportingModuleBinary, {}], TypeError, /TODO: error messages?/);
assertInstantiateError(
[memoryImportingModuleBinary, {'mod': {'my_memory': scratch_memory}}],
LinkError, /TODO: error messages?/);
TypeError, /TODO: error messages?/);
assertInstantiateError(
[memoryImportingModuleBinary, {'': {'memory': scratch_memory}}], LinkError,
/TODO: error messages?/);
......
......@@ -14,8 +14,6 @@ const known_failures = {
'https://bugs.chromium.org/p/v8/issues/detail?id=5507',
"'WebAssembly.Table.prototype.set' method":
'https://bugs.chromium.org/p/v8/issues/detail?id=5507',
"'WebAssembly.Instance' constructor function":
'https://bugs.chromium.org/p/v8/issues/detail?id=6017',
};
let failures = [];
......
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