Commit 582cddde authored by bradnelson's avatar bradnelson Committed by Commit bot

[wasm][asm.js] Require exported asm.js functions have be names.

The asm.js spec requires exports to be identifiers,
this was DCHECKED in the asm-wasm-builder, but not the typer.

BUG=672046
R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2552913004
Cr-Commit-Position: refs/heads/master@{#41557}
parent ebe94192
......@@ -935,6 +935,10 @@ AsmType* AsmTyper::ValidateExport(ReturnStatement* exports) {
"Only normal object properties may be used in the export object "
"literal.");
}
if (!prop->key()->AsLiteral()->IsPropertyName()) {
FAIL(prop->key(),
"Exported functions must have valid identifier names.");
}
auto* export_obj = prop->value()->AsVariableProxy();
if (export_obj == nullptr) {
......
......@@ -1484,6 +1484,19 @@ assertWasm(-34359738370.75, TestNegativeDouble);
})();
(function TestBadExportKey() {
function Module() {
"use asm";
function func() {
}
return {123: func};
}
Module(stdlib);
assertTrue(%IsNotAsmWasmCode(Module));
})();
function TestAndIntAndHeapValue(stdlib, foreign, buffer) {
"use asm";
var HEAP32 = new stdlib.Int32Array(buffer);
......
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