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 = { ...@@ -40,7 +40,7 @@ deps = {
"v8/tools/clang": "v8/tools/clang":
Var("chromium_url") + "/chromium/src/tools/clang.git" + "@" + "49df471350a60efaec6951f321dd65475496ba17", Var("chromium_url") + "/chromium/src/tools/clang.git" + "@" + "49df471350a60efaec6951f321dd65475496ba17",
"v8/test/wasm-js": "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 = { deps_os = {
......
...@@ -1455,22 +1455,26 @@ class InstantiationHelper { ...@@ -1455,22 +1455,26 @@ class InstantiationHelper {
std::vector<Handle<JSFunction>> js_wrappers_; std::vector<Handle<JSFunction>> js_wrappers_;
JSToWasmWrapperCache js_to_wasm_cache_; JSToWasmWrapperCache js_to_wasm_cache_;
// Helper routines to print out errors with imports. // Helper routines to print out errors with imports.
void ReportLinkError(const char* error, uint32_t index, #define ERROR_THROWER_WITH_MESSAGE(TYPE) \
Handle<String> module_name, Handle<String> import_name) { void Report##TYPE(const char* error, uint32_t index, \
thrower_->LinkError( Handle<String> module_name, Handle<String> import_name) { \
"Import #%d module=\"%.*s\" function=\"%.*s\" error: %s", index, thrower_->TYPE("Import #%d module=\"%.*s\" function=\"%.*s\" error: %s", \
module_name->length(), module_name->ToCString().get(), index, module_name->length(), \
import_name->length(), import_name->ToCString().get(), error); 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) { MaybeHandle<Object> Report##TYPE(const char* error, uint32_t index, \
thrower_->LinkError("Import #%d module=\"%.*s\" error: %s", index, Handle<String> module_name) { \
module_name->length(), module_name->ToCString().get(), thrower_->TYPE("Import #%d module=\"%.*s\" error: %s", index, \
error); module_name->length(), module_name->ToCString().get(), \
return MaybeHandle<Object>(); error); \
} return MaybeHandle<Object>(); \
}
ERROR_THROWER_WITH_MESSAGE(LinkError)
ERROR_THROWER_WITH_MESSAGE(TypeError)
// Look up an import value in the {ffi_} object. // Look up an import value in the {ffi_} object.
MaybeHandle<Object> LookupImport(uint32_t index, Handle<String> module_name, MaybeHandle<Object> LookupImport(uint32_t index, Handle<String> module_name,
...@@ -1483,14 +1487,14 @@ class InstantiationHelper { ...@@ -1483,14 +1487,14 @@ class InstantiationHelper {
MaybeHandle<Object> result = MaybeHandle<Object> result =
Object::GetPropertyOrElement(ffi_, module_name); Object::GetPropertyOrElement(ffi_, module_name);
if (result.is_null()) { 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(); Handle<Object> module = result.ToHandleChecked();
// Look up the value in the module. // Look up the value in the module.
if (!module->IsJSReceiver()) { 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); module_name);
} }
......
...@@ -86,12 +86,24 @@ function assertConversionError(bytes, imports) { ...@@ -86,12 +86,24 @@ function assertConversionError(bytes, imports) {
assertCompileError(builder().addStart(0).toBuffer()); assertCompileError(builder().addStart(0).toBuffer());
})(); })();
(function TestLinkingError() { (function TestTypeError() {
let b; let b;
b = builder(); b = builder();
b.addImport("foo", "bar", kSig_v_v); 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 = builder();
b.addImport("foo", "bar", kSig_v_v); b.addImport("foo", "bar", kSig_v_v);
assertLinkError(b.toBuffer(), {foo: {}}); assertLinkError(b.toBuffer(), {foo: {}});
...@@ -99,9 +111,6 @@ function assertConversionError(bytes, imports) { ...@@ -99,9 +111,6 @@ function assertConversionError(bytes, imports) {
b.addImport("foo", "bar", kSig_v_v); b.addImport("foo", "bar", kSig_v_v);
assertLinkError(b.toBuffer(), {foo: {bar: 9}}); assertLinkError(b.toBuffer(), {foo: {bar: 9}});
b = builder();
b.addImportedGlobal("foo", "bar", kWasmI32);
assertLinkError(b.toBuffer(), {});
b = builder(); b = builder();
b.addImportedGlobal("foo", "bar", kWasmI32); b.addImportedGlobal("foo", "bar", kWasmI32);
assertLinkError(b.toBuffer(), {foo: {}}); assertLinkError(b.toBuffer(), {foo: {}});
...@@ -112,9 +121,6 @@ function assertConversionError(bytes, imports) { ...@@ -112,9 +121,6 @@ function assertConversionError(bytes, imports) {
b.addImportedGlobal("foo", "bar", kWasmI32); b.addImportedGlobal("foo", "bar", kWasmI32);
assertLinkError(b.toBuffer(), {foo: {bar: () => 9}}); assertLinkError(b.toBuffer(), {foo: {bar: () => 9}});
b = builder();
b.addImportedMemory("foo", "bar");
assertLinkError(b.toBuffer(), {});
b = builder(); b = builder();
b.addImportedMemory("foo", "bar"); b.addImportedMemory("foo", "bar");
assertLinkError(b.toBuffer(), {foo: {}}); assertLinkError(b.toBuffer(), {foo: {}});
......
...@@ -365,7 +365,7 @@ assertErrorMessage( ...@@ -365,7 +365,7 @@ assertErrorMessage(
assertErrorMessage( assertErrorMessage(
() => new Instance(importingModule, {'': {g: () => {}}}), LinkError, ''); () => new Instance(importingModule, {'': {g: () => {}}}), LinkError, '');
assertErrorMessage( 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);
assertTrue(new Instance(emptyModule, {}) instanceof Instance); assertTrue(new Instance(emptyModule, {}) instanceof Instance);
...@@ -793,12 +793,12 @@ assertInstantiateError( ...@@ -793,12 +793,12 @@ assertInstantiateError(
assertInstantiateError( assertInstantiateError(
[importingModuleBinary, undefined], TypeError, /TODO: error messages?/); [importingModuleBinary, undefined], TypeError, /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[importingModuleBinary, {}], LinkError, /TODO: error messages?/); [importingModuleBinary, {}], TypeError, /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[importingModuleBinary, {'': {g: () => {}}}], LinkError, [importingModuleBinary, {'': {g: () => {}}}], LinkError,
/TODO: error messages?/); /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[importingModuleBinary, {t: {f: () => {}}}], LinkError, [importingModuleBinary, {t: {f: () => {}}}], TypeError,
/TODO: error messages?/); /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[memoryImportingModuleBinary, null], TypeError, /TODO: error messages?/); [memoryImportingModuleBinary, null], TypeError, /TODO: error messages?/);
...@@ -806,10 +806,10 @@ assertInstantiateError( ...@@ -806,10 +806,10 @@ assertInstantiateError(
[memoryImportingModuleBinary, undefined], TypeError, [memoryImportingModuleBinary, undefined], TypeError,
/TODO: error messages?/); /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[memoryImportingModuleBinary, {}], LinkError, /TODO: error messages?/); [memoryImportingModuleBinary, {}], TypeError, /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[memoryImportingModuleBinary, {'mod': {'my_memory': scratch_memory}}], [memoryImportingModuleBinary, {'mod': {'my_memory': scratch_memory}}],
LinkError, /TODO: error messages?/); TypeError, /TODO: error messages?/);
assertInstantiateError( assertInstantiateError(
[memoryImportingModuleBinary, {'': {'memory': scratch_memory}}], LinkError, [memoryImportingModuleBinary, {'': {'memory': scratch_memory}}], LinkError,
/TODO: error messages?/); /TODO: error messages?/);
......
...@@ -14,8 +14,6 @@ const known_failures = { ...@@ -14,8 +14,6 @@ const known_failures = {
'https://bugs.chromium.org/p/v8/issues/detail?id=5507', 'https://bugs.chromium.org/p/v8/issues/detail?id=5507',
"'WebAssembly.Table.prototype.set' method": "'WebAssembly.Table.prototype.set' method":
'https://bugs.chromium.org/p/v8/issues/detail?id=5507', '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 = []; 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