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

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

Issue 2164273002: V8. ASM-2-WASM. Enforces source code layout. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adds new entry to the new cctests. Created 4 years, 5 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 b9b3c58739267f94a8dc55e5df66e5fc464b5e5e..45f6021e2080755c04b5c916cd591b0889d71bd2 100644
--- a/test/cctest/asmjs/test-asm-typer.cc
+++ b/test/cctest/asmjs/test-asm-typer.cc
@@ -1797,4 +1797,113 @@ TEST(CannotReferenceModuleName) {
}
}
+TEST(InvalidSourceLayout) {
+ const char* kTests[] = {
+ "function asm() {\n"
+ " 'use asm';\n"
+ " function f() {}\n"
+ " var v = 0;\n"
+ " var v_v = [f];\n"
+ " return f;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " function f() {}\n"
+ " var v_v = [f];\n"
+ " var v = 0;\n"
+ " return f;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " function f() {}\n"
+ " var v_v = [f];\n"
+ " return f;\n"
+ " var v = 0;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " var v = 0;\n"
+ " var v_v = [f];\n"
+ " function f() {}\n"
+ " return f;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " var v = 0;\n"
+ " var v_v = [f];\n"
+ " return f;\n"
+ " function f() {}\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " var v = 0;\n"
+ " function f() {}\n"
+ " return f;\n"
+ " var v_v = [f];\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " var v = 0;\n"
+ " function f() {}\n"
+ " var v1 = 0;\n"
+ " var v_v = [f];\n"
+ " return f;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " var v = 0;\n"
+ " function f() {}\n"
+ " var v_v = [f];\n"
+ " var v1 = 0;\n"
+ " return f;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " var v = 0;\n"
+ " function f() {}\n"
+ " var v_v = [f];\n"
+ " return f;\n"
+ " var v1 = 0;\n"
+ "}",
+ "function asm() {\n"
+ " function f() {}\n"
+ " 'use asm';\n"
+ " var v_v = [f];\n"
+ " return f;\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " return f;\n"
+ " var v = 0;\n"
+ " function f() {}\n"
+ " var v_v = [f];\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " return f;\n"
+ " function f() {}\n"
+ "}",
+ "function __f_59() {\n"
+ " 'use asm';\n"
+ " function __f_110() {\n"
+ " return 71;\n"
+ " }\n"
+ " function __f_21() {\n"
+ " var __v_38 = 0;\n"
+ " return __v_23[__v_38&0]() | 0;\n"
+ " }\n"
+ " return {__f_21:__f_21};\n"
+ " var __v_23 = [__f_110];\n"
+ "}",
+ };
+
+ for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
+ if (!ValidationOf(Module(kTests[ii]))
+ ->FailsWithMessage("Invalid asm.js source code layout")) {
+ 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