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

Unified Diff: test/cctest/asmjs/test-asm-typer.cc

Issue 2268363002: [Asm.js] Prevents assignments to immutables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addresses comments. 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
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/asmjs/test-asm-typer.cc
diff --git a/test/cctest/asmjs/test-asm-typer.cc b/test/cctest/asmjs/test-asm-typer.cc
index bf8615e00790d41fc6064a186f7e844b3b70817c..dcb778533dcf5767bb7e205420fd51fe3526c82b 100644
--- a/test/cctest/asmjs/test-asm-typer.cc
+++ b/test/cctest/asmjs/test-asm-typer.cc
@@ -1941,4 +1941,63 @@ TEST(B63099) {
}
}
+// This issue was triggered because assignments to immutable symbols (e.g., the
+// module's name, or any of the asm.js' module parameters) was not being
+// handled.
+TEST(B640194) {
+ const char* kTests[] = {
+ "function asm() {\n"
+ " 'use asm';\n"
+ " function f() {\n"
+ " asm = 0;\n"
+ " }\n"
+ " return f;\n"
+ "}",
+ "function asm(stdlib) {\n"
+ " 'use asm';\n"
+ " function f() {\n"
+ " stdlib = 0;\n"
+ " }\n"
+ " return f;\n"
+ "}",
+ "function asm(stdlib, foreign) {\n"
+ " 'use asm';\n"
+ " function f() {\n"
+ " foreign = 0;\n"
+ " }\n"
+ " return f;\n"
+ "}",
+ "function asm(stdlib, foreign, heap) {\n"
+ " 'use asm';\n"
+ " function f() {\n"
+ " heap = 0;\n"
+ " }\n"
+ " return f;\n"
+ "}",
+ "function asm(stdlib, foreign, heap) {\n"
+ " 'use asm';\n"
+ " var f = stdlib.Math.fround;\n"
+ " function f() {\n"
+ " f = 0;\n"
+ " }\n"
+ " return f;\n"
+ "}",
+ "function asm(stdlib, foreign, heap) {\n"
+ " 'use asm';\n"
+ " var E = stdlib.Math.E;\n"
+ " function f() {\n"
+ " E = 0;\n"
+ " }\n"
+ " return f;\n"
+ "}",
+ };
+ for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
+ if (!ValidationOf(Module(kTests[ii]))
+ ->FailsWithMessage("Can't assign to immutable symbol")) {
+ std::cerr << "Test:\n" << kTests[ii];
+ CHECK(false);
+ }
+ }
+}
+
} // namespace
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698